Commit Graph

154 Commits

Author SHA1 Message Date
Victor Taelin
0ff051b497 implement kind->js/html5 compiler, quadtrees and some other demo files and libs 2024-07-11 21:58:59 -03:00
Victor Taelin
7bd588f9b6 stuff 2024-07-11 12:41:48 -03:00
Victor Taelin
0a48196422 WIP 2024-07-11 00:50:58 -03:00
Victor Taelin
3062ce4b6e WIP, starting working with KindAI soon 2024-07-10 19:42:18 -03:00
Victor Taelin
bf2d62a572 new tld syntax 2024-07-08 18:13:17 -03:00
Victor Taelin
e20170a8bb auto fix files - sonnet 2024-07-05 13:00:18 -03:00
Victor Taelin
d409b9d5b7 U60 to U48, use let to make match expr, WIPs 2024-07-05 10:06:49 -03:00
Victor Taelin
24510cedbe WIP 2024-07-05 02:03:05 -03:00
Victor Taelin
89c6a0d155 initial syntax guide 2024-07-05 01:09:41 -03:00
Victor Taelin
1142db1144 Update ADT param syntax; update many things (WIP) 2024-07-05 00:47:13 -03:00
Victor Taelin
c6779b7581 parse _ in name, fix hole parser 2024-06-22 23:51:36 -03:00
Victor Taelin
314aaeee1c use compiled GHC checker only 2024-06-22 23:11:07 -03:00
Victor Taelin
80e3ff76c2
Merge pull request #13 from NoamDev/ascii-alternatives
Ascii alternatives to forall and lambda
2024-05-25 15:07:50 -03:00
NoamDev
b516d3b7ea Ascii alternatives to forall and lambda 2024-05-25 20:51:12 +03:00
Victor Taelin
058633c6c9 desugar match with implicit args 2024-05-24 23:40:13 -03:00
Victor Taelin
ecc1455231 Merge branch 'master' of github.com:HigherOrderCO/kind2 2024-05-19 18:10:38 -03:00
Victor Taelin
12fc18c697 fix match motive on proofs WIP 2024-05-19 18:10:31 -03:00
Yan Mendes
28e8fda2ca
Merge pull request #11 from Eduardogbg/patch-1
fix typo in equality docs
2024-05-16 14:07:53 -03:00
Yan Mendes
5e13be733c
WIP update 2024-05-15 16:57:01 -03:00
Eduardo Gomes
d84640201d
fix typo in equality docs 2024-04-18 11:21:37 -03:00
Victor Taelin
2764c4c17d
Merge pull request #8 from imaqtkatt/refactor-book
Refactor book
2024-03-22 15:38:06 -03:00
imaqtkatt
4b4b398139 Refactor String/Map functions 2024-03-22 13:23:43 -03:00
imaqtkatt
78fc259958 some fixes and add BMap data structure 2024-03-20 15:33:17 -03:00
Victor Taelin
ae64132af2 Merge branch 'master' of github.com:HigherOrderCO/kind2 2024-03-20 13:43:07 -03:00
Victor Taelin
db5856b1ef style polishments 2024-03-20 13:38:13 -03:00
Victor Taelin
9f53ef7c5e
Merge pull request #7 from LunaAmora/kind2-hvm2
Update kind2.hvm2 file and compilation
2024-03-20 12:48:14 -03:00
imaqtkatt
56ec0f7951 add more List and Nat functions 2024-03-20 12:47:25 -03:00
imaqtkatt
22c3cf42ff refactor IO and HVM 2024-03-20 10:01:34 -03:00
imaqtkatt
af0ed6bb8d refactor BBT to new syntax 2024-03-20 09:28:46 -03:00
LunaAmora
5008491fe9 Add unification polishments to kind2.hvm2 2024-03-18 17:20:39 -03:00
LunaAmora
3c89c73d2f Remove commented fn 2024-03-18 17:09:43 -03:00
LunaAmora
c2200dd30a Fix generated name on generate_check_hvm2 2024-03-18 17:09:43 -03:00
LunaAmora
bf65d89f09 Update kind2 file and compilation 2024-03-18 17:09:43 -03:00
Victor Taelin
de14d56d3d Merge branch 'master' of github.com:HigherOrderCO/kind2 2024-03-18 17:02:39 -03:00
Victor Taelin
29d8338f4a unification fine polishments - see notes
1. Previously, the following term wouldn't type-check:

      match x = term {
        true: ct
        false: cf
      }

When `term` isn't a variable.

The reason is that the `match` syntax was desugared to:

    (~term _ ct cf)

Which, in general, results in the following check:

    true : ∀(P: Bool -> *) ∀(t: P true) ∀(f: P false) (P term)

    check _  :: Bool -> *
    check ct :: (_ true)
    check cf :: (_ false)
    check () :: (_ term)

    unify (_ term) == (P term)

This should generate the solution:

    _ = λx(P x)

But, when `term` isn't a variable (it could be a function call, or a ref, for
example), this fails to satisfy the pattern unification criteria. To fix that,
we just use a `let` to always create a variable before unifying, so that the
`match` syntax is desugared to:

      let x = term
      (~x _ ct cf)

Which solves the issue.

2. Previously, the following term wouldn't type-check:

    equal (a: Nat) (b: Nat) : Bool =
      match a with (b: Nat) {
        succ: match b {
          succ: (equal a.pred b.pred)
          zero: false
        }
        zero: match b {
          succ: false
          zero: true
        }
      }

After inspecting the type-checker output, I noticed the reason is due to how the
outer hole interacts with the inner hole. Specifically, after some computations
we eventually get to the following unification problem:

    unify _2 == (_3 b)

Here, there are two ways to solve this:

    _2 = (_3 b)

    or

    _3 = λx (_2)

Initially, it seems like both solutions are equivalent. Yet, by choosing the
first, we, later on, face the following problem:

    - (_3 (succ x))
    - Bool

Which violates the pattern unification requisites (for the same reason: `succ`
is a constructor, rather than a variable). A way to solve this problem would be
to simply invert the order, and use `_3 = λx (_2)` instead (done in the last
commit). That way, we'd have `(_3 (succ x))` reduce to just `_2`, which would
solve `_2 = Bool` and type-check fine. This is a quickfix though. I wonder if
there is a more principled approach that would let us avoid `(succ x)` to be
there at all.

Debug log: https://gist.github.com/VictorTaelin/6dd1a7167d5b7c8d5626c0f5b88c75a0
2024-03-18 16:59:21 -03:00
Victor Taelin
8c8c68cce9 fix repeated meta uids across refs 2024-03-18 14:53:47 -03:00
Victor Taelin
5571be7715
Update README.md 2024-03-15 23:38:31 -03:00
Victor Taelin
c7c4a0345a
Update README.md 2024-03-15 23:38:02 -03:00
Victor Taelin
9201bebc01 first kind2-hvm2 program run! sum-tree via fold 2024-03-15 23:06:44 -03:00
Victor Taelin
70288ef011 diff savida 2024-03-15 22:07:01 -03:00
Victor Taelin
0647ea9bc7 implicits args and stuff 2024-03-15 18:51:25 -03:00
Victor Taelin
dd6706a7d5 refactored CLI - by Claude3 2024-03-14 19:33:21 -03:00
Victor Taelin
6726b552b3 Merge branch 'LunaAmora-kind2-hvm2' 2024-03-14 18:32:10 -03:00
Victor Taelin
d98da0863e Merge branch 'kind2-hvm2' of https://github.com/LunaAmora/kind2 into LunaAmora-kind2-hvm2 2024-03-14 18:32:03 -03:00
Victor Taelin
f8ab510b1e Merge branch 'master' of github.com:HigherOrderCO/kind2 2024-03-14 18:27:06 -03:00
Victor Taelin
b061e8f3a3 HVM2 compiler WIP 2024-03-14 18:26:59 -03:00
Victor Taelin
f96624ddcb rename to_hs to to_hs_checker, to differentiate between compiling to hoas checker file, and the compiler to actually run 2024-03-14 17:34:38 -03:00
Victor Taelin
c918ee680e
Merge pull request #6 from Derenash/master
Updated BBT and other functions to fit new syntax
2024-03-14 17:14:47 -03:00
Derenash
867602746d
Merge branch 'HigherOrderCO:master' into master 2024-03-14 17:11:00 -03:00
Derenash
74ee9a3c97 fix Vector.concat using switch instead of match 2024-03-14 17:08:08 -03:00