From 3aec490f397315f354b368308d9925cb9de4dc4c Mon Sep 17 00:00:00 2001 From: felipegchi Date: Mon, 28 Nov 2022 14:49:49 -0300 Subject: [PATCH 1/5] refactor: moved tests folder --- Cargo.lock | 17 ++++++++++--- Cargo.toml | 1 + crates/kind-cli/Cargo.toml | 8 +------ .../checker/derive/fail/WrongU120.golden | 24 ------------------- .../suite/checker/derive/fail/WrongU120.kind2 | 6 ----- crates/kind-tests/Cargo.toml | 15 ++++++++++++ crates/{kind-cli => kind-tests}/tests/mod.rs | 0 .../tests/suite/checker/derive/Eq.golden | 0 .../tests/suite/checker/derive/Eq.kind2 | 0 .../tests/suite/checker/derive/Nat.golden | 0 .../tests/suite/checker/derive/Nat.kind2 | 0 .../tests/suite/checker/derive/User.golden | 0 .../tests/suite/checker/derive/User.kind2 | 0 .../tests/suite/checker/derive/Vec.golden | 0 .../tests/suite/checker/derive/Vec.kind2 | 0 .../checker/derive/fail/IncompleteCase.golden | 0 .../checker/derive/fail/IncompleteCase.kind2 | 0 .../suite/checker/derive/fail/Repeated.golden | 0 .../suite/checker/derive/fail/Repeated.kind2 | 0 .../checker/derive/fail/RepeatedDef.golden | 0 .../checker/derive/fail/RepeatedDef.kind2 | 0 .../checker/derive/fail/WrongU120Eq.golden | 0 .../checker/derive/fail/WrongU120Eq.kind2 | 0 .../tests/suite/eval/User.golden | 0 .../tests/suite/eval/User.kind2 | 0 25 files changed, 31 insertions(+), 40 deletions(-) delete mode 100644 crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.golden delete mode 100644 crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.kind2 create mode 100644 crates/kind-tests/Cargo.toml rename crates/{kind-cli => kind-tests}/tests/mod.rs (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Eq.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Eq.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Nat.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Nat.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/User.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/User.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Vec.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/Vec.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/IncompleteCase.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/IncompleteCase.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/Repeated.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/Repeated.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/RepeatedDef.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/RepeatedDef.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/WrongU120Eq.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/checker/derive/fail/WrongU120Eq.kind2 (100%) rename crates/{kind-cli => kind-tests}/tests/suite/eval/User.golden (100%) rename crates/{kind-cli => kind-tests}/tests/suite/eval/User.kind2 (100%) diff --git a/Cargo.lock b/Cargo.lock index b8693f9c..bb13cbcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -545,9 +545,6 @@ dependencies = [ "kind-driver", "kind-query", "kind-report", - "ntest", - "pretty_assertions", - "walkdir", ] [[package]] @@ -555,6 +552,7 @@ name = "kind-derive" version = "0.1.0" dependencies = [ "fxhash", + "im", "kind-report", "kind-span", "kind-tree", @@ -657,6 +655,19 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "kind-tests" +version = "0.1.0" +dependencies = [ + "kind-checker", + "kind-driver", + "kind-query", + "kind-report", + "ntest", + "pretty_assertions", + "walkdir", +] + [[package]] name = "kind-tree" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 80c1ef82..e9411a70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "crates/kind-target-kdl", "crates/kind-target-hvm", "crates/kind-derive", + "crates/kind-tests", # "crates/kind-optimization", # "crates/kind-lint", # "crates/kind-query", diff --git a/crates/kind-cli/Cargo.toml b/crates/kind-cli/Cargo.toml index b2094b84..b73f573b 100644 --- a/crates/kind-cli/Cargo.toml +++ b/crates/kind-cli/Cargo.toml @@ -19,10 +19,4 @@ kind-report = { path = "../kind-report" } kind-checker = { path = "../kind-checker" } kind-query = { path = "../kind-query" } -clap = { version = "4.0.10", features = ["derive"] } - -[dev-dependencies] - -pretty_assertions = "1.3.0" -ntest = "0.8.1" -walkdir = "2" +clap = { version = "4.0.10", features = ["derive"] } \ No newline at end of file diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.golden b/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.golden deleted file mode 100644 index 76ca4020..00000000 --- a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.golden +++ /dev/null @@ -1,24 +0,0 @@ - ERROR Required functions are not implemented for this type. - - /--[tests/suite/checker/derive/fail/WrongU120.kind2:5:12] - | - 4 | - 5 | Teste : Eq 123u120 124u120 - | v------ - | \You cannot use this expression! - 6 | Teste = Eq.rfl - - Hint: You must implement 'U120.new' in order to use the u120 notation. - - ERROR Required functions are not implemented for this type. - - /--[tests/suite/checker/derive/fail/WrongU120.kind2:5:20] - | - 4 | - 5 | Teste : Eq 123u120 124u120 - | v------ - | \You cannot use this expression! - 6 | Teste = Eq.rfl - - Hint: You must implement 'U120.new' in order to use the u120 notation. - diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.kind2 b/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.kind2 deleted file mode 100644 index efcd5df9..00000000 --- a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120.kind2 +++ /dev/null @@ -1,6 +0,0 @@ -type Eq (a: t) ~ (b: t) { - rfl: Eq t a a -} - -Teste : Eq 123u120 124u120 -Teste = Eq.rfl \ No newline at end of file diff --git a/crates/kind-tests/Cargo.toml b/crates/kind-tests/Cargo.toml new file mode 100644 index 00000000..ca18c48f --- /dev/null +++ b/crates/kind-tests/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "kind-tests" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +kind-driver = { path = "../kind-driver" } +kind-report = { path = "../kind-report" } +kind-checker = { path = "../kind-checker" } +kind-query = { path = "../kind-query" } +pretty_assertions = "1.3.0" +ntest = "0.8.1" +walkdir = "2" diff --git a/crates/kind-cli/tests/mod.rs b/crates/kind-tests/tests/mod.rs similarity index 100% rename from crates/kind-cli/tests/mod.rs rename to crates/kind-tests/tests/mod.rs diff --git a/crates/kind-cli/tests/suite/checker/derive/Eq.golden b/crates/kind-tests/tests/suite/checker/derive/Eq.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Eq.golden rename to crates/kind-tests/tests/suite/checker/derive/Eq.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/Eq.kind2 b/crates/kind-tests/tests/suite/checker/derive/Eq.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Eq.kind2 rename to crates/kind-tests/tests/suite/checker/derive/Eq.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/Nat.golden b/crates/kind-tests/tests/suite/checker/derive/Nat.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Nat.golden rename to crates/kind-tests/tests/suite/checker/derive/Nat.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/Nat.kind2 b/crates/kind-tests/tests/suite/checker/derive/Nat.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Nat.kind2 rename to crates/kind-tests/tests/suite/checker/derive/Nat.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/User.golden b/crates/kind-tests/tests/suite/checker/derive/User.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/User.golden rename to crates/kind-tests/tests/suite/checker/derive/User.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/User.kind2 b/crates/kind-tests/tests/suite/checker/derive/User.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/User.kind2 rename to crates/kind-tests/tests/suite/checker/derive/User.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/Vec.golden b/crates/kind-tests/tests/suite/checker/derive/Vec.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Vec.golden rename to crates/kind-tests/tests/suite/checker/derive/Vec.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/Vec.kind2 b/crates/kind-tests/tests/suite/checker/derive/Vec.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/Vec.kind2 rename to crates/kind-tests/tests/suite/checker/derive/Vec.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/IncompleteCase.golden b/crates/kind-tests/tests/suite/checker/derive/fail/IncompleteCase.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/IncompleteCase.golden rename to crates/kind-tests/tests/suite/checker/derive/fail/IncompleteCase.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/IncompleteCase.kind2 b/crates/kind-tests/tests/suite/checker/derive/fail/IncompleteCase.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/IncompleteCase.kind2 rename to crates/kind-tests/tests/suite/checker/derive/fail/IncompleteCase.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/Repeated.golden b/crates/kind-tests/tests/suite/checker/derive/fail/Repeated.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/Repeated.golden rename to crates/kind-tests/tests/suite/checker/derive/fail/Repeated.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/Repeated.kind2 b/crates/kind-tests/tests/suite/checker/derive/fail/Repeated.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/Repeated.kind2 rename to crates/kind-tests/tests/suite/checker/derive/fail/Repeated.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/RepeatedDef.golden b/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/RepeatedDef.golden rename to crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/RepeatedDef.kind2 b/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/RepeatedDef.kind2 rename to crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.kind2 diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120Eq.golden b/crates/kind-tests/tests/suite/checker/derive/fail/WrongU120Eq.golden similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/WrongU120Eq.golden rename to crates/kind-tests/tests/suite/checker/derive/fail/WrongU120Eq.golden diff --git a/crates/kind-cli/tests/suite/checker/derive/fail/WrongU120Eq.kind2 b/crates/kind-tests/tests/suite/checker/derive/fail/WrongU120Eq.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/checker/derive/fail/WrongU120Eq.kind2 rename to crates/kind-tests/tests/suite/checker/derive/fail/WrongU120Eq.kind2 diff --git a/crates/kind-cli/tests/suite/eval/User.golden b/crates/kind-tests/tests/suite/eval/User.golden similarity index 100% rename from crates/kind-cli/tests/suite/eval/User.golden rename to crates/kind-tests/tests/suite/eval/User.golden diff --git a/crates/kind-cli/tests/suite/eval/User.kind2 b/crates/kind-tests/tests/suite/eval/User.kind2 similarity index 100% rename from crates/kind-cli/tests/suite/eval/User.kind2 rename to crates/kind-tests/tests/suite/eval/User.kind2 From b7b15e7590bf09b740cb12ba7c4e8101c7382d5d Mon Sep 17 00:00:00 2001 From: felipegchi Date: Tue, 29 Nov 2022 11:23:34 -0300 Subject: [PATCH 2/5] fix: bug fixes and improvements in the code style --- Cargo.lock | 20 +- Cargo.toml | 5 +- crates/kind-checker/Cargo.toml | 2 +- crates/kind-checker/src/checker.hvm | 1386 +++++++---------- crates/kind-checker/src/report.rs | 42 +- crates/kind-cli/src/lib.rs | 23 +- crates/kind-derive/Cargo.toml | 2 +- crates/kind-driver/src/errors.rs | 4 +- crates/kind-driver/src/lib.rs | 37 +- crates/kind-parser/src/errors.rs | 2 +- crates/kind-parser/src/expr.rs | 56 +- crates/kind-parser/src/lexer/mod.rs | 6 +- crates/kind-parser/src/lexer/tokens.rs | 11 +- crates/kind-pass/Cargo.toml | 2 +- crates/kind-pass/src/desugar/app.rs | 5 +- crates/kind-pass/src/desugar/attributes.rs | 18 + crates/kind-pass/src/desugar/destruct.rs | 4 +- crates/kind-pass/src/desugar/expr.rs | 15 +- crates/kind-pass/src/desugar/mod.rs | 6 +- crates/kind-pass/src/erasure/mod.rs | 73 +- crates/kind-pass/src/errors.rs | 4 +- crates/kind-pass/src/expand/mod.rs | 4 +- crates/kind-pass/src/expand/uses.rs | 4 +- crates/kind-pass/src/inline/mod.rs | 20 +- crates/kind-pass/src/lib.rs | 2 +- crates/kind-pass/src/unbound/mod.rs | 25 +- crates/kind-pass/src/unbound/subst.rs | 15 +- crates/kind-query/src/errors.rs | 4 +- crates/kind-target-hvm/src/lib.rs | 84 +- crates/kind-target-kdl/src/compile.rs | 2 +- crates/kind-target-kdl/src/lib.rs | 2 +- crates/kind-tests/Teste.kind2 | 2 + crates/kind-tests/tests/mod.rs | 12 +- .../tests/suite/checker/derive/Algebra.golden | 11 + .../tests/suite/checker/derive/Algebra.kind2 | 41 + .../suite/checker/derive/DoNotation.golden | 1 + .../suite/checker/derive/DoNotation.kind2 | 12 + .../suite/checker/derive/Inspection.golden | 13 + .../suite/checker/derive/Inspection.kind2 | 3 + .../suite/checker/derive/Quicksort.golden | 1 + .../suite/checker/derive/Quicksort.kind2 | 55 + .../checker/derive/fail/RepeatedDef.golden | 2 +- .../tests/suite/eval/DoNotation.golden | 1 + .../tests/suite/eval/DoNotation.kind2 | 12 + .../tests/suite/eval/NoMatch.golden | 13 + .../kind-tests/tests/suite/eval/NoMatch.kind2 | 5 + .../kind-tests/tests/suite/lib/Maybe/_.kind2 | 5 + .../tests/suite/lib/Maybe/bind.kind2 | 3 + .../tests/suite/lib/Maybe/pure.kind2 | 2 + .../kind-tests/tests/suite/lib/NoMatch.kind2 | 3 + crates/kind-tree/src/lib.rs | 1 + crates/kind-tree/src/untyped/mod.rs | 2 +- 52 files changed, 1064 insertions(+), 1021 deletions(-) create mode 100644 crates/kind-tests/Teste.kind2 create mode 100644 crates/kind-tests/tests/suite/checker/derive/Algebra.golden create mode 100644 crates/kind-tests/tests/suite/checker/derive/Algebra.kind2 create mode 100644 crates/kind-tests/tests/suite/checker/derive/DoNotation.golden create mode 100644 crates/kind-tests/tests/suite/checker/derive/DoNotation.kind2 create mode 100644 crates/kind-tests/tests/suite/checker/derive/Inspection.golden create mode 100644 crates/kind-tests/tests/suite/checker/derive/Inspection.kind2 create mode 100644 crates/kind-tests/tests/suite/checker/derive/Quicksort.golden create mode 100644 crates/kind-tests/tests/suite/checker/derive/Quicksort.kind2 create mode 100644 crates/kind-tests/tests/suite/eval/DoNotation.golden create mode 100644 crates/kind-tests/tests/suite/eval/DoNotation.kind2 create mode 100644 crates/kind-tests/tests/suite/eval/NoMatch.golden create mode 100644 crates/kind-tests/tests/suite/eval/NoMatch.kind2 create mode 100644 crates/kind-tests/tests/suite/lib/Maybe/_.kind2 create mode 100644 crates/kind-tests/tests/suite/lib/Maybe/bind.kind2 create mode 100644 crates/kind-tests/tests/suite/lib/Maybe/pure.kind2 create mode 100644 crates/kind-tests/tests/suite/lib/NoMatch.kind2 diff --git a/Cargo.lock b/Cargo.lock index bb13cbcf..435c686e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -445,6 +445,20 @@ dependencies = [ "version_check", ] +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "impl-codec" version = "0.6.0" @@ -530,7 +544,7 @@ version = "0.1.0" dependencies = [ "fxhash", "hvm", - "im", + "im-rc", "kind-report", "kind-span", "kind-tree", @@ -552,7 +566,7 @@ name = "kind-derive" version = "0.1.0" dependencies = [ "fxhash", - "im", + "im-rc", "kind-report", "kind-span", "kind-tree", @@ -591,7 +605,7 @@ name = "kind-pass" version = "0.1.0" dependencies = [ "fxhash", - "im", + "im-rc", "kind-derive", "kind-report", "kind-span", diff --git a/Cargo.toml b/Cargo.toml index e9411a70..64b99deb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,4 @@ members = [ # "crates/kind-lint", # "crates/kind-query", # "crates/kind-macros", -] - -[profile.release] -debug = true \ No newline at end of file +] \ No newline at end of file diff --git a/crates/kind-checker/Cargo.toml b/crates/kind-checker/Cargo.toml index 37cc3d4e..26d5c395 100644 --- a/crates/kind-checker/Cargo.toml +++ b/crates/kind-checker/Cargo.toml @@ -13,4 +13,4 @@ kind-report = { path = "../kind-report" } hvm = { git = "https://github.com/Kindelia/HVM.git" } fxhash = "0.2.1" -im = "15.1.0" \ No newline at end of file +im-rc = "15.1.0" \ No newline at end of file diff --git a/crates/kind-checker/src/checker.hvm b/crates/kind-checker/src/checker.hvm index c6b5a54e..b7a5728f 100644 --- a/crates/kind-checker/src/checker.hvm +++ b/crates/kind-checker/src/checker.hvm @@ -1,307 +1,380 @@ -// Main : (List (Kind.Error.Quoted)) -(Main) = let imports = (List.cons (Dynamic.new @a @b (Kind.Term.set_origin a b)) (List.cons (Dynamic.new (Kind.API.check_all)) (List.cons (Dynamic.new (Kind.API.eval_main)) (List.nil)))); (Kind.API.check_all) - -// Kind.API.check_all : (List (Kind.Error.Quoted)) +(Main) = let imports = [(Dynamic.new λa λb (Kind.Term.set_origin a b)), (Dynamic.new (Kind.API.check_all)), (Dynamic.new (Kind.API.eval_main))]; (Kind.API.check_all) +(Kind.Term.set_origin new_origin (Kind.Term.typ old_orig)) = (Kind.Term.typ new_origin) +(Kind.Term.set_origin new_origin (Kind.Term.var old_orig name idx)) = (Kind.Term.var new_origin name idx) +(Kind.Term.set_origin new_origin (Kind.Term.hol old_orig numb)) = (Kind.Term.hol new_origin numb) +(Kind.Term.set_origin new_origin (Kind.Term.all old_orig name typ body)) = (Kind.Term.all new_origin name typ body) +(Kind.Term.set_origin new_origin (Kind.Term.lam old_orig name body)) = (Kind.Term.lam new_origin name body) +(Kind.Term.set_origin new_origin (Kind.Term.let old_orig name expr body)) = (Kind.Term.let new_origin name expr body) +(Kind.Term.set_origin new_origin (Kind.Term.ann old_orig expr typ)) = (Kind.Term.ann new_origin expr typ) +(Kind.Term.set_origin new_origin (Kind.Term.sub old_orig name indx redx expr)) = (Kind.Term.sub new_origin name indx redx expr) +(Kind.Term.set_origin new_origin (Kind.Term.app old_orig func arg)) = (Kind.Term.app new_origin func arg) +(Kind.Term.set_origin new_origin (Kind.Term.hlp old_orig)) = (Kind.Term.hlp new_origin) +(Kind.Term.set_origin new_origin (Kind.Term.u60 old_orig)) = (Kind.Term.u60 new_origin) +(Kind.Term.set_origin new_origin (Kind.Term.num old_orig num)) = (Kind.Term.num new_origin num) +(Kind.Term.set_origin new_origin (Kind.Term.op2 old_orig op left right)) = (Kind.Term.op2 new_origin op left right) +(Kind.Term.set_origin new_origin (Kind.Term.ct0 ctid old_orig)) = (Kind.Term.ct0 ctid new_origin) +(Kind.Term.set_origin new_origin (Kind.Term.ct1 ctid old_orig x0)) = (Kind.Term.ct1 ctid new_origin x0) +(Kind.Term.set_origin new_origin (Kind.Term.ct2 ctid old_orig x0 x1)) = (Kind.Term.ct2 ctid new_origin x0 x1) +(Kind.Term.set_origin new_origin (Kind.Term.ct3 ctid old_orig x0 x1 x2)) = (Kind.Term.ct3 ctid new_origin x0 x1 x2) +(Kind.Term.set_origin new_origin (Kind.Term.ct4 ctid old_orig x0 x1 x2 x3)) = (Kind.Term.ct4 ctid new_origin x0 x1 x2 x3) +(Kind.Term.set_origin new_origin (Kind.Term.ct5 ctid old_orig x0 x1 x2 x3 x4)) = (Kind.Term.ct5 ctid new_origin x0 x1 x2 x3 x4) +(Kind.Term.set_origin new_origin (Kind.Term.ct6 ctid old_orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.ct6 ctid new_origin x0 x1 x2 x3 x4 x5) +(Kind.Term.set_origin new_origin (Kind.Term.ct7 ctid old_orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.ct7 ctid new_origin x0 x1 x2 x3 x4 x5 x6) +(Kind.Term.set_origin new_origin (Kind.Term.ct8 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.ct8 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7) +(Kind.Term.set_origin new_origin (Kind.Term.ct9 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.ct9 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8) +(Kind.Term.set_origin new_origin (Kind.Term.ct10 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.ct10 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) +(Kind.Term.set_origin new_origin (Kind.Term.ct11 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.ct11 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) +(Kind.Term.set_origin new_origin (Kind.Term.ct12 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.ct12 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) +(Kind.Term.set_origin new_origin (Kind.Term.ct13 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.ct13 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) +(Kind.Term.set_origin new_origin (Kind.Term.ct14 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.ct14 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) +(Kind.Term.set_origin new_origin (Kind.Term.ct15 ctid old_orig args)) = (Kind.Term.ct15 ctid new_origin args) +(Kind.Term.set_origin new_origin (Kind.Term.ct16 ctid old_orig args)) = (Kind.Term.ct16 ctid new_origin args) +(Kind.Term.set_origin new_origin (Kind.Term.fn0 fnid old_orig)) = (Kind.Term.fn0 fnid new_origin) +(Kind.Term.set_origin new_origin (Kind.Term.fn1 fnid old_orig x0)) = (Kind.Term.fn1 fnid new_origin x0) +(Kind.Term.set_origin new_origin (Kind.Term.fn2 fnid old_orig x0 x1)) = (Kind.Term.fn2 fnid new_origin x0 x1) +(Kind.Term.set_origin new_origin (Kind.Term.fn3 fnid old_orig x0 x1 x2)) = (Kind.Term.fn3 fnid new_origin x0 x1 x2) +(Kind.Term.set_origin new_origin (Kind.Term.fn4 fnid old_orig x0 x1 x2 x3)) = (Kind.Term.fn4 fnid new_origin x0 x1 x2 x3) +(Kind.Term.set_origin new_origin (Kind.Term.fn5 fnid old_orig x0 x1 x2 x3 x4)) = (Kind.Term.fn5 fnid new_origin x0 x1 x2 x3 x4) +(Kind.Term.set_origin new_origin (Kind.Term.fn6 fnid old_orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.fn6 fnid new_origin x0 x1 x2 x3 x4 x5) +(Kind.Term.set_origin new_origin (Kind.Term.fn7 fnid old_orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.fn7 fnid new_origin x0 x1 x2 x3 x4 x5 x6) +(Kind.Term.set_origin new_origin (Kind.Term.fn8 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.fn8 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7) +(Kind.Term.set_origin new_origin (Kind.Term.fn9 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.fn9 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8) +(Kind.Term.set_origin new_origin (Kind.Term.fn10 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.fn10 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) +(Kind.Term.set_origin new_origin (Kind.Term.fn11 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.fn11 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) +(Kind.Term.set_origin new_origin (Kind.Term.fn12 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.fn12 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) +(Kind.Term.set_origin new_origin (Kind.Term.fn13 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.fn13 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) +(Kind.Term.set_origin new_origin (Kind.Term.fn14 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.fn14 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) +(Kind.Term.set_origin new_origin (Kind.Term.fn15 ctid old_orig args)) = (Kind.Term.fn15 ctid new_origin args) +(Kind.Term.set_origin new_origin (Kind.Term.fn16 ctid old_orig args)) = (Kind.Term.fn16 ctid new_origin args) +(Kind.API.eval_main) = (Kind.Printer.text [(Kind.Term.show (Kind.Term.FN0 (Main.) 0)), (String.new_line), (String.new_line)]) +(String.new_line) = (String.pure (Char.newline)) +(String.pure x) = (String.cons x "") +(Char.newline) = 10 +(Kind.Printer.text []) = "" +(Kind.Printer.text (List.cons x xs)) = (String.concat x (Kind.Printer.text xs)) +(String.concat (String.cons x xs) ys) = (String.cons x (String.concat xs ys)) +(String.concat "" ys) = ys +(Kind.Term.show term) = let sugars = [(Kind.Term.show.sugar.string term), (Kind.Term.show.sugar.list term), (Kind.Term.show.sugar.sigma term)]; (Maybe.try sugars (Kind.Term.show.go term)) +(Kind.Term.show.sugar.sigma (Kind.Term.ct2 (Sigma.) orig typ (Kind.Term.lam orig_ name body))) = (Maybe.some (Kind.Printer.text ["([", (Kind.Name.show name), ": ", (Kind.Term.show typ), "] -> ", (Kind.Term.show (body (Kind.Term.var orig_ name 0))), ")"])) +(Kind.Term.show.sugar.sigma term) = (Maybe.none) +(Kind.Name.show name) = (Kind.Name.show.go name "") +(Kind.Name.show.go name chrs) = (U60.if (== name 0) chrs let val = (% name 64); let chr = (U60.if (== val 0) 46 (U60.if (+ (<= 1 val) (<= val 10)) (+ (- val 1) 48) (U60.if (+ (<= 11 val) (<= val 36)) (+ (- val 11) 65) (U60.if (+ (<= 37 val) (<= val 62)) (+ (- val 37) 97) (U60.if (== val 63) 95 63))))); (Kind.Name.show.go (/ name 64) (String.cons chr chrs))) +(U60.if 0 t f) = f +(U60.if n t f) = t +(Maybe.try [] alt) = alt +(Maybe.try (List.cons maybe xs) alt) = (Maybe.match maybe (Maybe.try xs alt) λvalue value) +(Maybe.match (Maybe.none) none some) = none +(Maybe.match (Maybe.some value_) none some) = (some value_) +(Kind.Term.show.sugar.list term) = (Maybe.bind (Kind.Term.show.sugar.list.go term) λres (Maybe.pure (Kind.Printer.text ["[", (String.join " " res), "]"]))) +(Kind.Term.show.sugar.list.go (Kind.Term.ct0 (List.nil.) orig)) = (Maybe.some []) +(Kind.Term.show.sugar.list.go (Kind.Term.ct2 (List.cons.) orig x0 x1)) = (Maybe.bind (Kind.Term.show.sugar.list.go x1) λtail (Maybe.pure (List.cons (Kind.Term.show x0) tail))) +(Kind.Term.show.sugar.list.go other) = (Maybe.none) +(Maybe.pure x) = (Maybe.some x) +(Maybe.bind (Maybe.none) mb) = (Maybe.none) +(Maybe.bind (Maybe.some val) mb) = (mb val) +(String.join sep list) = (String.intercalate sep list) +(String.intercalate sep xs) = (String.flatten (List.intersperse sep xs)) +(String.flatten []) = "" +(String.flatten (List.cons head tail)) = (String.concat head (String.flatten tail)) +(List.intersperse sep []) = [] +(List.intersperse sep [xh]) = (List.pure xh) +(List.intersperse sep (List.cons xh xt)) = (List.cons xh (List.cons sep (List.intersperse sep xt))) +(List.pure x) = [x] +(Kind.Term.show.sugar.string term) = (Maybe.bind (Kind.Term.show.sugar.string.go term) λres let quot = "'"; (Maybe.pure (Kind.Printer.text [quot, res, quot]))) +(Kind.Term.show.sugar.string.go (Kind.Term.ct0 (String.nil.) orig)) = (Maybe.some "") +(Kind.Term.show.sugar.string.go (Kind.Term.ct2 (String.cons.) orig (Kind.Term.num orig1 x0) x1)) = (Maybe.bind (Kind.Term.show.sugar.string.go x1) λtail (Maybe.pure (String.cons x0 tail))) +(Kind.Term.show.sugar.string.go other) = (Maybe.none) +(Kind.Term.show.go (Kind.Term.typ orig)) = "Type" +(Kind.Term.show.go (Kind.Term.var orig name index)) = (Kind.Printer.text [(Kind.Name.show name)]) +(Kind.Term.show.go (Kind.Term.hol orig numb)) = (Kind.Printer.text ["_"]) +(Kind.Term.show.go (Kind.Term.all orig name type body)) = (Kind.Term.show.forall orig name type body) +(Kind.Term.show.go (Kind.Term.lam orig name body)) = (Kind.Printer.text ["(", (Kind.Name.show name), " => ", (Kind.Term.show (body (Kind.Term.var orig name 0))), ")"]) +(Kind.Term.show.go (Kind.Term.let orig name exp body)) = (Kind.Printer.text ["let ", (Kind.Name.show name), " = ", (Kind.Term.show exp), "; ", (Kind.Term.show (body (Kind.Term.var orig name 0)))]) +(Kind.Term.show.go (Kind.Term.ann orig expr type)) = (Kind.Printer.text ["{", (Kind.Term.show expr), " :: ", (Kind.Term.show type), "}"]) +(Kind.Term.show.go (Kind.Term.sub orig name indx redx expr)) = (Kind.Printer.text [(Kind.Term.show expr), " ## ", (Kind.Name.show name), "/", (Show.to_string (U60.show redx))]) +(Kind.Term.show.go (Kind.Term.app orig func argm)) = (Kind.Printer.text ["(", (Kind.Term.show func), " ", (Kind.Term.show argm), ")"]) +(Kind.Term.show.go (Kind.Term.ct0 ctid orig)) = (NameOf ctid) +(Kind.Term.show.go (Kind.Term.ct1 ctid orig x0)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), ")"]) +(Kind.Term.show.go (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), ")"]) +(Kind.Term.show.go (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), ")"]) +(Kind.Term.show.go (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), ")"]) +(Kind.Term.show.go (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), ")"]) +(Kind.Term.show.go (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), ")"]) +(Kind.Term.show.go (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), ")"]) +(Kind.Term.show.go (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), ")"]) +(Kind.Term.show.go (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), ")"]) +(Kind.Term.show.go (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), ")"]) +(Kind.Term.show.go (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), ")"]) +(Kind.Term.show.go (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), ")"]) +(Kind.Term.show.go (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), " ", (Kind.Term.show x13), ")"]) +(Kind.Term.show.go (Kind.Term.ct15 ctid orig x0)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.ct16 ctid orig x0)) = (Kind.Printer.text ["(", (NameOf ctid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.fn0 fnid orig)) = (NameOf fnid) +(Kind.Term.show.go (Kind.Term.fn1 fnid orig x0)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), ")"]) +(Kind.Term.show.go (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), ")"]) +(Kind.Term.show.go (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), ")"]) +(Kind.Term.show.go (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), ")"]) +(Kind.Term.show.go (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), ")"]) +(Kind.Term.show.go (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), ")"]) +(Kind.Term.show.go (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), ")"]) +(Kind.Term.show.go (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), ")"]) +(Kind.Term.show.go (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), ")"]) +(Kind.Term.show.go (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), ")"]) +(Kind.Term.show.go (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), ")"]) +(Kind.Term.show.go (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), ")"]) +(Kind.Term.show.go (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), " ", (Kind.Term.show x13), ")"]) +(Kind.Term.show.go (Kind.Term.fn15 fnid orig x0)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.fn16 fnid orig x0)) = (Kind.Printer.text ["(", (NameOf fnid), " ", (Kind.Term.show x0), ")"]) +(Kind.Term.show.go (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = (Kind.Printer.text [(Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), " ", (Kind.Term.show x13), " ", (Kind.Term.show x14)]) +(Kind.Term.show.go (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = (Kind.Printer.text [(Kind.Term.show x0), " ", (Kind.Term.show x1), " ", (Kind.Term.show x2), " ", (Kind.Term.show x3), " ", (Kind.Term.show x4), " ", (Kind.Term.show x5), " ", (Kind.Term.show x6), " ", (Kind.Term.show x7), " ", (Kind.Term.show x8), " ", (Kind.Term.show x9), " ", (Kind.Term.show x10), " ", (Kind.Term.show x11), " ", (Kind.Term.show x12), " ", (Kind.Term.show x13), " ", (Kind.Term.show x14), " ", (Kind.Term.show x15)]) +(Kind.Term.show.go (Kind.Term.hlp orig)) = "?" +(Kind.Term.show.go (Kind.Term.u60 orig)) = "U60" +(Kind.Term.show.go (Kind.Term.num orig numb)) = (Show.to_string (U60.show numb)) +(Kind.Term.show.go (Kind.Term.op2 orig operator left right)) = (Kind.Printer.text ["(", (Kind.Operator.show operator), " ", (Kind.Term.show left), " ", (Kind.Term.show right), ")"]) +(Show.to_string show) = (show "") +(Kind.Operator.show (Kind.Operator.add)) = "+" +(Kind.Operator.show (Kind.Operator.sub)) = "-" +(Kind.Operator.show (Kind.Operator.mul)) = "*" +(Kind.Operator.show (Kind.Operator.div)) = "/" +(Kind.Operator.show (Kind.Operator.mod)) = "%" +(Kind.Operator.show (Kind.Operator.and)) = "&" +(Kind.Operator.show (Kind.Operator.or)) = "|" +(Kind.Operator.show (Kind.Operator.xor)) = "^" +(Kind.Operator.show (Kind.Operator.shl)) = "<<" +(Kind.Operator.show (Kind.Operator.shr)) = ">>" +(Kind.Operator.show (Kind.Operator.ltn)) = "<" +(Kind.Operator.show (Kind.Operator.lte)) = "<=" +(Kind.Operator.show (Kind.Operator.eql)) = "==" +(Kind.Operator.show (Kind.Operator.gte)) = ">=" +(Kind.Operator.show (Kind.Operator.gtn)) = ">" +(Kind.Operator.show (Kind.Operator.neq)) = "!=" +(Kind.Term.show.forall orig name type body) = (U60.if (== name 63) (Kind.Printer.text ["(", (Kind.Term.show type), " -> ", (Kind.Term.show (body (Kind.Term.var orig name 0))), ")"]) (Kind.Printer.text ["((", (Kind.Name.show name), ": ", (Kind.Term.show type), ") -> ", (Kind.Term.show (body (Kind.Term.var orig name 0))), ")"])) +(U60.show 0) = λstr (String.cons 48 str) +(U60.show n) = λstr let next = (String.cons (+ 48 (% n 10)) str); let func = (U60.if (< n 10) λh h λh ((U60.show (/ n 10)) h)); (func next) (Kind.API.check_all) = let output = (Kind.API.output (List.reverse (Kind.API.check_functions (Functions)))); output - -// Kind.API.check_functions (fnid: (List U60)) : (List (Pair U60 (List (Kind.Result (Unit))))) -(Kind.API.check_functions (List.nil)) = (List.nil) +(Kind.API.check_functions []) = [] (Kind.API.check_functions (List.cons f fs)) = let head = (Pair.new f (Kind.API.check_function f)); let tail = (Kind.API.check_functions fs); (List.cons head tail) - -// Kind.API.check_function (fnid: U60) : (List (Kind.Result (Unit))) (Kind.API.check_function fnid) = let rules = (RuleOf fnid); let type = (TypeOf fnid); let type_check = (Kind.Checker.run (Kind.Checker.unify (Kind.Checker.check type (Kind.Term.typ 0))) (Bool.true)); let rule_check = (Kind.API.check_function.rules rules (Kind.Term.eval type)); (List.cons type_check rule_check) - -// Kind.API.check_function.rules (rules: (List (Kind.Rule))) (type: (Kind.Term)) : (List (Kind.Result (Unit))) -(Kind.API.check_function.rules (List.nil) type) = (List.nil) -(Kind.API.check_function.rules (List.cons rule rules) type) = let head = (Kind.Checker.run (Kind.Checker.unify (Kind.Checker.rule rule type)) (Bool.false)); let tail = (Kind.API.check_function.rules rules type); (List.cons head tail) - -// Kind.Checker.rule (rule: (Kind.Rule)) (term: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.rule (Kind.Rule.lhs arg args) (Kind.Term.all orig name type body)) = (Kind.Checker.bind (Kind.Checker.check arg type) @_ (Kind.Checker.bind (Kind.Checker.rule args (body arg)) @_ (Kind.Checker.pure (Unit.new)))) -(Kind.Checker.rule (Kind.Rule.lhs arg args) other) = (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.too_many_arguments ctx (Kind.Term.get_origin arg @orig @term orig)))) -(Kind.Checker.rule (Kind.Rule.rhs expr) type) = (Kind.Checker.bind (Kind.Checker.set_right_hand_side (Bool.true)) @_ (Kind.Checker.bind (Kind.Checker.check expr type) @_ (Kind.Checker.pure (Unit.new)))) - -// Kind.Checker.bind.result -(a: Type) -(b: Type) (result: (Kind.Result a)) (then: (_: a) (Kind.Checker b)) : (Kind.Result b) -(Kind.Checker.bind.result (Kind.Result.checked context hole_depth depth rhs sub equations errs ret) then) = ((((((((then ret) context) hole_depth) depth) rhs) sub) equations) errs) +(Kind.Checker.unify checker) = (Kind.Checker.bind checker λx_1 (Kind.Checker.bind (Kind.Checker.get_equations) λequations (Kind.Checker.unify.go equations [] (Bool.false)))) +(Kind.Checker.unify.go [] [] changed) = (Kind.Checker.pure (Unit.new)) +(Kind.Checker.unify.go [] unsolved (Bool.true)) = (Kind.Checker.unify.go unsolved [] (Bool.false)) +(Kind.Checker.unify.go [] unsolved (Bool.false)) = (Kind.Checker.unify.go.fail unsolved) +(Kind.Checker.unify.go (List.cons (Kind.Equation.new ctx orig left right) equations) unsolved changed) = (Kind.Checker.bind (Kind.Checker.with_context (Kind.Checker.equal (Kind.Term.eval left) (Kind.Term.eval right)) ctx) λis_equal let unify = (Bool.if is_equal λequations λunsolved (Kind.Checker.unify.go equations unsolved (Bool.true)) λequations λunsolved let eqt = (Kind.Equation.new ctx orig left right); (Kind.Checker.unify.go equations (List.cons eqt unsolved) changed)); (unify equations unsolved)) +(Kind.Checker.unify.go.fail []) = (Kind.Checker.pure (Unit.new)) +(Kind.Checker.unify.go.fail (List.cons (Kind.Equation.new ctx orig left right) eqts)) = (Kind.Checker.bind (Kind.Checker.error (Kind.Error.type_mismatch ctx orig left right) (Unit.new)) λx_1 (Kind.Checker.unify.go.fail eqts)) +(Kind.Checker.bind checker then) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Checker.bind.result (checker context depth rhs subst eqts errs) then) +(Kind.Checker.bind.result (Kind.Result.checked context depth rhs sub equations errs ret) then) = (then ret context depth rhs sub equations errs) (Kind.Checker.bind.result (Kind.Result.errored context sub errs) then) = (Kind.Result.errored context sub errs) - -// Kind.Checker.bind -(a: Type) -(b: Type) (checker: (Kind.Checker a)) (then: (_: a) (Kind.Checker b)) : (Kind.Checker b) -(Kind.Checker.bind checker then) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Checker.bind.result (((((((checker context) hole_depth) depth) rhs) subst) eqts) errs) then) - -// Kind.Checker (a: Type) : Type -(Kind.Checker a) = 0 - -// Kind.Checker.fail -(t: Type) (err: (Kind.Error)) : (Kind.Checker t) -(Kind.Checker.fail err) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.errored context subst (List.cons err errs)) - -// Kind.Checker.set_right_hand_side (rhs: (Bool)) : (Kind.Checker (Unit)) -(Kind.Checker.set_right_hand_side to_rhs) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth to_rhs subst eqts errs (Unit.new)) - -// Kind.Term.get_origin -(r: Type) (term: (Kind.Term)) (got: (_: U60) (_: (Kind.Term)) r) : r -(Kind.Term.get_origin (Kind.Term.typ orig) got) = ((got orig) (Kind.Term.typ orig)) -(Kind.Term.get_origin (Kind.Term.var orig name index) got) = ((got orig) (Kind.Term.var orig name index)) -(Kind.Term.get_origin (Kind.Term.hol orig numb) got) = ((got orig) (Kind.Term.hol orig numb)) -(Kind.Term.get_origin (Kind.Term.all orig name typ body) got) = ((got orig) (Kind.Term.all orig name typ body)) -(Kind.Term.get_origin (Kind.Term.lam orig name body) got) = ((got orig) (Kind.Term.lam orig name body)) -(Kind.Term.get_origin (Kind.Term.let orig name expr body) got) = ((got orig) (Kind.Term.let orig name expr body)) -(Kind.Term.get_origin (Kind.Term.ann orig expr typ) got) = ((got orig) (Kind.Term.ann orig expr typ)) -(Kind.Term.get_origin (Kind.Term.sub orig name indx redx expr) got) = ((got orig) (Kind.Term.sub orig name indx redx expr)) -(Kind.Term.get_origin (Kind.Term.app orig func arg) got) = ((got orig) (Kind.Term.app orig func arg)) -(Kind.Term.get_origin (Kind.Term.hlp orig) got) = ((got orig) (Kind.Term.hlp orig)) -(Kind.Term.get_origin (Kind.Term.u60 orig) got) = ((got orig) (Kind.Term.u60 orig)) -(Kind.Term.get_origin (Kind.Term.num orig num) got) = ((got orig) (Kind.Term.num orig num)) -(Kind.Term.get_origin (Kind.Term.op2 orig op left right) got) = ((got orig) (Kind.Term.op2 orig op left right)) -(Kind.Term.get_origin (Kind.Term.ct0 ctid orig) got) = ((got orig) (Kind.Term.ct0 ctid orig)) -(Kind.Term.get_origin (Kind.Term.ct1 ctid orig x0) got) = ((got orig) (Kind.Term.ct1 ctid orig x0)) -(Kind.Term.get_origin (Kind.Term.ct2 ctid orig x0 x1) got) = ((got orig) (Kind.Term.ct2 ctid orig x0 x1)) -(Kind.Term.get_origin (Kind.Term.ct3 ctid orig x0 x1 x2) got) = ((got orig) (Kind.Term.ct3 ctid orig x0 x1 x2)) -(Kind.Term.get_origin (Kind.Term.ct4 ctid orig x0 x1 x2 x3) got) = ((got orig) (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) -(Kind.Term.get_origin (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4) got) = ((got orig) (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) -(Kind.Term.get_origin (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5) got) = ((got orig) (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) -(Kind.Term.get_origin (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6) got) = ((got orig) (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) -(Kind.Term.get_origin (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7) got) = ((got orig) (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) -(Kind.Term.get_origin (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) got) = ((got orig) (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) -(Kind.Term.get_origin (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) got) = ((got orig) (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) -(Kind.Term.get_origin (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) got) = ((got orig) (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) -(Kind.Term.get_origin (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) got) = ((got orig) (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) -(Kind.Term.get_origin (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) got) = ((got orig) (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) -(Kind.Term.get_origin (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) got) = ((got orig) (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) -(Kind.Term.get_origin (Kind.Term.ct15 fnid orig args) got) = ((got orig) (Kind.Term.ct15 fnid orig args)) -(Kind.Term.get_origin (Kind.Term.ct16 fnid orig args) got) = ((got orig) (Kind.Term.ct16 fnid orig args)) -(Kind.Term.get_origin (Kind.Term.fn0 fnid orig) got) = ((got orig) (Kind.Term.fn0 fnid orig)) -(Kind.Term.get_origin (Kind.Term.fn1 fnid orig x0) got) = ((got orig) (Kind.Term.fn1 fnid orig x0)) -(Kind.Term.get_origin (Kind.Term.fn2 fnid orig x0 x1) got) = ((got orig) (Kind.Term.fn2 fnid orig x0 x1)) -(Kind.Term.get_origin (Kind.Term.fn3 fnid orig x0 x1 x2) got) = ((got orig) (Kind.Term.fn3 fnid orig x0 x1 x2)) -(Kind.Term.get_origin (Kind.Term.fn4 fnid orig x0 x1 x2 x3) got) = ((got orig) (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) -(Kind.Term.get_origin (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4) got) = ((got orig) (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) -(Kind.Term.get_origin (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5) got) = ((got orig) (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) -(Kind.Term.get_origin (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6) got) = ((got orig) (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) -(Kind.Term.get_origin (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7) got) = ((got orig) (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) -(Kind.Term.get_origin (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) got) = ((got orig) (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) -(Kind.Term.get_origin (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) got) = ((got orig) (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) -(Kind.Term.get_origin (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) got) = ((got orig) (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) -(Kind.Term.get_origin (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) got) = ((got orig) (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) -(Kind.Term.get_origin (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) got) = ((got orig) (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) -(Kind.Term.get_origin (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) got) = ((got orig) (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) -(Kind.Term.get_origin (Kind.Term.fn15 fnid orig args) got) = ((got orig) (Kind.Term.fn15 fnid orig args)) -(Kind.Term.get_origin (Kind.Term.fn16 fnid orig args) got) = ((got orig) (Kind.Term.fn16 fnid orig args)) - -// Kind.Checker.check (term: (Kind.Term)) (type: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.check (Kind.Term.lam orig name body) type) = (Kind.Checker.bind (Kind.Checker.get_subst) @subst let fun = (Kind.Term.if_all type @t_orig @t_name @t_type @t_body @orig @name @body (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name dep)) (t_body (Kind.Term.var t_orig t_name dep))) name t_type (List.nil)) @chk (Kind.Checker.pure (Unit.new)))) @orig @name @body (Kind.Checker.bind (Kind.Checker.get_right_hand_side) @rhs (Kind.Checker.compare rhs (Kind.Term.lam orig name body) type))); (((fun orig) name) body)) -(Kind.Checker.check (Kind.Term.let orig name expr body) type) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.infer expr) @expr_typ (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name dep)) type) name expr_typ (List.cons (Kind.Term.eval expr) (List.nil))) @body_chk (Kind.Checker.pure (Unit.new))))) -(Kind.Checker.check (Kind.Term.hlp orig) type) = (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.bind (Kind.Checker.error (Kind.Error.inspection ctx orig type) (Unit.new)) @_ (Kind.Checker.pure (Unit.new)))) -(Kind.Checker.check (Kind.Term.var orig name idx) type) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) @rhs (Bool.if rhs (Kind.Checker.compare rhs (Kind.Term.var orig name idx) type) (Kind.Checker.extend name type (List.nil)))) -(Kind.Checker.check (Kind.Term.hol orig numb) type) = (Kind.Checker.pure (Unit.new)) -(Kind.Checker.check term type) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) @rhs (Kind.Checker.compare rhs term type)) - -// Kind.Checker.compare (rhs: (Bool)) (term: (Kind.Term)) (type: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.compare rhs term type) = (Kind.Term.get_origin term @orig @term (Kind.Checker.bind (Kind.Checker.infer term) @term_typ let fun = (Bool.if rhs @term_typ @type (Kind.Checker.new_equation orig type term_typ) @term_typ @type (Kind.Checker.bind (Kind.Checker.equal (Kind.Term.eval term_typ) (Kind.Term.eval type)) @is_equal (Bool.if is_equal (Kind.Checker.pure (Unit.new)) (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.impossible_case ctx orig type term_typ)))))); ((fun term_typ) type))) - -// Kind.Checker.new_equation (orig: U60) (left: (Kind.Term)) (right: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.new_equation orig left right) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst (List.append eqts (Kind.Equation.new context orig left right)) errs (Unit.new)) - -// List.append -(a: Type) (xs: (List a)) (x: a) : (List a) -(List.append (List.nil) x) = (List.pure x) -(List.append (List.cons xs.h xs.t) x) = (List.cons xs.h (List.append xs.t x)) - -// List.pure -(t: Type) (x: t) : (List t) -(List.pure x) = (List.cons x (List.nil)) - -// Kind.Checker.extend (name: U60) (type: (Kind.Term)) (vals: (List (Kind.Term))) : (Kind.Checker (Unit)) -(Kind.Checker.extend name type vals) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked (Kind.Context.extend context name type vals) hole_depth (+ depth 1) rhs subst eqts errs (Unit.new)) - -// Kind.Context.extend (prev: (Kind.Context)) (name: U60) (term: (Kind.Term)) (ls: (List (Kind.Term))) : (Kind.Context) -(Kind.Context.extend (Kind.Context.empty) name type values) = (Kind.Context.entry name type values (Kind.Context.empty)) -(Kind.Context.extend (Kind.Context.entry n t v rest) name type values) = (Kind.Context.entry n t v (Kind.Context.extend rest name type values)) - -// Kind.Checker.get_context : (Kind.Checker (Kind.Context)) -(Kind.Checker.get_context) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs context) - -// Kind.Checker.extended -(a: Type) (checker: (Kind.Checker a)) (name: U60) (type: (Kind.Term)) (vals: (List (Kind.Term))) : (Kind.Checker a) -(Kind.Checker.extended checker name type vals) = (Kind.Checker.bind (Kind.Checker.extend name type vals) @_ (Kind.Checker.bind checker @got (Kind.Checker.bind (Kind.Checker.shrink) @_ (Kind.Checker.pure got)))) - -// Kind.Checker.shrink : (Kind.Checker (Unit)) -(Kind.Checker.shrink) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked (Kind.Context.shrink context) hole_depth (- depth 1) rhs subst eqts errs (Unit.new)) - -// Kind.Context.shrink (ctx: (Kind.Context)) : (Kind.Context) +(Kind.Checker.pure res) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs res) +(Kind.Checker.error err ret) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts (List.cons err errs) ret) +(Bool.if (Bool.true) t f) = t +(Bool.if (Bool.false) t f) = f +(Kind.Checker.with_context checker new_context) = (Kind.Checker.bind (Kind.Checker.set_context new_context) λold_context (Kind.Checker.bind checker λgot (Kind.Checker.bind (Kind.Checker.set_context old_context) λx_1 (Kind.Checker.pure got)))) +(Kind.Checker.set_context new_context) = λold_context λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked new_context depth rhs subst eqts errs old_context) +(Kind.Term.eval (Kind.Term.typ orig)) = (Kind.Term.typ orig) +(Kind.Term.eval (Kind.Term.var orig name index)) = (Kind.Term.var orig name index) +(Kind.Term.eval (Kind.Term.hol orig numb)) = (Kind.Term.hol orig numb) +(Kind.Term.eval (Kind.Term.all orig name typ body)) = (Kind.Term.all orig name (Kind.Term.eval typ) λx (Kind.Term.eval (body x))) +(Kind.Term.eval (Kind.Term.lam orig name body)) = (Kind.Term.lam orig name λx (Kind.Term.eval (body x))) +(Kind.Term.eval (Kind.Term.let orig name expr body)) = (Kind.Term.eval_let orig name (Kind.Term.eval expr) λx (Kind.Term.eval (body x))) +(Kind.Term.eval (Kind.Term.ann orig expr typ)) = (Kind.Term.eval_ann orig (Kind.Term.eval expr) (Kind.Term.eval typ)) +(Kind.Term.eval (Kind.Term.sub orig name indx redx expr)) = (Kind.Term.eval_sub orig name indx redx (Kind.Term.eval expr)) +(Kind.Term.eval (Kind.Term.app orig expr typ)) = (Kind.Term.eval_app orig (Kind.Term.eval expr) (Kind.Term.eval typ)) +(Kind.Term.eval (Kind.Term.hlp orig)) = (Kind.Term.hlp orig) +(Kind.Term.eval (Kind.Term.u60 orig)) = (Kind.Term.u60 orig) +(Kind.Term.eval (Kind.Term.num orig num)) = (Kind.Term.num orig num) +(Kind.Term.eval (Kind.Term.op2 orig op left right)) = (Kind.Term.eval_op orig op (Kind.Term.eval left) (Kind.Term.eval right)) +(Kind.Term.eval (Kind.Term.ct0 ctid orig)) = (Kind.Term.ct0 ctid orig) +(Kind.Term.eval (Kind.Term.ct1 ctid orig x0)) = (Kind.Term.ct1 ctid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Term.ct2 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1)) +(Kind.Term.eval (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Term.ct3 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2)) +(Kind.Term.eval (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Term.ct4 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3)) +(Kind.Term.eval (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Term.ct5 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4)) +(Kind.Term.eval (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.ct6 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5)) +(Kind.Term.eval (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.ct7 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6)) +(Kind.Term.eval (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.ct8 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7)) +(Kind.Term.eval (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.ct9 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8)) +(Kind.Term.eval (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.ct10 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9)) +(Kind.Term.eval (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.ct11 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10)) +(Kind.Term.eval (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.ct12 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11)) +(Kind.Term.eval (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.ct13 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12)) +(Kind.Term.eval (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.ct14 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13)) +(Kind.Term.eval (Kind.Term.ct15 fnid orig x0)) = (Kind.Term.ct15 fnid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.ct16 fnid orig x0)) = (Kind.Term.ct16 fnid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.fn0 fnid orig)) = (Kind.Term.FN0 fnid orig) +(Kind.Term.eval (Kind.Term.fn1 fnid orig x0)) = (Kind.Term.FN1 fnid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Term.FN2 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1)) +(Kind.Term.eval (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Term.FN3 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2)) +(Kind.Term.eval (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Term.FN4 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3)) +(Kind.Term.eval (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Term.FN5 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4)) +(Kind.Term.eval (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.FN6 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5)) +(Kind.Term.eval (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.FN7 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6)) +(Kind.Term.eval (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.FN8 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7)) +(Kind.Term.eval (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.FN9 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8)) +(Kind.Term.eval (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.FN10 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9)) +(Kind.Term.eval (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.FN11 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10)) +(Kind.Term.eval (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.FN12 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11)) +(Kind.Term.eval (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.FN13 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12)) +(Kind.Term.eval (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.FN14 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13)) +(Kind.Term.eval (Kind.Term.fn15 fnid orig x0)) = (Kind.Term.FN15 fnid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.fn16 fnid orig x0)) = (Kind.Term.FN16 fnid orig (Kind.Term.eval x0)) +(Kind.Term.eval (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = (Kind.Term.args15 (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13) (Kind.Term.eval x14)) +(Kind.Term.eval (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = (Kind.Term.args16 (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13) (Kind.Term.eval x14) (Kind.Term.eval x15)) +(Kind.Term.eval_sub orig name indx redx expr) = expr +(Kind.Term.eval_ann orig expr type) = expr +(Kind.Term.eval_let orig name expr body) = (body expr) +(Kind.Term.eval_app orig (Kind.Term.lam orig1 name body) arg) = (body arg) +(Kind.Term.eval_app orig func arg) = (Kind.Term.app orig func arg) +(Kind.Term.eval_op orig (Kind.Operator.add) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (+ a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.sub) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (- a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.mul) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (* a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.div) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (/ a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.mod) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (% a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.and) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (+ a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.or) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (| a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.xor) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (^ a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.shl) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (<< a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.shr) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (>> a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.ltn) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (< a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.lte) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (<= a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.eql) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (== a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.gte) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (>= a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.gtn) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (> a.num b.num)) +(Kind.Term.eval_op orig (Kind.Operator.neq) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (!= a.num b.num)) +(Kind.Term.eval_op orig op left right) = (Kind.Term.op2 orig op left right) +(Kind.Checker.equal (Kind.Term.typ orig) (Kind.Term.typ orig1)) = (Kind.Checker.pure (Bool.true)) +(Kind.Checker.equal (Kind.Term.all a.orig a.name a.type a.body) (Kind.Term.all b.orig b.name b.type b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.equal a.type b.type) λtype (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) []) λbody (Kind.Checker.pure (Bool.and type body))))) +(Kind.Checker.equal (Kind.Term.lam a.orig a.name a.body) (Kind.Term.lam b.orig b.name b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) []) λbody (Kind.Checker.pure body))) +(Kind.Checker.equal (Kind.Term.app a.orig a.func a.argm) (Kind.Term.app b.orig b.func b.argm)) = (Kind.Checker.bind (Kind.Checker.equal a.func b.func) λfunc (Kind.Checker.bind (Kind.Checker.equal a.argm b.argm) λargm (Kind.Checker.pure (Bool.and func argm)))) +(Kind.Checker.equal (Kind.Term.let a.orig a.name a.expr a.body) (Kind.Term.let b.orig b.name b.expr b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) λexpr (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) []) λbody (Kind.Checker.pure (Bool.and expr body))))) +(Kind.Checker.equal (Kind.Term.ann a.orig a.expr a.type) (Kind.Term.ann b.orig b.expr b.type)) = (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) λfunc (Kind.Checker.bind (Kind.Checker.equal a.type b.type) λtype (Kind.Checker.pure (Bool.and func type)))) +(Kind.Checker.equal (Kind.Term.sub a.orig a.name a.indx a.redx a.expr) (Kind.Term.sub b.orig b.name b.indx b.redx b.expr)) = (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) λfunc (Kind.Checker.pure func)) +(Kind.Checker.equal (Kind.Term.u60 a.orig) (Kind.Term.u60 b.orig)) = (Kind.Checker.pure (Bool.true)) +(Kind.Checker.equal (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Checker.pure (U60.equal a.num b.num)) +(Kind.Checker.equal (Kind.Term.op2 a.orig a.op a.val0 a.val1) (Kind.Term.op2 b.orig b.op b.val0 b.val1)) = let op = (Kind.Operator.equal a.op b.op); (Kind.Checker.bind (Kind.Checker.equal a.val0 b.val0) λval0 (Kind.Checker.bind (Kind.Checker.equal a.val1 b.val1) λval1 (Kind.Checker.pure (Bool.and op (Bool.and val0 val1))))) +(Kind.Checker.equal (Kind.Term.hol a.orig a.numb) (Kind.Term.hol b.orig b.numb)) = (Bool.if (U60.equal a.numb b.numb) (Kind.Checker.pure (Bool.true)) (Kind.Checker.equal.hol a.orig a.numb (Kind.Term.hol b.orig b.numb))) +(Kind.Checker.equal (Kind.Term.hol a.orig a.numb) b) = (Kind.Checker.equal.hol a.orig a.numb b) +(Kind.Checker.equal b (Kind.Term.hol a.orig a.numb)) = (Kind.Checker.equal.hol a.orig a.numb b) +(Kind.Checker.equal (Kind.Term.var a.orig a.name a.idx) b) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) λrhs (Kind.Checker.equal.var rhs a.orig a.name a.idx b)) +(Kind.Checker.equal b (Kind.Term.var a.orig a.name a.idx)) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) λrhs (Kind.Checker.equal.var rhs a.orig a.name a.idx b)) +(Kind.Checker.equal (Kind.Term.ct0 a.ctid a.orig) (Kind.Term.ct0 b.ctid b.orig)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.pure ctid) +(Kind.Checker.equal (Kind.Term.ct1 a.ctid a.orig a.x0) (Kind.Term.ct1 b.ctid b.orig b.x0)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.pure (Bool.and ctid x0))) +(Kind.Checker.equal (Kind.Term.ct2 a.ctid a.orig a.x0 a.x1) (Kind.Term.ct2 b.ctid b.orig b.x0 b.x1)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 x1))))) +(Kind.Checker.equal (Kind.Term.ct3 a.ctid a.orig a.x0 a.x1 a.x2) (Kind.Term.ct3 b.ctid b.orig b.x0 b.x1 b.x2)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 x2))))))) +(Kind.Checker.equal (Kind.Term.ct4 a.ctid a.orig a.x0 a.x1 a.x2 a.x3) (Kind.Term.ct4 b.ctid b.orig b.x0 b.x1 b.x2 b.x3)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 x3))))))))) +(Kind.Checker.equal (Kind.Term.ct5 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4) (Kind.Term.ct5 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 x4))))))))))) +(Kind.Checker.equal (Kind.Term.ct6 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5) (Kind.Term.ct6 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 x5))))))))))))) +(Kind.Checker.equal (Kind.Term.ct7 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6) (Kind.Term.ct7 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 x6))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct8 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7) (Kind.Term.ct8 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 x7))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct9 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8) (Kind.Term.ct9 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 x8))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct10 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9) (Kind.Term.ct10 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 x9))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct11 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10) (Kind.Term.ct11 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 x10))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct12 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11) (Kind.Term.ct12 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 x11))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct13 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12) (Kind.Term.ct13 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 x12))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct14 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13) (Kind.Term.ct14 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) λx13 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 x13))))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.ct15 a.ctid a.orig a.args) (Kind.Term.ct15 b.ctid b.orig b.args)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) λxargs (Kind.Checker.pure (Bool.and ctid xargs))) +(Kind.Checker.equal (Kind.Term.ct16 a.ctid a.orig a.args) (Kind.Term.ct16 b.ctid b.orig b.args)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) λxargs (Kind.Checker.pure (Bool.and ctid xargs))) +(Kind.Checker.equal (Kind.Term.args15 a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13 a.x14) (Kind.Term.args15 b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13 b.x14)) = (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) λx13 (Kind.Checker.bind (Kind.Checker.equal a.x14 b.x14) λx14 (Kind.Checker.pure (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 (Bool.and x13 x14)))))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.args16 a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13 a.x14 a.x15) (Kind.Term.args16 b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13 b.x14 b.x15)) = (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) λx13 (Kind.Checker.bind (Kind.Checker.equal a.x14 b.x14) λx14 (Kind.Checker.bind (Kind.Checker.equal a.x15 b.x15) λx15 (Kind.Checker.pure (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 (Bool.and x13 (Bool.and x14 x15)))))))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn0 a.fnid a.orig) (Kind.Term.fn0 b.fnid b.orig)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.pure fnid) +(Kind.Checker.equal (Kind.Term.fn1 a.fnid a.orig a.x0) (Kind.Term.fn1 b.fnid b.orig b.x0)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.pure (Bool.and fnid x0))) +(Kind.Checker.equal (Kind.Term.fn2 a.fnid a.orig a.x0 a.x1) (Kind.Term.fn2 b.fnid b.orig b.x0 b.x1)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 x1))))) +(Kind.Checker.equal (Kind.Term.fn3 a.fnid a.orig a.x0 a.x1 a.x2) (Kind.Term.fn3 b.fnid b.orig b.x0 b.x1 b.x2)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 x2))))))) +(Kind.Checker.equal (Kind.Term.fn4 a.fnid a.orig a.x0 a.x1 a.x2 a.x3) (Kind.Term.fn4 b.fnid b.orig b.x0 b.x1 b.x2 b.x3)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 x3))))))))) +(Kind.Checker.equal (Kind.Term.fn5 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4) (Kind.Term.fn5 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 x4))))))))))) +(Kind.Checker.equal (Kind.Term.fn6 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5) (Kind.Term.fn6 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 x5))))))))))))) +(Kind.Checker.equal (Kind.Term.fn7 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6) (Kind.Term.fn7 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 x6))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn8 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7) (Kind.Term.fn8 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 x7))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn9 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8) (Kind.Term.fn9 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 x8))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn10 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9) (Kind.Term.fn10 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 x9))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn11 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10) (Kind.Term.fn11 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 x10))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn12 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11) (Kind.Term.fn12 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 x11))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn13 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12) (Kind.Term.fn13 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 x12))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn14 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13) (Kind.Term.fn14 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) λx0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) λx1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) λx2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) λx3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) λx4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) λx5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) λx6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) λx7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) λx8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) λx9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) λx10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) λx11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) λx12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) λx13 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 x13))))))))))))))))))))))))))))) +(Kind.Checker.equal (Kind.Term.fn15 a.fnid a.orig a.args) (Kind.Term.fn15 b.fnid b.orig b.args)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) λxargs (Kind.Checker.pure (Bool.and fnid xargs))) +(Kind.Checker.equal (Kind.Term.fn16 a.fnid a.orig a.args) (Kind.Term.fn16 b.fnid b.orig b.args)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) λxargs (Kind.Checker.pure (Bool.and fnid xargs))) +(Kind.Checker.equal a b) = (Kind.Checker.bind (Kind.Checker.get_subst) λsub (Bool.if (Bool.or (Kind.Term.fillable a sub) (Kind.Term.fillable b sub)) (Kind.Checker.equal (Kind.Term.fill a sub) (Kind.Term.fill b sub)) (Kind.Checker.pure (Bool.false)))) +(Kind.Checker.extended checker name type vals) = (Kind.Checker.bind (Kind.Checker.extend name type vals) λx_2 (Kind.Checker.bind checker λgot (Kind.Checker.bind (Kind.Checker.shrink) λx_1 (Kind.Checker.pure got)))) +(Kind.Checker.shrink) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked (Kind.Context.shrink context) (- depth 1) rhs subst eqts errs (Unit.new)) (Kind.Context.shrink (Kind.Context.empty)) = (Kind.Context.empty) (Kind.Context.shrink (Kind.Context.entry name type vals (Kind.Context.empty))) = (Kind.Context.empty) (Kind.Context.shrink (Kind.Context.entry name type vals rest)) = (Kind.Context.entry name type vals (Kind.Context.shrink rest)) - -// Kind.Checker.pure -(t: Type) (a: t) : (Kind.Checker t) -(Kind.Checker.pure res) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs res) - -// Kind.Checker.get_right_hand_side : (Kind.Checker (Bool)) -(Kind.Checker.get_right_hand_side) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs rhs) - -// Kind.Checker.infer_args (args: (Kind.Term)) : (_: (Kind.Term)) (_: U60) (Kind.Term) -(Kind.Checker.infer_args (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = @term @orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig term x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13) x14) -(Kind.Checker.infer_args (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = @term @orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig term x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13) x14) x15) - -// Kind.Checker.infer (term: (Kind.Term)) : (Kind.Checker (Kind.Term)) -(Kind.Checker.infer (Kind.Term.var orig name index)) = (Kind.Checker.bind (Kind.Checker.find index (Maybe.none) @n @t @v (Maybe.some t)) @got_type (Maybe.match got_type (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) @got_type.value (Kind.Checker.pure got_type.value))) -(Kind.Checker.infer (Kind.Term.hol orig numb)) = (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.cant_infer_hole ctx orig))) -(Kind.Checker.infer (Kind.Term.typ orig)) = (Kind.Checker.pure (Kind.Term.typ orig)) -(Kind.Checker.infer (Kind.Term.all orig name type body)) = (Kind.Checker.bind (Kind.Checker.get_depth) @depth (Kind.Checker.bind (Kind.Checker.check type (Kind.Term.typ orig)) @_ (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name depth)) (Kind.Term.typ orig)) name (Kind.Term.eval type) (List.nil)) @_ (Kind.Checker.pure (Kind.Term.typ orig))))) -(Kind.Checker.infer (Kind.Term.lam orig name body)) = (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.bind (Kind.Checker.new_hole orig) @arg (Kind.Checker.bind (Kind.Checker.new_hole orig) @ret let term = (Kind.Term.all orig 63 arg @_ ret); (Kind.Checker.bind (Kind.Checker.check (Kind.Term.lam orig name body) term) @_ (Kind.Checker.pure term))))) -(Kind.Checker.infer (Kind.Term.app orig func argm)) = (Kind.Checker.bind (Kind.Checker.infer func) @fn_infer (Kind.Checker.bind (Kind.Checker.infer.forall fn_infer @fn_orig @fn_name @fn_type @fn_body (Kind.Checker.bind (Kind.Checker.check argm fn_type) @_ (Kind.Checker.pure (fn_body (Kind.Term.eval argm)))) (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.invalid_call ctx orig)))) @ap_infer (Kind.Checker.pure ap_infer))) -(Kind.Checker.infer (Kind.Term.let orig name expr body)) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.infer expr) @expr_typ (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.infer (body (Kind.Term.var orig name dep))) name expr_typ (List.cons (Kind.Term.eval expr) (List.nil))) @body_typ (Kind.Checker.pure body_typ)))) -(Kind.Checker.infer (Kind.Term.ann orig expr type)) = let type = (Kind.Term.eval type); (Kind.Checker.bind (Kind.Checker.check expr type) @_ (Kind.Checker.pure type)) -(Kind.Checker.infer (Kind.Term.sub orig name indx redx expr)) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.find indx (Maybe.none) @n @t @v (Maybe.some (Pair.new t v))) @got (Maybe.match got (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) @got.value (Pair.match got.value @got.value.fst @got.value.snd (Maybe.match (List.at.u60 got.value.snd redx) (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) @reduction.value (Kind.Checker.bind (Kind.Checker.infer expr) @expr_typ (Kind.Checker.pure (Kind.Term.eval (Kind.Term.replace expr_typ indx reduction.value))))))))) -(Kind.Checker.infer (Kind.Term.ct0 ctid orig)) = (Kind.Checker.pure (Kind.Term.eval (TypeOf ctid))) -(Kind.Checker.infer (Kind.Term.ct1 ctid orig x0)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0)) -(Kind.Checker.infer (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1)) -(Kind.Checker.infer (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2)) -(Kind.Checker.infer (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3)) -(Kind.Checker.infer (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4)) -(Kind.Checker.infer (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5)) -(Kind.Checker.infer (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6)) -(Kind.Checker.infer (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7)) -(Kind.Checker.infer (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8)) -(Kind.Checker.infer (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9)) -(Kind.Checker.infer (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10)) -(Kind.Checker.infer (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11)) -(Kind.Checker.infer (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12)) -(Kind.Checker.infer (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13)) -(Kind.Checker.infer (Kind.Term.ct15 ctid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer ((expr (Kind.Term.ct0 ctid orig)) orig)) -(Kind.Checker.infer (Kind.Term.ct16 ctid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer ((expr (Kind.Term.ct0 ctid orig)) orig)) -(Kind.Checker.infer (Kind.Term.fn0 fnid orig)) = (Kind.Checker.pure (Kind.Term.eval (TypeOf fnid))) -(Kind.Checker.infer (Kind.Term.fn1 fnid orig x0)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0)) -(Kind.Checker.infer (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1)) -(Kind.Checker.infer (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2)) -(Kind.Checker.infer (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3)) -(Kind.Checker.infer (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4)) -(Kind.Checker.infer (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5)) -(Kind.Checker.infer (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6)) -(Kind.Checker.infer (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7)) -(Kind.Checker.infer (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8)) -(Kind.Checker.infer (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9)) -(Kind.Checker.infer (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10)) -(Kind.Checker.infer (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11)) -(Kind.Checker.infer (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12)) -(Kind.Checker.infer (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13)) -(Kind.Checker.infer (Kind.Term.fn15 fnid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer ((expr (Kind.Term.fn0 fnid orig)) orig)) -(Kind.Checker.infer (Kind.Term.fn16 fnid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer ((expr (Kind.Term.fn0 fnid orig)) orig)) -(Kind.Checker.infer (Kind.Term.hlp orig)) = (Kind.Checker.bind (Kind.Checker.get_context) @ctx (Kind.Checker.fail (Kind.Error.inspection ctx orig (Kind.Term.hlp 0)))) -(Kind.Checker.infer (Kind.Term.u60 orig)) = (Kind.Checker.pure (Kind.Term.typ 0)) -(Kind.Checker.infer (Kind.Term.num orig numb)) = (Kind.Checker.pure (Kind.Term.u60 0)) -(Kind.Checker.infer (Kind.Term.op2 orig oper left right)) = (Kind.Checker.bind (Kind.Checker.check left (Kind.Term.u60 0)) @_ (Kind.Checker.bind (Kind.Checker.check right (Kind.Term.u60 0)) @_ (Kind.Checker.pure (Kind.Term.u60 0)))) - -// Kind.Checker.equal.hol (orig: U60) (numb: U60) (b: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.hol a.orig a.numb b) = (Kind.Checker.bind (Kind.Checker.look a.numb) @got (Kind.Checker.bind (Kind.Checker.equal.hol.val got a.orig a.numb b) @res (Kind.Checker.pure res))) - -// Kind.Checker.equal.hol.val (val: (Maybe (Kind.Term))) (orig: U60) (numb: U60) (b: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.hol.val (Maybe.none) orig numb b) = (Kind.Checker.bind (Kind.Checker.fill numb b) @_ (Kind.Checker.pure (Bool.true))) -(Kind.Checker.equal.hol.val (Maybe.some val) orig numb b) = (Kind.Checker.equal val b) - -// Kind.Checker.infer.forall -(r: Type) (term: (Kind.Term)) (then_fn: (_: U60) (_: U60) (_: (Kind.Term)) (_: (_: (Kind.Term)) (Kind.Term)) (Kind.Checker r)) (else_val: (Kind.Checker r)) : (Kind.Checker r) -(Kind.Checker.infer.forall (Kind.Term.all orig name type body) then_fn else_val) = ((((then_fn orig) name) type) body) -(Kind.Checker.infer.forall (Kind.Term.var orig name index) then_fn else_val) = (Kind.Checker.bind (Kind.Checker.find index (List.nil) @n @t @v v) @reducs (Kind.Checker.bind (Kind.Checker.infer.forall.try_values reducs then_fn else_val) @result (Kind.Checker.pure result))) -(Kind.Checker.infer.forall (Kind.Term.hol orig numb) then_fn else_val) = (Kind.Checker.bind (Kind.Checker.look numb) @got (Maybe.match got (Kind.Checker.bind (Kind.Checker.new_hole orig) @arg (Kind.Checker.bind (Kind.Checker.new_hole orig) @ret let term = (Kind.Term.all orig 0 arg @_ ret); (Kind.Checker.bind (Kind.Checker.fill numb term) @_ (Kind.Checker.infer.forall term then_fn else_val)))) @got.value (Kind.Checker.infer.forall got.value then_fn else_val))) -(Kind.Checker.infer.forall other then_fn else_val) = else_val - -// Kind.Checker.infer.forall.try_values -(r: Type) (terms: (List (Kind.Term))) (then_fn: (_: U60) (_: U60) (_: (Kind.Term)) (_: (_: (Kind.Term)) (Kind.Term)) (Kind.Checker r)) (else_val: (Kind.Checker r)) : (Kind.Checker r) -(Kind.Checker.infer.forall.try_values (List.cons (Kind.Term.all orig name type body) terms) then_fn else_val) = ((((then_fn orig) name) type) body) -(Kind.Checker.infer.forall.try_values (List.cons other terms) then_fn else_val) = (Kind.Checker.infer.forall.try_values terms then_fn else_val) -(Kind.Checker.infer.forall.try_values (List.nil) then_fn else_val) = else_val - -// Maybe.match -(t: Type) (x: (Maybe t)) -(p: (x: (Maybe t)) Type) (none: (p (Maybe.none t))) (some: (value: t) (p (Maybe.some t value))) : (p x) -(Maybe.match (Maybe.none) none some) = none -(Maybe.match (Maybe.some value_) none some) = (some value_) - -// Kind.Checker.look (index: U60) : (Kind.Checker (Maybe (Kind.Term))) -(Kind.Checker.look index) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs (Kind.Subst.look subst index)) - -// Kind.Subst.look (subst: (Kind.Subst)) (depth: U60) : (Maybe (Kind.Term)) +(Kind.Checker.extend name type vals) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked (Kind.Context.extend context name type vals) (+ depth 1) rhs subst eqts errs (Unit.new)) +(Kind.Context.extend (Kind.Context.empty) name type values) = (Kind.Context.entry name type values (Kind.Context.empty)) +(Kind.Context.extend (Kind.Context.entry n t v rest) name type values) = (Kind.Context.entry n t v (Kind.Context.extend rest name type values)) +(Kind.Term.fill term (Kind.Subst.end)) = term +(Kind.Term.fill (Kind.Term.typ orig) sub) = (Kind.Term.typ orig) +(Kind.Term.fill (Kind.Term.var orig name index) sub) = (Kind.Term.var orig name index) +(Kind.Term.fill (Kind.Term.all orig name typ body) sub) = (Kind.Term.all orig name (Kind.Term.fill typ sub) λx (Kind.Term.fill (body x) sub)) +(Kind.Term.fill (Kind.Term.lam orig name body) sub) = (Kind.Term.lam orig name λx (Kind.Term.fill (body x) sub)) +(Kind.Term.fill (Kind.Term.let orig name expr body) sub) = (Kind.Term.eval_let orig name (Kind.Term.fill expr sub) λx (Kind.Term.fill (body x) sub)) +(Kind.Term.fill (Kind.Term.ann orig expr typ) sub) = (Kind.Term.eval_ann orig (Kind.Term.fill expr sub) (Kind.Term.fill typ sub)) +(Kind.Term.fill (Kind.Term.sub orig name indx redx expr) sub) = (Kind.Term.eval_sub orig name indx redx (Kind.Term.fill expr sub)) +(Kind.Term.fill (Kind.Term.app orig expr typ) sub) = (Kind.Term.eval_app orig (Kind.Term.fill expr sub) (Kind.Term.fill typ sub)) +(Kind.Term.fill (Kind.Term.hlp orig) sub) = (Kind.Term.hlp orig) +(Kind.Term.fill (Kind.Term.u60 orig) sub) = (Kind.Term.u60 orig) +(Kind.Term.fill (Kind.Term.num orig num) sub) = (Kind.Term.num orig num) +(Kind.Term.fill (Kind.Term.op2 orig op left right) sub) = (Kind.Term.op2 orig op (Kind.Term.fill left sub) (Kind.Term.fill right sub)) +(Kind.Term.fill (Kind.Term.ct0 ctid orig) sub) = (Kind.Term.ct0 ctid orig) +(Kind.Term.fill (Kind.Term.ct1 ctid orig x0) sub) = (Kind.Term.ct1 ctid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.ct2 ctid orig x0 x1) sub) = (Kind.Term.ct2 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub)) +(Kind.Term.fill (Kind.Term.ct3 ctid orig x0 x1 x2) sub) = (Kind.Term.ct3 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub)) +(Kind.Term.fill (Kind.Term.ct4 ctid orig x0 x1 x2 x3) sub) = (Kind.Term.ct4 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub)) +(Kind.Term.fill (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4) sub) = (Kind.Term.ct5 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub)) +(Kind.Term.fill (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5) sub) = (Kind.Term.ct6 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub)) +(Kind.Term.fill (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6) sub) = (Kind.Term.ct7 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub)) +(Kind.Term.fill (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7) sub) = (Kind.Term.ct8 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub)) +(Kind.Term.fill (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) sub) = (Kind.Term.ct9 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub)) +(Kind.Term.fill (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) sub) = (Kind.Term.ct10 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub)) +(Kind.Term.fill (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) sub) = (Kind.Term.ct11 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub)) +(Kind.Term.fill (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) sub) = (Kind.Term.ct12 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub)) +(Kind.Term.fill (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) sub) = (Kind.Term.ct13 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub)) +(Kind.Term.fill (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) sub) = (Kind.Term.ct14 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub)) +(Kind.Term.fill (Kind.Term.ct15 ctid orig x0) sub) = (Kind.Term.ct15 ctid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.ct16 ctid orig x0) sub) = (Kind.Term.ct16 ctid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.fn0 fnid orig) sub) = (Kind.Term.FN0 fnid orig) +(Kind.Term.fill (Kind.Term.fn1 fnid orig x0) sub) = (Kind.Term.FN1 fnid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.fn2 fnid orig x0 x1) sub) = (Kind.Term.FN2 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub)) +(Kind.Term.fill (Kind.Term.fn3 fnid orig x0 x1 x2) sub) = (Kind.Term.FN3 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub)) +(Kind.Term.fill (Kind.Term.fn4 fnid orig x0 x1 x2 x3) sub) = (Kind.Term.FN4 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub)) +(Kind.Term.fill (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4) sub) = (Kind.Term.FN5 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub)) +(Kind.Term.fill (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5) sub) = (Kind.Term.FN6 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub)) +(Kind.Term.fill (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6) sub) = (Kind.Term.FN7 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub)) +(Kind.Term.fill (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7) sub) = (Kind.Term.FN8 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub)) +(Kind.Term.fill (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) sub) = (Kind.Term.FN9 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub)) +(Kind.Term.fill (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) sub) = (Kind.Term.FN10 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub)) +(Kind.Term.fill (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) sub) = (Kind.Term.FN11 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub)) +(Kind.Term.fill (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) sub) = (Kind.Term.FN12 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub)) +(Kind.Term.fill (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) sub) = (Kind.Term.FN13 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub)) +(Kind.Term.fill (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) sub) = (Kind.Term.FN14 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub)) +(Kind.Term.fill (Kind.Term.fn15 ctid orig x0) sub) = (Kind.Term.FN15 ctid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.fn16 ctid orig x0) sub) = (Kind.Term.FN16 ctid orig (Kind.Term.fill x0 sub)) +(Kind.Term.fill (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14) sub) = (Kind.Term.args15 (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub) (Kind.Term.fill x14 sub)) +(Kind.Term.fill (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15) sub) = (Kind.Term.args16 (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub) (Kind.Term.fill x14 sub) (Kind.Term.fill x15 sub)) +(Kind.Term.fill (Kind.Term.hol orig numb) sub) = let substRes = (Kind.Subst.look sub numb); (Maybe.match substRes (Kind.Term.hol orig numb) λvalue (Kind.Term.fill value sub)) (Kind.Subst.look (Kind.Subst.end) 0) = (Maybe.none) (Kind.Subst.look (Kind.Subst.unfilled rest) 0) = (Maybe.none) (Kind.Subst.look (Kind.Subst.sub term rest) 0) = (Maybe.some term) (Kind.Subst.look (Kind.Subst.end) n) = (Maybe.none) (Kind.Subst.look (Kind.Subst.unfilled rest) n) = (Kind.Subst.look rest (- n 1)) (Kind.Subst.look (Kind.Subst.sub term rest) n) = (Kind.Subst.look rest (- n 1)) - -// Kind.Checker.equal (left: (Kind.Term)) (right: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal (Kind.Term.typ orig) (Kind.Term.typ orig1)) = (Kind.Checker.pure (Bool.true)) -(Kind.Checker.equal (Kind.Term.all a.orig a.name a.type a.body) (Kind.Term.all b.orig b.name b.type b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.equal a.type b.type) @type (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) (List.nil)) @body (Kind.Checker.pure (Bool.and type body))))) -(Kind.Checker.equal (Kind.Term.lam a.orig a.name a.body) (Kind.Term.lam b.orig b.name b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) (List.nil)) @body (Kind.Checker.pure body))) -(Kind.Checker.equal (Kind.Term.app a.orig a.func a.argm) (Kind.Term.app b.orig b.func b.argm)) = (Kind.Checker.bind (Kind.Checker.equal a.func b.func) @func (Kind.Checker.bind (Kind.Checker.equal a.argm b.argm) @argm (Kind.Checker.pure (Bool.and func argm)))) -(Kind.Checker.equal (Kind.Term.let a.orig a.name a.expr a.body) (Kind.Term.let b.orig b.name b.expr b.body)) = (Kind.Checker.bind (Kind.Checker.get_depth) @dep (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) @expr (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.equal (a.body (Kind.Term.var a.orig a.name dep)) (b.body (Kind.Term.var b.orig b.name dep))) (Null) (Null) (List.nil)) @body (Kind.Checker.pure (Bool.and expr body))))) -(Kind.Checker.equal (Kind.Term.ann a.orig a.expr a.type) (Kind.Term.ann b.orig b.expr b.type)) = (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) @func (Kind.Checker.bind (Kind.Checker.equal a.type b.type) @type (Kind.Checker.pure (Bool.and func type)))) -(Kind.Checker.equal (Kind.Term.sub a.orig a.name a.indx a.redx a.expr) (Kind.Term.sub b.orig b.name b.indx b.redx b.expr)) = (Kind.Checker.bind (Kind.Checker.equal a.expr b.expr) @func (Kind.Checker.pure func)) -(Kind.Checker.equal (Kind.Term.u60 a.orig) (Kind.Term.u60 b.orig)) = (Kind.Checker.pure (Bool.true)) -(Kind.Checker.equal (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Checker.pure (U60.equal a.num b.num)) -(Kind.Checker.equal (Kind.Term.op2 a.orig a.op a.val0 a.val1) (Kind.Term.op2 b.orig b.op b.val0 b.val1)) = let op = (Kind.Operator.equal a.op b.op); (Kind.Checker.bind (Kind.Checker.equal a.val0 b.val0) @val0 (Kind.Checker.bind (Kind.Checker.equal a.val1 b.val1) @val1 (Kind.Checker.pure (Bool.and op (Bool.and val0 val1))))) -(Kind.Checker.equal (Kind.Term.hol a.orig a.numb) (Kind.Term.hol b.orig b.numb)) = (Bool.if (U60.equal a.numb b.numb) (Kind.Checker.pure (Bool.true)) (Kind.Checker.equal.hol a.orig a.numb (Kind.Term.hol b.orig b.numb))) -(Kind.Checker.equal (Kind.Term.hol a.orig a.numb) b) = (Kind.Checker.equal.hol a.orig a.numb b) -(Kind.Checker.equal b (Kind.Term.hol a.orig a.numb)) = (Kind.Checker.equal.hol a.orig a.numb b) -(Kind.Checker.equal (Kind.Term.var a.orig a.name a.idx) b) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) @rhs (Kind.Checker.equal.var rhs a.orig a.name a.idx b)) -(Kind.Checker.equal b (Kind.Term.var a.orig a.name a.idx)) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) @rhs (Kind.Checker.equal.var rhs a.orig a.name a.idx b)) -(Kind.Checker.equal (Kind.Term.ct0 a.ctid a.orig) (Kind.Term.ct0 b.ctid b.orig)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.pure ctid) -(Kind.Checker.equal (Kind.Term.ct1 a.ctid a.orig a.x0) (Kind.Term.ct1 b.ctid b.orig b.x0)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.pure (Bool.and ctid x0))) -(Kind.Checker.equal (Kind.Term.ct2 a.ctid a.orig a.x0 a.x1) (Kind.Term.ct2 b.ctid b.orig b.x0 b.x1)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 x1))))) -(Kind.Checker.equal (Kind.Term.ct3 a.ctid a.orig a.x0 a.x1 a.x2) (Kind.Term.ct3 b.ctid b.orig b.x0 b.x1 b.x2)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 x2))))))) -(Kind.Checker.equal (Kind.Term.ct4 a.ctid a.orig a.x0 a.x1 a.x2 a.x3) (Kind.Term.ct4 b.ctid b.orig b.x0 b.x1 b.x2 b.x3)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 x3))))))))) -(Kind.Checker.equal (Kind.Term.ct5 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4) (Kind.Term.ct5 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 x4))))))))))) -(Kind.Checker.equal (Kind.Term.ct6 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5) (Kind.Term.ct6 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 x5))))))))))))) -(Kind.Checker.equal (Kind.Term.ct7 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6) (Kind.Term.ct7 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 x6))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct8 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7) (Kind.Term.ct8 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 x7))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct9 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8) (Kind.Term.ct9 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 x8))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct10 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9) (Kind.Term.ct10 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 x9))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct11 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10) (Kind.Term.ct11 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 x10))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct12 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11) (Kind.Term.ct12 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 x11))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct13 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12) (Kind.Term.ct13 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 x12))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct14 a.ctid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13) (Kind.Term.ct14 b.ctid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) @x13 (Kind.Checker.pure (Bool.and ctid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 x13))))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.ct15 a.ctid a.orig a.args) (Kind.Term.ct15 b.ctid b.orig b.args)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) @xargs (Kind.Checker.pure (Bool.and ctid xargs))) -(Kind.Checker.equal (Kind.Term.ct16 a.ctid a.orig a.args) (Kind.Term.ct16 b.ctid b.orig b.args)) = let ctid = (U60.equal (HashOf a.ctid) (HashOf b.ctid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) @xargs (Kind.Checker.pure (Bool.and ctid xargs))) -(Kind.Checker.equal (Kind.Term.args15 a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13 a.x14) (Kind.Term.args15 b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13 b.x14)) = (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) @x13 (Kind.Checker.bind (Kind.Checker.equal a.x14 b.x14) @x14 (Kind.Checker.pure (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 (Bool.and x13 x14)))))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.args16 a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13 a.x14 a.x15) (Kind.Term.args16 b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13 b.x14 b.x15)) = (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) @x13 (Kind.Checker.bind (Kind.Checker.equal a.x14 b.x14) @x14 (Kind.Checker.bind (Kind.Checker.equal a.x15 b.x15) @x15 (Kind.Checker.pure (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 (Bool.and x13 (Bool.and x14 x15)))))))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn0 a.fnid a.orig) (Kind.Term.fn0 b.fnid b.orig)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.pure fnid) -(Kind.Checker.equal (Kind.Term.fn1 a.fnid a.orig a.x0) (Kind.Term.fn1 b.fnid b.orig b.x0)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.pure (Bool.and fnid x0))) -(Kind.Checker.equal (Kind.Term.fn2 a.fnid a.orig a.x0 a.x1) (Kind.Term.fn2 b.fnid b.orig b.x0 b.x1)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 x1))))) -(Kind.Checker.equal (Kind.Term.fn3 a.fnid a.orig a.x0 a.x1 a.x2) (Kind.Term.fn3 b.fnid b.orig b.x0 b.x1 b.x2)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 x2))))))) -(Kind.Checker.equal (Kind.Term.fn4 a.fnid a.orig a.x0 a.x1 a.x2 a.x3) (Kind.Term.fn4 b.fnid b.orig b.x0 b.x1 b.x2 b.x3)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 x3))))))))) -(Kind.Checker.equal (Kind.Term.fn5 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4) (Kind.Term.fn5 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 x4))))))))))) -(Kind.Checker.equal (Kind.Term.fn6 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5) (Kind.Term.fn6 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 x5))))))))))))) -(Kind.Checker.equal (Kind.Term.fn7 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6) (Kind.Term.fn7 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 x6))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn8 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7) (Kind.Term.fn8 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 x7))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn9 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8) (Kind.Term.fn9 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 x8))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn10 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9) (Kind.Term.fn10 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 x9))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn11 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10) (Kind.Term.fn11 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 x10))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn12 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11) (Kind.Term.fn12 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 x11))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn13 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12) (Kind.Term.fn13 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 x12))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn14 a.fnid a.orig a.x0 a.x1 a.x2 a.x3 a.x4 a.x5 a.x6 a.x7 a.x8 a.x9 a.x10 a.x11 a.x12 a.x13) (Kind.Term.fn14 b.fnid b.orig b.x0 b.x1 b.x2 b.x3 b.x4 b.x5 b.x6 b.x7 b.x8 b.x9 b.x10 b.x11 b.x12 b.x13)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.x0 b.x0) @x0 (Kind.Checker.bind (Kind.Checker.equal a.x1 b.x1) @x1 (Kind.Checker.bind (Kind.Checker.equal a.x2 b.x2) @x2 (Kind.Checker.bind (Kind.Checker.equal a.x3 b.x3) @x3 (Kind.Checker.bind (Kind.Checker.equal a.x4 b.x4) @x4 (Kind.Checker.bind (Kind.Checker.equal a.x5 b.x5) @x5 (Kind.Checker.bind (Kind.Checker.equal a.x6 b.x6) @x6 (Kind.Checker.bind (Kind.Checker.equal a.x7 b.x7) @x7 (Kind.Checker.bind (Kind.Checker.equal a.x8 b.x8) @x8 (Kind.Checker.bind (Kind.Checker.equal a.x9 b.x9) @x9 (Kind.Checker.bind (Kind.Checker.equal a.x10 b.x10) @x10 (Kind.Checker.bind (Kind.Checker.equal a.x11 b.x11) @x11 (Kind.Checker.bind (Kind.Checker.equal a.x12 b.x12) @x12 (Kind.Checker.bind (Kind.Checker.equal a.x13 b.x13) @x13 (Kind.Checker.pure (Bool.and fnid (Bool.and x0 (Bool.and x1 (Bool.and x2 (Bool.and x3 (Bool.and x4 (Bool.and x5 (Bool.and x6 (Bool.and x7 (Bool.and x8 (Bool.and x9 (Bool.and x10 (Bool.and x11 (Bool.and x12 x13))))))))))))))))))))))))))))) -(Kind.Checker.equal (Kind.Term.fn15 a.fnid a.orig a.args) (Kind.Term.fn15 b.fnid b.orig b.args)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) @xargs (Kind.Checker.pure (Bool.and fnid xargs))) -(Kind.Checker.equal (Kind.Term.fn16 a.fnid a.orig a.args) (Kind.Term.fn16 b.fnid b.orig b.args)) = let fnid = (U60.equal (HashOf a.fnid) (HashOf b.fnid)); (Kind.Checker.bind (Kind.Checker.equal a.args b.args) @xargs (Kind.Checker.pure (Bool.and fnid xargs))) -(Kind.Checker.equal a b) = (Kind.Checker.bind (Kind.Checker.get_subst) @sub (Bool.if (Bool.or (Kind.Term.fillable a sub) (Kind.Term.fillable b sub)) (Kind.Checker.equal (Kind.Term.fill a sub) (Kind.Term.fill b sub)) (Kind.Checker.pure (Bool.false)))) - -// Kind.Checker.equal.var (rhs: (Bool)) (orig: U60) (name: U60) (idx: U60) (b: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.var (Bool.false) orig name idx b) = (Kind.Checker.bind (Kind.Checker.add_value idx b) @_ (Kind.Checker.pure (Bool.true))) -(Kind.Checker.equal.var (Bool.true) a.orig a.name a.idx (Kind.Term.var b.orig b.name b.idx)) = (Bool.if (U60.equal a.idx b.idx) (Kind.Checker.pure (Bool.true)) (Kind.Checker.bind (Kind.Checker.find a.idx (List.nil) @n @t @v v) @a.val (Kind.Checker.bind (Kind.Checker.find b.idx (List.nil) @n @t @v v) @b.val (Kind.Checker.bind (Kind.Checker.equal.var.try_values a.val (Kind.Term.var b.orig b.name b.idx)) @a.chk (Kind.Checker.bind (Kind.Checker.equal.var.try_values b.val (Kind.Term.var a.orig a.name a.idx)) @b.chk (Kind.Checker.pure (Bool.or a.chk b.chk))))))) -(Kind.Checker.equal.var (Bool.true) a.orig a.name a.idx b) = (Kind.Checker.bind (Kind.Checker.get_subst) @sub (Bool.if (Kind.Term.fillable b sub) (Kind.Checker.equal (Kind.Term.var a.orig a.name a.idx) (Kind.Term.fill b sub)) (Kind.Checker.bind (Kind.Checker.find a.idx (List.nil) @n @t @v v) @a.val (Kind.Checker.bind (Kind.Checker.equal.var.try_values a.val b) @res (Kind.Checker.pure res))))) - -// Kind.Checker.equal.var.try_values (ls: (List (Kind.Term))) (term: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.var.try_values (List.nil) term) = (Kind.Checker.pure (Bool.false)) -(Kind.Checker.equal.var.try_values (List.cons x xs) term) = (Kind.Checker.bind (Kind.Checker.equal x term) @head (Bool.if head (Kind.Checker.pure (Bool.true)) (Kind.Checker.equal.var.try_values xs term))) - -// Kind.Checker.equal.hol (orig: U60) (numb: U60) (b: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.hol a.orig a.numb b) = (Kind.Checker.bind (Kind.Checker.look a.numb) @got (Kind.Checker.bind (Kind.Checker.equal.hol.val got a.orig a.numb b) @res (Kind.Checker.pure res))) - -// Kind.Checker.equal.hol.val (val: (Maybe (Kind.Term))) (orig: U60) (numb: U60) (b: (Kind.Term)) : (Kind.Checker (Bool)) -(Kind.Checker.equal.hol.val (Maybe.none) orig numb b) = (Kind.Checker.bind (Kind.Checker.fill numb b) @_ (Kind.Checker.pure (Bool.true))) +(U60.equal a b) = (U60.to_bool (== a b)) +(U60.to_bool 0) = (Bool.false) +(U60.to_bool n) = (Bool.true) +(Kind.Checker.equal.hol a.orig a.numb b) = (Kind.Checker.bind (Kind.Checker.look a.numb) λgot (Kind.Checker.bind (Kind.Checker.equal.hol.val got a.orig a.numb b) λres (Kind.Checker.pure res))) +(Kind.Checker.look index) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs (Kind.Subst.look subst index)) +(Kind.Checker.equal.hol.val (Maybe.none) orig numb b) = (Kind.Checker.bind (Kind.Checker.fill numb b) λx_1 (Kind.Checker.pure (Bool.true))) (Kind.Checker.equal.hol.val (Maybe.some val) orig numb b) = (Kind.Checker.equal val b) - -// Kind.Checker.find -(r: Type) (index: U60) (alt: r) (fun: (_: U60) (_: (Kind.Term)) (_: (List (Kind.Term))) r) : (Kind.Checker r) -(Kind.Checker.find index alt fun) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs (Kind.Context.find context index alt fun)) - -// Kind.Context.find -(res: Type) (ctx: (Kind.Context)) (name: U60) (alt: res) (fun: (_: U60) (_: (Kind.Term)) (_: (List (Kind.Term))) res) : res -(Kind.Context.find (Kind.Context.entry name type vals rest) 0 alt fun) = (((fun name) type) vals) -(Kind.Context.find (Kind.Context.entry name type vals rest) n alt fun) = (Kind.Context.find rest (- n 1) alt fun) -(Kind.Context.find (Kind.Context.empty) n alt fun) = alt - -// Bool.and (a: (Bool)) (b: (Bool)) : (Bool) -(Bool.and (Bool.true) b) = b -(Bool.and (Bool.false) b) = (Bool.false) - -// Kind.Term.fillable (term: (Kind.Term)) (sub: (Kind.Subst)) : (Bool) +(Kind.Checker.fill index val) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs (Kind.Subst.fill subst index val) eqts errs (Unit.new)) +(Kind.Subst.fill (Kind.Subst.end) 0 term) = (Kind.Subst.sub term (Kind.Subst.end)) +(Kind.Subst.fill (Kind.Subst.unfilled rest) 0 term) = (Kind.Subst.sub term rest) +(Kind.Subst.fill (Kind.Subst.sub lost rest) 0 term) = (Kind.Subst.sub term rest) +(Kind.Subst.fill (Kind.Subst.end) n term) = (Kind.Subst.unfilled (Kind.Subst.fill (Kind.Subst.end) (- n 1) term)) +(Kind.Subst.fill (Kind.Subst.unfilled rest) n term) = (Kind.Subst.unfilled (Kind.Subst.fill rest (- n 1) term)) +(Kind.Subst.fill (Kind.Subst.sub keep rest) n term) = (Kind.Subst.sub keep (Kind.Subst.fill rest (- n 1) term)) +(Kind.Checker.get_right_hand_side) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs rhs) (Kind.Term.fillable term (Kind.Subst.end)) = (Bool.false) (Kind.Term.fillable (Kind.Term.typ orig) sub) = (Bool.false) (Kind.Term.fillable (Kind.Term.var orig name index) sub) = (Bool.false) @@ -352,106 +425,11 @@ (Kind.Term.fillable (Kind.Term.fn16 fnid orig args) sub) = (Kind.Term.fillable args sub) (Kind.Term.fillable (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14) sub) = (Bool.or (Kind.Term.fillable x0 sub) (Bool.or (Kind.Term.fillable x1 sub) (Bool.or (Kind.Term.fillable x2 sub) (Bool.or (Kind.Term.fillable x3 sub) (Bool.or (Kind.Term.fillable x4 sub) (Bool.or (Kind.Term.fillable x5 sub) (Bool.or (Kind.Term.fillable x6 sub) (Bool.or (Kind.Term.fillable x7 sub) (Bool.or (Kind.Term.fillable x8 sub) (Bool.or (Kind.Term.fillable x9 sub) (Bool.or (Kind.Term.fillable x10 sub) (Bool.or (Kind.Term.fillable x11 sub) (Bool.or (Kind.Term.fillable x12 sub) (Bool.or (Kind.Term.fillable x13 sub) (Kind.Term.fillable x14 sub))))))))))))))) (Kind.Term.fillable (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15) sub) = (Bool.or (Kind.Term.fillable x0 sub) (Bool.or (Kind.Term.fillable x1 sub) (Bool.or (Kind.Term.fillable x2 sub) (Bool.or (Kind.Term.fillable x3 sub) (Bool.or (Kind.Term.fillable x4 sub) (Bool.or (Kind.Term.fillable x5 sub) (Bool.or (Kind.Term.fillable x6 sub) (Bool.or (Kind.Term.fillable x7 sub) (Bool.or (Kind.Term.fillable x8 sub) (Bool.or (Kind.Term.fillable x9 sub) (Bool.or (Kind.Term.fillable x10 sub) (Bool.or (Kind.Term.fillable x11 sub) (Bool.or (Kind.Term.fillable x12 sub) (Bool.or (Kind.Term.fillable x13 sub) (Bool.or (Kind.Term.fillable x14 sub) (Kind.Term.fillable x15 sub)))))))))))))))) - -// Maybe.is_some -(a: Type) (m: (Maybe a)) : (Bool) (Maybe.is_some (Maybe.none)) = (Bool.false) (Maybe.is_some (Maybe.some v)) = (Bool.true) - -// Bool.or (a: (Bool)) (b: (Bool)) : (Bool) (Bool.or (Bool.true) b) = (Bool.true) (Bool.or (Bool.false) b) = b - -// Kind.Checker.get_subst : (Kind.Checker (Kind.Subst)) -(Kind.Checker.get_subst) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs subst) - -// Kind.Term.fill (term: (Kind.Term)) (subst: (Kind.Subst)) : (Kind.Term) -(Kind.Term.fill term (Kind.Subst.end)) = term -(Kind.Term.fill (Kind.Term.typ orig) sub) = (Kind.Term.typ orig) -(Kind.Term.fill (Kind.Term.var orig name index) sub) = (Kind.Term.var orig name index) -(Kind.Term.fill (Kind.Term.all orig name typ body) sub) = (Kind.Term.all orig name (Kind.Term.fill typ sub) @x (Kind.Term.fill (body x) sub)) -(Kind.Term.fill (Kind.Term.lam orig name body) sub) = (Kind.Term.lam orig name @x (Kind.Term.fill (body x) sub)) -(Kind.Term.fill (Kind.Term.let orig name expr body) sub) = (Kind.Term.eval_let orig name (Kind.Term.fill expr sub) @x (Kind.Term.fill (body x) sub)) -(Kind.Term.fill (Kind.Term.ann orig expr typ) sub) = (Kind.Term.eval_ann orig (Kind.Term.fill expr sub) (Kind.Term.fill typ sub)) -(Kind.Term.fill (Kind.Term.sub orig name indx redx expr) sub) = (Kind.Term.eval_sub orig name indx redx (Kind.Term.fill expr sub)) -(Kind.Term.fill (Kind.Term.app orig expr typ) sub) = (Kind.Term.eval_app orig (Kind.Term.fill expr sub) (Kind.Term.fill typ sub)) -(Kind.Term.fill (Kind.Term.hlp orig) sub) = (Kind.Term.hlp orig) -(Kind.Term.fill (Kind.Term.u60 orig) sub) = (Kind.Term.u60 orig) -(Kind.Term.fill (Kind.Term.num orig num) sub) = (Kind.Term.num orig num) -(Kind.Term.fill (Kind.Term.op2 orig op left right) sub) = (Kind.Term.op2 orig op (Kind.Term.fill left sub) (Kind.Term.fill right sub)) -(Kind.Term.fill (Kind.Term.ct0 ctid orig) sub) = (Kind.Term.ct0 ctid orig) -(Kind.Term.fill (Kind.Term.ct1 ctid orig x0) sub) = (Kind.Term.ct1 ctid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.ct2 ctid orig x0 x1) sub) = (Kind.Term.ct2 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub)) -(Kind.Term.fill (Kind.Term.ct3 ctid orig x0 x1 x2) sub) = (Kind.Term.ct3 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub)) -(Kind.Term.fill (Kind.Term.ct4 ctid orig x0 x1 x2 x3) sub) = (Kind.Term.ct4 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub)) -(Kind.Term.fill (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4) sub) = (Kind.Term.ct5 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub)) -(Kind.Term.fill (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5) sub) = (Kind.Term.ct6 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub)) -(Kind.Term.fill (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6) sub) = (Kind.Term.ct7 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub)) -(Kind.Term.fill (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7) sub) = (Kind.Term.ct8 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub)) -(Kind.Term.fill (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) sub) = (Kind.Term.ct9 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub)) -(Kind.Term.fill (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) sub) = (Kind.Term.ct10 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub)) -(Kind.Term.fill (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) sub) = (Kind.Term.ct11 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub)) -(Kind.Term.fill (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) sub) = (Kind.Term.ct12 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub)) -(Kind.Term.fill (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) sub) = (Kind.Term.ct13 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub)) -(Kind.Term.fill (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) sub) = (Kind.Term.ct14 ctid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub)) -(Kind.Term.fill (Kind.Term.ct15 ctid orig x0) sub) = (Kind.Term.ct15 ctid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.ct16 ctid orig x0) sub) = (Kind.Term.ct16 ctid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.fn0 fnid orig) sub) = (Kind.Term.FN0 fnid orig) -(Kind.Term.fill (Kind.Term.fn1 fnid orig x0) sub) = (Kind.Term.FN1 fnid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.fn2 fnid orig x0 x1) sub) = (Kind.Term.FN2 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub)) -(Kind.Term.fill (Kind.Term.fn3 fnid orig x0 x1 x2) sub) = (Kind.Term.FN3 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub)) -(Kind.Term.fill (Kind.Term.fn4 fnid orig x0 x1 x2 x3) sub) = (Kind.Term.FN4 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub)) -(Kind.Term.fill (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4) sub) = (Kind.Term.FN5 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub)) -(Kind.Term.fill (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5) sub) = (Kind.Term.FN6 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub)) -(Kind.Term.fill (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6) sub) = (Kind.Term.FN7 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub)) -(Kind.Term.fill (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7) sub) = (Kind.Term.FN8 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub)) -(Kind.Term.fill (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) sub) = (Kind.Term.FN9 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub)) -(Kind.Term.fill (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) sub) = (Kind.Term.FN10 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub)) -(Kind.Term.fill (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) sub) = (Kind.Term.FN11 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub)) -(Kind.Term.fill (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) sub) = (Kind.Term.FN12 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub)) -(Kind.Term.fill (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) sub) = (Kind.Term.FN13 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub)) -(Kind.Term.fill (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) sub) = (Kind.Term.FN14 fnid orig (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub)) -(Kind.Term.fill (Kind.Term.fn15 ctid orig x0) sub) = (Kind.Term.FN15 ctid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.fn16 ctid orig x0) sub) = (Kind.Term.FN16 ctid orig (Kind.Term.fill x0 sub)) -(Kind.Term.fill (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14) sub) = (Kind.Term.args15 (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub) (Kind.Term.fill x14 sub)) -(Kind.Term.fill (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15) sub) = (Kind.Term.args16 (Kind.Term.fill x0 sub) (Kind.Term.fill x1 sub) (Kind.Term.fill x2 sub) (Kind.Term.fill x3 sub) (Kind.Term.fill x4 sub) (Kind.Term.fill x5 sub) (Kind.Term.fill x6 sub) (Kind.Term.fill x7 sub) (Kind.Term.fill x8 sub) (Kind.Term.fill x9 sub) (Kind.Term.fill x10 sub) (Kind.Term.fill x11 sub) (Kind.Term.fill x12 sub) (Kind.Term.fill x13 sub) (Kind.Term.fill x14 sub) (Kind.Term.fill x15 sub)) -(Kind.Term.fill (Kind.Term.hol orig numb) sub) = let substRes = (Kind.Subst.look sub numb); (Maybe.match substRes (Kind.Term.hol orig numb) @substRes.value (Kind.Term.fill substRes.value sub)) - -// Kind.Term.eval_sub (orig: U60) (name: U60) (indx: U60) (redx: U60) (expr: (Kind.Term)) : (Kind.Term) -(Kind.Term.eval_sub orig name indx redx expr) = expr - -// Kind.Term.eval_app (orig: U60) (left: (Kind.Term)) (right: (Kind.Term)) : (Kind.Term) -(Kind.Term.eval_app orig (Kind.Term.lam orig1 name body) arg) = (body arg) -(Kind.Term.eval_app orig func arg) = (Kind.Term.app orig func arg) - -// Kind.Term.eval_ann (orig: U60) (expr: (Kind.Term)) (type: (Kind.Term)) : (Kind.Term) -(Kind.Term.eval_ann orig expr type) = expr - -// Kind.Term.eval_let (orig: U60) (name: U60) (expr: (Kind.Term)) (body: (_: (Kind.Term)) (Kind.Term)) : (Kind.Term) -(Kind.Term.eval_let orig name expr body) = (body expr) - -// Kind.Checker.fill (index: U60) (val: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.fill index val) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs (Kind.Subst.fill subst index val) eqts errs (Unit.new)) - -// Kind.Subst.fill (subst: (Kind.Subst)) (depth: U60) (term: (Kind.Term)) : (Kind.Subst) -(Kind.Subst.fill (Kind.Subst.end) 0 term) = (Kind.Subst.sub term (Kind.Subst.end)) -(Kind.Subst.fill (Kind.Subst.unfilled rest) 0 term) = (Kind.Subst.sub term rest) -(Kind.Subst.fill (Kind.Subst.sub lost rest) 0 term) = (Kind.Subst.sub term rest) -(Kind.Subst.fill (Kind.Subst.end) n term) = (Kind.Subst.unfilled (Kind.Subst.fill (Kind.Subst.end) (- n 1) term)) -(Kind.Subst.fill (Kind.Subst.unfilled rest) n term) = (Kind.Subst.unfilled (Kind.Subst.fill rest (- n 1) term)) -(Kind.Subst.fill (Kind.Subst.sub keep rest) n term) = (Kind.Subst.sub keep (Kind.Subst.fill rest (- n 1) term)) - -// Kind.Checker.add_value (idx: U60) (val: (Kind.Term)) : (Kind.Checker (Unit)) -(Kind.Checker.add_value idx val) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked (Kind.Context.add_value context idx val) hole_depth depth rhs subst eqts errs (Unit.new)) - -// Kind.Context.add_value (prev: (Kind.Context)) (name: U60) (term: (Kind.Term)) : (Kind.Context) -(Kind.Context.add_value (Kind.Context.entry name type vals rest) 0 val) = (Kind.Context.entry name type (List.cons val vals) rest) -(Kind.Context.add_value (Kind.Context.entry name type vals rest) n val) = (Kind.Context.entry name type vals (Kind.Context.add_value rest (- n 1) val)) -(Kind.Context.add_value (Kind.Context.empty) n val) = (Kind.Context.empty) - -// Kind.Checker.get_depth : (Kind.Checker U60) -(Kind.Checker.get_depth) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs depth) - -// Kind.Operator.equal (left: (Kind.Operator)) (right: (Kind.Operator)) : (Bool) +(Kind.Checker.get_depth) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs depth) (Kind.Operator.equal (Kind.Operator.and) (Kind.Operator.and)) = (Bool.true) (Kind.Operator.equal (Kind.Operator.sub) (Kind.Operator.sub)) = (Bool.true) (Kind.Operator.equal (Kind.Operator.mul) (Kind.Operator.mul)) = (Bool.true) @@ -469,24 +447,89 @@ (Kind.Operator.equal (Kind.Operator.gtn) (Kind.Operator.gtn)) = (Bool.true) (Kind.Operator.equal (Kind.Operator.neq) (Kind.Operator.neq)) = (Bool.true) (Kind.Operator.equal a b) = (Bool.false) - -// U60.equal (a: U60) (b: U60) : (Bool) -(U60.equal a b) = (U60.to_bool (== a b)) - -// U60.to_bool (n: U60) : (Bool) -(U60.to_bool 0) = (Bool.false) -(U60.to_bool n) = (Bool.true) - -// Bool.if -(a: Type) (b: (Bool)) (t: a) (f: a) : a -(Bool.if (Bool.true) t f) = t -(Bool.if (Bool.false) t f) = f - -// Kind.Term.replace (term: (Kind.Term)) (index: U60) (value: (Kind.Term)) : (Kind.Term) +(Kind.Checker.get_subst) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs subst) +(Kind.Checker.equal.var (Bool.false) orig name idx b) = (Kind.Checker.bind (Kind.Checker.add_value idx b) λx_1 (Kind.Checker.pure (Bool.true))) +(Kind.Checker.equal.var (Bool.true) a.orig a.name a.idx (Kind.Term.var b.orig b.name b.idx)) = (Bool.if (U60.equal a.idx b.idx) (Kind.Checker.pure (Bool.true)) (Kind.Checker.bind (Kind.Checker.find a.idx [] λn λt λv v) λa.val (Kind.Checker.bind (Kind.Checker.find b.idx [] λn λt λv v) λb.val (Kind.Checker.bind (Kind.Checker.equal.var.try_values a.val (Kind.Term.var b.orig b.name b.idx)) λa.chk (Kind.Checker.bind (Kind.Checker.equal.var.try_values b.val (Kind.Term.var a.orig a.name a.idx)) λb.chk (Kind.Checker.pure (Bool.or a.chk b.chk))))))) +(Kind.Checker.equal.var (Bool.true) a.orig a.name a.idx b) = (Kind.Checker.bind (Kind.Checker.get_subst) λsub (Bool.if (Kind.Term.fillable b sub) (Kind.Checker.equal (Kind.Term.var a.orig a.name a.idx) (Kind.Term.fill b sub)) (Kind.Checker.bind (Kind.Checker.find a.idx [] λn λt λv v) λa.val (Kind.Checker.bind (Kind.Checker.equal.var.try_values a.val b) λres (Kind.Checker.pure res))))) +(Kind.Checker.equal.var.try_values [] term) = (Kind.Checker.pure (Bool.false)) +(Kind.Checker.equal.var.try_values (List.cons x xs) term) = (Kind.Checker.bind (Kind.Checker.equal x term) λhead (Bool.if head (Kind.Checker.pure (Bool.true)) (Kind.Checker.equal.var.try_values xs term))) +(Kind.Checker.find index alt fun) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs (Kind.Context.find context index alt fun)) +(Kind.Context.find (Kind.Context.entry name type vals rest) 0 alt fun) = (fun name type vals) +(Kind.Context.find (Kind.Context.entry name type vals rest) n alt fun) = (Kind.Context.find rest (- n 1) alt fun) +(Kind.Context.find (Kind.Context.empty) n alt fun) = alt +(Kind.Checker.add_value idx val) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked (Kind.Context.add_value context idx val) depth rhs subst eqts errs (Unit.new)) +(Kind.Context.add_value (Kind.Context.entry name type vals rest) 0 val) = (Kind.Context.entry name type (List.cons val vals) rest) +(Kind.Context.add_value (Kind.Context.entry name type vals rest) n val) = (Kind.Context.entry name type vals (Kind.Context.add_value rest (- n 1) val)) +(Kind.Context.add_value (Kind.Context.empty) n val) = (Kind.Context.empty) +(Bool.and (Bool.true) b) = b +(Bool.and (Bool.false) b) = (Bool.false) +(Kind.Checker.get_equations) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs eqts) +(Kind.Checker.check (Kind.Term.lam orig name body) type) = (Kind.Checker.bind (Kind.Checker.get_subst) λsubst let fun = (Kind.Term.if_all type λt_orig λt_name λt_type λt_body λorig λname λbody (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name dep)) (t_body (Kind.Term.var t_orig t_name dep))) name t_type []) λchk (Kind.Checker.pure (Unit.new)))) λorig λname λbody (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.cant_infer_lambda ctx orig)))); (fun orig name body)) +(Kind.Checker.check (Kind.Term.let orig name expr body) type) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.infer expr) λexpr_typ (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name dep)) type) name expr_typ [(Kind.Term.eval expr)]) λbody_chk (Kind.Checker.pure (Unit.new))))) +(Kind.Checker.check (Kind.Term.hlp orig) type) = (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.bind (Kind.Checker.error (Kind.Error.inspection ctx orig type) (Unit.new)) λx_25 (Kind.Checker.pure (Unit.new)))) +(Kind.Checker.check (Kind.Term.var orig name idx) type) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) λrhs (Bool.if rhs (Kind.Checker.compare rhs (Kind.Term.var orig name idx) type) (Kind.Checker.extend name type []))) +(Kind.Checker.check (Kind.Term.hol orig numb) type) = (Kind.Checker.pure (Unit.new)) +(Kind.Checker.check term type) = (Kind.Checker.bind (Kind.Checker.get_right_hand_side) λrhs (Kind.Checker.compare rhs term type)) +(Kind.Checker.infer (Kind.Term.var orig name index)) = (Kind.Checker.bind (Kind.Checker.find index (Maybe.none) λn λt λv (Maybe.some t)) λgot_type (Maybe.match got_type (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) λvalue (Kind.Checker.pure value))) +(Kind.Checker.infer (Kind.Term.hol orig numb)) = (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.cant_infer_hole ctx orig))) +(Kind.Checker.infer (Kind.Term.typ orig)) = (Kind.Checker.pure (Kind.Term.typ orig)) +(Kind.Checker.infer (Kind.Term.all orig name type body)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdepth (Kind.Checker.bind (Kind.Checker.check type (Kind.Term.typ orig)) λx_2 (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.check (body (Kind.Term.var orig name depth)) (Kind.Term.typ orig)) name (Kind.Term.eval type) []) λx_1 (Kind.Checker.pure (Kind.Term.typ orig))))) +(Kind.Checker.infer (Kind.Term.lam orig name body)) = (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.cant_infer_lambda ctx orig))) +(Kind.Checker.infer (Kind.Term.app orig func argm)) = (Kind.Checker.bind (Kind.Checker.infer func) λfn_infer (Kind.Checker.bind (Kind.Checker.infer.forall fn_infer λfn_orig λfn_name λfn_type λfn_body (Kind.Checker.bind (Kind.Checker.check argm fn_type) λx_3 (Kind.Checker.pure (fn_body (Kind.Term.eval argm)))) (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.invalid_call ctx orig)))) λap_infer (Kind.Checker.pure ap_infer))) +(Kind.Checker.infer (Kind.Term.let orig name expr body)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.infer expr) λexpr_typ (Kind.Checker.bind (Kind.Checker.extended (Kind.Checker.infer (body (Kind.Term.var orig name dep))) name expr_typ [(Kind.Term.eval expr)]) λbody_typ (Kind.Checker.pure body_typ)))) +(Kind.Checker.infer (Kind.Term.ann orig expr type)) = let type = (Kind.Term.eval type); (Kind.Checker.bind (Kind.Checker.check expr type) λx_4 (Kind.Checker.pure type)) +(Kind.Checker.infer (Kind.Term.sub orig name indx redx expr)) = (Kind.Checker.bind (Kind.Checker.get_depth) λdep (Kind.Checker.bind (Kind.Checker.find indx (Maybe.none) λn λt λv (Maybe.some (Pair.new t v))) λgot (Maybe.match got (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) λvalue (Pair.match value λx_5 λsnd (Maybe.match (List.at.u60 snd redx) (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.unbound_variable ctx orig))) λvalue (Kind.Checker.bind (Kind.Checker.infer expr) λexpr_typ (Kind.Checker.pure (Kind.Term.eval (Kind.Term.replace expr_typ indx value))))))))) +(Kind.Checker.infer (Kind.Term.ct0 ctid orig)) = (Kind.Checker.pure (Kind.Term.eval (TypeOf ctid))) +(Kind.Checker.infer (Kind.Term.ct1 ctid orig x0)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0)) +(Kind.Checker.infer (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1)) +(Kind.Checker.infer (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2)) +(Kind.Checker.infer (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3)) +(Kind.Checker.infer (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4)) +(Kind.Checker.infer (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5)) +(Kind.Checker.infer (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6)) +(Kind.Checker.infer (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7)) +(Kind.Checker.infer (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8)) +(Kind.Checker.infer (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9)) +(Kind.Checker.infer (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10)) +(Kind.Checker.infer (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11)) +(Kind.Checker.infer (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12)) +(Kind.Checker.infer (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.ct0 ctid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13)) +(Kind.Checker.infer (Kind.Term.ct15 ctid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer (expr (Kind.Term.ct0 ctid orig) orig)) +(Kind.Checker.infer (Kind.Term.ct16 ctid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer (expr (Kind.Term.ct0 ctid orig) orig)) +(Kind.Checker.infer (Kind.Term.fn0 fnid orig)) = (Kind.Checker.pure (Kind.Term.eval (TypeOf fnid))) +(Kind.Checker.infer (Kind.Term.fn1 fnid orig x0)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0)) +(Kind.Checker.infer (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1)) +(Kind.Checker.infer (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2)) +(Kind.Checker.infer (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3)) +(Kind.Checker.infer (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4)) +(Kind.Checker.infer (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5)) +(Kind.Checker.infer (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6)) +(Kind.Checker.infer (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7)) +(Kind.Checker.infer (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8)) +(Kind.Checker.infer (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9)) +(Kind.Checker.infer (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10)) +(Kind.Checker.infer (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11)) +(Kind.Checker.infer (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12)) +(Kind.Checker.infer (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Checker.infer (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.fn0 fnid orig) x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13)) +(Kind.Checker.infer (Kind.Term.fn15 fnid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer (expr (Kind.Term.fn0 fnid orig) orig)) +(Kind.Checker.infer (Kind.Term.fn16 fnid orig x0)) = let expr = (Kind.Checker.infer_args x0); (Kind.Checker.infer (expr (Kind.Term.fn0 fnid orig) orig)) +(Kind.Checker.infer (Kind.Term.hlp orig)) = (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.inspection ctx orig (Kind.Term.hlp 0)))) +(Kind.Checker.infer (Kind.Term.u60 orig)) = (Kind.Checker.pure (Kind.Term.typ 0)) +(Kind.Checker.infer (Kind.Term.num orig numb)) = (Kind.Checker.pure (Kind.Term.u60 0)) +(Kind.Checker.infer (Kind.Term.op2 orig oper left right)) = (Kind.Checker.bind (Kind.Checker.check left (Kind.Term.u60 0)) λx_7 (Kind.Checker.bind (Kind.Checker.check right (Kind.Term.u60 0)) λx_6 (Kind.Checker.pure (Kind.Term.u60 0)))) +(Kind.Checker.infer.forall (Kind.Term.all orig name type body) then_fn else_val) = (then_fn orig name type body) +(Kind.Checker.infer.forall (Kind.Term.var orig name index) then_fn else_val) = (Kind.Checker.bind (Kind.Checker.find index [] λn λt λv v) λreducs (Kind.Checker.bind (Kind.Checker.infer.forall.try_values reducs then_fn else_val) λresult (Kind.Checker.pure result))) +(Kind.Checker.infer.forall other then_fn else_val) = else_val +(Kind.Checker.infer.forall.try_values (List.cons (Kind.Term.all orig name type body) terms) then_fn else_val) = (then_fn orig name type body) +(Kind.Checker.infer.forall.try_values (List.cons other terms) then_fn else_val) = (Kind.Checker.infer.forall.try_values terms then_fn else_val) +(Kind.Checker.infer.forall.try_values [] then_fn else_val) = else_val +(Kind.Checker.infer_args (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = λterm λorig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig term x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13) x14) +(Kind.Checker.infer_args (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = λterm λorig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig (Kind.Term.app orig term x0) x1) x2) x3) x4) x5) x6) x7) x8) x9) x10) x11) x12) x13) x14) x15) (Kind.Term.replace (Kind.Term.typ orig) idx val) = (Kind.Term.typ orig) (Kind.Term.replace (Kind.Term.var orig name index) idx val) = (Bool.if (U60.equal idx index) val (Kind.Term.var orig name index)) -(Kind.Term.replace (Kind.Term.all orig name typ body) idx val) = (Kind.Term.all orig name (Kind.Term.replace typ idx val) @x (Kind.Term.replace (body x) idx val)) -(Kind.Term.replace (Kind.Term.lam orig name body) idx val) = (Kind.Term.lam orig name @x (Kind.Term.replace (body x) idx val)) -(Kind.Term.replace (Kind.Term.let orig name expr body) idx val) = (Kind.Term.let orig name (Kind.Term.replace expr idx val) @x (Kind.Term.replace (body x) idx val)) +(Kind.Term.replace (Kind.Term.all orig name typ body) idx val) = (Kind.Term.all orig name (Kind.Term.replace typ idx val) λx (Kind.Term.replace (body x) idx val)) +(Kind.Term.replace (Kind.Term.lam orig name body) idx val) = (Kind.Term.lam orig name λx (Kind.Term.replace (body x) idx val)) +(Kind.Term.replace (Kind.Term.let orig name expr body) idx val) = (Kind.Term.let orig name (Kind.Term.replace expr idx val) λx (Kind.Term.replace (body x) idx val)) (Kind.Term.replace (Kind.Term.ann orig expr typ) idx val) = (Kind.Term.ann orig (Kind.Term.replace expr idx val) (Kind.Term.replace typ idx val)) (Kind.Term.replace (Kind.Term.sub orig name indx redx expr) idx val) = (Kind.Term.sub orig name indx redx (Kind.Term.replace expr idx val)) (Kind.Term.replace (Kind.Term.app orig expr typ) idx val) = (Kind.Term.app orig (Kind.Term.replace expr idx val) (Kind.Term.replace typ idx val)) @@ -527,137 +570,83 @@ (Kind.Term.replace (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14) idx val) = (Kind.Term.args15 (Kind.Term.replace x0 idx val) (Kind.Term.replace x1 idx val) (Kind.Term.replace x2 idx val) (Kind.Term.replace x3 idx val) (Kind.Term.replace x4 idx val) (Kind.Term.replace x5 idx val) (Kind.Term.replace x6 idx val) (Kind.Term.replace x7 idx val) (Kind.Term.replace x8 idx val) (Kind.Term.replace x9 idx val) (Kind.Term.replace x10 idx val) (Kind.Term.replace x11 idx val) (Kind.Term.replace x12 idx val) (Kind.Term.replace x13 idx val) (Kind.Term.replace x14 idx val)) (Kind.Term.replace (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15) idx val) = (Kind.Term.args16 (Kind.Term.replace x0 idx val) (Kind.Term.replace x1 idx val) (Kind.Term.replace x2 idx val) (Kind.Term.replace x3 idx val) (Kind.Term.replace x4 idx val) (Kind.Term.replace x5 idx val) (Kind.Term.replace x6 idx val) (Kind.Term.replace x7 idx val) (Kind.Term.replace x8 idx val) (Kind.Term.replace x9 idx val) (Kind.Term.replace x10 idx val) (Kind.Term.replace x11 idx val) (Kind.Term.replace x12 idx val) (Kind.Term.replace x13 idx val) (Kind.Term.replace x14 idx val) (Kind.Term.replace x15 idx val)) (Kind.Term.replace (Kind.Term.hol orig numb) idx val) = (Kind.Term.hol orig numb) - -// List.at.u60 -(a: Type) (xs: (List a)) (idx: U60) : (Maybe a) -(List.at.u60 (List.nil) idx) = (Maybe.none) +(Kind.Checker.fail err) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.errored context subst (List.cons err errs)) +(List.at.u60 [] idx) = (Maybe.none) (List.at.u60 (List.cons head tail) 0) = (Maybe.some head) (List.at.u60 (List.cons head tail) idx) = (List.at.u60 tail (- idx 1)) - -// Pair.match -(a: Type) -(b: Type) (x: (Pair a b)) -(p: (x: (Pair a b)) Type) (new: (fst: a) (snd: b) (p (Pair.new a b fst snd))) : (p x) -(Pair.match (Pair.new fst_ snd_) new) = ((new fst_) snd_) - -// Kind.Checker.new_hole (origin: U60) : (Kind.Checker (Kind.Term)) -(Kind.Checker.new_hole origin) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context (+ hole_depth 1) depth rhs subst eqts errs (Kind.Term.hol origin hole_depth)) - -// Kind.Term.eval (term: (Kind.Term)) : (Kind.Term) -(Kind.Term.eval (Kind.Term.typ orig)) = (Kind.Term.typ orig) -(Kind.Term.eval (Kind.Term.var orig name index)) = (Kind.Term.var orig name index) -(Kind.Term.eval (Kind.Term.hol orig numb)) = (Kind.Term.hol orig numb) -(Kind.Term.eval (Kind.Term.all orig name typ body)) = (Kind.Term.all orig name (Kind.Term.eval typ) @x (Kind.Term.eval (body x))) -(Kind.Term.eval (Kind.Term.lam orig name body)) = (Kind.Term.lam orig name @x (Kind.Term.eval (body x))) -(Kind.Term.eval (Kind.Term.let orig name expr body)) = (Kind.Term.eval_let orig name (Kind.Term.eval expr) @x (Kind.Term.eval (body x))) -(Kind.Term.eval (Kind.Term.ann orig expr typ)) = (Kind.Term.eval_ann orig (Kind.Term.eval expr) (Kind.Term.eval typ)) -(Kind.Term.eval (Kind.Term.sub orig name indx redx expr)) = (Kind.Term.eval_sub orig name indx redx (Kind.Term.eval expr)) -(Kind.Term.eval (Kind.Term.app orig expr typ)) = (Kind.Term.eval_app orig (Kind.Term.eval expr) (Kind.Term.eval typ)) -(Kind.Term.eval (Kind.Term.hlp orig)) = (Kind.Term.hlp orig) -(Kind.Term.eval (Kind.Term.u60 orig)) = (Kind.Term.u60 orig) -(Kind.Term.eval (Kind.Term.num orig num)) = (Kind.Term.num orig num) -(Kind.Term.eval (Kind.Term.op2 orig op left right)) = (Kind.Term.eval_op orig op (Kind.Term.eval left) (Kind.Term.eval right)) -(Kind.Term.eval (Kind.Term.ct0 ctid orig)) = (Kind.Term.ct0 ctid orig) -(Kind.Term.eval (Kind.Term.ct1 ctid orig x0)) = (Kind.Term.ct1 ctid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Term.ct2 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1)) -(Kind.Term.eval (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Term.ct3 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2)) -(Kind.Term.eval (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Term.ct4 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3)) -(Kind.Term.eval (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Term.ct5 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4)) -(Kind.Term.eval (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.ct6 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5)) -(Kind.Term.eval (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.ct7 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6)) -(Kind.Term.eval (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.ct8 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7)) -(Kind.Term.eval (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.ct9 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8)) -(Kind.Term.eval (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.ct10 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9)) -(Kind.Term.eval (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.ct11 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10)) -(Kind.Term.eval (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.ct12 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11)) -(Kind.Term.eval (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.ct13 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12)) -(Kind.Term.eval (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.ct14 ctid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13)) -(Kind.Term.eval (Kind.Term.ct15 fnid orig x0)) = (Kind.Term.ct15 fnid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.ct16 fnid orig x0)) = (Kind.Term.ct16 fnid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.fn0 fnid orig)) = (Kind.Term.FN0 fnid orig) -(Kind.Term.eval (Kind.Term.fn1 fnid orig x0)) = (Kind.Term.FN1 fnid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Term.FN2 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1)) -(Kind.Term.eval (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Term.FN3 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2)) -(Kind.Term.eval (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Term.FN4 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3)) -(Kind.Term.eval (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Term.FN5 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4)) -(Kind.Term.eval (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.FN6 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5)) -(Kind.Term.eval (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.FN7 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6)) -(Kind.Term.eval (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.FN8 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7)) -(Kind.Term.eval (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.FN9 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8)) -(Kind.Term.eval (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.FN10 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9)) -(Kind.Term.eval (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.FN11 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10)) -(Kind.Term.eval (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.FN12 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11)) -(Kind.Term.eval (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.FN13 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12)) -(Kind.Term.eval (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.FN14 fnid orig (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13)) -(Kind.Term.eval (Kind.Term.fn15 fnid orig x0)) = (Kind.Term.FN15 fnid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.fn16 fnid orig x0)) = (Kind.Term.FN16 fnid orig (Kind.Term.eval x0)) -(Kind.Term.eval (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = (Kind.Term.args15 (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13) (Kind.Term.eval x14)) -(Kind.Term.eval (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = (Kind.Term.args16 (Kind.Term.eval x0) (Kind.Term.eval x1) (Kind.Term.eval x2) (Kind.Term.eval x3) (Kind.Term.eval x4) (Kind.Term.eval x5) (Kind.Term.eval x6) (Kind.Term.eval x7) (Kind.Term.eval x8) (Kind.Term.eval x9) (Kind.Term.eval x10) (Kind.Term.eval x11) (Kind.Term.eval x12) (Kind.Term.eval x13) (Kind.Term.eval x14) (Kind.Term.eval x15)) - -// Kind.Term.eval_op (orig: U60) (op: (Kind.Operator)) (left: (Kind.Term)) (right: (Kind.Term)) : (Kind.Term) -(Kind.Term.eval_op orig (Kind.Operator.add) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (+ a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.sub) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (- a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.mul) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (* a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.div) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (/ a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.mod) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (% a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.and) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (& a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.or) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (| a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.xor) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (^ a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.shl) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (<< a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.shr) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (>> a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.ltn) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (< a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.lte) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (<= a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.eql) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (== a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.gte) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (>= a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.gtn) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (> a.num b.num)) -(Kind.Term.eval_op orig (Kind.Operator.neq) (Kind.Term.num a.orig a.num) (Kind.Term.num b.orig b.num)) = (Kind.Term.num 0 (!= a.num b.num)) -(Kind.Term.eval_op orig op left right) = (Kind.Term.op2 orig op left right) - -// Kind.Term.if_all -(res: Type) (term: (Kind.Term)) (if: (_: U60) (_: U60) (_: (Kind.Term)) (_: (_: (Kind.Term)) (Kind.Term)) res) (else: res) : res -(Kind.Term.if_all (Kind.Term.all orig name typ body) func_if else) = ((((func_if orig) name) typ) body) +(Kind.Checker.get_context) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst eqts errs context) +(Pair.match (Pair.new fst_ snd_) new) = (new fst_ snd_) +(Kind.Term.if_all (Kind.Term.all orig name typ body) func_if else) = (func_if orig name typ body) (Kind.Term.if_all other func_if else) = else - -// Kind.Checker.error -(t: Type) (err: (Kind.Error)) (ret: t) : (Kind.Checker t) -(Kind.Checker.error err ret) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts (List.cons err errs) ret) - -// Kind.Checker.run -(t: Type) (checker: (Kind.Checker t)) (rhs: (Bool)) : (Kind.Result t) -(Kind.Checker.run checker rhs) = (((((((checker (Kind.Context.empty)) (+ (HoleInit) 1)) 0) rhs) (Kind.Subst.end)) (List.nil)) (List.nil)) - -// Kind.Checker.unify (checker: (Kind.Checker (Unit))) : (Kind.Checker (Unit)) -(Kind.Checker.unify checker) = (Kind.Checker.bind checker @_ (Kind.Checker.bind (Kind.Checker.get_equations) @equations (Kind.Checker.unify.go equations (List.nil) (Bool.false)))) - -// Kind.Checker.unify.go (equations: (List (Kind.Equation))) (unsolved: (List (Kind.Equation))) (changed: (Bool)) : (Kind.Checker (Unit)) -(Kind.Checker.unify.go (List.nil) (List.nil) changed) = (Kind.Checker.pure (Unit.new)) -(Kind.Checker.unify.go (List.nil) unsolved (Bool.true)) = (Kind.Checker.unify.go unsolved (List.nil) (Bool.false)) -(Kind.Checker.unify.go (List.nil) unsolved (Bool.false)) = (Kind.Checker.unify.go.fail unsolved) -(Kind.Checker.unify.go (List.cons (Kind.Equation.new ctx orig left right) equations) unsolved changed) = (Kind.Checker.bind (Kind.Checker.with_context (Kind.Checker.equal (Kind.Term.eval left) (Kind.Term.eval right)) ctx) @is_equal let unify = (Bool.if is_equal @equations @unsolved (Kind.Checker.unify.go equations unsolved (Bool.true)) @equations @unsolved let eqt = (Kind.Equation.new ctx orig left right); (Kind.Checker.unify.go equations (List.cons eqt unsolved) changed)); ((unify equations) unsolved)) - -// Kind.Checker.unify.go.fail (equations: (List (Kind.Equation))) : (Kind.Checker (Unit)) -(Kind.Checker.unify.go.fail (List.nil)) = (Kind.Checker.pure (Unit.new)) -(Kind.Checker.unify.go.fail (List.cons (Kind.Equation.new ctx orig left right) eqts)) = (Kind.Checker.bind (Kind.Checker.error (Kind.Error.type_mismatch ctx orig left right) (Unit.new)) @_ (Kind.Checker.unify.go.fail eqts)) - -// Kind.Checker.with_context -(a: Type) (checker: (Kind.Checker a)) (context: (Kind.Context)) : (Kind.Checker a) -(Kind.Checker.with_context checker new_context) = (Kind.Checker.bind (Kind.Checker.set_context new_context) @old_context (Kind.Checker.bind checker @got (Kind.Checker.bind (Kind.Checker.set_context old_context) @_ (Kind.Checker.pure got)))) - -// Kind.Checker.set_context (new_context: (Kind.Context)) : (Kind.Checker (Kind.Context)) -(Kind.Checker.set_context new_context) = @old_context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked new_context hole_depth depth rhs subst eqts errs old_context) - -// Kind.Checker.get_equations : (Kind.Checker (List (Kind.Equation))) -(Kind.Checker.get_equations) = @context @hole_depth @depth @rhs @subst @eqts @errs (Kind.Result.checked context hole_depth depth rhs subst eqts errs eqts) - -// Kind.API.output (res: (List (Pair U60 (List (Kind.Result (Unit)))))) : (List (Kind.Error.Quoted)) -(Kind.API.output (List.nil)) = (List.nil) -(Kind.API.output (List.cons pair rest)) = (Pair.match pair @pair.fst @pair.snd (List.concat (Kind.API.output.function pair.fst pair.snd) (Kind.API.output rest))) - -// Kind.API.output.function (fnid: U60) (ls: (List (Kind.Result (Unit)))) : (List (Kind.Error.Quoted)) -(Kind.API.output.function fnid (List.nil)) = (List.nil) -(Kind.API.output.function fnid (List.cons (Kind.Result.checked a ctx dep rhs sub eqt err val) checks)) = (Kind.API.output.function.show_errors err sub fnid checks) +(Kind.Checker.compare rhs term type) = (Kind.Term.get_origin term λorig λterm (Kind.Checker.bind (Kind.Checker.infer term) λterm_typ let fun = (Bool.if rhs λterm_typ λtype (Kind.Checker.new_equation orig type term_typ) λterm_typ λtype (Kind.Checker.bind (Kind.Checker.equal (Kind.Term.eval term_typ) (Kind.Term.eval type)) λis_equal (Bool.if is_equal (Kind.Checker.pure (Unit.new)) (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.impossible_case ctx orig type term_typ)))))); (fun term_typ type))) +(Kind.Term.get_origin (Kind.Term.typ orig) got) = (got orig (Kind.Term.typ orig)) +(Kind.Term.get_origin (Kind.Term.var orig name index) got) = (got orig (Kind.Term.var orig name index)) +(Kind.Term.get_origin (Kind.Term.hol orig numb) got) = (got orig (Kind.Term.hol orig numb)) +(Kind.Term.get_origin (Kind.Term.all orig name typ body) got) = (got orig (Kind.Term.all orig name typ body)) +(Kind.Term.get_origin (Kind.Term.lam orig name body) got) = (got orig (Kind.Term.lam orig name body)) +(Kind.Term.get_origin (Kind.Term.let orig name expr body) got) = (got orig (Kind.Term.let orig name expr body)) +(Kind.Term.get_origin (Kind.Term.ann orig expr typ) got) = (got orig (Kind.Term.ann orig expr typ)) +(Kind.Term.get_origin (Kind.Term.sub orig name indx redx expr) got) = (got orig (Kind.Term.sub orig name indx redx expr)) +(Kind.Term.get_origin (Kind.Term.app orig func arg) got) = (got orig (Kind.Term.app orig func arg)) +(Kind.Term.get_origin (Kind.Term.hlp orig) got) = (got orig (Kind.Term.hlp orig)) +(Kind.Term.get_origin (Kind.Term.u60 orig) got) = (got orig (Kind.Term.u60 orig)) +(Kind.Term.get_origin (Kind.Term.num orig num) got) = (got orig (Kind.Term.num orig num)) +(Kind.Term.get_origin (Kind.Term.op2 orig op left right) got) = (got orig (Kind.Term.op2 orig op left right)) +(Kind.Term.get_origin (Kind.Term.ct0 ctid orig) got) = (got orig (Kind.Term.ct0 ctid orig)) +(Kind.Term.get_origin (Kind.Term.ct1 ctid orig x0) got) = (got orig (Kind.Term.ct1 ctid orig x0)) +(Kind.Term.get_origin (Kind.Term.ct2 ctid orig x0 x1) got) = (got orig (Kind.Term.ct2 ctid orig x0 x1)) +(Kind.Term.get_origin (Kind.Term.ct3 ctid orig x0 x1 x2) got) = (got orig (Kind.Term.ct3 ctid orig x0 x1 x2)) +(Kind.Term.get_origin (Kind.Term.ct4 ctid orig x0 x1 x2 x3) got) = (got orig (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) +(Kind.Term.get_origin (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4) got) = (got orig (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) +(Kind.Term.get_origin (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5) got) = (got orig (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) +(Kind.Term.get_origin (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6) got) = (got orig (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) +(Kind.Term.get_origin (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7) got) = (got orig (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) +(Kind.Term.get_origin (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) got) = (got orig (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) +(Kind.Term.get_origin (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) got) = (got orig (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) +(Kind.Term.get_origin (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) got) = (got orig (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) +(Kind.Term.get_origin (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) got) = (got orig (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) +(Kind.Term.get_origin (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) got) = (got orig (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) +(Kind.Term.get_origin (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) got) = (got orig (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) +(Kind.Term.get_origin (Kind.Term.ct15 fnid orig args) got) = (got orig (Kind.Term.ct15 fnid orig args)) +(Kind.Term.get_origin (Kind.Term.ct16 fnid orig args) got) = (got orig (Kind.Term.ct16 fnid orig args)) +(Kind.Term.get_origin (Kind.Term.fn0 fnid orig) got) = (got orig (Kind.Term.fn0 fnid orig)) +(Kind.Term.get_origin (Kind.Term.fn1 fnid orig x0) got) = (got orig (Kind.Term.fn1 fnid orig x0)) +(Kind.Term.get_origin (Kind.Term.fn2 fnid orig x0 x1) got) = (got orig (Kind.Term.fn2 fnid orig x0 x1)) +(Kind.Term.get_origin (Kind.Term.fn3 fnid orig x0 x1 x2) got) = (got orig (Kind.Term.fn3 fnid orig x0 x1 x2)) +(Kind.Term.get_origin (Kind.Term.fn4 fnid orig x0 x1 x2 x3) got) = (got orig (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) +(Kind.Term.get_origin (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4) got) = (got orig (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) +(Kind.Term.get_origin (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5) got) = (got orig (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) +(Kind.Term.get_origin (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6) got) = (got orig (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) +(Kind.Term.get_origin (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7) got) = (got orig (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) +(Kind.Term.get_origin (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8) got) = (got orig (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) +(Kind.Term.get_origin (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) got) = (got orig (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) +(Kind.Term.get_origin (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) got) = (got orig (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) +(Kind.Term.get_origin (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) got) = (got orig (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) +(Kind.Term.get_origin (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) got) = (got orig (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) +(Kind.Term.get_origin (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) got) = (got orig (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) +(Kind.Term.get_origin (Kind.Term.fn15 fnid orig args) got) = (got orig (Kind.Term.fn15 fnid orig args)) +(Kind.Term.get_origin (Kind.Term.fn16 fnid orig args) got) = (got orig (Kind.Term.fn16 fnid orig args)) +(Kind.Checker.new_equation orig left right) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth rhs subst (List.append eqts (Kind.Equation.new context orig left right)) errs (Unit.new)) +(List.append [] x) = (List.pure x) +(List.append (List.cons xs.h xs.t) x) = (List.cons xs.h (List.append xs.t x)) +(Kind.Checker.run checker rhs) = (checker (Kind.Context.empty) 0 rhs (Kind.Subst.end) [] []) +(Kind.API.check_function.rules [] type) = [] +(Kind.API.check_function.rules (List.cons rule rules) type) = let head = (Kind.Checker.run (Kind.Checker.unify (Kind.Checker.rule rule type)) (Bool.false)); let tail = (Kind.API.check_function.rules rules type); (List.cons head tail) +(Kind.Checker.rule (Kind.Rule.lhs arg args) (Kind.Term.all orig name type body)) = (Kind.Checker.bind (Kind.Checker.check arg type) λx_2 (Kind.Checker.bind (Kind.Checker.rule args (body arg)) λx_1 (Kind.Checker.pure (Unit.new)))) +(Kind.Checker.rule (Kind.Rule.lhs arg args) other) = (Kind.Checker.bind (Kind.Checker.get_context) λctx (Kind.Checker.fail (Kind.Error.too_many_arguments ctx (Kind.Term.get_origin arg λorig λterm orig)))) +(Kind.Checker.rule (Kind.Rule.rhs expr) type) = (Kind.Checker.bind (Kind.Checker.set_right_hand_side (Bool.true)) λx_4 (Kind.Checker.bind (Kind.Checker.check expr type) λx_3 (Kind.Checker.pure (Unit.new)))) +(Kind.Checker.set_right_hand_side to_rhs) = λcontext λdepth λrhs λsubst λeqts λerrs (Kind.Result.checked context depth to_rhs subst eqts errs (Unit.new)) +(List.reverse xs) = (List.reverse.go xs []) +(List.reverse.go [] ys) = ys +(List.reverse.go (List.cons x xs) ys) = (List.reverse.go xs (List.cons x ys)) +(Kind.API.output []) = [] +(Kind.API.output (List.cons pair rest)) = (Pair.match pair λfst λsnd (List.concat (Kind.API.output.function fst snd) (Kind.API.output rest))) +(Kind.API.output.function fnid []) = [] +(Kind.API.output.function fnid (List.cons (Kind.Result.checked ctx dep rhs sub eqt err val) checks)) = (Kind.API.output.function.show_errors err sub fnid checks) (Kind.API.output.function fnid (List.cons (Kind.Result.errored ctx sub err) checks)) = (Kind.API.output.function.show_errors err sub fnid checks) - -// Kind.API.output.function.show_errors (ls: (List (Kind.Error))) (sub: (Kind.Subst)) (fnid: U60) (res: (List (Kind.Result (Unit)))) : (List (Kind.Error.Quoted)) -(Kind.API.output.function.show_errors (List.nil) sub fnid checks) = (Kind.API.output.function fnid checks) +(Kind.API.output.function.show_errors [] sub fnid checks) = (Kind.API.output.function fnid checks) (Kind.API.output.function.show_errors (List.cons err errs) sub fnid checks) = (List.cons (Kind.API.output.error fnid err sub) (Kind.API.output.function.show_errors errs sub fnid checks)) - -// Kind.API.output.error (fnid: U60) (err: (Kind.Error)) (sub: (Kind.Subst)) : (Kind.Error.Quoted) (Kind.API.output.error fnid err sub) = (Kind.Error.quote err sub) - -// Kind.Error.quote (err: (Kind.Error)) (sub: (Kind.Subst)) : (Kind.Error.Quoted) (Kind.Error.quote (Kind.Error.unbound_variable ctx orig) sub) = (Kind.Error.Quoted.unbound_variable (Kind.Context.quote ctx sub) orig) (Kind.Error.quote (Kind.Error.cant_infer_hole ctx orig) sub) = (Kind.Error.Quoted.cant_infer_hole (Kind.Context.quote ctx sub) orig) (Kind.Error.quote (Kind.Error.cant_infer_lambda ctx orig) sub) = (Kind.Error.Quoted.cant_infer_lambda (Kind.Context.quote ctx sub) orig) @@ -666,294 +655,59 @@ (Kind.Error.quote (Kind.Error.inspection ctx orig term) sub) = (Kind.Error.Quoted.inspection (Kind.Context.quote ctx sub) orig (Kind.Term.quote term sub)) (Kind.Error.quote (Kind.Error.too_many_arguments ctx orig) sub) = (Kind.Error.Quoted.too_many_arguments (Kind.Context.quote ctx sub) orig) (Kind.Error.quote (Kind.Error.type_mismatch ctx orig expected detected) sub) = (Kind.Error.Quoted.type_mismatch (Kind.Context.quote ctx sub) orig (Kind.Term.quote expected sub) (Kind.Term.quote detected sub)) - -// Kind.Context.quote (context: (Kind.Context)) (sub: (Kind.Subst)) : (List (Pair U60 (Pair (Kind.Quoted) (List (Kind.Quoted))))) -(Kind.Context.quote (Kind.Context.empty) sub) = (List.nil) -(Kind.Context.quote (Kind.Context.entry name type vals rest) sub) = (List.cons (Pair.new name (Pair.new (Kind.Term.quote type sub) (List.map vals @x (Kind.Term.quote x sub)))) (Kind.Context.quote rest sub)) - -// List.map -(a: Type) -(b: Type) (xs: (List a)) (f: (_: a) b) : (List b) -(List.map (List.nil) f) = (List.nil) -(List.map (List.cons head tail) f) = (List.cons (f head) (List.map tail f)) - -// Kind.Term.quote (term: (Kind.Term)) (sub: (Kind.Subst)) : (Kind.Quoted) (Kind.Term.quote term sub) = (Kind.Term.quote.go (Kind.Term.fill term sub)) - -// Kind.Term.quote.args (term: (Kind.Term)) : (List (Kind.Quoted)) -(Kind.Term.quote.args (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.cons (Kind.Term.quote.go x13) (List.cons (Kind.Term.quote.go x14) (List.nil)))))))))))))))) -(Kind.Term.quote.args (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.cons (Kind.Term.quote.go x13) (List.cons (Kind.Term.quote.go x14) (List.cons (Kind.Term.quote.go x15) (List.nil))))))))))))))))) - -// Kind.Term.quote.go (term: (Kind.Term)) : (Kind.Quoted) -(Kind.Term.quote.go (Kind.Term.typ orig)) = (Kind.Quoted.typ orig) -(Kind.Term.quote.go (Kind.Term.var orig name index)) = (Kind.Quoted.var orig name index) -(Kind.Term.quote.go (Kind.Term.hol orig numb)) = (Kind.Quoted.hol orig numb) -(Kind.Term.quote.go (Kind.Term.all orig name type body)) = (Kind.Quoted.all orig name (Kind.Term.quote.go type) (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) -(Kind.Term.quote.go (Kind.Term.lam orig name body)) = (Kind.Quoted.lam orig name (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) -(Kind.Term.quote.go (Kind.Term.let orig name exp body)) = (Kind.Quoted.let orig name (Kind.Term.quote.go exp) (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) -(Kind.Term.quote.go (Kind.Term.ann orig expr type)) = (Kind.Quoted.ann orig (Kind.Term.quote.go expr) (Kind.Term.quote.go type)) -(Kind.Term.quote.go (Kind.Term.sub orig name indx redx expr)) = (Kind.Quoted.sub orig name indx redx (Kind.Term.quote.go expr)) -(Kind.Term.quote.go (Kind.Term.app orig func argm)) = (Kind.Quoted.app orig (Kind.Term.quote.go func) (Kind.Term.quote.go argm)) -(Kind.Term.quote.go (Kind.Term.ct0 ctid orig)) = (Kind.Quoted.ctr ctid orig (List.nil)) -(Kind.Term.quote.go (Kind.Term.ct1 ctid orig x0)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.nil))) -(Kind.Term.quote.go (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.nil)))) -(Kind.Term.quote.go (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.nil))))) -(Kind.Term.quote.go (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.nil)))))) -(Kind.Term.quote.go (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.nil))))))) -(Kind.Term.quote.go (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.nil)))))))) -(Kind.Term.quote.go (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.nil))))))))) -(Kind.Term.quote.go (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.nil)))))))))) -(Kind.Term.quote.go (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.nil))))))))))) -(Kind.Term.quote.go (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.nil)))))))))))) -(Kind.Term.quote.go (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.nil))))))))))))) -(Kind.Term.quote.go (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.nil)))))))))))))) -(Kind.Term.quote.go (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.nil))))))))))))))) -(Kind.Term.quote.go (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Quoted.ctr ctid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.cons (Kind.Term.quote.go x13) (List.nil)))))))))))))))) -(Kind.Term.quote.go (Kind.Term.ct15 ctid orig x0)) = (Kind.Quoted.ctr ctid orig (Kind.Term.quote.args x0)) -(Kind.Term.quote.go (Kind.Term.ct16 ctid orig x0)) = (Kind.Quoted.ctr ctid orig (Kind.Term.quote.args x0)) -(Kind.Term.quote.go (Kind.Term.fn0 fnid orig)) = (Kind.Quoted.fun fnid orig (List.nil)) -(Kind.Term.quote.go (Kind.Term.fn1 fnid orig x0)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.nil))) -(Kind.Term.quote.go (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.nil)))) -(Kind.Term.quote.go (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.nil))))) -(Kind.Term.quote.go (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.nil)))))) -(Kind.Term.quote.go (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.nil))))))) -(Kind.Term.quote.go (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.nil)))))))) -(Kind.Term.quote.go (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.nil))))))))) -(Kind.Term.quote.go (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.nil)))))))))) -(Kind.Term.quote.go (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.nil))))))))))) -(Kind.Term.quote.go (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.nil)))))))))))) -(Kind.Term.quote.go (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.nil))))))))))))) -(Kind.Term.quote.go (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.nil)))))))))))))) -(Kind.Term.quote.go (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.nil))))))))))))))) -(Kind.Term.quote.go (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Quoted.fun fnid orig (List.cons (Kind.Term.quote.go x0) (List.cons (Kind.Term.quote.go x1) (List.cons (Kind.Term.quote.go x2) (List.cons (Kind.Term.quote.go x3) (List.cons (Kind.Term.quote.go x4) (List.cons (Kind.Term.quote.go x5) (List.cons (Kind.Term.quote.go x6) (List.cons (Kind.Term.quote.go x7) (List.cons (Kind.Term.quote.go x8) (List.cons (Kind.Term.quote.go x9) (List.cons (Kind.Term.quote.go x10) (List.cons (Kind.Term.quote.go x11) (List.cons (Kind.Term.quote.go x12) (List.cons (Kind.Term.quote.go x13) (List.nil)))))))))))))))) -(Kind.Term.quote.go (Kind.Term.fn15 fnid orig x0)) = (Kind.Quoted.fun fnid orig (Kind.Term.quote.args x0)) -(Kind.Term.quote.go (Kind.Term.fn16 fnid orig x0)) = (Kind.Quoted.fun fnid orig (Kind.Term.quote.args x0)) -(Kind.Term.quote.go (Kind.Term.hlp orig)) = (Kind.Quoted.hlp orig) -(Kind.Term.quote.go (Kind.Term.u60 orig)) = (Kind.Quoted.u60 orig) -(Kind.Term.quote.go (Kind.Term.num orig numb)) = (Kind.Quoted.num orig numb) -(Kind.Term.quote.go (Kind.Term.op2 orig operator left right)) = (Kind.Quoted.op2 orig operator (Kind.Term.quote.go left) (Kind.Term.quote.go right)) - -// Kind.Context.Quoted : Type -(Kind.Context.Quoted) = (List (Pair 0 (Pair (Kind.Quoted) (List (Kind.Quoted))))) - -// List.concat -(a: Type) (xs: (List a)) (ys: (List a)) : (List a) -(List.concat (List.nil) ys) = ys +(Kind.Term.quote.go (Kind.Term.typ orig)) = (Kind.Term.Quoted.typ orig) +(Kind.Term.quote.go (Kind.Term.var orig name index)) = (Kind.Term.Quoted.var orig name index) +(Kind.Term.quote.go (Kind.Term.hol orig numb)) = (Kind.Term.Quoted.hol orig numb) +(Kind.Term.quote.go (Kind.Term.all orig name type body)) = (Kind.Term.Quoted.all orig name (Kind.Term.quote.go type) (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) +(Kind.Term.quote.go (Kind.Term.lam orig name body)) = (Kind.Term.Quoted.lam orig name (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) +(Kind.Term.quote.go (Kind.Term.let orig name exp body)) = (Kind.Term.Quoted.let orig name (Kind.Term.quote.go exp) (Kind.Term.quote.go (body (Kind.Term.var orig name 0)))) +(Kind.Term.quote.go (Kind.Term.ann orig expr type)) = (Kind.Term.Quoted.ann orig (Kind.Term.quote.go expr) (Kind.Term.quote.go type)) +(Kind.Term.quote.go (Kind.Term.sub orig name indx redx expr)) = (Kind.Term.Quoted.sub orig name indx redx (Kind.Term.quote.go expr)) +(Kind.Term.quote.go (Kind.Term.app orig func argm)) = (Kind.Term.Quoted.app orig (Kind.Term.quote.go func) (Kind.Term.quote.go argm)) +(Kind.Term.quote.go (Kind.Term.ct0 ctid orig)) = (Kind.Term.Quoted.ctr ctid orig []) +(Kind.Term.quote.go (Kind.Term.ct1 ctid orig x0)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0)]) +(Kind.Term.quote.go (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1)]) +(Kind.Term.quote.go (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2)]) +(Kind.Term.quote.go (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3)]) +(Kind.Term.quote.go (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4)]) +(Kind.Term.quote.go (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5)]) +(Kind.Term.quote.go (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6)]) +(Kind.Term.quote.go (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7)]) +(Kind.Term.quote.go (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8)]) +(Kind.Term.quote.go (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9)]) +(Kind.Term.quote.go (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10)]) +(Kind.Term.quote.go (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11)]) +(Kind.Term.quote.go (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12)]) +(Kind.Term.quote.go (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.Quoted.ctr ctid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12), (Kind.Term.quote.go x13)]) +(Kind.Term.quote.go (Kind.Term.ct15 ctid orig x0)) = (Kind.Term.Quoted.ctr ctid orig (Kind.Term.quote.args x0)) +(Kind.Term.quote.go (Kind.Term.ct16 ctid orig x0)) = (Kind.Term.Quoted.ctr ctid orig (Kind.Term.quote.args x0)) +(Kind.Term.quote.go (Kind.Term.fn0 fnid orig)) = (Kind.Term.Quoted.fun fnid orig []) +(Kind.Term.quote.go (Kind.Term.fn1 fnid orig x0)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0)]) +(Kind.Term.quote.go (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1)]) +(Kind.Term.quote.go (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2)]) +(Kind.Term.quote.go (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3)]) +(Kind.Term.quote.go (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4)]) +(Kind.Term.quote.go (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5)]) +(Kind.Term.quote.go (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6)]) +(Kind.Term.quote.go (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7)]) +(Kind.Term.quote.go (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8)]) +(Kind.Term.quote.go (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9)]) +(Kind.Term.quote.go (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10)]) +(Kind.Term.quote.go (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11)]) +(Kind.Term.quote.go (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12)]) +(Kind.Term.quote.go (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.Quoted.fun fnid orig [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12), (Kind.Term.quote.go x13)]) +(Kind.Term.quote.go (Kind.Term.fn15 fnid orig x0)) = (Kind.Term.Quoted.fun fnid orig (Kind.Term.quote.args x0)) +(Kind.Term.quote.go (Kind.Term.fn16 fnid orig x0)) = (Kind.Term.Quoted.fun fnid orig (Kind.Term.quote.args x0)) +(Kind.Term.quote.go (Kind.Term.hlp orig)) = (Kind.Term.Quoted.hlp orig) +(Kind.Term.quote.go (Kind.Term.u60 orig)) = (Kind.Term.Quoted.u60 orig) +(Kind.Term.quote.go (Kind.Term.num orig numb)) = (Kind.Term.Quoted.num orig numb) +(Kind.Term.quote.go (Kind.Term.op2 orig operator left right)) = (Kind.Term.Quoted.op2 orig operator (Kind.Term.quote.go left) (Kind.Term.quote.go right)) +(Kind.Term.quote.args (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12), (Kind.Term.quote.go x13), (Kind.Term.quote.go x14)] +(Kind.Term.quote.args (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = [(Kind.Term.quote.go x0), (Kind.Term.quote.go x1), (Kind.Term.quote.go x2), (Kind.Term.quote.go x3), (Kind.Term.quote.go x4), (Kind.Term.quote.go x5), (Kind.Term.quote.go x6), (Kind.Term.quote.go x7), (Kind.Term.quote.go x8), (Kind.Term.quote.go x9), (Kind.Term.quote.go x10), (Kind.Term.quote.go x11), (Kind.Term.quote.go x12), (Kind.Term.quote.go x13), (Kind.Term.quote.go x14), (Kind.Term.quote.go x15)] +(Kind.Context.quote (Kind.Context.empty) sub) = [] +(Kind.Context.quote (Kind.Context.entry name type vals rest) sub) = (List.cons (Pair.new name (Pair.new (Kind.Term.quote type sub) (List.map vals λx (Kind.Term.quote x sub)))) (Kind.Context.quote rest sub)) +(List.map [] f) = [] +(List.map (List.cons head tail) f) = (List.cons (f head) (List.map tail f)) +(List.concat [] ys) = ys (List.concat (List.cons head tail) ys) = (List.cons head (List.concat tail ys)) - -// List.reverse -(a: Type) (xs: (List a)) : (List a) -(List.reverse xs) = (List.reverse.go xs (List.nil)) - -// List.reverse.go -(a: Type) (xs: (List a)) (ys: (List a)) : (List a) -(List.reverse.go (List.nil) ys) = ys -(List.reverse.go (List.cons x xs) ys) = (List.reverse.go xs (List.cons x ys)) - -// Kind.API.eval_main : (String) -(Kind.API.eval_main) = (Kind.Printer.text (List.cons (Kind.Term.show (Kind.Term.FN0 (Main.) 0)) (List.cons (String.new_line) (List.cons (String.new_line) (List.nil))))) - -// Kind.Term.show.forall (orig: U60) (name: U60) (type: (Kind.Term)) (body: (_: (Kind.Term)) (Kind.Term)) : (String) -(Kind.Term.show.forall orig name type body) = (U60.if (== name 63) (Kind.Printer.text (List.cons "(" (List.cons (Kind.Term.show type) (List.cons " -> " (List.cons (Kind.Term.show (body (Kind.Term.var orig name 0))) (List.cons ")" (List.nil))))))) (Kind.Printer.text (List.cons "((" (List.cons (Kind.Name.show name) (List.cons ": " (List.cons (Kind.Term.show type) (List.cons ") -> " (List.cons (Kind.Term.show (body (Kind.Term.var orig name 0))) (List.cons ")" (List.nil)))))))))) - -// Kind.Term.show (term: (Kind.Term)) : (String) -(Kind.Term.show term) = let sugars = (List.cons (Kind.Term.show.sugar.string term) (List.cons (Kind.Term.show.sugar.list term) (List.cons (Kind.Term.show.sugar.sigma term) (List.nil)))); (Maybe.try sugars (Kind.Term.show.go term)) - -// Kind.Term.show.go (term: (Kind.Term)) : (String) -(Kind.Term.show.go (Kind.Term.typ orig)) = "Type" -(Kind.Term.show.go (Kind.Term.var orig name index)) = (Kind.Printer.text (List.cons (Kind.Name.show name) (List.nil))) -(Kind.Term.show.go (Kind.Term.hol orig numb)) = (Kind.Printer.text (List.cons "_" (List.nil))) -(Kind.Term.show.go (Kind.Term.all orig name type body)) = (Kind.Term.show.forall orig name type body) -(Kind.Term.show.go (Kind.Term.lam orig name body)) = (Kind.Printer.text (List.cons "(" (List.cons (Kind.Name.show name) (List.cons " => " (List.cons (Kind.Term.show (body (Kind.Term.var orig name 0))) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.let orig name exp body)) = (Kind.Printer.text (List.cons "let " (List.cons (Kind.Name.show name) (List.cons " = " (List.cons (Kind.Term.show exp) (List.cons "; " (List.cons (Kind.Term.show (body (Kind.Term.var orig name 0))) (List.nil)))))))) -(Kind.Term.show.go (Kind.Term.ann orig expr type)) = (Kind.Printer.text (List.cons "{" (List.cons (Kind.Term.show expr) (List.cons " :: " (List.cons (Kind.Term.show type) (List.cons "}" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.sub orig name indx redx expr)) = (Kind.Printer.text (List.cons (Kind.Term.show expr) (List.cons " ## " (List.cons (Kind.Name.show name) (List.cons "/" (List.cons (Show.to_string (U60.show redx)) (List.nil))))))) -(Kind.Term.show.go (Kind.Term.app orig func argm)) = (Kind.Printer.text (List.cons "(" (List.cons (Kind.Term.show func) (List.cons " " (List.cons (Kind.Term.show argm) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.ct0 ctid orig)) = (NameOf ctid) -(Kind.Term.show.go (Kind.Term.ct1 ctid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.ct2 ctid orig x0 x1)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons ")" (List.nil))))))))) -(Kind.Term.show.go (Kind.Term.ct3 ctid orig x0 x1 x2)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons ")" (List.nil))))))))))) -(Kind.Term.show.go (Kind.Term.ct4 ctid orig x0 x1 x2 x3)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons ")" (List.nil))))))))))))) -(Kind.Term.show.go (Kind.Term.ct5 ctid orig x0 x1 x2 x3 x4)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons ")" (List.nil))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct6 ctid orig x0 x1 x2 x3 x4 x5)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons ")" (List.nil))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct7 ctid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons ")" (List.nil))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct8 ctid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons ")" (List.nil))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct9 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons ")" (List.nil))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct10 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons ")" (List.nil))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct11 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons ")" (List.nil))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct12 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons ")" (List.nil))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct13 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons ")" (List.nil))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct14 ctid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons " " (List.cons (Kind.Term.show x13) (List.cons ")" (List.nil))))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.ct15 ctid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.ct16 ctid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf ctid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.fn0 fnid orig)) = (NameOf fnid) -(Kind.Term.show.go (Kind.Term.fn1 fnid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.fn2 fnid orig x0 x1)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons ")" (List.nil))))))))) -(Kind.Term.show.go (Kind.Term.fn3 fnid orig x0 x1 x2)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons ")" (List.nil))))))))))) -(Kind.Term.show.go (Kind.Term.fn4 fnid orig x0 x1 x2 x3)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons ")" (List.nil))))))))))))) -(Kind.Term.show.go (Kind.Term.fn5 fnid orig x0 x1 x2 x3 x4)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons ")" (List.nil))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn6 fnid orig x0 x1 x2 x3 x4 x5)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons ")" (List.nil))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn7 fnid orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons ")" (List.nil))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn8 fnid orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons ")" (List.nil))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn9 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons ")" (List.nil))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn10 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons ")" (List.nil))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn11 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons ")" (List.nil))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn12 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons ")" (List.nil))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn13 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons ")" (List.nil))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn14 fnid orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons " " (List.cons (Kind.Term.show x13) (List.cons ")" (List.nil))))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.fn15 fnid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.fn16 fnid orig x0)) = (Kind.Printer.text (List.cons "(" (List.cons (NameOf fnid) (List.cons " " (List.cons (Kind.Term.show x0) (List.cons ")" (List.nil))))))) -(Kind.Term.show.go (Kind.Term.args15 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14)) = (Kind.Printer.text (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons " " (List.cons (Kind.Term.show x13) (List.cons " " (List.cons (Kind.Term.show x14) (List.nil))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.args16 x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15)) = (Kind.Printer.text (List.cons (Kind.Term.show x0) (List.cons " " (List.cons (Kind.Term.show x1) (List.cons " " (List.cons (Kind.Term.show x2) (List.cons " " (List.cons (Kind.Term.show x3) (List.cons " " (List.cons (Kind.Term.show x4) (List.cons " " (List.cons (Kind.Term.show x5) (List.cons " " (List.cons (Kind.Term.show x6) (List.cons " " (List.cons (Kind.Term.show x7) (List.cons " " (List.cons (Kind.Term.show x8) (List.cons " " (List.cons (Kind.Term.show x9) (List.cons " " (List.cons (Kind.Term.show x10) (List.cons " " (List.cons (Kind.Term.show x11) (List.cons " " (List.cons (Kind.Term.show x12) (List.cons " " (List.cons (Kind.Term.show x13) (List.cons " " (List.cons (Kind.Term.show x14) (List.cons " " (List.cons (Kind.Term.show x15) (List.nil))))))))))))))))))))))))))))))))) -(Kind.Term.show.go (Kind.Term.hlp orig)) = "?" -(Kind.Term.show.go (Kind.Term.u60 orig)) = "U60" -(Kind.Term.show.go (Kind.Term.num orig numb)) = (Show.to_string (U60.show numb)) -(Kind.Term.show.go (Kind.Term.op2 orig operator left right)) = (Kind.Printer.text (List.cons "(" (List.cons (Kind.Operator.show operator) (List.cons " " (List.cons (Kind.Term.show left) (List.cons " " (List.cons (Kind.Term.show right) (List.cons ")" (List.nil))))))))) - -// Show.to_string (show: (Show)) : (String) -(Show.to_string show) = (show "") - -// Show : Type -(Show) = 0 - -// Kind.Term.show.sugar.list.go (term: (Kind.Term)) : (Maybe (List (String))) -(Kind.Term.show.sugar.list.go (Kind.Term.ct0 (List.nil.) orig)) = (Maybe.some (List.nil)) -(Kind.Term.show.sugar.list.go (Kind.Term.ct2 (List.cons.) orig x0 x1)) = (Maybe.bind (Kind.Term.show.sugar.list.go x1) @tail (Maybe.pure (List.cons (Kind.Term.show x0) tail))) -(Kind.Term.show.sugar.list.go other) = (Maybe.none) - -// Kind.Term.show.sugar.list (term: (Kind.Term)) : (Maybe (String)) -(Kind.Term.show.sugar.list term) = (Maybe.bind (Kind.Term.show.sugar.list.go term) @res (Maybe.pure (Kind.Printer.text (List.cons "[" (List.cons (String.join " " res) (List.cons "]" (List.nil))))))) - -// Maybe.bind -(a: Type) -(b: Type) (ma: (Maybe a)) (mb: (_: a) (Maybe b)) : (Maybe b) -(Maybe.bind (Maybe.none) mb) = (Maybe.none) -(Maybe.bind (Maybe.some val) mb) = (mb val) - -// Kind.Printer.text (ls: (List (String))) : (String) -(Kind.Printer.text (List.nil)) = "" -(Kind.Printer.text (List.cons x xs)) = (String.concat x (Kind.Printer.text xs)) - -// String.concat (xs: (String)) (ys: (String)) : (String) -(String.concat (String.cons x xs) ys) = (String.cons x (String.concat xs ys)) -(String.concat "" ys) = ys - -// String.join (sep: (String)) (list: (List (String))) : (String) -(String.join sep list) = (String.intercalate sep list) - -// String.intercalate (sep: (String)) (xs: (List (String))) : (String) -(String.intercalate sep xs) = (String.flatten (List.intersperse sep xs)) - -// List.intersperse -(a: Type) (sep: a) (xs: (List a)) : (List a) -(List.intersperse sep (List.nil)) = (List.nil) -(List.intersperse sep (List.cons xh (List.nil))) = (List.pure xh) -(List.intersperse sep (List.cons xh xt)) = (List.cons xh (List.cons sep (List.intersperse sep xt))) - -// String.flatten (xs: (List (String))) : (String) -(String.flatten (List.nil)) = "" -(String.flatten (List.cons head tail)) = (String.concat head (String.flatten tail)) - -// Maybe.pure -(a: Type) (x: a) : (Maybe a) -(Maybe.pure x) = (Maybe.some x) - -// Kind.Name.show.go (name: U60) (chrs: (String)) : (String) -(Kind.Name.show.go name chrs) = (U60.if (== name 0) chrs let val = (% name 64); let chr = (U60.if (== val 0) 46 (U60.if (& (<= 1 val) (<= val 10)) (+ (- val 1) 48) (U60.if (& (<= 11 val) (<= val 36)) (+ (- val 11) 65) (U60.if (& (<= 37 val) (<= val 62)) (+ (- val 37) 97) (U60.if (== val 63) 95 63))))); (Kind.Name.show.go (/ name 64) (String.cons chr chrs))) - -// Kind.Name.show (name: U60) : (String) -(Kind.Name.show name) = (Kind.Name.show.go name "") - -// U60.if -(r: Type) (n: U60) (t: r) (f: r) : r -(U60.if 0 t f) = f -(U60.if x t f) = t - -// Maybe.try -(a: Type) (ls: (List (Maybe a))) (alt: a) : a -(Maybe.try (List.nil) alt) = alt -(Maybe.try (List.cons maybe xs) alt) = (Maybe.match maybe (Maybe.try xs alt) @maybe.value maybe.value) - -// Kind.Operator.show (op: (Kind.Operator)) : (String) -(Kind.Operator.show (Kind.Operator.add)) = "+" -(Kind.Operator.show (Kind.Operator.sub)) = "-" -(Kind.Operator.show (Kind.Operator.mul)) = "*" -(Kind.Operator.show (Kind.Operator.div)) = "/" -(Kind.Operator.show (Kind.Operator.mod)) = "%" -(Kind.Operator.show (Kind.Operator.and)) = "&" -(Kind.Operator.show (Kind.Operator.or)) = "|" -(Kind.Operator.show (Kind.Operator.xor)) = "^" -(Kind.Operator.show (Kind.Operator.shl)) = "<<" -(Kind.Operator.show (Kind.Operator.shr)) = ">>" -(Kind.Operator.show (Kind.Operator.ltn)) = "<" -(Kind.Operator.show (Kind.Operator.lte)) = "<=" -(Kind.Operator.show (Kind.Operator.eql)) = "==" -(Kind.Operator.show (Kind.Operator.gte)) = ">=" -(Kind.Operator.show (Kind.Operator.gtn)) = ">" -(Kind.Operator.show (Kind.Operator.neq)) = "!=" - -// Kind.Term.show.sugar.string.go (term: (Kind.Term)) : (Maybe (String)) -(Kind.Term.show.sugar.string.go (Kind.Term.ct0 (String.nil.) orig)) = (Maybe.some "") -(Kind.Term.show.sugar.string.go (Kind.Term.ct2 (String.cons.) orig (Kind.Term.num orig1 x0) x1)) = (Maybe.bind (Kind.Term.show.sugar.string.go x1) @tail (Maybe.pure (String.cons x0 tail))) -(Kind.Term.show.sugar.string.go other) = (Maybe.none) - -// Kind.Term.show.sugar.string (term: (Kind.Term)) : (Maybe (String)) -(Kind.Term.show.sugar.string term) = (Maybe.bind (Kind.Term.show.sugar.string.go term) @res let quot = (String.cons 39 ""); (Maybe.pure (Kind.Printer.text (List.cons quot (List.cons res (List.cons quot (List.nil))))))) - -// Kind.Term.show.sugar.sigma (term: (Kind.Term)) : (Maybe (String)) -(Kind.Term.show.sugar.sigma (Kind.Term.ct2 (Sigma.) orig typ (Kind.Term.lam orig_ name body))) = (Maybe.some (Kind.Printer.text (List.cons "([" (List.cons (Kind.Name.show name) (List.cons ": " (List.cons (Kind.Term.show typ) (List.cons "] -> " (List.cons (Kind.Term.show (body (Kind.Term.var orig_ name 0))) (List.cons ")" (List.nil)))))))))) -(Kind.Term.show.sugar.sigma term) = (Maybe.none) - -// U60.show (n: U60) : (Show) -(U60.show 0) = @str (String.cons 48 str) -(U60.show n) = @str let next = (String.cons (+ 48 (% n 10)) str); let func = (U60.if (< n 10) @h h @h ((U60.show (/ n 10)) h)); (func next) - -// String.new_line : (String) -(String.new_line) = (String.pure (Char.newline)) - -// String.pure (x: (Char)) : (String) -(String.pure x) = (String.cons x "") - -// Char : Type -(Char) = 0 - -// Char.newline : (Char) -(Char.newline) = 10 - -// Kind.Term.set_origin (new_origin: U60) (term: (Kind.Term)) : (Kind.Term) -(Kind.Term.set_origin new_origin (Kind.Term.typ old_orig)) = (Kind.Term.typ new_origin) -(Kind.Term.set_origin new_origin (Kind.Term.var old_orig name idx)) = (Kind.Term.var new_origin name idx) -(Kind.Term.set_origin new_origin (Kind.Term.hol old_orig numb)) = (Kind.Term.hol new_origin numb) -(Kind.Term.set_origin new_origin (Kind.Term.all old_orig name typ body)) = (Kind.Term.all new_origin name typ body) -(Kind.Term.set_origin new_origin (Kind.Term.lam old_orig name body)) = (Kind.Term.lam new_origin name body) -(Kind.Term.set_origin new_origin (Kind.Term.let old_orig name expr body)) = (Kind.Term.let new_origin name expr body) -(Kind.Term.set_origin new_origin (Kind.Term.ann old_orig expr typ)) = (Kind.Term.ann new_origin expr typ) -(Kind.Term.set_origin new_origin (Kind.Term.sub old_orig name indx redx expr)) = (Kind.Term.sub new_origin name indx redx expr) -(Kind.Term.set_origin new_origin (Kind.Term.app old_orig func arg)) = (Kind.Term.app new_origin func arg) -(Kind.Term.set_origin new_origin (Kind.Term.hlp old_orig)) = (Kind.Term.hlp new_origin) -(Kind.Term.set_origin new_origin (Kind.Term.u60 old_orig)) = (Kind.Term.u60 new_origin) -(Kind.Term.set_origin new_origin (Kind.Term.num old_orig num)) = (Kind.Term.num new_origin num) -(Kind.Term.set_origin new_origin (Kind.Term.op2 old_orig op left right)) = (Kind.Term.op2 new_origin op left right) -(Kind.Term.set_origin new_origin (Kind.Term.ct0 ctid old_orig)) = (Kind.Term.ct0 ctid new_origin) -(Kind.Term.set_origin new_origin (Kind.Term.ct1 ctid old_orig x0)) = (Kind.Term.ct1 ctid new_origin x0) -(Kind.Term.set_origin new_origin (Kind.Term.ct2 ctid old_orig x0 x1)) = (Kind.Term.ct2 ctid new_origin x0 x1) -(Kind.Term.set_origin new_origin (Kind.Term.ct3 ctid old_orig x0 x1 x2)) = (Kind.Term.ct3 ctid new_origin x0 x1 x2) -(Kind.Term.set_origin new_origin (Kind.Term.ct4 ctid old_orig x0 x1 x2 x3)) = (Kind.Term.ct4 ctid new_origin x0 x1 x2 x3) -(Kind.Term.set_origin new_origin (Kind.Term.ct5 ctid old_orig x0 x1 x2 x3 x4)) = (Kind.Term.ct5 ctid new_origin x0 x1 x2 x3 x4) -(Kind.Term.set_origin new_origin (Kind.Term.ct6 ctid old_orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.ct6 ctid new_origin x0 x1 x2 x3 x4 x5) -(Kind.Term.set_origin new_origin (Kind.Term.ct7 ctid old_orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.ct7 ctid new_origin x0 x1 x2 x3 x4 x5 x6) -(Kind.Term.set_origin new_origin (Kind.Term.ct8 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.ct8 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7) -(Kind.Term.set_origin new_origin (Kind.Term.ct9 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.ct9 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8) -(Kind.Term.set_origin new_origin (Kind.Term.ct10 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.ct10 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) -(Kind.Term.set_origin new_origin (Kind.Term.ct11 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.ct11 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) -(Kind.Term.set_origin new_origin (Kind.Term.ct12 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.ct12 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) -(Kind.Term.set_origin new_origin (Kind.Term.ct13 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.ct13 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) -(Kind.Term.set_origin new_origin (Kind.Term.ct14 ctid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.ct14 ctid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) -(Kind.Term.set_origin new_origin (Kind.Term.ct15 ctid old_orig args)) = (Kind.Term.ct15 ctid new_origin args) -(Kind.Term.set_origin new_origin (Kind.Term.ct16 ctid old_orig args)) = (Kind.Term.ct16 ctid new_origin args) -(Kind.Term.set_origin new_origin (Kind.Term.fn0 fnid old_orig)) = (Kind.Term.fn0 fnid new_origin) -(Kind.Term.set_origin new_origin (Kind.Term.fn1 fnid old_orig x0)) = (Kind.Term.fn1 fnid new_origin x0) -(Kind.Term.set_origin new_origin (Kind.Term.fn2 fnid old_orig x0 x1)) = (Kind.Term.fn2 fnid new_origin x0 x1) -(Kind.Term.set_origin new_origin (Kind.Term.fn3 fnid old_orig x0 x1 x2)) = (Kind.Term.fn3 fnid new_origin x0 x1 x2) -(Kind.Term.set_origin new_origin (Kind.Term.fn4 fnid old_orig x0 x1 x2 x3)) = (Kind.Term.fn4 fnid new_origin x0 x1 x2 x3) -(Kind.Term.set_origin new_origin (Kind.Term.fn5 fnid old_orig x0 x1 x2 x3 x4)) = (Kind.Term.fn5 fnid new_origin x0 x1 x2 x3 x4) -(Kind.Term.set_origin new_origin (Kind.Term.fn6 fnid old_orig x0 x1 x2 x3 x4 x5)) = (Kind.Term.fn6 fnid new_origin x0 x1 x2 x3 x4 x5) -(Kind.Term.set_origin new_origin (Kind.Term.fn7 fnid old_orig x0 x1 x2 x3 x4 x5 x6)) = (Kind.Term.fn7 fnid new_origin x0 x1 x2 x3 x4 x5 x6) -(Kind.Term.set_origin new_origin (Kind.Term.fn8 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7)) = (Kind.Term.fn8 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7) -(Kind.Term.set_origin new_origin (Kind.Term.fn9 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8)) = (Kind.Term.fn9 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8) -(Kind.Term.set_origin new_origin (Kind.Term.fn10 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9)) = (Kind.Term.fn10 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9) -(Kind.Term.set_origin new_origin (Kind.Term.fn11 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)) = (Kind.Term.fn11 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) -(Kind.Term.set_origin new_origin (Kind.Term.fn12 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)) = (Kind.Term.fn12 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11) -(Kind.Term.set_origin new_origin (Kind.Term.fn13 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)) = (Kind.Term.fn13 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) -(Kind.Term.set_origin new_origin (Kind.Term.fn14 fnid old_orig x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13)) = (Kind.Term.fn14 fnid new_origin x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) -(Kind.Term.set_origin new_origin (Kind.Term.fn15 ctid old_orig args)) = (Kind.Term.fn15 ctid new_origin args) -(Kind.Term.set_origin new_origin (Kind.Term.fn16 ctid old_orig args)) = (Kind.Term.fn16 ctid new_origin args) \ No newline at end of file diff --git a/crates/kind-checker/src/report.rs b/crates/kind-checker/src/report.rs index 5206cdd2..962771a2 100644 --- a/crates/kind-checker/src/report.rs +++ b/crates/kind-checker/src/report.rs @@ -85,49 +85,49 @@ fn parse_expr(term: &Term) -> Result, String> { } fn parse_all_expr( - names: im::HashMap, + names: im_rc::HashMap, term: &Term, ) -> Result, String> { match term { Term::Ctr { name, args } => match name.as_str() { - "Kind.Quoted.all" => Ok(Expr::all( + "Kind.Term.Quoted.all" => Ok(Expr::all( parse_orig(&args[0])?, Ident::generate(&parse_name(&args[1])?), parse_all_expr(names.clone(), &args[2])?, parse_all_expr(names, &args[3])?, false, // TODO: Fix )), - "Kind.Quoted.lam" => Ok(Expr::lambda( + "Kind.Term.Quoted.lam" => Ok(Expr::lambda( parse_orig(&args[0])?, Ident::generate(&parse_name(&args[1])?), parse_all_expr(names, &args[2])?, false, // TODO: Fix )), - "Kind.Quoted.let" => Ok(Expr::let_( + "Kind.Term.Quoted.let" => Ok(Expr::let_( parse_orig(&args[0])?, Ident::generate(&parse_name(&args[1])?), parse_all_expr(names.clone(), &args[2])?, parse_all_expr(names, &args[3])?, )), - "Kind.Quoted.typ" => Ok(Expr::typ(parse_orig(&args[0])?)), - "Kind.Quoted.var" => Ok(Expr::var(Ident::new( + "Kind.Term.Quoted.typ" => Ok(Expr::typ(parse_orig(&args[0])?)), + "Kind.Term.Quoted.var" => Ok(Expr::var(Ident::new( parse_name(&args[1])?, parse_orig(&args[0])?, ))), - "Kind.Quoted.hol" => Ok(Expr::hole(parse_orig(&args[0])?, parse_num(&args[1])?)), - "Kind.Quoted.ann" => Ok(Expr::ann( + "Kind.Term.Quoted.hol" => Ok(Expr::hole(parse_orig(&args[0])?, parse_num(&args[1])?)), + "Kind.Term.Quoted.ann" => Ok(Expr::ann( parse_orig(&args[0])?, parse_all_expr(names.clone(), &args[1])?, parse_all_expr(names, &args[2])?, )), - "Kind.Quoted.sub" => Ok(Expr::sub( + "Kind.Term.Quoted.sub" => Ok(Expr::sub( parse_orig(&args[0])?, Ident::generate(&parse_name(&args[1])?), parse_num(&args[2])? as usize, parse_num(&args[3])? as usize, parse_all_expr(names, &args[4])?, )), - "Kind.Quoted.app" => Ok(Expr::app( + "Kind.Term.Quoted.app" => Ok(Expr::app( parse_orig(&args[0])?, parse_all_expr(names.clone(), &args[1])?, vec![desugared::AppBinding { @@ -135,7 +135,7 @@ fn parse_all_expr( erased: false, }], )), - "Kind.Quoted.ctr" => { + "Kind.Term.Quoted.ctr" => { let name = parse_qualified(&args[0])?; let orig = parse_orig(&args[1])?; let mut res = Vec::new(); @@ -162,7 +162,7 @@ fn parse_all_expr( Ok(Expr::ctr(orig, name, res)) } } - "Kind.Quoted.fun" => Ok(Expr::fun( + "Kind.Term.Quoted.fun" => Ok(Expr::fun( parse_orig(&args[1])?, parse_qualified(&args[0])?, { @@ -173,10 +173,10 @@ fn parse_all_expr( res }, )), - "Kind.Quoted.hlp" => Ok(Expr::hlp(parse_orig(&args[0])?, Ident::generate("?"))), - "Kind.Quoted.u60" => Ok(Expr::u60(parse_orig(&args[0])?)), - "Kind.Quoted.num" => Ok(Expr::num60(parse_orig(&args[0])?, parse_num(&args[1])?)), // TODO: do something about u120? - "Kind.Quoted.op2" => Ok(Expr::binary( + "Kind.Term.Quoted.hlp" => Ok(Expr::hlp(parse_orig(&args[0])?, Ident::generate("?"))), + "Kind.Term.Quoted.u60" => Ok(Expr::u60(parse_orig(&args[0])?)), + "Kind.Term.Quoted.num" => Ok(Expr::num60(parse_orig(&args[0])?, parse_num(&args[1])?)), // TODO: do something about u120? + "Kind.Term.Quoted.op2" => Ok(Expr::binary( parse_orig(&args[0])?, parse_op(&args[1])?, parse_all_expr(names.clone(), &args[2])?, @@ -249,13 +249,13 @@ fn parse_type_error(expr: &Term) -> Result { "Kind.Error.Quoted.impossible_case" => Ok(TypeError::ImpossibleCase( ctx, orig, - parse_all_expr(im::HashMap::new(), &args[2])?, - parse_all_expr(im::HashMap::new(), &args[3])?, + parse_all_expr(im_rc::HashMap::new(), &args[2])?, + parse_all_expr(im_rc::HashMap::new(), &args[3])?, )), "Kind.Error.Quoted.inspection" => Ok(TypeError::Inspection( ctx, orig, - parse_all_expr(im::HashMap::new(), &args[2])?, + parse_all_expr(im_rc::HashMap::new(), &args[2])?, )), "Kind.Error.Quoted.too_many_arguments" => { Ok(TypeError::TooManyArguments(ctx, orig)) @@ -263,8 +263,8 @@ fn parse_type_error(expr: &Term) -> Result { "Kind.Error.Quoted.type_mismatch" => Ok(TypeError::TypeMismatch( ctx, orig, - parse_all_expr(im::HashMap::new(), &args[2])?, - parse_all_expr(im::HashMap::new(), &args[3])?, + parse_all_expr(im_rc::HashMap::new(), &args[2])?, + parse_all_expr(im_rc::HashMap::new(), &args[3])?, )), _ => Err("Unexpected tag on quoted value".to_string()), } diff --git a/crates/kind-cli/src/lib.rs b/crates/kind-cli/src/lib.rs index 8eb146ca..9508a51b 100644 --- a/crates/kind-cli/src/lib.rs +++ b/crates/kind-cli/src/lib.rs @@ -32,6 +32,10 @@ pub struct Cli { #[arg(short, long)] pub no_color: bool, + /// Prints all of the functions and their evaluation + #[arg(short, long)] + pub trace: bool, + /// Only ascii characters in error messages #[arg(short, long)] pub ascii: bool, @@ -149,6 +153,7 @@ pub fn compile_in_session( Log::Checked(start.elapsed()) }, ); + eprintln!(); res } else { render_to_stderr(&render_config, &session, &Log::Failed(start.elapsed())); @@ -175,13 +180,14 @@ pub fn run_cli(config: Cli) { match config.command { Command::Check { file } => { compile_in_session(render_config, root, file.clone(), false, &mut |session| { - driver::type_check_book(session, &PathBuf::from(file.clone())) + driver::type_check_book(session, &PathBuf::from(file.clone()), entrypoints.clone()) }); } Command::ToHVM { file } => { compile_in_session(render_config, root, file.clone(), true, &mut |session| { - let book = driver::erase_book(session, &PathBuf::from(file.clone()))?; - Some(driver::compile_book_to_hvm(book)) + let book = + driver::erase_book(session, &PathBuf::from(file.clone()), entrypoints.clone())?; + Some(driver::compile_book_to_hvm(book, config.trace)) }) .map(|res| { println!("{}", res); @@ -190,12 +196,10 @@ pub fn run_cli(config: Cli) { } Command::Run { file } => { let res = compile_in_session(render_config, root, file.clone(), true, &mut |session| { - let book = driver::erase_book( - session, - &PathBuf::from(file.clone()), - )?; + let book = + driver::erase_book(session, &PathBuf::from(file.clone()), entrypoints.clone())?; driver::check_main_entry(session, &book)?; - Some(driver::compile_book_to_hvm(book)) + Some(driver::compile_book_to_hvm(book, config.trace)) }); if let Some(res) = res { @@ -225,7 +229,7 @@ pub fn run_cli(config: Cli) { } Command::Erase { file } => { compile_in_session(render_config, root, file.clone(), true, &mut |session| { - driver::erase_book(session, &PathBuf::from(file.clone())) + driver::erase_book(session, &PathBuf::from(file.clone()), entrypoints.clone()) }) .map(|res| { print!("{}", res); @@ -255,6 +259,7 @@ pub fn run_cli(config: Cli) { &PathBuf::from(file.clone()), session, &namespace.clone().unwrap_or("".to_string()), + entrypoints.clone(), ) }) .map(|res| { diff --git a/crates/kind-derive/Cargo.toml b/crates/kind-derive/Cargo.toml index 6757c1eb..9e3101df 100644 --- a/crates/kind-derive/Cargo.toml +++ b/crates/kind-derive/Cargo.toml @@ -10,4 +10,4 @@ kind-span = { path = "../kind-span" } kind-tree = { path = "../kind-tree" } kind-report = { path = "../kind-report" } fxhash = "0.2.1" -im = "*" \ No newline at end of file +im-rc = "*" \ No newline at end of file diff --git a/crates/kind-driver/src/errors.rs b/crates/kind-driver/src/errors.rs index 10009d13..f6f39242 100644 --- a/crates/kind-driver/src/errors.rs +++ b/crates/kind-driver/src/errors.rs @@ -40,7 +40,7 @@ impl Diagnostic for DriverError { suggestions.iter().map(|x| format!("'{}'", x)).collect::>().join(", ") ) } else { - "Take a look at the rules for name searching at https://kind.kindelia.org/hints/name-search".to_string() + "Take a look at the rules for name searching at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string() }], positions: idents .iter() @@ -75,7 +75,7 @@ impl Diagnostic for DriverError { severity: Severity::Error, title: "Defined multiple times for the same name".to_string(), subtitles: vec![], - hints: vec!["Rename one of the definitions or remove and look at how names work in Kind at https://kind.kindelia.org/hints/names".to_string()], + hints: vec!["Rename one of the definitions or remove and look at how names work in Kind at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string()], positions: vec![ Marker { position: fst.range, diff --git a/crates/kind-driver/src/lib.rs b/crates/kind-driver/src/lib.rs index 250a882c..01a44e56 100644 --- a/crates/kind-driver/src/lib.rs +++ b/crates/kind-driver/src/lib.rs @@ -21,7 +21,11 @@ impl FileCache for Session { } } -pub fn type_check_book(session: &mut Session, path: &PathBuf) -> Option { +pub fn type_check_book( + session: &mut Session, + path: &PathBuf, + entrypoints: Vec, +) -> Option { let concrete_book = to_book(session, path)?; let desugared_book = desugar::desugar_book(session.diagnostic_sender.clone(), &concrete_book)?; @@ -33,9 +37,13 @@ pub fn type_check_book(session: &mut Session, path: &PathBuf) -> Option Option pub fn erase_book( session: &mut Session, path: &PathBuf, + entrypoints: Vec, ) -> Option { let concrete_book = to_book(session, path)?; let desugared_book = desugar::desugar_book(session.diagnostic_sender.clone(), &concrete_book)?; - let mut book = erasure::erase_book(&desugared_book, session.diagnostic_sender.clone())?; + let mut book = erasure::erase_book( + &desugared_book, + session.diagnostic_sender.clone(), + entrypoints, + )?; inline_book(&mut book); Some(book) - } pub fn desugar_book(session: &mut Session, path: &PathBuf) -> Option { @@ -77,19 +89,24 @@ pub fn check_erasure_book(session: &mut Session, path: &PathBuf) -> Option backend::File { - kind_target_hvm::compile_book(book) +pub fn compile_book_to_hvm(book: untyped::Book, trace: bool) -> backend::File { + kind_target_hvm::compile_book(book, trace) } pub fn compile_book_to_kdl( path: &PathBuf, session: &mut Session, - namespace: &str + namespace: &str, + entrypoints: Vec, ) -> Option { let concrete_book = to_book(session, path)?; let desugared_book = desugar::desugar_book(session.diagnostic_sender.clone(), &concrete_book)?; - let mut book = erasure::erase_book(&desugared_book, session.diagnostic_sender.clone())?; - + let mut book = erasure::erase_book( + &desugared_book, + session.diagnostic_sender.clone(), + entrypoints, + )?; + inline_book(&mut book); kind_target_kdl::compile_book(book, session.diagnostic_sender.clone(), namespace) diff --git a/crates/kind-parser/src/errors.rs b/crates/kind-parser/src/errors.rs index a07a2340..ddf58859 100644 --- a/crates/kind-parser/src/errors.rs +++ b/crates/kind-parser/src/errors.rs @@ -100,7 +100,7 @@ impl Diagnostic for SyntaxDiagnostic { severity: Severity::Warning, title: "This entire documentation comment is in a invalid position".to_string(), subtitles: vec![], - hints: vec!["Take a look at the rules for doc comments at https://kind.kindelia.org/hints/documentation-strings".to_string()], + hints: vec!["Take a look at the rules for doc comments at https://github.com/Kindelia/Kind2/blob/master/guide/doc_strings.md".to_string()], positions: vec![Marker { position: *range, color: Color::For, diff --git a/crates/kind-parser/src/expr.rs b/crates/kind-parser/src/expr.rs index 21345bdb..b33ba998 100644 --- a/crates/kind-parser/src/expr.rs +++ b/crates/kind-parser/src/expr.rs @@ -380,23 +380,10 @@ impl<'a> Parser<'a> { let range = self.range(); self.advance(); // '(' let mut expr = self.parse_expr(true)?; - if self.get().same_variant(&Token::ColonColon) { - self.advance(); // ':' - let typ = self.parse_expr(false)?; - let range = range.mix(self.range()); - - self.eat_closing_keyword(Token::RPar, range)?; - - Ok(Box::new(Expr { - data: ExprKind::Ann { val: expr, typ }, - range, - })) - } else { - let end = self.range(); - self.eat_closing_keyword(Token::RPar, range)?; - expr.range = range.mix(end); - Ok(expr) - } + let end = self.range(); + self.eat_closing_keyword(Token::RPar, range)?; + expr.range = range.mix(end); + Ok(expr) } } @@ -530,26 +517,43 @@ impl<'a> Parser<'a> { } fn parse_arrow(&mut self, multiline: bool) -> Result, SyntaxDiagnostic> { - let mut typ = self.parse_call(multiline)?; + let mut expr = self.parse_call(multiline)?; + while self.check_and_eat(Token::RightArrow) { let body = self.parse_expr(false)?; - let range = typ.range.mix(body.range); - typ = Box::new(Expr { + let range = expr.range.mix(body.range); + expr = Box::new(Expr { data: ExprKind::All { param: None, - typ, + typ: expr, body, erased: false, }, range, }); } - Ok(typ) + + Ok(expr) + } + + fn parse_ann(&mut self, multiline: bool) -> Result, SyntaxDiagnostic> { + let expr = self.parse_arrow(multiline)?; + + if self.check_and_eat(Token::ColonColon) { + let typ = self.parse_arrow(multiline)?; + let range = expr.range.mix(typ.range); + Ok(Box::new(Expr { + data: ExprKind::Ann { val: expr, typ }, + range, + })) + } else { + Ok(expr) + } } fn parse_ask(&mut self) -> Result, SyntaxDiagnostic> { let start = self.range(); - self.advance(); + self.advance(); // 'ask' let name = self.parse_destruct()?; self.eat_variant(Token::Eq)?; let expr = self.parse_expr(false)?; @@ -607,9 +611,9 @@ impl<'a> Parser<'a> { fn parse_sttm(&mut self) -> Result, SyntaxDiagnostic> { let start = self.range(); - if self.check_actual_id("ask") { + if self.check_actual(Token::Ask) { self.parse_ask() - } else if self.check_actual_id("return") { + } else if self.check_actual(Token::Return) { self.parse_return() } else if self.check_actual_id("let") { self.parse_monadic_let() @@ -825,7 +829,7 @@ impl<'a> Parser<'a> { } else if self.check_actual(Token::Tilde) { self.parse_erased() } else { - self.parse_arrow(multiline) + self.parse_ann(multiline) } } } diff --git a/crates/kind-parser/src/lexer/mod.rs b/crates/kind-parser/src/lexer/mod.rs index 75e5c40a..ff3670fc 100644 --- a/crates/kind-parser/src/lexer/mod.rs +++ b/crates/kind-parser/src/lexer/mod.rs @@ -50,7 +50,11 @@ impl<'a> Lexer<'a> { } pub fn to_keyword(data: &str) -> Token { - Token::LowerId(data.to_string()) + match data { + "return" => Token::Return, + "ask" => Token::Ask, + _ => Token::LowerId(data.to_string()), + } } pub fn get_next_no_error(&mut self, vec: Sender>) -> (Token, Range) { diff --git a/crates/kind-parser/src/lexer/tokens.rs b/crates/kind-parser/src/lexer/tokens.rs index b6d1a961..a8e7bd47 100644 --- a/crates/kind-parser/src/lexer/tokens.rs +++ b/crates/kind-parser/src/lexer/tokens.rs @@ -29,13 +29,16 @@ pub enum Token { LowerId(String), UpperId(String, Option), + // Strong keywords because they lead to better + // error messages. + Return, + Ask, + // Keywords // Do, // If, // Else, // Match, - // Ask, - // Return, // Let, // Type, // Record, @@ -166,9 +169,11 @@ impl fmt::Display for Token { Token::Bang => write!(f, "!"), Token::HashHash => write!(f, "##"), Token::Hash => write!(f, "#"), - Token::Comment(_, _) => write!(f, "Comment"), + Token::Comment(_, _) => write!(f, "docstring comment"), Token::Eof => write!(f, "End of file"), Token::Error(_) => write!(f, "ERROR"), + Token::Return => write!(f, "return"), + Token::Ask => write!(f, "ask"), } } } diff --git a/crates/kind-pass/Cargo.toml b/crates/kind-pass/Cargo.toml index c2d8aa5e..123161f8 100644 --- a/crates/kind-pass/Cargo.toml +++ b/crates/kind-pass/Cargo.toml @@ -13,4 +13,4 @@ kind-derive = { path = "../kind-derive" } linked-hash-map = "0.5.6" fxhash = "0.2.1" -im = "15.1.0" \ No newline at end of file +im-rc = "15.1.0" \ No newline at end of file diff --git a/crates/kind-pass/src/desugar/app.rs b/crates/kind-pass/src/desugar/app.rs index 80887ec9..4260b9d0 100644 --- a/crates/kind-pass/src/desugar/app.rs +++ b/crates/kind-pass/src/desugar/app.rs @@ -93,10 +93,7 @@ impl<'a> DesugarState<'a> { if entry.arguments[i].hidden { // It's not expected that positional arguments require the range so // it's the reason why we are using a terrible "ghost range" - arguments[i] = Some(( - range, - self.gen_hole_expr(range), - )) + arguments[i] = Some((range, self.gen_hole_expr(range))) } } } else if entry.arguments.len() != args.len() { diff --git a/crates/kind-pass/src/desugar/attributes.rs b/crates/kind-pass/src/desugar/attributes.rs index 99b72d49..33ae4a1f 100644 --- a/crates/kind-pass/src/desugar/attributes.rs +++ b/crates/kind-pass/src/desugar/attributes.rs @@ -1,3 +1,4 @@ +use kind_span::Locatable; use kind_tree::concrete::{self, Attribute, AttributeStyle}; use kind_tree::Attributes; @@ -73,6 +74,23 @@ impl<'a> DesugarState<'a> { None => self.attr_expects_a_value(attr), } } + "trace" => { + self.args_should_be_empty(attr); + match &attr.value { + Some(AttributeStyle::Ident(_, id)) if id.to_string() == "true" => { + attributes.trace = Some(true); + } + Some(AttributeStyle::Ident(_, id)) if id.to_string() == "false" => { + attributes.trace = Some(false); + } + Some(other) => { + self.send_err(PassError::InvalidAttributeArgument(other.locate())) + } + None => { + attributes.trace = Some(false); + } + } + } _ => self.send_err(PassError::AttributeDoesNotExists(attr.range)), } } diff --git a/crates/kind-pass/src/desugar/destruct.rs b/crates/kind-pass/src/desugar/destruct.rs index 809f18b1..5aa4f62e 100644 --- a/crates/kind-pass/src/desugar/destruct.rs +++ b/crates/kind-pass/src/desugar/destruct.rs @@ -197,11 +197,11 @@ impl<'a> DesugarState<'a> { if let Some((range, _, _)) = cases_args[index] { self.send_err(PassError::DuplicatedNamed(range, case.constructor.range)); } else { - let sum_c = &sum.constructors[index]; + let sum_constructor = &sum.constructors[index]; let ordered = self.order_case_arguments( (&case.constructor.range, case.constructor.to_string()), - &sum_c + &sum_constructor .args .iter() .map(|x| (x.name.to_string(), x.hidden)) diff --git a/crates/kind-pass/src/desugar/expr.rs b/crates/kind-pass/src/desugar/expr.rs index b8444854..bd2542ef 100644 --- a/crates/kind-pass/src/desugar/expr.rs +++ b/crates/kind-pass/src/desugar/expr.rs @@ -134,8 +134,8 @@ impl<'a> DesugarState<'a> { let bind_ident = typ.add_segment("bind"); let pure_ident = typ.add_segment("pure"); - let bind = self.old_book.entries.get(bind_ident.to_string().as_str()); - let pure = self.old_book.entries.get(pure_ident.to_string().as_str()); + let bind = self.old_book.names.get(bind_ident.to_str()); + let pure = self.old_book.names.get(pure_ident.to_str()); if bind.is_none() || pure.is_none() { self.send_err(PassError::NeedToImplementMethods(range, Sugar::DoNotation)); @@ -180,9 +180,9 @@ impl<'a> DesugarState<'a> { let cons_ident = list_ident.add_segment("cons"); let nil_ident = list_ident.add_segment("nil"); - let list = self.old_book.entries.get(list_ident.to_string().as_str()); - let nil = self.old_book.entries.get(cons_ident.to_string().as_str()); - let cons = self.old_book.entries.get(nil_ident.to_string().as_str()); + let list = self.old_book.names.get(list_ident.to_str()); + let nil = self.old_book.names.get(cons_ident.to_str()); + let cons = self.old_book.names.get(nil_ident.to_str()); if list.is_none() || nil.is_none() || cons.is_none() { self.send_err(PassError::NeedToImplementMethods(range, Sugar::List)); @@ -208,10 +208,7 @@ impl<'a> DesugarState<'a> { let boolean = QualifiedIdent::new_static("Bool", None, range); let bool_if_ident = boolean.add_segment("if"); - let bool_if = self - .old_book - .entries - .get(bool_if_ident.to_string().as_str()); + let bool_if = self.old_book.names.get(bool_if_ident.to_str()); if bool_if.is_none() { self.send_err(PassError::NeedToImplementMethods(range, Sugar::BoolIf)); diff --git a/crates/kind-pass/src/desugar/mod.rs b/crates/kind-pass/src/desugar/mod.rs index d7a2cfb8..dd58f696 100644 --- a/crates/kind-pass/src/desugar/mod.rs +++ b/crates/kind-pass/src/desugar/mod.rs @@ -29,7 +29,6 @@ pub struct DesugarState<'a> { pub old_book: &'a concrete::Book, pub new_book: desugared::Book, pub name_count: u64, - pub holes: u64, pub failed: bool, } @@ -42,7 +41,6 @@ pub fn desugar_book( old_book: book, new_book: Default::default(), name_count: 0, - holes: 0, failed: false, }; state.desugar_book(book); @@ -55,8 +53,8 @@ pub fn desugar_book( impl<'a> DesugarState<'a> { fn gen_hole(&mut self) -> u64 { - self.holes += 1; - self.holes - 1 + self.new_book.holes += 1; + self.new_book.holes - 1 } fn gen_name(&mut self, range: Range) -> Ident { diff --git a/crates/kind-pass/src/erasure/mod.rs b/crates/kind-pass/src/erasure/mod.rs index 13440e4c..e01a304c 100644 --- a/crates/kind-pass/src/erasure/mod.rs +++ b/crates/kind-pass/src/erasure/mod.rs @@ -5,7 +5,7 @@ use kind_report::data::Diagnostic; use kind_span::Range; use kind_tree::desugared; -use kind_tree::symbol::{Ident, QualifiedIdent}; +use kind_tree::symbol::QualifiedIdent; use kind_tree::untyped::{self}; use kind_tree::Number; @@ -46,7 +46,7 @@ pub struct ErasureState<'a> { edges: Vec, names: FxHashMap, - ctx: im::HashMap, + ctx: im_rc::HashMap, failed: bool, } @@ -54,6 +54,7 @@ pub struct ErasureState<'a> { pub fn erase_book<'a>( book: &'a desugared::Book, errs: Sender>, + entrypoints: Vec, ) -> Option { let mut state = ErasureState { errs, @@ -64,7 +65,7 @@ pub fn erase_book<'a>( failed: Default::default(), }; - state.erase_book(book) + state.erase_book(book, entrypoints) } impl<'a> ErasureState<'a> { @@ -95,15 +96,21 @@ impl<'a> ErasureState<'a> { entry.push((name.range, ambient)) } - pub fn erase_book(&mut self, book: &'a desugared::Book) -> Option { + pub fn erase_book( + &mut self, + book: &'a desugared::Book, + named_entrypoints: Vec, + ) -> Option { let mut vals = FxHashMap::default(); let mut entrypoints = Vec::new(); - - if let Some(entr) = book.entrs.get("Main") { - let id = self.get_edge_or_create(&entr.name); - self.set_relevance(id, Relevance::Relevant, entr.name.range); - entrypoints.push(id); + + for name in named_entrypoints { + if let Some(entr) = book.entrs.get(&name) { + let id = self.get_edge_or_create(&entr.name); + self.set_relevance(id, Relevance::Relevant, entr.name.range); + entrypoints.push(id); + } } // Kdl specific things. @@ -134,12 +141,15 @@ impl<'a> ErasureState<'a> { names: Default::default(), }; - let mut queue = entrypoints.iter().map(|x| (x, Ambient::Relevant)).collect::>(); + let mut queue = entrypoints + .iter() + .map(|x| (x, Ambient::Relevant)) + .collect::>(); while !queue.is_empty() { let (fst, relev) = queue.pop().unwrap(); - - if visited.contains(&fst) { + + if visited.contains(fst) { continue; } @@ -155,15 +165,15 @@ impl<'a> ErasureState<'a> { } } + let entry = vals.remove(&edge.name).unwrap(); - let entry = vals.get(&edge.name).cloned().unwrap(); + new_book + .names + .insert(entry.name.to_str().to_string(), new_book.entrs.len()); - new_book.names.insert(entry.name.to_string(), new_book.entrs.len()); - - new_book.entrs.insert( - entry.name.to_string(), - entry - ); + new_book + .entrs + .insert(entry.name.to_str().to_string(), entry); for (to, relevs) in &edge.connections { for (_, relev) in relevs.iter() { @@ -196,7 +206,7 @@ impl<'a> ErasureState<'a> { for arg in &entry.args { self.erase_expr(Ambient::Irrelevant, id, &arg.typ); self.ctx.insert(arg.name.to_string(), Relevance::Irrelevant); - if !arg.hidden { + if !arg.erased { args.push((arg.name.to_string(), arg.range, false)) } } @@ -206,7 +216,7 @@ impl<'a> ErasureState<'a> { self.ctx = backup; let mut rules = Vec::new(); - + for rule in &entry.rules { rules.push(self.erase_rule(entry, id, rule)); } @@ -246,12 +256,11 @@ impl<'a> ErasureState<'a> { .pats .iter() .zip(&entr.args) - .map(|(pat, arg)| (self.erase_pat(relev(arg.hidden), edge, pat), arg)) + .map(|(pat, arg)| (self.erase_pat(relev(arg.erased), edge, pat), arg)) .filter(|(_, arg)| !arg.erased) .map(|res| res.0) .collect::>(); - let body = self.erase_expr(relev(false), edge, &rule.body); self.ctx = backup; @@ -279,7 +288,7 @@ impl<'a> ErasureState<'a> { }; use desugared::ExprKind::*; - + match &expr.data { Var { name } => { self.ctx.insert( @@ -293,7 +302,7 @@ impl<'a> ErasureState<'a> { untyped::Expr::var(name.clone()) } - Hole { num } => untyped::Expr::var(Ident::generate(&format!("_x{}", num))), + Hole { num: _ } => untyped::Expr::err(expr.range), Fun { name, args } => { self.connect_with(edge, name, relevance); @@ -308,8 +317,8 @@ impl<'a> ErasureState<'a> { let args = args .iter() .zip(¶ms.args) - .map(|(arg, param)| (self.erase_pat(relev(param.hidden), edge, arg), param)) - .filter(|(_, param)| !param.hidden) + .map(|(arg, param)| (self.erase_pat(relev(param.erased), edge, arg), param)) + .filter(|(_, param)| !param.erased) .map(|x| x.0) .collect::>(); @@ -329,8 +338,8 @@ impl<'a> ErasureState<'a> { let args = args .iter() .zip(¶ms.args) - .map(|(arg, param)| (self.erase_pat(relev(param.hidden), edge, arg), param)) - .filter(|(_, param)| !param.hidden) + .map(|(arg, param)| (self.erase_pat(relev(param.erased), edge, arg), param)) + .filter(|(_, param)| !param.erased) .map(|x| x.0) .collect::>(); @@ -371,7 +380,7 @@ impl<'a> ErasureState<'a> { } => { let backup = self.ctx.clone(); self.ctx.insert(param.to_string(), Relevance::Irrelevant); - + if ambient != Ambient::Irrelevant { self.set_relevance(edge, Relevance::Irrelevant, expr.range); } @@ -466,7 +475,7 @@ impl<'a> ErasureState<'a> { let var_rev = self .ctx .get(&name.to_string()) - .expect(&format!("Uwnraping {}", name.to_string())); + .expect(&format!("Uwnraping {}", name)); if *var_rev == Relevance::Irrelevant && ambient != Ambient::Irrelevant { self.set_relevance(edge, Relevance::Irrelevant, name.range) @@ -508,7 +517,7 @@ impl<'a> ErasureState<'a> { untyped::Expr::binary(expr.range, *op, left, right) } Typ | NumType { typ: _ } | Hole { num: _ } | Hlp(_) | Err => { - if ambient != Ambient::Irrelevant && ambient != Ambient::Irrelevant { + if ambient != Ambient::Irrelevant { self.set_relevance(edge, Relevance::Irrelevant, expr.range); } untyped::Expr::err(expr.range) diff --git a/crates/kind-pass/src/errors.rs b/crates/kind-pass/src/errors.rs index 730103e8..8e768992 100644 --- a/crates/kind-pass/src/errors.rs +++ b/crates/kind-pass/src/errors.rs @@ -88,7 +88,7 @@ impl Diagnostic for PassError { suggestions.iter().map(|x| format!("'{}'", x)).collect::>().join(", ") ) } else { - "Take a look at the rules for name searching at https://kind.kindelia.org/hints/name-search".to_string() + "Take a look at naming rules at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string() }], positions: idents .iter() @@ -322,7 +322,7 @@ impl Diagnostic for PassError { title: "Incorrect arity in the sugar definition".to_string(), subtitles: vec![], hints: vec![format!( - "Take a look at how sugar functions should be implemented at https://kind2.kindelia.com/hints/sugars." + "Take a look at how sugar functions should be implemented at https://github.com/Kindelia/Kind2/blob/master/guide/sugars.md" )], positions: vec![ Marker { diff --git a/crates/kind-pass/src/expand/mod.rs b/crates/kind-pass/src/expand/mod.rs index b5a04329..0de04731 100644 --- a/crates/kind-pass/src/expand/mod.rs +++ b/crates/kind-pass/src/expand/mod.rs @@ -44,7 +44,7 @@ pub fn insert_or_report( Some(last_range) => { channel .send(Box::new(PassError::DuplicatedAttributeArgument( - last_range.clone(), + *last_range, range, ))) .unwrap(); @@ -89,7 +89,7 @@ pub fn expand_derive( match arg { Ident(range, ident) => match string_to_derive(ident.to_str()) { Some(key) => { - insert_or_report(error_channel.clone(), &mut def, key, range.clone()) + insert_or_report(error_channel.clone(), &mut def, key, *range) } _ => { error_channel diff --git a/crates/kind-pass/src/expand/uses.rs b/crates/kind-pass/src/expand/uses.rs index ab90e372..c192d2f3 100644 --- a/crates/kind-pass/src/expand/uses.rs +++ b/crates/kind-pass/src/expand/uses.rs @@ -19,12 +19,12 @@ impl Visitor for Expand { if ident.get_aux().is_none() { return; } - let alias = match self.names.get(&ident.get_root().to_string()) { + let alias = match self.names.get(&ident.get_root()) { Some(path) => path, None => { self.errors .send(Box::new(PassError::CannotFindAlias( - ident.get_root().to_string(), + ident.get_root(), ident.range, ))) .unwrap(); diff --git a/crates/kind-pass/src/inline/mod.rs b/crates/kind-pass/src/inline/mod.rs index 2c5a7653..0e90d141 100644 --- a/crates/kind-pass/src/inline/mod.rs +++ b/crates/kind-pass/src/inline/mod.rs @@ -8,7 +8,7 @@ struct Inlinable { body: Box, } struct InlineState { - funs: FxHashMap + funs: FxHashMap, } fn inlinable(entry: &untyped::Entry) -> Option { @@ -16,14 +16,15 @@ fn inlinable(entry: &untyped::Entry) -> Option { let mut names = Vec::new(); for pat in &entry.rules[0].pats { match &pat.data { - untyped::ExprKind::Var { name } => { - names.push(name.to_string()) - }, - _ => return None + untyped::ExprKind::Var { name } => names.push(name.to_string()), + _ => return None, } } // TODO: Check if is recursive - Some(Inlinable { names, body: entry.rules[0].body.clone() }) + Some(Inlinable { + names, + body: entry.rules[0].body.clone(), + }) } else { None } @@ -36,7 +37,7 @@ pub fn inline_book(book: &mut untyped::Book) { for entr in book.entrs.values() { if entr.attrs.inlined { - if let Some(inlinable) = inlinable(&entr) { + if let Some(inlinable) = inlinable(entr) { funs.insert(entr.name.to_string(), inlinable); to_remove.push(entr.name.to_string()); } @@ -73,10 +74,11 @@ impl InlineState { } Fun { name, args } | Ctr { name, args } => { if let Some(inlinable) = self.funs.get(name.to_str()) { - let subst = FxHashMap::from_iter(inlinable.names.iter().cloned().zip(args.clone())); + let subst = + FxHashMap::from_iter(inlinable.names.iter().cloned().zip(args.clone())); *expr = inlinable.body.clone(); subst_on_expr(expr, subst); - }else { + } else { for arg in args { self.inline_expr(arg); } diff --git a/crates/kind-pass/src/lib.rs b/crates/kind-pass/src/lib.rs index 3a0ae41e..3c65f2e3 100644 --- a/crates/kind-pass/src/lib.rs +++ b/crates/kind-pass/src/lib.rs @@ -8,5 +8,5 @@ pub mod desugar; pub mod erasure; mod errors; pub mod expand; -pub mod unbound; pub mod inline; +pub mod unbound; diff --git a/crates/kind-pass/src/unbound/mod.rs b/crates/kind-pass/src/unbound/mod.rs index cb045b03..afc5605d 100644 --- a/crates/kind-pass/src/unbound/mod.rs +++ b/crates/kind-pass/src/unbound/mod.rs @@ -117,7 +117,6 @@ impl UnboundCollector { self.top_level_defs .insert(name_cons.get_root(), name_cons.range); } - TopLevel::Entry(entry) => { debug_assert!(entry.name.get_aux().is_none()); self.top_level_defs @@ -474,7 +473,7 @@ impl Visitor for UnboundCollector { self.context_vars.pop(); } ExprKind::Match(matcher) => { - self.visit_qualified_ident(&mut matcher.typ.add_segment("match")); + self.visit_qualified_ident(&mut matcher.typ.add_segment("match").to_generated()); self.visit_match(matcher) } ExprKind::Subst(subst) => { @@ -497,27 +496,25 @@ impl Visitor for UnboundCollector { self.visit_sttm(sttm) } ExprKind::If { cond, then_, else_ } => { - self.visit_qualified_ident(&mut QualifiedIdent::new_sugared( - "Bool", "if", expr.range, - )); + let typ = QualifiedIdent::new_static("Bool", None, expr.range); + self.visit_qualified_ident(&mut typ.add_segment("if").to_generated()); self.visit_expr(cond); self.visit_expr(then_); self.visit_expr(else_); } ExprKind::Pair { fst, snd } => { - self.visit_qualified_ident(&mut QualifiedIdent::new_sugared( - "Pair", "new", expr.range, - )); + let typ = QualifiedIdent::new_static("Pair", None, expr.range); + self.visit_qualified_ident(&mut typ.add_segment("new").to_generated()); self.visit_expr(fst); self.visit_expr(snd); } ExprKind::List { args } => { - self.visit_qualified_ident(&mut QualifiedIdent::new_sugared( - "List", "nil", expr.range, - )); - self.visit_qualified_ident(&mut QualifiedIdent::new_sugared( - "List", "cons", expr.range, - )); + let mut typ = QualifiedIdent::new_static("List", None, expr.range); + + self.visit_qualified_ident(&mut typ); + self.visit_qualified_ident(&mut typ.add_segment("nil").to_generated()); + self.visit_qualified_ident(&mut typ.add_segment("cons").to_generated()); + visit_vec!(args.iter_mut(), arg => self.visit_expr(arg)); } } diff --git a/crates/kind-pass/src/unbound/subst.rs b/crates/kind-pass/src/unbound/subst.rs index 2ceb480c..1ca297ac 100644 --- a/crates/kind-pass/src/unbound/subst.rs +++ b/crates/kind-pass/src/unbound/subst.rs @@ -3,7 +3,7 @@ use kind_tree::untyped::*; pub struct Subst { vars: FxHashMap>, - ctx: im::HashSet + ctx: im_rc::HashSet, } pub fn subst_on_expr(expr: &mut Box, vars: FxHashMap>) { @@ -24,12 +24,11 @@ impl Subst { for rule in &mut entry.rules { self.subst_rule(rule); } - } pub fn subst_rule(&mut self, rule: &mut Rule) { let backup = self.ctx.clone(); - + for pat in &mut rule.pats { self.subst_expr(pat) } @@ -51,7 +50,7 @@ impl Subst { self.subst_pat(arg); } } - _ => () + _ => (), } } @@ -64,9 +63,9 @@ impl Subst { return; } if let Some(res) = self.vars.get(name.to_str()) { - *expr = res.clone().clone(); + *expr = res.clone(); } - }, + } Lambda { param, body, .. } => { let backup = self.ctx.clone(); self.ctx.insert(param.to_string()); @@ -95,7 +94,7 @@ impl Subst { self.subst_expr(left); self.subst_expr(right); } - _ => () + _ => (), } } -} \ No newline at end of file +} diff --git a/crates/kind-query/src/errors.rs b/crates/kind-query/src/errors.rs index ac1e9771..baf6edce 100644 --- a/crates/kind-query/src/errors.rs +++ b/crates/kind-query/src/errors.rs @@ -57,7 +57,7 @@ impl Diagnostic for DriverError { .iter() .map(|path| Subtitle::Phrase(Color::Fst, vec![Word::White(path.display().to_string())])) .collect(), - hints: vec!["Take a look at the rules for name searching at https://kind.kindelia.org/hints/name-search".to_string()], + hints: vec!["Take a look at the rules for name searching at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string()], positions: vec![Marker { position: ident.range, color: Color::Fst, @@ -71,7 +71,7 @@ impl Diagnostic for DriverError { severity: Severity::Error, title: "Defined multiple times for the same name".to_string(), subtitles: vec![], - hints: vec!["Rename one of the definitions or remove and look at how names work in Kind at https://kind.kindelia.org/hints/names".to_string()], + hints: vec!["Rename one of the definitions or remove and look at how names work in Kind at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string()], positions: vec![ Marker { position: fst.range, diff --git a/crates/kind-target-hvm/src/lib.rs b/crates/kind-target-hvm/src/lib.rs index f5ef4dec..c1a40210 100644 --- a/crates/kind-target-hvm/src/lib.rs +++ b/crates/kind-target-hvm/src/lib.rs @@ -5,17 +5,33 @@ use kind_tree::{ untyped, }; -pub fn compile_book(book: untyped::Book) -> File { +pub fn compile_book(book: untyped::Book, trace: bool) -> File { let mut file = File { rules: Default::default(), smaps: Default::default(), }; for (_, entry) in book.entrs { - compile_entry(&mut file, *entry); + compile_entry(&mut file, *entry, trace); } file } +pub fn compile_str(val: &str) -> Box { + let nil = Box::new(Term::Ctr { + name: String::from("String.nil"), + args: vec![], + }); + + let cons = |numb, next| { + Box::new(Term::Ctr { + name: String::from("String.cons"), + args: vec![Box::new(Term::U6O { numb }), next], + }) + }; + + val.chars().rfold(nil, |rest, chr| cons(chr as u64, rest)) +} + pub fn compile_term(expr: &untyped::Expr) -> Box { use kind_tree::Number; use untyped::ExprKind::*; @@ -65,37 +81,61 @@ pub fn compile_term(expr: &untyped::Expr) -> Box { name: op.to_string(), args: vec![compile_term(left), compile_term(right)], }), - Str { val } => { - let nil = Box::new(Term::Ctr { - name: String::from("String.nil"), - args: vec![], - }); - - let cons = |numb, next| { - Box::new(Term::Ctr { - name: String::from("String.cons"), - args: vec![Box::new(Term::U6O { numb }), next], - }) - }; - - val.chars().rfold(nil, |rest, chr| cons(chr as u64, rest)) - } + Str { val } => compile_str(val), Err => unreachable!("Internal Error: 'ERR' cannot be a relevant term"), } } -fn compile_rule(rule: untyped::Rule) -> Rule { +fn compile_rule(name: String, rule: untyped::Rule) -> Rule { Rule { lhs: Box::new(Term::Ctr { - name: rule.name.to_string(), + name, args: rule.pats.iter().map(|x| compile_term(x)).collect(), }), rhs: compile_term(&rule.body), } } -fn compile_entry(file: &mut File, entry: untyped::Entry) { - for rule in entry.rules { - file.rules.push(compile_rule(rule)) +fn compile_entry(file: &mut File, entry: untyped::Entry, trace: bool) { + if entry.attrs.trace.is_some() || trace { + let _with_args = entry.attrs.trace.unwrap_or(false); + + let name_trace = format!("{}__trace", entry.name.to_string()); + for rule in entry.rules { + file.rules.push(compile_rule(name_trace.clone(), rule)) + } + + let args = entry + .args + .iter() + .enumerate() + .map(|(i, x)| { + Box::new(Term::Var { + name: format!("_{}{}", i, x.0.clone()), + }) + }) + .collect::>(); + + file.rules.push(Rule { + lhs: Box::new(Term::Ctr { + name: entry.name.to_string(), + args: args.clone(), + }), + rhs: Box::new(Term::Ctr { + name: "HVM.log".to_string(), + args: vec![ + compile_str(entry.name.to_str()), + Box::new(Term::Ctr { + name: name_trace, + args, + }), + ], + }), + }) + } else { + let name = entry.name.to_string(); + for rule in entry.rules { + file.rules.push(compile_rule(name.clone(), rule)) + } } } diff --git a/crates/kind-target-kdl/src/compile.rs b/crates/kind-target-kdl/src/compile.rs index 24d3213f..9d6142f9 100644 --- a/crates/kind-target-kdl/src/compile.rs +++ b/crates/kind-target-kdl/src/compile.rs @@ -469,7 +469,7 @@ impl Display for File { for ctr in &self.ctrs { writeln!(f, "{}", ctr.1)?; } - + if self.ctrs.len() > 0 && self.funs.len() > 0 { writeln!(f)?; } diff --git a/crates/kind-target-kdl/src/lib.rs b/crates/kind-target-kdl/src/lib.rs index 2d4c9af5..d504c4d6 100644 --- a/crates/kind-target-kdl/src/lib.rs +++ b/crates/kind-target-kdl/src/lib.rs @@ -20,7 +20,7 @@ pub fn compile_book( // TODO: Remove kdl_states (maybe check if they're ever called?) // TODO: Convert to some sort of Kindelia.Contract let flattened = flatten(book); - + let file = compile::compile_book(&flattened, sender, namespace)?; let file = linearize::linearize_file(file); Some(file) diff --git a/crates/kind-tests/Teste.kind2 b/crates/kind-tests/Teste.kind2 new file mode 100644 index 00000000..b02617b2 --- /dev/null +++ b/crates/kind-tests/Teste.kind2 @@ -0,0 +1,2 @@ +Main : U60 +Main = HVM.log 222 2 \ No newline at end of file diff --git a/crates/kind-tests/tests/mod.rs b/crates/kind-tests/tests/mod.rs index a37b78d3..f638fe72 100644 --- a/crates/kind-tests/tests/mod.rs +++ b/crates/kind-tests/tests/mod.rs @@ -41,10 +41,11 @@ fn test_kind2(path: &Path, run: fn(&Path) -> String) -> Result<(), Error> { fn test_checker() -> Result<(), Error> { test_kind2(Path::new("./tests/suite/checker"), |path| { let (rx, tx) = std::sync::mpsc::channel(); - let root = PathBuf::from("."); + let root = PathBuf::from("./tests/suite/lib").canonicalize().unwrap(); let mut session = Session::new(root, rx); - let check = driver::type_check_book(&mut session, &PathBuf::from(path)); + let entrypoints = vec!["Main".to_string()]; + let check = driver::type_check_book(&mut session, &PathBuf::from(path), entrypoints); let diagnostics = tx.try_iter().collect::>>(); let render = RenderConfig::ascii(2); @@ -72,11 +73,12 @@ fn test_checker() -> Result<(), Error> { fn test_eval() -> Result<(), Error> { test_kind2(Path::new("./tests/suite/eval"), |path| { let (rx, tx) = std::sync::mpsc::channel(); - let root = PathBuf::from("."); + let root = PathBuf::from("./tests/suite/lib").canonicalize().unwrap(); let mut session = Session::new(root, rx); - let check = driver::erase_book(&mut session, &PathBuf::from(path)) - .map(driver::compile_book_to_hvm); + let entrypoints = vec!["Main".to_string()]; + let check = driver::erase_book(&mut session, &PathBuf::from(path), entrypoints) + .map(|x| driver::compile_book_to_hvm(x, false)); let diagnostics = tx.try_iter().collect::>(); let render = RenderConfig::ascii(2); diff --git a/crates/kind-tests/tests/suite/checker/derive/Algebra.golden b/crates/kind-tests/tests/suite/checker/derive/Algebra.golden new file mode 100644 index 00000000..3cc18efd --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Algebra.golden @@ -0,0 +1,11 @@ + ERROR Unexpected token ':'. + + /--[tests/suite/checker/derive/Algebra.kind2:1:69] + | + 1 | Algebra.Group.new (monoid: (Algebra.Monoid t)) (invert: (_: t) t) (inverse: (Algebra.Laws.Inverse t (Algebra.Monoid.concat _ monoid) invert (Algebra.Monoid.empty _ monoid))) : (Algebra.Group t) + | v + | \Here! + 2 | + 3 | Algebra.Group (t: Type) : Type + + diff --git a/crates/kind-tests/tests/suite/checker/derive/Algebra.kind2 b/crates/kind-tests/tests/suite/checker/derive/Algebra.kind2 new file mode 100644 index 00000000..69b5778a --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Algebra.kind2 @@ -0,0 +1,41 @@ +Algebra.Group.new (monoid: (Algebra.Monoid t)) (invert: (_: t) t) (inverse: (Algebra.Laws.Inverse t (Algebra.Monoid.concat _ monoid) invert (Algebra.Monoid.empty _ monoid))) : (Algebra.Group t) + +Algebra.Group (t: Type) : Type + +Algebra.Monoid.concat (monoid: (Algebra.Monoid t)) : (_: t) (_: t) t +Algebra.Monoid.concat t (Algebra.Monoid.new t_ sg empty id) = (Algebra.Semigroup.concat _ sg) + + +Algebra.Monoid.new (sg: (Algebra.Semigroup t)) (empty: t) (identity: (Algebra.Laws.Identity t (Algebra.Semigroup.concat _ sg) empty)) : (Algebra.Monoid t) + +Algebra.Semigroup (t: Type) : Type + +Algebra.Laws.Identity (t: Type) (concat: (_: t) (_: t) t) (empty: t) : Type + +Algebra.Monoid (t: Type) : Type + +Algebra.Semigroup.concat (semigroup: (Algebra.Semigroup t)) : (_: t) (_: t) t +Algebra.Semigroup.concat t (Algebra.Semigroup.new t_ magma assoc) = (Algebra.Magma.concat _ magma) + + +Algebra.Semigroup.new (magma: (Algebra.Magma t)) (associativity: (Algebra.Laws.associativity.eta _ (Algebra.Magma.concat _ magma))) : (Algebra.Semigroup t) + +Algebra.Magma (t: Type) : Type + +Algebra.Laws.associativity.eta (concat: (_: t) (_: t) t) : Type +Algebra.Laws.associativity.eta t concat = (a: t) (b: t) (c: t) (Equal _ (concat (concat a b) c) (concat a (concat b c))) + + +Equal (a: t) (b: t) : Type + +Algebra.Magma.concat (magma: (Algebra.Magma t)) : (_: t) (_: t) t +Algebra.Magma.concat t (Algebra.Magma.new t_ concat) = concat + + +Algebra.Magma.new (concat: (_: t) (_: t) t) : (Algebra.Magma t) + +Algebra.Monoid.empty (monoid: (Algebra.Monoid t)) : t +Algebra.Monoid.empty t (Algebra.Monoid.new t_ sg empty id) = empty + + +Algebra.Laws.Inverse (t: Type) (concat: (_: t) (_: t) t) (inverse: (_: t) t) (empty: t) : Type \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/DoNotation.golden b/crates/kind-tests/tests/suite/checker/derive/DoNotation.golden new file mode 100644 index 00000000..db814b93 --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/DoNotation.golden @@ -0,0 +1 @@ +Ok! \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/DoNotation.kind2 b/crates/kind-tests/tests/suite/checker/derive/DoNotation.kind2 new file mode 100644 index 00000000..9803751d --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/DoNotation.kind2 @@ -0,0 +1,12 @@ +Main : Maybe U60 +Main = + do Maybe { + Maybe.some 3 + Maybe.pure 2 + ask res = Maybe.pure 2 + ask res2 = Maybe.pure 3 + match Maybe (Maybe.some 4) { + some val => Maybe.pure (+ 1000 (+ val (+ res res2))) + none => Maybe.none + } + } \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/Inspection.golden b/crates/kind-tests/tests/suite/checker/derive/Inspection.golden new file mode 100644 index 00000000..ca7451f3 --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Inspection.golden @@ -0,0 +1,13 @@ + INFO Inspection. + + * Expected: U60 + + + /--[tests/suite/checker/derive/Inspection.kind2:3:3] + | + 2 | Main = + 3 | ? + | v + | \Here! + + diff --git a/crates/kind-tests/tests/suite/checker/derive/Inspection.kind2 b/crates/kind-tests/tests/suite/checker/derive/Inspection.kind2 new file mode 100644 index 00000000..631d99c5 --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Inspection.kind2 @@ -0,0 +1,3 @@ +Main : U60 +Main = + ? \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/Quicksort.golden b/crates/kind-tests/tests/suite/checker/derive/Quicksort.golden new file mode 100644 index 00000000..db814b93 --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Quicksort.golden @@ -0,0 +1 @@ +Ok! \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/Quicksort.kind2 b/crates/kind-tests/tests/suite/checker/derive/Quicksort.kind2 new file mode 100644 index 00000000..c8aed76c --- /dev/null +++ b/crates/kind-tests/tests/suite/checker/derive/Quicksort.kind2 @@ -0,0 +1,55 @@ +// From: https://github.com/Kindelia/Functional-Benchmarks/blob/master/Runtime/quicksort.kind2 + +type List (t: Type) { + Cons (head: t) (tail: List t) + Nil +} + +type Tree (t: Type) { + Empty + Single (value: t) + Concat (left: Tree t) (right: Tree t) +} + +// Generates a random list +Randoms (s: U60) (n: U60) : List U60 +Randoms s 0 = List.Nil +Randoms s l = List.Cons s (Randoms (% (+ (* s 1664525) 1013904223) 4294967296) (- l 1)) + +// Sums all elements in a concatenation tree +Sum (tree: Tree U60) : U60 +Sum (Tree.Empty t) = 0 +Sum (Tree.Single t a) = a +Sum (Tree.Concat t a b) = (+ (Sum a) (Sum b)) + +//// The initial pivot +Pivot : U60 +Pivot = 2147483648 + +QSort (p: U60) (s: U60) (l: List U60): Tree U60 +QSort p s List.Nil = Tree.Empty +QSort p s (List.Cons x List.Nil) = Tree.Single x +QSort p s (List.Cons x xs) = Split p s (List.Cons x xs) List.Nil List.Nil + +//// Splits list in two partitions +Split (p: U60) (s: U60) (l: List U60) (min: List U60) (max: List U60) : Tree U60 +Split p s List.Nil min max = + let s = (>> s 1) + let min = (QSort (- p s) s min) + let max = (QSort (+ p s) s max) + Tree.Concat min max + +Split p s (List.Cons x xs) min max = + Place p s (< p x) x xs min max + +//// Moves element to its partition + +Place (p: U60) (s: U60) (y: U60) (x: U60) (xs: List U60) (min: List U60) (max: List U60) : Tree U60 +Place p s 0 x xs min max = Split p s xs (List.Cons x min) max +Place p s 1 x xs min max = Split p s xs min (List.Cons x max) + +//// Sorts and sums n random numbers +Main : U60 +Main = + let list = Randoms 1 254 + Sum (QSort Pivot Pivot list) \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden b/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden index e861688f..a1cfa0d6 100644 --- a/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden +++ b/crates/kind-tests/tests/suite/checker/derive/fail/RepeatedDef.golden @@ -12,5 +12,5 @@ | v------- | \Second occorrence here! - Hint: Rename one of the definitions or remove and look at how names work in Kind at https://kind.kindelia.org/hints/names + Hint: Rename one of the definitions or remove and look at how names work in Kind at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md diff --git a/crates/kind-tests/tests/suite/eval/DoNotation.golden b/crates/kind-tests/tests/suite/eval/DoNotation.golden new file mode 100644 index 00000000..6d072348 --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/DoNotation.golden @@ -0,0 +1 @@ +(Maybe.some 1009) \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/eval/DoNotation.kind2 b/crates/kind-tests/tests/suite/eval/DoNotation.kind2 new file mode 100644 index 00000000..9803751d --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/DoNotation.kind2 @@ -0,0 +1,12 @@ +Main : Maybe U60 +Main = + do Maybe { + Maybe.some 3 + Maybe.pure 2 + ask res = Maybe.pure 2 + ask res2 = Maybe.pure 3 + match Maybe (Maybe.some 4) { + some val => Maybe.pure (+ 1000 (+ val (+ res res2))) + none => Maybe.none + } + } \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/eval/NoMatch.golden b/crates/kind-tests/tests/suite/eval/NoMatch.golden new file mode 100644 index 00000000..6098f1fa --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/NoMatch.golden @@ -0,0 +1,13 @@ + ERROR Required functions are not implemented for this type. + + /--[tests/suite/eval/NoMatch.kind2:3:5] + | + | / + 3 | | match NoMatch NoMatch.pudding { + 4 | | pudding => 2 + 5 | | } + : | + : \ You cannot use this expression! + + Hint: You must implement 'NoMatch.match' in order to use the match notation (or derive match with #derive[match]). + diff --git a/crates/kind-tests/tests/suite/eval/NoMatch.kind2 b/crates/kind-tests/tests/suite/eval/NoMatch.kind2 new file mode 100644 index 00000000..898a3ea8 --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/NoMatch.kind2 @@ -0,0 +1,5 @@ +Main : U60 +Main = + match NoMatch NoMatch.pudding { + pudding => 2 + } \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/lib/Maybe/_.kind2 b/crates/kind-tests/tests/suite/lib/Maybe/_.kind2 new file mode 100644 index 00000000..878c451b --- /dev/null +++ b/crates/kind-tests/tests/suite/lib/Maybe/_.kind2 @@ -0,0 +1,5 @@ +#derive[match] +type Maybe (a: Type) { + some (val: a) + none +} \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/lib/Maybe/bind.kind2 b/crates/kind-tests/tests/suite/lib/Maybe/bind.kind2 new file mode 100644 index 00000000..cbdae498 --- /dev/null +++ b/crates/kind-tests/tests/suite/lib/Maybe/bind.kind2 @@ -0,0 +1,3 @@ +Maybe.bind (ma: Maybe a) (mb: a -> Maybe b) : Maybe b +Maybe.bind a b (Maybe.none t) mb = Maybe.none +Maybe.bind a b (Maybe.some t val) mb = (mb val) \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/lib/Maybe/pure.kind2 b/crates/kind-tests/tests/suite/lib/Maybe/pure.kind2 new file mode 100644 index 00000000..23f1f225 --- /dev/null +++ b/crates/kind-tests/tests/suite/lib/Maybe/pure.kind2 @@ -0,0 +1,2 @@ +Maybe.pure (x: a) : Maybe a +Maybe.pure a x = Maybe.some x \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/lib/NoMatch.kind2 b/crates/kind-tests/tests/suite/lib/NoMatch.kind2 new file mode 100644 index 00000000..1ae5a7b1 --- /dev/null +++ b/crates/kind-tests/tests/suite/lib/NoMatch.kind2 @@ -0,0 +1,3 @@ +type NoMatch { + pudding +} \ No newline at end of file diff --git a/crates/kind-tree/src/lib.rs b/crates/kind-tree/src/lib.rs index 66f4ab9b..ef259190 100644 --- a/crates/kind-tree/src/lib.rs +++ b/crates/kind-tree/src/lib.rs @@ -31,6 +31,7 @@ pub struct Attributes { pub kdl_erase: bool, pub kdl_name: Option, pub kdl_state: Option, + pub trace: Option, // Some is enabled and some(true) is enabled with arguments } /// Enum of binary operators. diff --git a/crates/kind-tree/src/untyped/mod.rs b/crates/kind-tree/src/untyped/mod.rs index 75a68519..b90358bc 100644 --- a/crates/kind-tree/src/untyped/mod.rs +++ b/crates/kind-tree/src/untyped/mod.rs @@ -205,7 +205,7 @@ pub struct Entry { #[derive(Clone, Debug, Default)] pub struct Book { pub entrs: LinkedHashMap>, - pub names: FxHashMap + pub names: FxHashMap, } impl Expr { From 6844cc273541dc55c7b6842a1bf2016cd411a4f6 Mon Sep 17 00:00:00 2001 From: felipegchi Date: Tue, 29 Nov 2022 13:19:56 -0300 Subject: [PATCH 3/5] feat: added getter and setter derivings --- crates/kind-derive/src/getters.rs | 117 +++++++++++++++++++ crates/kind-derive/src/lib.rs | 2 + crates/kind-derive/src/open.rs | 8 +- crates/kind-derive/src/record.rs | 3 - crates/kind-derive/src/setters.rs | 174 +++++++++++++++++++++++++++++ crates/kind-pass/src/expand/mod.rs | 20 ++++ 6 files changed, 318 insertions(+), 6 deletions(-) create mode 100644 crates/kind-derive/src/getters.rs delete mode 100644 crates/kind-derive/src/record.rs create mode 100644 crates/kind-derive/src/setters.rs diff --git a/crates/kind-derive/src/getters.rs b/crates/kind-derive/src/getters.rs new file mode 100644 index 00000000..edf7aeff --- /dev/null +++ b/crates/kind-derive/src/getters.rs @@ -0,0 +1,117 @@ +//! Module to derive a "open" function for records. + +use kind_span::Range; + +use kind_tree::concrete::expr::Expr; +use kind_tree::concrete::pat::{Pat, PatIdent}; +use kind_tree::concrete::*; +use kind_tree::concrete::{self}; +use kind_tree::symbol::{Ident, QualifiedIdent}; + +pub fn derive_getters(range: Range, rec: &RecordDecl) -> Vec { + let mk_var = |name: Ident| -> Box { + Box::new(Expr { + data: ExprKind::Var { name }, + range, + }) + }; + + let mk_cons = |name: QualifiedIdent, args: Vec| -> Box { + Box::new(Expr { + data: ExprKind::Constr { name, args }, + range, + }) + }; + + let mut types = Telescope::default(); + + for arg in rec.parameters.iter() { + types.push(arg.to_implicit()) + } + + // The type + + let all_args = rec.parameters.clone(); + + let res_motive_ty = mk_cons( + rec.name.clone(), + all_args + .iter() + .cloned() + .map(|x| Binding::Positional(mk_var(x.name))) + .collect(), + ); + + // Sccrutinzies + + types.push(Argument { + hidden: false, + erased: false, + name: Ident::generate("scrutinizer"), + typ: Some(res_motive_ty), + range, + }); + + // Motive with indices + + let mut pats: Vec> = Vec::new(); + + let spine: Vec<_> = rec + .fields + .iter() + .map(|(name, _, ty)| (name, ty)) + .collect(); + + pats.push(Box::new(Pat { + data: concrete::pat::PatKind::App( + rec.name.add_segment(rec.constructor.to_str()), + spine + .iter() + .cloned() + .map(|x| { + Box::new(Pat { + data: concrete::pat::PatKind::Var(PatIdent(x.0.clone().with_name(|f| format!("{}_", f)))), + range, + }) + }) + .collect(), + ), + range, + })); + + let mut entries = vec![]; + + for (arg, typ) in spine { + let body = mk_var(arg.with_name(|f| format!("{}_", f)).clone()); + + let mut name = rec + .name + .add_segment(arg.to_str()) + .add_segment("get"); + + name.range = rec.constructor.range; + + + let rules = vec![Box::new(Rule { + name: name.clone(), + pats: pats.clone(), + body, + range: rec.constructor.range, + })]; + + let entry = Entry { + name: name.clone(), + docs: Vec::new(), + args: types.clone(), + typ: typ.clone(), + rules, + range: rec.constructor.range, + attrs: Vec::new(), + generated_by: Some(rec.name.to_string().clone()), + }; + + entries.push(entry) + } + + entries +} diff --git a/crates/kind-derive/src/lib.rs b/crates/kind-derive/src/lib.rs index 06fb4eee..dc7f9729 100644 --- a/crates/kind-derive/src/lib.rs +++ b/crates/kind-derive/src/lib.rs @@ -4,3 +4,5 @@ pub mod errors; pub mod matching; pub mod open; pub mod subst; +pub mod getters; +pub mod setters; \ No newline at end of file diff --git a/crates/kind-derive/src/open.rs b/crates/kind-derive/src/open.rs index 7364161d..23c837f8 100644 --- a/crates/kind-derive/src/open.rs +++ b/crates/kind-derive/src/open.rs @@ -42,11 +42,13 @@ pub fn derive_open(range: Range, rec: &RecordDecl) -> concrete::Entry { }) }; - let name = rec + let mut name = rec .name .add_segment(rec.constructor.to_str()) .add_segment("open"); + name.range = rec.constructor.range; + let mut types = Telescope::default(); for arg in rec.parameters.iter() { @@ -146,7 +148,7 @@ pub fn derive_open(range: Range, rec: &RecordDecl) -> concrete::Entry { name: name.clone(), pats, body, - range, + range: rec.constructor.range, })]; let entry = Entry { @@ -155,7 +157,7 @@ pub fn derive_open(range: Range, rec: &RecordDecl) -> concrete::Entry { args: types, typ: ret_ty, rules, - range, + range: rec.constructor.range, attrs: Vec::new(), generated_by: Some(rec.name.to_string().clone()), }; diff --git a/crates/kind-derive/src/record.rs b/crates/kind-derive/src/record.rs deleted file mode 100644 index ca11d673..00000000 --- a/crates/kind-derive/src/record.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Derives getters and setters for record -//! types. - diff --git a/crates/kind-derive/src/setters.rs b/crates/kind-derive/src/setters.rs new file mode 100644 index 00000000..f3d2fcda --- /dev/null +++ b/crates/kind-derive/src/setters.rs @@ -0,0 +1,174 @@ +//! Module to derive a "open" function for records. + +use kind_span::Range; + +use kind_tree::concrete::expr::Expr; +use kind_tree::concrete::pat::{Pat, PatIdent}; +use kind_tree::concrete::*; +use kind_tree::concrete::{self}; +use kind_tree::symbol::{Ident, QualifiedIdent}; + +pub fn derive_setters(range: Range, rec: &RecordDecl) -> Vec { + let mk_var = |name: Ident| -> Box { + Box::new(Expr { + data: ExprKind::Var { name }, + range, + }) + }; + + let mk_cons = |name: QualifiedIdent, args: Vec| -> Box { + Box::new(Expr { + data: ExprKind::Constr { name, args }, + range, + }) + }; + + let typ = |range: Range| -> Box { + Box::new(Expr { + data: ExprKind::Lit { lit: Literal::Type }, + range, + }) + }; + + let mk_pat_var = |name: Ident| { + Box::new(Pat { + range: name.range, + data: concrete::pat::PatKind::Var(PatIdent(name)), + }) + }; + + let mut types = Telescope::default(); + + for arg in rec.parameters.iter() { + types.push(arg.to_implicit()) + } + + // The type + + let all_args = rec.parameters.clone(); + + let res_motive_ty = mk_cons( + rec.name.clone(), + all_args + .iter() + .cloned() + .map(|x| Binding::Positional(mk_var(x.name))) + .collect(), + ); + + // Sccrutinzies + + types.push(Argument { + hidden: false, + erased: false, + name: Ident::generate("scrutinizer"), + typ: Some(res_motive_ty.clone()), + range, + }); + + // Motive with indices + + let mut pats: Vec> = Vec::new(); + + let fields_spine: Vec<_> = rec + .fields + .iter() + .map(|(name, _, typ)| (name.clone(), typ.clone())) + .collect(); + + let params_spine: Vec<_> = rec + .parameters + .iter() + .map(|arg| { + ( + arg.name.clone(), + arg.typ.clone().unwrap_or_else(|| typ(arg.range.clone())), + ) + }) + .collect(); + + let spine = [params_spine.as_slice(), fields_spine.as_slice()].concat(); + + pats.push(Box::new(Pat { + data: concrete::pat::PatKind::App( + rec.name.add_segment(rec.constructor.to_str()), + spine + .iter() + .cloned() + .map(|(name, _)| mk_pat_var(name)) + .collect(), + ), + range, + })); + + let mut entries = vec![]; + + let mut cons_name = rec.name.add_segment(rec.constructor.to_str()); + + cons_name.range = rec.constructor.range; + + for (i, (arg, cons_typ)) in fields_spine.iter().enumerate() { + let mut types = types.clone(); + + let place = rec.parameters.len() + i; + + types.push(Argument { + hidden: false, + erased: false, + name: Ident::generate("set"), + typ: Some(cons_typ.clone()), + range, + }); + + let new_var = Ident::generate("_new_var"); + + let mut pats = pats.clone(); + + pats.push(Box::new(Pat { + data: concrete::pat::PatKind::Var(PatIdent(new_var.clone())), + range, + })); + + let mut args: Vec<_> = spine + .iter() + .cloned() + .map(|x| Binding::Positional(mk_var(x.0))) + .collect(); + + args[place] = Binding::Positional(mk_var(new_var)); + + let body = Box::new(Expr { + data: ExprKind::Constr { + name: cons_name.clone(), + args, + }, + range, + }); + + let mut name = rec.name.add_segment(arg.to_str()).add_segment("set"); + + name.range = rec.constructor.range; + + let rules = vec![Box::new(Rule { + name: name.clone(), + pats: pats.clone(), + body, + range: rec.constructor.range, + })]; + + let entry = Entry { + name: name.clone(), + docs: Vec::new(), + args: types.clone(), + typ: res_motive_ty.clone(), + rules, + range: rec.constructor.range, + attrs: Vec::new(), + generated_by: Some(rec.name.to_string().clone()), + }; + + entries.push(entry) + } + + entries +} diff --git a/crates/kind-pass/src/expand/mod.rs b/crates/kind-pass/src/expand/mod.rs index 0de04731..0b4692e7 100644 --- a/crates/kind-pass/src/expand/mod.rs +++ b/crates/kind-pass/src/expand/mod.rs @@ -6,8 +6,10 @@ use std::fmt::Display; use std::sync::mpsc::Sender; use fxhash::FxHashMap; +use kind_derive::getters::derive_getters; use kind_derive::matching::derive_match; use kind_derive::open::derive_open; +use kind_derive::setters::derive_setters; use kind_report::data::Diagnostic; use kind_span::Locatable; use kind_span::Range; @@ -23,6 +25,8 @@ pub mod uses; pub enum Derive { Match, Open, + Getters, + Setters } impl Display for Derive { @@ -30,6 +34,8 @@ impl Display for Derive { match self { Derive::Match => write!(f, "match"), Derive::Open => write!(f, "open"), + Derive::Getters => write!(f, "getters"), + Derive::Setters => write!(f, "setters"), } } } @@ -59,6 +65,8 @@ fn string_to_derive(name: &str) -> Option { match name { "match" => Some(Derive::Match), "open" => Some(Derive::Open), + "getters" => Some(Derive::Getters), + "setters" => Some(Derive::Setters), _ => None, } } @@ -160,6 +168,18 @@ pub fn expand_book(error_channel: Sender>, book: &mut Book) let info = res.extract_book_info(); entries.insert(res.name.to_string(), (res, info)); } + Derive::Getters => { + for res in derive_getters(rec.name.range, rec) { + let info = res.extract_book_info(); + entries.insert(res.name.to_string(), (res, info)); + } + } + Derive::Setters => { + for res in derive_setters(rec.name.range, rec) { + let info = res.extract_book_info(); + entries.insert(res.name.to_string(), (res, info)); + } + } other => { error_channel .send(Box::new(PassError::CannotDerive(other.to_string(), val))) From df27bb8190327abeedc0d4b8d48b43e3841fc3da Mon Sep 17 00:00:00 2001 From: felipegchi Date: Tue, 29 Nov 2022 13:45:33 -0300 Subject: [PATCH 4/5] tests: added tons of tests for kdl --- crates/kind-pass/src/desugar/attributes.rs | 5 +++ crates/kind-pass/src/erasure/mod.rs | 2 +- crates/kind-target-kdl/src/lib.rs | 3 ++ crates/kind-tests/tests/mod.rs | 35 +++++++++++++++++++ .../tests/suite/eval/Getters.golden | 1 + .../kind-tests/tests/suite/eval/Getters.kind2 | 10 ++++++ .../tests/suite/eval/Setters.golden | 1 + .../kind-tests/tests/suite/eval/Setters.kind2 | 12 +++++++ .../tests/suite/kdl/ChangeName.golden | 0 .../tests/suite/kdl/ChangeName.kind2 | 3 ++ .../kind-tests/tests/suite/kdl/Lambda.golden | 0 .../kind-tests/tests/suite/kdl/Lambda.kind2 | 8 +++++ .../tests/suite/kdl/NonInlineState.golden | 1 + .../tests/suite/kdl/NonInlineState.kind2 | 6 ++++ .../tests/suite/kdl/Operators.golden | 3 ++ .../tests/suite/kdl/Operators.kind2 | 18 ++++++++++ .../tests/suite/kdl/RemoveNames.golden | 0 .../tests/suite/kdl/RemoveNames.kind2 | 14 ++++++++ crates/kind-tests/tests/suite/kdl/Run.golden | 10 ++++++ crates/kind-tests/tests/suite/kdl/Run.kind2 | 13 +++++++ .../tests/suite/kdl/Shortener.golden | 0 .../tests/suite/kdl/Shortener.kind2 | 3 ++ .../tests/suite/kdl/StillCalable.golden | 4 +++ .../tests/suite/kdl/StillCalable.kind2 | 11 ++++++ crates/kind-tests/tests/suite/kdl/U60.golden | 3 ++ crates/kind-tests/tests/suite/kdl/U60.kind2 | 4 +++ .../tests/suite/kdl/WithAttr.golden | 3 ++ .../kind-tests/tests/suite/kdl/WithAttr.kind2 | 9 +++++ .../kind-tests/tests/suite/lib/String.kind2 | 4 +++ crates/kind-tree/src/lib.rs | 1 + 30 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 crates/kind-tests/tests/suite/eval/Getters.golden create mode 100644 crates/kind-tests/tests/suite/eval/Getters.kind2 create mode 100644 crates/kind-tests/tests/suite/eval/Setters.golden create mode 100644 crates/kind-tests/tests/suite/eval/Setters.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/ChangeName.golden create mode 100644 crates/kind-tests/tests/suite/kdl/ChangeName.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/Lambda.golden create mode 100644 crates/kind-tests/tests/suite/kdl/Lambda.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/NonInlineState.golden create mode 100644 crates/kind-tests/tests/suite/kdl/NonInlineState.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/Operators.golden create mode 100644 crates/kind-tests/tests/suite/kdl/Operators.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/RemoveNames.golden create mode 100644 crates/kind-tests/tests/suite/kdl/RemoveNames.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/Run.golden create mode 100644 crates/kind-tests/tests/suite/kdl/Run.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/Shortener.golden create mode 100644 crates/kind-tests/tests/suite/kdl/Shortener.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/StillCalable.golden create mode 100644 crates/kind-tests/tests/suite/kdl/StillCalable.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/U60.golden create mode 100644 crates/kind-tests/tests/suite/kdl/U60.kind2 create mode 100644 crates/kind-tests/tests/suite/kdl/WithAttr.golden create mode 100644 crates/kind-tests/tests/suite/kdl/WithAttr.kind2 create mode 100644 crates/kind-tests/tests/suite/lib/String.kind2 diff --git a/crates/kind-pass/src/desugar/attributes.rs b/crates/kind-pass/src/desugar/attributes.rs index 33ae4a1f..787de77e 100644 --- a/crates/kind-pass/src/desugar/attributes.rs +++ b/crates/kind-pass/src/desugar/attributes.rs @@ -44,6 +44,11 @@ impl<'a> DesugarState<'a> { self.attr_without_value(attr); attributes.inlined = true; } + "keep" => { + self.args_should_be_empty(attr); + self.attr_without_value(attr); + attributes.keep = true; + } "kdl_run" => { self.args_should_be_empty(attr); self.attr_without_value(attr); diff --git a/crates/kind-pass/src/erasure/mod.rs b/crates/kind-pass/src/erasure/mod.rs index e01a304c..9499db8d 100644 --- a/crates/kind-pass/src/erasure/mod.rs +++ b/crates/kind-pass/src/erasure/mod.rs @@ -123,7 +123,7 @@ impl<'a> ErasureState<'a> { } } - if entr.attrs.kdl_run { + if entr.attrs.kdl_run || entr.attrs.keep { let id = self.get_edge_or_create(&entr.name); self.set_relevance(id, Relevance::Relevant, entr.name.range); entrypoints.push(id); diff --git a/crates/kind-target-kdl/src/lib.rs b/crates/kind-target-kdl/src/lib.rs index d504c4d6..7575c760 100644 --- a/crates/kind-target-kdl/src/lib.rs +++ b/crates/kind-target-kdl/src/lib.rs @@ -22,6 +22,9 @@ pub fn compile_book( let flattened = flatten(book); let file = compile::compile_book(&flattened, sender, namespace)?; + + println!("{}", file); + let file = linearize::linearize_file(file); Some(file) } diff --git a/crates/kind-tests/tests/mod.rs b/crates/kind-tests/tests/mod.rs index f638fe72..6811499d 100644 --- a/crates/kind-tests/tests/mod.rs +++ b/crates/kind-tests/tests/mod.rs @@ -102,3 +102,38 @@ fn test_eval() -> Result<(), Error> { })?; Ok(()) } + + +#[test] +#[timeout(15000)] +fn test_kdl() -> Result<(), Error> { + test_kind2(Path::new("./tests/suite/kdl"), |path| { + let (rx, tx) = std::sync::mpsc::channel(); + let root = PathBuf::from("./tests/suite/lib").canonicalize().unwrap(); + let mut session = Session::new(root, rx); + + let entrypoints = vec!["Main".to_string()]; + let check = driver::compile_book_to_kdl(&PathBuf::from(path), &mut session, "", entrypoints); + + let diagnostics = tx.try_iter().collect::>(); + let render = RenderConfig::ascii(2); + + kind_report::check_if_colors_are_supported(true); + + match check { + Some(file) if diagnostics.is_empty() => { + file.to_string() + } + _ => { + let mut res_string = String::new(); + + for diag in diagnostics { + diag.render(&mut session, &render, &mut res_string).unwrap(); + } + + res_string + } + } + })?; + Ok(()) +} diff --git a/crates/kind-tests/tests/suite/eval/Getters.golden b/crates/kind-tests/tests/suite/eval/Getters.golden new file mode 100644 index 00000000..f1efb205 --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/Getters.golden @@ -0,0 +1 @@ +300 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/eval/Getters.kind2 b/crates/kind-tests/tests/suite/eval/Getters.kind2 new file mode 100644 index 00000000..00615476 --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/Getters.kind2 @@ -0,0 +1,10 @@ +#derive[getters] +record Pair (a: Type) (b: Type) { + fst : a + snd : b +} + +Main : U60 +Main = + let a = (Pair.new 100 200 :: Pair U60 U60) + (+ (Pair.fst.get a) (Pair.snd.get a)) \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/eval/Setters.golden b/crates/kind-tests/tests/suite/eval/Setters.golden new file mode 100644 index 00000000..cdb660b8 --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/Setters.golden @@ -0,0 +1 @@ +700 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/eval/Setters.kind2 b/crates/kind-tests/tests/suite/eval/Setters.kind2 new file mode 100644 index 00000000..1411a6bd --- /dev/null +++ b/crates/kind-tests/tests/suite/eval/Setters.kind2 @@ -0,0 +1,12 @@ +#derive[getters, setters] +record Pair (a: Type) (b: Type) { + fst : a + snd : b +} + +Main : U60 +Main = + let a = (Pair.new 100 200 :: Pair U60 U60) + let b = Pair.fst.set a 500 + let c = Pair.snd.set a (+ (Pair.fst.get b) (Pair.snd.get b)) + Pair.snd.get c \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/ChangeName.golden b/crates/kind-tests/tests/suite/kdl/ChangeName.golden new file mode 100644 index 00000000..e69de29b diff --git a/crates/kind-tests/tests/suite/kdl/ChangeName.kind2 b/crates/kind-tests/tests/suite/kdl/ChangeName.kind2 new file mode 100644 index 00000000..85f73756 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/ChangeName.kind2 @@ -0,0 +1,3 @@ +#kdl_name = JOJO +Jonathan.Joestar : U60 +Jonathan.Joestar = 42 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/Lambda.golden b/crates/kind-tests/tests/suite/kdl/Lambda.golden new file mode 100644 index 00000000..e69de29b diff --git a/crates/kind-tests/tests/suite/kdl/Lambda.kind2 b/crates/kind-tests/tests/suite/kdl/Lambda.kind2 new file mode 100644 index 00000000..d63a0fee --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Lambda.kind2 @@ -0,0 +1,8 @@ +CoolFn : U60 -> U60 { + (x: U60) => (* 2 x) +} + +CoolFnApp (n: U60) : U60 { + let lam = (x: U60) => ((CoolFn) x) + (lam n) +} \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/NonInlineState.golden b/crates/kind-tests/tests/suite/kdl/NonInlineState.golden new file mode 100644 index 00000000..38cdeec3 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/NonInlineState.golden @@ -0,0 +1 @@ +ctr {MyFn.state} diff --git a/crates/kind-tests/tests/suite/kdl/NonInlineState.kind2 b/crates/kind-tests/tests/suite/kdl/NonInlineState.kind2 new file mode 100644 index 00000000..d94e77b5 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/NonInlineState.kind2 @@ -0,0 +1,6 @@ +#kdl_state = MyFn.state +MyFn : U60 { + 1 +} + +MyFn.state : U60 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/Operators.golden b/crates/kind-tests/tests/suite/kdl/Operators.golden new file mode 100644 index 00000000..7d702560 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Operators.golden @@ -0,0 +1,3 @@ +run { + (& (+ #2 (& (- #3 (& (* #4 (/ #5 (% #6 (& (+ #2 (| #8 (^ #9 (<< #10 (% (>> #23 (% (< #2 (>= #4 (<= (== #4 #4) (> #3 (!= #5 #3))))) #60)) #60))))) #1152921504606846975)))) #1152921504606846975)) #1152921504606846975)) #1152921504606846975) +} diff --git a/crates/kind-tests/tests/suite/kdl/Operators.kind2 b/crates/kind-tests/tests/suite/kdl/Operators.kind2 new file mode 100644 index 00000000..6dafa9f6 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Operators.kind2 @@ -0,0 +1,18 @@ +#kdl_run +Main : U60 +Main = + (+ 2 + (- 3 + (* 4 + (/ 5 + (% 6 + (& 2 + (| 8 + (^ 9 + (<< 10 + (>> 23 + (< 2 + (>= 4 + (<= (== 4 4) + (> 3 + (!= 5 3))))))))))))))) \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/RemoveNames.golden b/crates/kind-tests/tests/suite/kdl/RemoveNames.golden new file mode 100644 index 00000000..e69de29b diff --git a/crates/kind-tests/tests/suite/kdl/RemoveNames.kind2 b/crates/kind-tests/tests/suite/kdl/RemoveNames.kind2 new file mode 100644 index 00000000..eac8ce41 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/RemoveNames.kind2 @@ -0,0 +1,14 @@ +List : Type + List.nil : List + List.cons (head: a) (tail: List a) : List + +/* +#keep +Ora.Ora.ora (h: List U60) : List U60 +Ora.Ora.ora (List.cons x xs) = + let aaa = 2 + let bbb = 3 + let ccc = 4 + let ddd = (+ ccc bbb) + List.cons aaa xs +*/ \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/Run.golden b/crates/kind-tests/tests/suite/kdl/Run.golden new file mode 100644 index 00000000..0e702f11 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Run.golden @@ -0,0 +1,10 @@ +fun (A ) { + {A} = #2 +} + +run { + (A) +} +run { + #4 +} diff --git a/crates/kind-tests/tests/suite/kdl/Run.kind2 b/crates/kind-tests/tests/suite/kdl/Run.kind2 new file mode 100644 index 00000000..b4e34f9d --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Run.kind2 @@ -0,0 +1,13 @@ +#kdl_name = A +Ata : U60 +Ata = 2 + +#kdl_name = B +#kdl_run +Be : U60 +Be = Ata + +#kdl_name = C +#kdl_run +Ce : U60 +Ce = 4 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/Shortener.golden b/crates/kind-tests/tests/suite/kdl/Shortener.golden new file mode 100644 index 00000000..e69de29b diff --git a/crates/kind-tests/tests/suite/kdl/Shortener.kind2 b/crates/kind-tests/tests/suite/kdl/Shortener.kind2 new file mode 100644 index 00000000..7f0c6436 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/Shortener.kind2 @@ -0,0 +1,3 @@ +FunctionWithAVeryLongName : U60 { + 0 +} \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/StillCalable.golden b/crates/kind-tests/tests/suite/kdl/StillCalable.golden new file mode 100644 index 00000000..a61d2616 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/StillCalable.golden @@ -0,0 +1,4 @@ +fun (A ) { + {A} = (& (+ (B) #1) #1152921504606846975) +} + diff --git a/crates/kind-tests/tests/suite/kdl/StillCalable.kind2 b/crates/kind-tests/tests/suite/kdl/StillCalable.kind2 new file mode 100644 index 00000000..53cee51f --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/StillCalable.kind2 @@ -0,0 +1,11 @@ +#kdl_name = A +#keep +FnA { + (+ FnB 1) +} + +#kdl_name = B +#kdl_erase +FnB { + 2 +} \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/U60.golden b/crates/kind-tests/tests/suite/kdl/U60.golden new file mode 100644 index 00000000..99928f86 --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/U60.golden @@ -0,0 +1,3 @@ +run { + #2 +} diff --git a/crates/kind-tests/tests/suite/kdl/U60.kind2 b/crates/kind-tests/tests/suite/kdl/U60.kind2 new file mode 100644 index 00000000..1f6fa84c --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/U60.kind2 @@ -0,0 +1,4 @@ +#kdl_run +#keep +Main: U60 +Main = 2 \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/kdl/WithAttr.golden b/crates/kind-tests/tests/suite/kdl/WithAttr.golden new file mode 100644 index 00000000..e7df6d7c --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/WithAttr.golden @@ -0,0 +1,3 @@ +run { + #0 +} diff --git a/crates/kind-tests/tests/suite/kdl/WithAttr.kind2 b/crates/kind-tests/tests/suite/kdl/WithAttr.kind2 new file mode 100644 index 00000000..e307640e --- /dev/null +++ b/crates/kind-tests/tests/suite/kdl/WithAttr.kind2 @@ -0,0 +1,9 @@ +#kdl_state = MyFn.state +MyFn : U60 { + 1 +} + +#kdl_run +MyFn.state : U60 { + 0 +} \ No newline at end of file diff --git a/crates/kind-tests/tests/suite/lib/String.kind2 b/crates/kind-tests/tests/suite/lib/String.kind2 new file mode 100644 index 00000000..dea62404 --- /dev/null +++ b/crates/kind-tests/tests/suite/lib/String.kind2 @@ -0,0 +1,4 @@ +type String { + cons (x: U60) (xs: String) + nil +} \ No newline at end of file diff --git a/crates/kind-tree/src/lib.rs b/crates/kind-tree/src/lib.rs index ef259190..86bc7509 100644 --- a/crates/kind-tree/src/lib.rs +++ b/crates/kind-tree/src/lib.rs @@ -32,6 +32,7 @@ pub struct Attributes { pub kdl_name: Option, pub kdl_state: Option, pub trace: Option, // Some is enabled and some(true) is enabled with arguments + pub keep: bool } /// Enum of binary operators. From bd26cf3ce7ef1ec3460e2977885945caa1588aeb Mon Sep 17 00:00:00 2001 From: felipegchi Date: Tue, 29 Nov 2022 13:57:46 -0300 Subject: [PATCH 5/5] fix: change guide URLs --- crates/kind-driver/src/errors.rs | 2 +- crates/kind-query/src/errors.rs | 2 +- guide/doc_strings.md | 1 + guide/naming.md | 1 + guide/sugars.md | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 guide/doc_strings.md create mode 100644 guide/naming.md create mode 100644 guide/sugars.md diff --git a/crates/kind-driver/src/errors.rs b/crates/kind-driver/src/errors.rs index f6f39242..7320681c 100644 --- a/crates/kind-driver/src/errors.rs +++ b/crates/kind-driver/src/errors.rs @@ -61,7 +61,7 @@ impl Diagnostic for DriverError { .iter() .map(|path| Subtitle::Phrase(Color::Fst, vec![Word::White(path.display().to_string())])) .collect(), - hints: vec!["Take a look at the rules for name searching at https://kind.kindelia.org/hints/name-search".to_string()], + hints: vec!["Take a look at the rules for name searching at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string()], positions: vec![Marker { position: ident.range, color: Color::Fst, diff --git a/crates/kind-query/src/errors.rs b/crates/kind-query/src/errors.rs index baf6edce..d4d26946 100644 --- a/crates/kind-query/src/errors.rs +++ b/crates/kind-query/src/errors.rs @@ -36,7 +36,7 @@ impl Diagnostic for DriverError { suggestions.iter().map(|x| format!("'{}'", x)).collect::>().join(", ") ) } else { - "Take a look at the rules for name searching at https://kind.kindelia.org/hints/name-search".to_string() + "Take a look at the rules for name searching at https://github.com/Kindelia/Kind2/blob/master/guide/naming.md".to_string() }], positions: idents .iter() diff --git a/guide/doc_strings.md b/guide/doc_strings.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/guide/doc_strings.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/guide/naming.md b/guide/naming.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/guide/naming.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/guide/sugars.md b/guide/sugars.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/guide/sugars.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file