diff --git a/hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/DeBrujinSplit.scala b/hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/DeBrujinSplit.scala index 171e0551a..c9c426070 100644 --- a/hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/DeBrujinSplit.scala +++ b/hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/DeBrujinSplit.scala @@ -67,16 +67,6 @@ enum DeBrujinSplit: case Accept(outcome: Int) case Reject - def firstPatterns: Set[PatternStub] = - def go(split: DeBrujinSplit, target: Int): Set[PatternStub] = - split match - case Binder(body) => go(body, target + 1) - case Branch(scrutinee, pattern, consequence, alternative) => - go(consequence, target) ++ go(alternative, target) ++ - (if scrutinee == target then Set(pattern) else Set()) - case Accept(_) | Reject => Set() - go(this, Outermost) - def showDbg: Str = def go(split: DeBrujinSplit): Str = split match case Binder(body) => diff --git a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/EvenOddTree.mls b/hkmc2/shared/src/test/mlscript/rp/nondeterminism/EvenOddTree.mls index a1b220349..a81b5ccea 100644 --- a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/EvenOddTree.mls +++ b/hkmc2/shared/src/test/mlscript/rp/nondeterminism/EvenOddTree.mls @@ -7,11 +7,29 @@ class Pair[A, B](first: A, second: B) [A, B] //│ = [ A { class: [class A] }, B { class: [class B] } ] +:cp pattern OddTree = A | Pair(EvenTree, OddTree) | Pair(OddTree, EvenTree) pattern EvenTree = B | Pair(EvenTree, EvenTree) | Pair(OddTree, OddTree) // This does not work for now. -// :cp -A is OddTree -//│ = true +:cp +:ucs desugared rp:normalize rp:expand rp:memo +A is EvenTree +//│ Desugared: +//│ > if +//│ > let $scrut = globalThis:block#1#666(.)A‹member:A› +//│ > $scrut is EvenTree then true +//│ > else false +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: found unelaborated pattern: EvenTree +//│ at: mlscript.utils.package$.lastWords(package.scala:230) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.$anonfun$10(DeBrujinSplit.scala:292) +//│ at: scala.Option.getOrElse(Option.scala:201) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$12$$anonfun$1(DeBrujinSplit.scala:292) +//│ at: hkmc2.utils.TraceLogger.scoped(TraceLogger.scala:37) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$12(DeBrujinSplit.scala:350) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$12$$anonfun$1(DeBrujinSplit.scala:285) +//│ at: hkmc2.utils.TraceLogger.scoped(TraceLogger.scala:37) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$12(DeBrujinSplit.scala:350) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.normalize(DeBrujinSplit.scala:352) diff --git a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/NullTree.mls b/hkmc2/shared/src/test/mlscript/rp/nondeterminism/NullTree.mls deleted file mode 100644 index 8dbd46f7c..000000000 --- a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/NullTree.mls +++ /dev/null @@ -1,75 +0,0 @@ -:js - - -class Pair[A, B](val first: A, val second: B) - -:cp -pattern Null = null - -[null is Null, 0 is Null, false is Null] -//│ = [ true, false, false ] - -:cp -pattern Tree = Null | Pair(Tree, Tree) - -fun (##) concat(a, b) = Pair(a, b) - -0 ## 1 -//│ = Pair { first: 0, second: 1 } - -// Positive Test Cases -// =================== - -:global -:expect true - -:todo -// :cp -null is Tree -//│ = true - -// :cp -:todo -null ## null is Tree -//│ = true - -// :cp -:todo -((null ## null) ## null) is Tree -//│ = true - -// :cp -:todo -null ## (null ## null) is Tree -//│ = true - -// :cp -:todo -((null ## null) ## (null ## null)) is Tree -//│ = true - -// Negative Test Cases -// =================== - -:global -:expect false - -// :cp -:todo -0 is Tree -//│ = false - -// :cp -:todo -0 ## 0 is Tree -//│ ═══[RUNTIME ERROR] Expected: false, got: true - -// :cp -:todo -0 ## null is Tree -//│ ═══[RUNTIME ERROR] Expected: false, got: true - -// :cp -:todo -null ## 0 is Tree -//│ ═══[RUNTIME ERROR] Expected: false, got: true diff --git a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/BitTree.mls b/hkmc2/shared/src/test/mlscript/rp/recursion/BitTree.mls similarity index 96% rename from hkmc2/shared/src/test/mlscript/rp/nondeterminism/BitTree.mls rename to hkmc2/shared/src/test/mlscript/rp/recursion/BitTree.mls index 2d2f0130c..63ad2d6ec 100644 --- a/hkmc2/shared/src/test/mlscript/rp/nondeterminism/BitTree.mls +++ b/hkmc2/shared/src/test/mlscript/rp/recursion/BitTree.mls @@ -21,13 +21,13 @@ pattern Bit = 0 | 1 :cp pattern BitTree = null | Pair(Bit | BitTree, Bit | BitTree) -:todo +:cp null is BitTree //│ = true -:todo +:cp Pair(null, null) is BitTree -//│ = true +//│ = false // :ucs rp:elaborated pattern BinTree = null | Pair(BinTree | 0 | 1, BinTree | 0 | 1) diff --git a/hkmc2/shared/src/test/mlscript/rp/recursion/NullTree.mls b/hkmc2/shared/src/test/mlscript/rp/recursion/NullTree.mls new file mode 100644 index 000000000..d2fbfe0e5 --- /dev/null +++ b/hkmc2/shared/src/test/mlscript/rp/recursion/NullTree.mls @@ -0,0 +1,796 @@ +:js + + +class Pair[A, B](val first: A, val second: B) + +:cp +pattern Null = null + +[null is Null, 0 is Null, false is Null] +//│ = [ true, false, false ] + +:cp +pattern Tree = Null | Pair(Tree, Tree) + +fun (##) concat(a, b) = Pair(a, b) + +0 ## 1 +//│ = Pair { first: 0, second: 1 } + +// Positive Test Cases +// =================== + +:global +:expect true + +:cp +:ucs rp:memo +null is Tree +//│ normalize <<< +//│ > 1 is null -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> accept 42 +//│ | normalize <<< +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> accept 42 +//│ | | normalize <<< +//│ | | > 2 is null -> 1 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | normalize <<< +//│ | | | > 1 is null -> accept 42 +//│ | | | > 1 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> accept 42 +//│ | | | | this is a recursive split +//│ | | | normalize >>> +//│ | | | > 1 is local:0 -> accept 42 +//│ | | | normalize <<< +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | normalize <<< +//│ | | | | > 2 is null -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | normalize <<< +//│ | | | | | > 1 is null -> 3 is pattern:Tree -> accept 42 +//│ | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | normalize <<< +//│ | | | | | | > 3 is null -> accept 42 +//│ | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize <<< +//│ | | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize >>> +//│ | | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | | | normalize >>> +//│ | | | | | | > 3 is null -> accept 42 +//│ | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | | | normalize <<< +//│ | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize <<< +//│ | | | | | | | > 2 is null -> 1 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize <<< +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize >>> +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize >>> +//│ | | | | | | | > 2 is null -> +//│ | | | | | | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | normalize >>> +//│ | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | > 2 is null -> +//│ | | | | | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | normalize >>> +//│ | | | | | > 1 is null -> +//│ | | | | | > 3 is null -> accept 42 +//│ | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | > 2 is null -> +//│ | | | | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | normalize <<< +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | normalize <<< +//│ | | | | | | > 2 is null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize <<< +//│ | | | | | | | > 1 is null -> 3 is pattern:Tree -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize <<< +//│ | | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize >>> +//│ | | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize >>> +//│ | | | | | | | > 1 is null -> +//│ | | | | | | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize <<< +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize <<< +//│ | | | | | | | | > 2 is null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | | | normalize <<< +//│ | | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | | | normalize >>> +//│ | | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | | | | | | normalize >>> +//│ | | | | | | | | > 2 is null -> +//│ | | | | | | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | | | | | normalize >>> +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is null -> +//│ | | | | | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | | | | normalize >>> +//│ | | | | | | > 2 is null -> +//│ | | | | | | > 1 is null -> +//│ | | | | | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is null -> +//│ | | | | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | | | normalize >>> +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is null -> +//│ | | | | | > 1 is null -> +//│ | | | | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | | > 3 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is null -> +//│ | | | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | | > 1 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | | > 2 is class:Pair -> λ λ +//│ | | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | | normalize >>> +//│ | | | | > 2 is null -> +//│ | | | | > 1 is null -> +//│ | | | | > 3 is null -> accept 42 +//│ | | | | > 3 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | | > 1 is class:Pair -> λ λ +//│ | | | | > 2 is null -> +//│ | | | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | > 1 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is null -> +//│ | | | | > 1 is null -> +//│ | | | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | | > 3 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | > 1 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is null -> +//│ | | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | | > 1 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | | > 2 is class:Pair -> λ λ +//│ | | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | | normalize >>> +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is null -> +//│ | | | > 1 is null -> +//│ | | | > 3 is null -> accept 42 +//│ | | | > 3 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | | > 1 is class:Pair -> λ λ +//│ | | | > 2 is null -> +//│ | | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | > 1 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is null -> +//│ | | | > 1 is null -> +//│ | | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | | > 3 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | > 1 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is null -> +//│ | | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | | > 1 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | | > 2 is class:Pair -> λ λ +//│ | | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | | normalize >>> +//│ | | > 2 is null -> 1 is local:0 -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is null -> +//│ | | > 1 is null -> +//│ | | > 3 is null -> accept 42 +//│ | | > 3 is class:Pair -> λ λ +//│ | | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | | > 1 is class:Pair -> λ λ +//│ | | > 2 is null -> +//│ | | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | > 1 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is null -> +//│ | | > 1 is null -> +//│ | | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | | > 3 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | > 1 is class:Pair -> λ λ +//│ | | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is null -> +//│ | | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | | > 1 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | | > 2 is class:Pair -> λ λ +//│ | | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | normalize >>> +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is null -> 1 is local:0 -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is null -> +//│ | > 1 is null -> +//│ | > 3 is null -> accept 42 +//│ | > 3 is class:Pair -> λ λ +//│ | > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is null -> +//│ | > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is null -> +//│ | > 1 is null -> +//│ | > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ | > 3 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is null -> +//│ | > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ | > 1 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ | > 2 is class:Pair -> λ λ +//│ | > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ | found a recursive pattern +//│ normalize >>> +//│ > 1 is local:0 -> accept 42 +//│ memo: +//│ > 15 (0) => +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 7 (0) => +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 9 (0) => +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 13 (0) => +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 12 (0) => +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 2 (0) => +//│ > 2 is null -> 1 is local:0 -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 5 (0) => +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 1 (0) => +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> 1 is local:0 -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 17 (0) => +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 8 (0) => +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 3 (0) => +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 4 (0) => +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 11 (0) => +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 14 (0) => +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 6 (0) => +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 0 (1) => +//│ > 1 is null -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> 1 is local:0 -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is null -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is null -> +//│ > 3 is pattern:Null -> 5 is pattern:Tree -> accept 42 +//│ > 3 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 16 (0) => +//│ > 2 is null -> +//│ > 1 is pattern:Null -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 1 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 7 is pattern:Tree -> 9 is pattern:Tree -> 11 is pattern:Tree -> accept 42 +//│ > 10 (0) => +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Null -> 1 is pattern:Tree -> 3 is pattern:Tree -> 7 is pattern:Tree -> accept 42 +//│ > 2 is class:Pair -> λ λ +//│ > 2 is pattern:Tree -> 1 is pattern:Tree -> 3 is pattern:Tree -> 5 is pattern:Tree -> 9 is pattern:Tree -> accept 42 +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: scala.MatchError: ClassLike(pattern:Tree) (of class hkmc2.semantics.ucs.PatternStub$ClassLike) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:265) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) + +:cp +null ## null is Tree +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: scala.MatchError: ClassLike(pattern:Tree) (of class hkmc2.semantics.ucs.PatternStub$ClassLike) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:265) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) + +:cp +((null ## null) ## null) is Tree +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: scala.MatchError: ClassLike(pattern:Tree) (of class hkmc2.semantics.ucs.PatternStub$ClassLike) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:265) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) + +:cp +null ## (null ## null) is Tree +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: scala.MatchError: ClassLike(pattern:Tree) (of class hkmc2.semantics.ucs.PatternStub$ClassLike) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:265) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) + +:cp +((null ## null) ## (null ## null)) is Tree +//│ FAILURE: Unexpected exception +//│ /!!!\ Uncaught error: scala.MatchError: ClassLike(pattern:Tree) (of class hkmc2.semantics.ucs.PatternStub$ClassLike) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:265) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:255) +//│ at: hkmc2.semantics.ucs.DeBrujinSplit$package$.go$11(DeBrujinSplit.scala:258) + +// Negative Test Cases +// =================== + +:global +:expect false + +// :cp +:todo +0 is Tree +//│ = false + +// :cp +:todo +0 ## 0 is Tree +//│ ═══[RUNTIME ERROR] Expected: false, got: true + +// :cp +:todo +0 ## null is Tree +//│ ═══[RUNTIME ERROR] Expected: false, got: true + +// :cp +:todo +null ## 0 is Tree +//│ ═══[RUNTIME ERROR] Expected: false, got: true