CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 23:35:56 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=2c8d27cf4d38b535b18b2d035fead7e46aac92618a7be45a352e5ecaf325ea8da%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22WoFH7gG2mzeYvLSwyyGBFARJn-5yqGl1%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d22d3e0ea25917-BLR
Higman and Kruskal relation - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sealed trait Expr{ def HKRelation(expr: Expr): Boolean }
- case class Variable(name: String) extends Expr {
- override def toString: String = { name.toLowerCase() }
- override def HKRelation(expr: Expr): Boolean = expr match {
- case Variable(vname) => true
- case Function(fname, fargs) => fargs.nonEmpty && fargs.exists(p => this.HKRelation(p))
- case default => false
- }
- }
- case class Constant(name: String) extends Expr {
- override def toString: String = { name.toUpperCase() }
- override def HKRelation(expr: Expr): Boolean = expr match {
- case Constant(cname) => name == cname
- case Function(fname, fargs) => fargs.nonEmpty && fargs.exists(p => this.HKRelation(p))
- case default => false
- }
- }
- case class Function(name: String, args: List[Expr] = List()) extends Expr {
- override def toString: String = {
- val args_str =
- if (args.isEmpty)
- "()"
- else if (args.length == 1)
- "(" + args.head.toString + ")"
- else {
- var buffer = args.head.toString
- for(idx <- 1 until args.length) {
- buffer += ", " + args.apply(idx).toString
- }
- "(" + buffer + ")"
- }
- name + args_str
- }
- override def HKRelation(expr: Expr): Boolean = expr match {
- case Function(fname, fargs) =>
- fargs.nonEmpty && fargs.exists(p => this.HKRelation(p)) ||
- (name == fname && args.length == fargs.length && args.iterator.zip(fargs.iterator).forall(x => x._1.HKRelation(x._2)))
- case default => false
- }
- }
- object Main {
- def main(args: Array[String]): Unit = {
- val test1 = ( Function("Tree", Function("Leaf", Constant("A")::Nil) :: Function("Leaf", Variable("x") :: Nil) :: Nil),
- Function("Tree", Function("Tree", Function("Leaf", Constant("A")::Nil) :: Function("Leaf", Function("f", Variable("y") :: Variable("z") :: Nil) :: Nil) :: Nil) ::
- Function("g", Variable("y") :: Variable("z") :: Nil) :: Nil))
- val test2 =( Function("f", Function("g", Function("h", Variable("x") :: Nil) :: Nil) :: Nil),
- Function("f", Function("h", Variable("x") :: Nil) :: Nil))
- val tests = test1 :: test2 :: Nil
- var testCnt = 1
- for (test <- tests) {
- println("Test #" + testCnt)
- println(test._1.toString + " <= " + test._2.toString + " -> " + test._1.HKRelation(test._2))
- testCnt += 1
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Exploit 500$ in 15 Minutes⭐⭐
Java | 2 sec ago | 0.10 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 9 sec ago | 0.24 KB
-
⭐⭐⭐Exploit 500$ in 15 Minutes⭐⭐
Java | 15 sec ago | 0.10 KB
-
📌 Swapzone +37% glitch
JavaScript | 19 sec ago | 0.24 KB
-
📝 Exchange profit method
JavaScript | 27 sec ago | 0.24 KB
-
⭐⭐⭐GMAIL Logs (2FA disabled)⭐⭐
Java | 28 sec ago | 0.10 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 36 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ R
JavaScript | 40 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand