mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-10-03 18:27:13 +03:00
use-notation
Now, there are two local binders: let x = ... use x = ... The 'let' binder will create a local definition, type-check it, and assign a name to it. When compiled, it will create 'dup' nodes. The 'use' binder is just an alias. It will not bind a new variable, and, when compiled, will create inline copies. Also, for type-checking, it allows creating aliases that are definitionaly equal for the checker.
This commit is contained in:
parent
97015e9390
commit
85ad65b026
@ -9,21 +9,21 @@ BBT.balance
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λcmp λset_key λnode_key λval λlft λrgt
|
||||
let P = λx (BBT K V)
|
||||
let new = λlft.size λlft
|
||||
let P = λx (BBT K V)
|
||||
let new = λrgt.size λrgt
|
||||
let new_size = #(+ #1 (U60.max lft.size rgt.size))
|
||||
let balance = (U60.abs_diff lft.size rgt.size)
|
||||
let P = λx
|
||||
use P = λx (BBT K V)
|
||||
use new = λlft.size λlft
|
||||
use P = λx (BBT K V)
|
||||
use new = λrgt.size λrgt
|
||||
use new_size = #(+ #1 (U60.max lft.size rgt.size))
|
||||
use balance = (U60.abs_diff lft.size rgt.size)
|
||||
use P = λx
|
||||
∀(new_size: #U60)
|
||||
∀(node_key: K)
|
||||
∀(val: V)
|
||||
∀(lft: (BBT K V))
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
let true = λnew_size λnode_key λval λlft λrgt
|
||||
let P = λx
|
||||
use true = λnew_size λnode_key λval λlft λrgt
|
||||
use P = λx
|
||||
∀(K: *)
|
||||
∀(V: *)
|
||||
∀(cmp: ∀(a: K) ∀(b: K) Cmp)
|
||||
@ -34,8 +34,8 @@ BBT.balance
|
||||
∀(lft: (BBT K V))
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
let true = BBT.balance.lft_heavier
|
||||
let false = BBT.balance.rgt_heavier
|
||||
use true = BBT.balance.lft_heavier
|
||||
use false = BBT.balance.rgt_heavier
|
||||
(~(U60.to_bool #(< rgt.size lft.size))
|
||||
P
|
||||
true
|
||||
@ -50,7 +50,7 @@ BBT.balance
|
||||
lft
|
||||
rgt
|
||||
)
|
||||
let false = λnew_size λnode_key λval λlft λrgt
|
||||
use false = λnew_size λnode_key λval λlft λrgt
|
||||
(BBT.bin K V new_size node_key val lft rgt)
|
||||
(~(U60.to_bool #(> balance #1))
|
||||
P
|
||||
|
@ -10,9 +10,9 @@ BBT.balance.lft_heavier
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λcmp λnew_size λnode_key λset_key λval λlft λrgt
|
||||
let P = λx (BBT K V)
|
||||
let bin = λlft.size λlft.key λlft.val λlft.lft λlft.rgt
|
||||
let P = λx
|
||||
use P = λx (BBT K V)
|
||||
use bin = λlft.size λlft.key λlft.val λlft.lft λlft.rgt
|
||||
use P = λx
|
||||
∀(new_size: #U60)
|
||||
∀(key: K)
|
||||
∀(val: V)
|
||||
@ -22,8 +22,8 @@ BBT.balance.lft_heavier
|
||||
∀(lft.rgt: (BBT K V))
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
let true = λnew_size λkey λval λlft.key λlft.val λlft.lft λlft.rgt λrgt
|
||||
let lft = (BBT.lft_rotate
|
||||
use true = λnew_size λkey λval λlft.key λlft.val λlft.lft λlft.rgt λrgt
|
||||
use lft = (BBT.lft_rotate
|
||||
K
|
||||
V
|
||||
lft.size
|
||||
@ -33,8 +33,8 @@ BBT.balance.lft_heavier
|
||||
lft.rgt
|
||||
)
|
||||
(BBT.rgt_rotate K V new_size key val lft rgt)
|
||||
let false = λnew_size λkey λval λlft.key λlft.val λlft.lft λlft.rgt λrgt
|
||||
let lft = (BBT.bin K V lft.size lft.key lft.val lft.lft lft.rgt)
|
||||
use false = λnew_size λkey λval λlft.key λlft.val λlft.lft λlft.rgt λrgt
|
||||
use lft = (BBT.bin K V lft.size lft.key lft.val lft.lft lft.rgt)
|
||||
(BBT.rgt_rotate K V new_size key val lft rgt)
|
||||
(~(Cmp.is_gtn (cmp set_key lft.key))
|
||||
P
|
||||
@ -49,5 +49,5 @@ BBT.balance.lft_heavier
|
||||
lft.rgt
|
||||
rgt
|
||||
)
|
||||
let tip = (BBT.tip K V)
|
||||
use tip = (BBT.tip K V)
|
||||
(~lft P bin tip)
|
@ -10,9 +10,9 @@ BBT.balance.rgt_heavier
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λcmp λnew_size λnode_key λset_key λval λlft λrgt
|
||||
let P = λx (BBT K V)
|
||||
let bin = λrgt.size λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
let P = λx
|
||||
use P = λx (BBT K V)
|
||||
use bin = λrgt.size λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
use P = λx
|
||||
∀(new_size: #U60)
|
||||
∀(key: K)
|
||||
∀(val: V)
|
||||
@ -22,11 +22,11 @@ BBT.balance.rgt_heavier
|
||||
∀(rgt.lft: (BBT K V))
|
||||
∀(rgt.rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
let true = λnew_size λkey λval λlft λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
let rgt = (BBT.bin K V rgt.size rgt.key rgt.val rgt.lft rgt.rgt)
|
||||
use true = λnew_size λkey λval λlft λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
use rgt = (BBT.bin K V rgt.size rgt.key rgt.val rgt.lft rgt.rgt)
|
||||
(BBT.lft_rotate K V new_size key val lft rgt)
|
||||
let false = λnew_size λkey λval λlft λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
let rgt = (BBT.rgt_rotate
|
||||
use false = λnew_size λkey λval λlft λrgt.key λrgt.val λrgt.lft λrgt.rgt
|
||||
use rgt = (BBT.rgt_rotate
|
||||
K
|
||||
V
|
||||
rgt.size
|
||||
@ -49,5 +49,5 @@ BBT.balance.rgt_heavier
|
||||
rgt.lft
|
||||
rgt.rgt
|
||||
)
|
||||
let tip = (BBT.tip K V)
|
||||
use tip = (BBT.tip K V)
|
||||
(~rgt P bin tip)
|
@ -5,11 +5,11 @@ BBT.from_list
|
||||
∀(list: (List (Pair K V)))
|
||||
(BBT K V)
|
||||
= λK λV λcmp λlist
|
||||
let P = λx (BBT K V)
|
||||
let cons = λhead λtail
|
||||
let P = λx (BBT K V)
|
||||
let new = λkey λval
|
||||
use P = λx (BBT K V)
|
||||
use cons = λhead λtail
|
||||
use P = λx (BBT K V)
|
||||
use new = λkey λval
|
||||
(BBT.set K V cmp key val (BBT.from_list K V cmp tail))
|
||||
(~head P new)
|
||||
let nil = (BBT.tip K V)
|
||||
use nil = (BBT.tip K V)
|
||||
(~list P cons nil)
|
@ -6,13 +6,13 @@ BBT.get
|
||||
∀(map: (BBT K V))
|
||||
(Maybe V)
|
||||
= λK λV λcmp λkey λmap
|
||||
let P = λx (Maybe V)
|
||||
let bin = λ_size λnext.key λnext.val λnext.lft λnext.rgt
|
||||
let P = λx
|
||||
use P = λx (Maybe V)
|
||||
use bin = λ_size λnext.key λnext.val λnext.lft λnext.rgt
|
||||
use P = λx
|
||||
∀(cmp: ∀(a: K) ∀(b: K) Cmp) ∀(key: K) (Maybe V)
|
||||
let ltn = λcmp λkey (BBT.get K V cmp key next.lft)
|
||||
let eql = λcmp λkey (Maybe.some V next.val)
|
||||
let gtn = λcmp λkey (BBT.get K V cmp key next.rgt)
|
||||
use ltn = λcmp λkey (BBT.get K V cmp key next.lft)
|
||||
use eql = λcmp λkey (Maybe.some V next.val)
|
||||
use gtn = λcmp λkey (BBT.get K V cmp key next.rgt)
|
||||
(~(cmp key next.key) P ltn eql gtn cmp key)
|
||||
let tip = (Maybe.none V)
|
||||
use tip = (Maybe.none V)
|
||||
(~map P bin tip)
|
@ -6,35 +6,35 @@ BBT.got
|
||||
∀(map: (BBT K V))
|
||||
(Pair (Maybe V) (BBT K V))
|
||||
= λK λV λcmp λkey λmap
|
||||
let P = λx (Pair (Maybe V) (BBT K V))
|
||||
let bin = λsize λnext.key λnext.val λnext.lft λnext.rgt
|
||||
let P = λx
|
||||
use P = λx (Pair (Maybe V) (BBT K V))
|
||||
use bin = λsize λnext.key λnext.val λnext.lft λnext.rgt
|
||||
use P = λx
|
||||
∀(cmp: ∀(a: K) ∀(b: K) Cmp) ∀(key: K)
|
||||
(Pair (Maybe V) (BBT K V))
|
||||
let ltn = λcmp λkey
|
||||
let new_pair = (BBT.got K V cmp key next.lft)
|
||||
let P = λx (Pair (Maybe V) (BBT K V))
|
||||
let new = λval λlft
|
||||
let map = (BBT.bin K V size next.key next.val lft next.rgt)
|
||||
use ltn = λcmp λkey
|
||||
use new_pair = (BBT.got K V cmp key next.lft)
|
||||
use P = λx (Pair (Maybe V) (BBT K V))
|
||||
use new = λval λlft
|
||||
use map = (BBT.bin K V size next.key next.val lft next.rgt)
|
||||
(Pair.new (Maybe V) (BBT K V) val map)
|
||||
(~new_pair P new)
|
||||
let eql = λcmp λkey
|
||||
let map = (BBT.bin K V size next.key next.val next.lft next.rgt)
|
||||
use eql = λcmp λkey
|
||||
use map = (BBT.bin K V size next.key next.val next.lft next.rgt)
|
||||
(Pair.new
|
||||
(Maybe V)
|
||||
(BBT K V)
|
||||
(Maybe.some V next.val)
|
||||
map
|
||||
)
|
||||
let gtn = λcmp λkey
|
||||
let new_pair = (BBT.got K V cmp key next.rgt)
|
||||
let P = λx (Pair (Maybe V) (BBT K V))
|
||||
let new = λval λrgt
|
||||
let map = (BBT.bin K V size next.key next.val next.lft rgt)
|
||||
use gtn = λcmp λkey
|
||||
use new_pair = (BBT.got K V cmp key next.rgt)
|
||||
use P = λx (Pair (Maybe V) (BBT K V))
|
||||
use new = λval λrgt
|
||||
use map = (BBT.bin K V size next.key next.val next.lft rgt)
|
||||
(Pair.new (Maybe V) (BBT K V) val map)
|
||||
(~new_pair P new)
|
||||
(~(cmp key next.key) P ltn eql gtn cmp key)
|
||||
let tip = (Pair.new
|
||||
use tip = (Pair.new
|
||||
(Maybe V)
|
||||
(BBT K V)
|
||||
(Maybe.none V)
|
||||
|
@ -2,9 +2,9 @@ BBT.got_size
|
||||
: ∀(K: *) ∀(V: *) ∀(map: (BBT K V))
|
||||
(Pair #U60 (BBT K V))
|
||||
= λK λV λmap
|
||||
let P = λx (Pair #U60 (BBT K V))
|
||||
let bin = λsize λnext.key λnext.val λnext.lft λnext.rgt
|
||||
let map = (BBT.bin K V size next.key next.val next.lft next.rgt)
|
||||
use P = λx (Pair #U60 (BBT K V))
|
||||
use bin = λsize λnext.key λnext.val λnext.lft λnext.rgt
|
||||
use map = (BBT.bin K V size next.key next.val next.lft next.rgt)
|
||||
(Pair.new #U60 (BBT K V) size map)
|
||||
let tip = (Pair.new #U60 (BBT K V) #0 (BBT.tip K V))
|
||||
use tip = (Pair.new #U60 (BBT K V) #0 (BBT.tip K V))
|
||||
(~map P bin tip)
|
@ -6,12 +6,12 @@ BBT.has
|
||||
∀(map: (BBT K V))
|
||||
Bool
|
||||
= λK λV λcmp λkey λmap
|
||||
let P = λx Bool
|
||||
let bin = λnext.size λnext.key λnext.val λnext.lft λnext.rgt
|
||||
let P = λx ∀(cmp: ∀(a: K) ∀(b: K) Cmp) ∀(key: K) Bool
|
||||
let ltn = λcmp λkey (BBT.has K V cmp key next.lft)
|
||||
let eql = λcmp λkey Bool.true
|
||||
let gtn = λcmp λkey (BBT.has K V cmp key next.rgt)
|
||||
use P = λx Bool
|
||||
use bin = λnext.size λnext.key λnext.val λnext.lft λnext.rgt
|
||||
use P = λx ∀(cmp: ∀(a: K) ∀(b: K) Cmp) ∀(key: K) Bool
|
||||
use ltn = λcmp λkey (BBT.has K V cmp key next.lft)
|
||||
use eql = λcmp λkey Bool.true
|
||||
use gtn = λcmp λkey (BBT.has K V cmp key next.rgt)
|
||||
(~(cmp key next.key) P ltn eql gtn cmp key)
|
||||
let tip = Bool.false
|
||||
use tip = Bool.false
|
||||
(~map P bin tip)
|
@ -6,31 +6,31 @@ BBT.has.linear
|
||||
∀(map: (BBT K V))
|
||||
(Pair Bool (BBT K V))
|
||||
= λK λV λcmp λkey λmap
|
||||
let P = λx (Pair Bool (BBT K V))
|
||||
let bin = λsize λnode_key λval λlft λrgt
|
||||
let P = λx
|
||||
use P = λx (Pair Bool (BBT K V))
|
||||
use bin = λsize λnode_key λval λlft λrgt
|
||||
use P = λx
|
||||
∀(cmp: ∀(a: K) ∀(b: K) Cmp)
|
||||
∀(key: K)
|
||||
∀(lft: (BBT K V))
|
||||
∀(rgt: (BBT K V))
|
||||
(Pair Bool (BBT K V))
|
||||
let ltn = λcmp λsize λhas_key λval λlft λrgt λhas_key
|
||||
let P = λx (Pair Bool (BBT K V))
|
||||
let new = λbool λlft
|
||||
let map = (BBT.bin K V size node_key val lft rgt)
|
||||
use ltn = λcmp λsize λhas_key λval λlft λrgt λhas_key
|
||||
use P = λx (Pair Bool (BBT K V))
|
||||
use new = λbool λlft
|
||||
use map = (BBT.bin K V size node_key val lft rgt)
|
||||
(Pair.new Bool (BBT K V) bool map)
|
||||
(~(BBT.has.linear K V cmp has_key lft) P new)
|
||||
let eql = λcmp λsize λkey λval λlft λrgt λhas_key
|
||||
use eql = λcmp λsize λkey λval λlft λrgt λhas_key
|
||||
(Pair.new
|
||||
Bool
|
||||
(BBT K V)
|
||||
Bool.true
|
||||
(BBT.bin K V size node_key val lft rgt)
|
||||
)
|
||||
let gtn = λcmp λsize λkey λval λlft λrgt λhas_key
|
||||
let P = λx (Pair Bool (BBT K V))
|
||||
let new = λbool λrgt
|
||||
let map = (BBT.bin K V size node_key val lft rgt)
|
||||
use gtn = λcmp λsize λkey λval λlft λrgt λhas_key
|
||||
use P = λx (Pair Bool (BBT K V))
|
||||
use new = λbool λrgt
|
||||
use map = (BBT.bin K V size node_key val lft rgt)
|
||||
(Pair.new Bool (BBT K V) bool rgt)
|
||||
(~(BBT.has.linear K V cmp has_key rgt) P new)
|
||||
(~(cmp key node_key)
|
||||
@ -46,5 +46,5 @@ BBT.has.linear
|
||||
rgt
|
||||
key
|
||||
)
|
||||
let tip = (Pair.new Bool (BBT K V) Bool.false (BBT.tip K V))
|
||||
use tip = (Pair.new Bool (BBT K V) Bool.false (BBT.tip K V))
|
||||
(~map P bin tip)
|
@ -8,11 +8,11 @@ BBT.lft_rotate
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λsize λkey λval λlft λrgt
|
||||
let P = λx ∀(key: K) ∀(val: V) ∀(lft: (BBT K V)) (BBT K V)
|
||||
let bin = λ_size λrgt.key λrgt.val λrgt.lft λrgt.rgt λkey λval λlft
|
||||
let b = (BBT.new_node K V key val lft rgt.lft)
|
||||
let a = (BBT.new_node K V rgt.key rgt.val b rgt.rgt)
|
||||
use P = λx ∀(key: K) ∀(val: V) ∀(lft: (BBT K V)) (BBT K V)
|
||||
use bin = λ_size λrgt.key λrgt.val λrgt.lft λrgt.rgt λkey λval λlft
|
||||
use b = (BBT.new_node K V key val lft rgt.lft)
|
||||
use a = (BBT.new_node K V rgt.key rgt.val b rgt.rgt)
|
||||
a
|
||||
let tip = λkey λval λlft
|
||||
use tip = λkey λval λlft
|
||||
(BBT.bin K V size key val lft (BBT.tip K V))
|
||||
(~rgt P bin tip key val lft)
|
@ -7,11 +7,11 @@ BBT.new_node
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λkey λval λlft λrgt
|
||||
let P = λx (BBT K V)
|
||||
let new = λlft.size λlft
|
||||
let P = λx (BBT K V)
|
||||
let new = λrgt.size λrgt
|
||||
let new_size = #(+ #1 (U60.max rgt.size lft.size))
|
||||
use P = λx (BBT K V)
|
||||
use new = λlft.size λlft
|
||||
use P = λx (BBT K V)
|
||||
use new = λrgt.size λrgt
|
||||
use new_size = #(+ #1 (U60.max rgt.size lft.size))
|
||||
(BBT.bin K V new_size key val lft rgt)
|
||||
(~(BBT.got_size K V rgt) P new)
|
||||
(~(BBT.got_size K V lft) P new)
|
@ -8,11 +8,11 @@ BBT.rgt_rotate
|
||||
∀(rgt: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λsize λkey λval λlft λrgt
|
||||
let P = λx ∀(key: K) ∀(val: V) ∀(rgt: (BBT K V)) (BBT K V)
|
||||
let bin = λ_size λlft.key λlft.val λlft.lft λlft.rgt λkey λval λrgt
|
||||
let b = (BBT.new_node K V key val lft.rgt rgt)
|
||||
let a = (BBT.new_node K V lft.key lft.val lft.lft b)
|
||||
use P = λx ∀(key: K) ∀(val: V) ∀(rgt: (BBT K V)) (BBT K V)
|
||||
use bin = λ_size λlft.key λlft.val λlft.lft λlft.rgt λkey λval λrgt
|
||||
use b = (BBT.new_node K V key val lft.rgt rgt)
|
||||
use a = (BBT.new_node K V lft.key lft.val lft.lft b)
|
||||
a
|
||||
let tip = λkey λval λrgt
|
||||
use tip = λkey λval λrgt
|
||||
(BBT.bin K V size key val (BBT.tip K V) rgt)
|
||||
(~lft P bin tip key val rgt)
|
@ -7,9 +7,9 @@ BBT.set
|
||||
∀(map: (BBT K V))
|
||||
(BBT K V)
|
||||
= λK λV λcmp λkey λval λmap
|
||||
let P = λx ∀(key: K) ∀(val: V) (BBT K V)
|
||||
let bin = λsize λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
let P = λx
|
||||
use P = λx ∀(key: K) ∀(val: V) (BBT K V)
|
||||
use bin = λsize λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
use P = λx
|
||||
∀(key: K)
|
||||
∀(next.key: K)
|
||||
∀(next.val: V)
|
||||
@ -18,8 +18,8 @@ BBT.set
|
||||
∀(key: K)
|
||||
∀(val: V)
|
||||
(BBT K V)
|
||||
let ltn = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
let new_lft = (BBT.set K V cmp key val next.lft)
|
||||
use ltn = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
use new_lft = (BBT.set K V cmp key val next.lft)
|
||||
(BBT.balance
|
||||
K
|
||||
V
|
||||
@ -30,10 +30,10 @@ BBT.set
|
||||
new_lft
|
||||
next.rgt
|
||||
)
|
||||
let eql = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
use eql = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
(BBT.bin K V size next.key val next.lft next.rgt)
|
||||
let gtn = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
let new_rgt = (BBT.set K V cmp key val next.rgt)
|
||||
use gtn = λkey λnext.key λnext.val λnext.lft λnext.rgt λkey λval
|
||||
use new_rgt = (BBT.set K V cmp key val next.rgt)
|
||||
(BBT.balance
|
||||
K
|
||||
V
|
||||
@ -57,5 +57,5 @@ BBT.set
|
||||
key
|
||||
val
|
||||
)
|
||||
let tip = λkey λval (BBT.singleton K V key val)
|
||||
use tip = λkey λval (BBT.singleton K V key val)
|
||||
(~map P bin tip key val)
|
@ -2,16 +2,16 @@ BBT.to_list
|
||||
: ∀(K: *) ∀(V: *) ∀(map: (BBT K V))
|
||||
(List (Pair K V))
|
||||
= λK λV λmap
|
||||
let P = λx (List (Pair K V))
|
||||
let bin = λsize λkey λval λlft λrgt
|
||||
let lft = (BBT.to_list K V lft)
|
||||
let rgt = (BBT.to_list K V rgt)
|
||||
let pair = (Pair.new K V key val)
|
||||
let list = (List.cons
|
||||
use P = λx (List (Pair K V))
|
||||
use bin = λsize λkey λval λlft λrgt
|
||||
use lft = (BBT.to_list K V lft)
|
||||
use rgt = (BBT.to_list K V rgt)
|
||||
use pair = (Pair.new K V key val)
|
||||
use list = (List.cons
|
||||
(Pair K V)
|
||||
pair
|
||||
(List.concat (Pair K V) lft rgt)
|
||||
)
|
||||
list
|
||||
let tip = (List.nil (Pair K V))
|
||||
use tip = (List.nil (Pair K V))
|
||||
(~map P bin tip)
|
@ -1,7 +1,7 @@
|
||||
Bool.and
|
||||
: ∀(a: Bool) ∀(b: Bool) Bool
|
||||
= λa
|
||||
let P = λa ∀(b: Bool) Bool
|
||||
let true = λb b
|
||||
let false = λb Bool.false
|
||||
use P = λa ∀(b: Bool) Bool
|
||||
use true = λb b
|
||||
use false = λb Bool.false
|
||||
(~a P true false)
|
@ -1,7 +1,7 @@
|
||||
Bool.not
|
||||
: ∀(x: Bool) Bool
|
||||
= λx
|
||||
let P = {λx Bool:_}
|
||||
let true = {Bool.false:_}
|
||||
let false = {Nat.zero:_}
|
||||
use P = λx Bool
|
||||
use true = {Bool.false:_}
|
||||
use false = {Bool.true:_}
|
||||
(~x P true false)
|
@ -1,7 +1,7 @@
|
||||
Bool.or
|
||||
: ∀(a: Bool) ∀(b: Bool) Bool
|
||||
= λa
|
||||
let P = λa ∀(b: Bool) Bool
|
||||
let true = λb Bool.true
|
||||
let false = λb b
|
||||
use P = λa ∀(b: Bool) Bool
|
||||
use true = λb Bool.true
|
||||
use false = λb b
|
||||
(~a P true false)
|
@ -1,7 +1,7 @@
|
||||
Bool.show
|
||||
: ∀(x: Bool) String
|
||||
= λx
|
||||
let P = λx String
|
||||
let true = "true"
|
||||
let false = "false"
|
||||
use P = λx String
|
||||
use true = "true"
|
||||
use false = "false"
|
||||
(~x P true false)
|
@ -1,7 +0,0 @@
|
||||
CNat
|
||||
: *
|
||||
= $(self: CNat)
|
||||
∀(P: ∀(x: CNat) *)
|
||||
∀(s: ∀(i: (P self)) (P (CNat.succ i)))
|
||||
∀(z: (P CNat.zero))
|
||||
(P self)
|
@ -1,3 +0,0 @@
|
||||
CNat.succ
|
||||
: ∀(n: CNat) CNat
|
||||
= λn ~λP λs λz (s (n P s z))
|
@ -1,3 +0,0 @@
|
||||
CNat.zero
|
||||
: CNat
|
||||
= ~λP λs λz z
|
@ -1,8 +1,8 @@
|
||||
Cmp.is_gtn
|
||||
: ∀(cmp: Cmp) Bool
|
||||
= λcmp
|
||||
let P = λx Bool
|
||||
let ltn = Bool.false
|
||||
let eql = Bool.false
|
||||
let gtn = Bool.true
|
||||
use P = λx Bool
|
||||
use ltn = Bool.false
|
||||
use eql = Bool.false
|
||||
use gtn = Bool.true
|
||||
(~cmp P ltn eql gtn)
|
@ -1,8 +1,8 @@
|
||||
HVM.print.many
|
||||
: ∀(A: *) ∀(msgs: (List String)) ∀(ret: A) A
|
||||
= λA λmsgs λret
|
||||
let P = λx A
|
||||
let cons = λmsg λmsgs
|
||||
use P = λx A
|
||||
use cons = λmsg λmsgs
|
||||
(HVM.print A msg (HVM.print.many A msgs ret))
|
||||
let nil = ret
|
||||
use nil = ret
|
||||
(~msgs P cons nil)
|
@ -5,17 +5,17 @@ IO.bind
|
||||
∀(b: ∀(x: A) (IO B))
|
||||
(IO B)
|
||||
= λA λB λa λb
|
||||
let P = λx ∀(b: ∀(x: A) (IO B)) (IO B)
|
||||
let print = λtext λthen λb
|
||||
use P = λx ∀(b: ∀(x: A) (IO B)) (IO B)
|
||||
use print = λtext λthen λb
|
||||
(IO.print B text λx (IO.bind A B (then x) b))
|
||||
let load = λfile λthen λb
|
||||
use load = λfile λthen λb
|
||||
(IO.load B file λs (IO.bind A B (then s) b))
|
||||
let save = λfile λdata λthen λb
|
||||
use save = λfile λdata λthen λb
|
||||
(IO.save
|
||||
B
|
||||
file
|
||||
data
|
||||
λx (IO.bind A B (then Unit.one) b)
|
||||
)
|
||||
let done = λterm λb (b term)
|
||||
use done = λterm λb (b term)
|
||||
(~a P print load save done b)
|
@ -1,12 +1,12 @@
|
||||
IO.run
|
||||
: ∀(A: *) ∀(x: (IO A)) (IO A)
|
||||
= λA λx
|
||||
let P = λx (IO A)
|
||||
let print = λtext λthen
|
||||
use P = λx (IO A)
|
||||
use print = λtext λthen
|
||||
(HVM.print (IO A) text (IO.run A (then Unit.one)))
|
||||
let load = λfile λthen
|
||||
use load = λfile λthen
|
||||
(HVM.load (IO A) file λs (IO.run A (then s)))
|
||||
let save = λfile λdata λthen
|
||||
use save = λfile λdata λthen
|
||||
(HVM.save (IO A) file data (IO.run A (then Unit.one)))
|
||||
let done = λterm (IO.done A term)
|
||||
use done = λterm (IO.done A term)
|
||||
(~x P print load save done)
|
@ -1,7 +1,7 @@
|
||||
Kind.API.check.done
|
||||
: ∀(result: (Maybe Kind.Term)) (IO Unit)
|
||||
= λresult
|
||||
let P = λx (IO Unit)
|
||||
let some = λvalue (IO.print.do "check")
|
||||
let none = (IO.print.do "error")
|
||||
use P = λx (IO Unit)
|
||||
use some = λvalue (IO.print.do "check")
|
||||
use none = (IO.print.do "error")
|
||||
(~result P some none)
|
@ -2,14 +2,14 @@ Kind.Book.get_refs.go
|
||||
: ∀(book: (List (Pair String Kind.Term)))
|
||||
(List.Concatenator String)
|
||||
= λbook
|
||||
let P = λx (List.Concatenator String)
|
||||
let cons = λhead λtail
|
||||
let P = λx (List.Concatenator String)
|
||||
let new = λhead.fst λhead.snd λnil
|
||||
use P = λx (List.Concatenator String)
|
||||
use cons = λhead λtail
|
||||
use P = λx (List.Concatenator String)
|
||||
use new = λhead.fst λhead.snd λnil
|
||||
(Kind.Term.get_refs.go
|
||||
head.snd
|
||||
(Kind.Book.get_refs.go tail nil)
|
||||
)
|
||||
(~head P new)
|
||||
let nil = λnil nil
|
||||
use nil = λnil nil
|
||||
(~book P cons nil)
|
@ -1,7 +1,7 @@
|
||||
Kind.Book.parse
|
||||
: ∀(code: String) Kind.Book
|
||||
= λcode
|
||||
let P = λx Kind.Book
|
||||
let done = λcode λbook book
|
||||
let fail = λerror (String.Map.new Kind.Term)
|
||||
use P = λx Kind.Book
|
||||
use done = λcode λbook book
|
||||
use fail = λerror (String.Map.new Kind.Term)
|
||||
(~(Kind.Book.parser code) P done fail)
|
@ -5,9 +5,9 @@ Kind.Book.parser
|
||||
Kind.Book
|
||||
Parser.is_eof
|
||||
λis_eof
|
||||
let P = λx (Parser Kind.Book)
|
||||
let true = (Parser.pure Kind.Book (String.Map.new Kind.Term))
|
||||
let false = (Parser.bind
|
||||
use P = λx (Parser Kind.Book)
|
||||
use true = (Parser.pure Kind.Book (String.Map.new Kind.Term))
|
||||
use false = (Parser.bind
|
||||
String
|
||||
Kind.Book
|
||||
Parser.name
|
||||
@ -17,8 +17,8 @@ Kind.Book.parser
|
||||
Kind.Book
|
||||
(Parser.skip Bool (Parser.test ":"))
|
||||
λann
|
||||
let P = λx (Parser Kind.Book)
|
||||
let true = (Parser.bind
|
||||
use P = λx (Parser Kind.Book)
|
||||
use true = (Parser.bind
|
||||
Unit
|
||||
Kind.Book
|
||||
(Parser.text ":")
|
||||
@ -60,7 +60,7 @@ Kind.Book.parser
|
||||
)
|
||||
)
|
||||
)
|
||||
let false = (Parser.bind
|
||||
use false = (Parser.bind
|
||||
Unit
|
||||
Kind.Book
|
||||
(Parser.text "=")
|
||||
|
@ -2,10 +2,10 @@ Kind.Book.show.go
|
||||
: ∀(book: (List (Pair String Kind.Term)))
|
||||
String.Concatenator
|
||||
= λbook
|
||||
let P = λx String.Concatenator
|
||||
let cons = λhead λtail
|
||||
let P = λx String.Concatenator
|
||||
let new = λhead.fst λhead.snd λnil
|
||||
use P = λx String.Concatenator
|
||||
use cons = λhead λtail
|
||||
use P = λx String.Concatenator
|
||||
use new = λhead.fst λhead.snd λnil
|
||||
(Kind.Text.show.go
|
||||
head.fst
|
||||
(Kind.Text.show.go
|
||||
@ -21,5 +21,5 @@ Kind.Book.show.go
|
||||
)
|
||||
)
|
||||
(~head P new)
|
||||
let nil = λnil nil
|
||||
use nil = λnil nil
|
||||
(~book P cons nil)
|
@ -1,8 +1,8 @@
|
||||
Kind.Oper.parser
|
||||
: (Parser Kind.Oper)
|
||||
= let TRY = (List.cons (Parser.Guard Kind.Oper))
|
||||
let END = (List.nil (Parser.Guard Kind.Oper))
|
||||
let OP2 = {λsym λoper
|
||||
= use TRY = (List.cons (Parser.Guard Kind.Oper))
|
||||
use END = (List.nil (Parser.Guard Kind.Oper))
|
||||
use OP2 = {λsym λoper
|
||||
(Parser.Guard.text
|
||||
Kind.Oper
|
||||
sym
|
||||
|
@ -1,23 +1,23 @@
|
||||
Kind.Oper.show.go
|
||||
: ∀(oper: Kind.Oper) String.Concatenator
|
||||
= λoper
|
||||
let P = λX String.Concatenator
|
||||
let add = (Kind.Text.show.go "+")
|
||||
let mul = (Kind.Text.show.go "*")
|
||||
let sub = (Kind.Text.show.go "-")
|
||||
let div = (Kind.Text.show.go "/")
|
||||
let mod = (Kind.Text.show.go "%")
|
||||
let eq = (Kind.Text.show.go "==")
|
||||
let ne = (Kind.Text.show.go "!=")
|
||||
let lt = (Kind.Text.show.go "<")
|
||||
let gt = (Kind.Text.show.go ">")
|
||||
let lte = (Kind.Text.show.go "<=")
|
||||
let gte = (Kind.Text.show.go ">=")
|
||||
let and = (Kind.Text.show.go "&")
|
||||
let or = (Kind.Text.show.go "|")
|
||||
let xor = (Kind.Text.show.go "^")
|
||||
let lsh = (Kind.Text.show.go "<<")
|
||||
let rsh = (Kind.Text.show.go ">>")
|
||||
use P = λX String.Concatenator
|
||||
use add = (Kind.Text.show.go "+")
|
||||
use mul = (Kind.Text.show.go "*")
|
||||
use sub = (Kind.Text.show.go "-")
|
||||
use div = (Kind.Text.show.go "/")
|
||||
use mod = (Kind.Text.show.go "%")
|
||||
use eq = (Kind.Text.show.go "==")
|
||||
use ne = (Kind.Text.show.go "!=")
|
||||
use lt = (Kind.Text.show.go "<")
|
||||
use gt = (Kind.Text.show.go ">")
|
||||
use lte = (Kind.Text.show.go "<=")
|
||||
use gte = (Kind.Text.show.go ">=")
|
||||
use and = (Kind.Text.show.go "&")
|
||||
use or = (Kind.Text.show.go "|")
|
||||
use xor = (Kind.Text.show.go "^")
|
||||
use lsh = (Kind.Text.show.go "<<")
|
||||
use rsh = (Kind.Text.show.go ">>")
|
||||
(~oper
|
||||
P
|
||||
add
|
||||
|
@ -1,9 +1,9 @@
|
||||
Kind.Scope.find
|
||||
: ∀(nam: String) ∀(scp: Kind.Scope) Kind.Term
|
||||
= λname λscope
|
||||
let cond = λbnd (~bnd λx Bool λn λt (String.equal name n))
|
||||
let found = (List.find Kind.Binder cond scope)
|
||||
let P = λx Kind.Term
|
||||
let some = λbnd (~bnd λx Kind.Term λn λt t)
|
||||
let none = (Kind.ref name Kind.set)
|
||||
use cond = λbnd (~bnd λx Bool λn λt (String.equal name n))
|
||||
use found = (List.find Kind.Binder cond scope)
|
||||
use P = λx Kind.Term
|
||||
use some = λbnd (~bnd λx Kind.Term λn λt t)
|
||||
use none = (Kind.ref name Kind.set)
|
||||
(~found P some none)
|
@ -1,42 +1,42 @@
|
||||
Kind.Term.get_refs.go
|
||||
: ∀(term: Kind.Term) (List.Concatenator String)
|
||||
= λterm
|
||||
let P = λx (List.Concatenator String)
|
||||
let all = λnam λinp λbod λnil
|
||||
use P = λx (List.Concatenator String)
|
||||
use all = λnam λinp λbod λnil
|
||||
(Kind.Term.get_refs.go
|
||||
inp
|
||||
(Kind.Term.get_refs.go (bod Kind.set) nil)
|
||||
)
|
||||
let lam = λnam λbod λnil
|
||||
use lam = λnam λbod λnil
|
||||
(Kind.Term.get_refs.go (bod Kind.set) nil)
|
||||
let app = λfun λarg λnil
|
||||
use app = λfun λarg λnil
|
||||
(Kind.Term.get_refs.go
|
||||
fun
|
||||
(Kind.Term.get_refs.go arg nil)
|
||||
)
|
||||
let ann = λval λtyp λnil
|
||||
use ann = λval λtyp λnil
|
||||
(Kind.Term.get_refs.go
|
||||
val
|
||||
(Kind.Term.get_refs.go typ nil)
|
||||
)
|
||||
let slf = λnam λbod λnil
|
||||
use slf = λnam λbod λnil
|
||||
(Kind.Term.get_refs.go (bod Kind.set) nil)
|
||||
let ins = λval λnil (Kind.Term.get_refs.go val nil)
|
||||
let ref = λnam λval λnil (List.cons String nam nil)
|
||||
let def = λnam λval λbod λnil
|
||||
use ins = λval λnil (Kind.Term.get_refs.go val nil)
|
||||
use ref = λnam λval λnil (List.cons String nam nil)
|
||||
use def = λnam λval λbod λnil
|
||||
(Kind.Term.get_refs.go
|
||||
val
|
||||
(Kind.Term.get_refs.go (bod Kind.set) nil)
|
||||
)
|
||||
let set = λnil nil
|
||||
let u60 = λnil nil
|
||||
let num = λval λnil nil
|
||||
let op2 = λopr λfst λsnd λnil
|
||||
use set = λnil nil
|
||||
use u60 = λnil nil
|
||||
use num = λval λnil nil
|
||||
use op2 = λopr λfst λsnd λnil
|
||||
(Kind.Term.get_refs.go
|
||||
fst
|
||||
(Kind.Term.get_refs.go snd nil)
|
||||
)
|
||||
let mat = λnam λx λz λs λp λnil
|
||||
use mat = λnam λx λz λs λp λnil
|
||||
(Kind.Term.get_refs.go
|
||||
x
|
||||
(Kind.Term.get_refs.go
|
||||
@ -47,9 +47,9 @@ Kind.Term.get_refs.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let txt = λtext λnil nil
|
||||
let hol = λnam λctx λnil nil
|
||||
let var = λnam λidx λnil nil
|
||||
use txt = λtext λnil nil
|
||||
use hol = λnam λctx λnil nil
|
||||
use var = λnam λidx λnil nil
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -1,7 +1,7 @@
|
||||
Kind.Term.parse
|
||||
: ∀(code: String) Kind.Term
|
||||
= λcode
|
||||
let P = λx Kind.Term
|
||||
let done = λcode λterm (term (List.nil Kind.Binder))
|
||||
let fail = λerror (Kind.hol "error" (List.nil Kind.Term))
|
||||
use P = λx Kind.Term
|
||||
use done = λcode λterm (term (List.nil Kind.Binder))
|
||||
use fail = λerror (Kind.hol "error" (List.nil Kind.Term))
|
||||
(~(Kind.Term.parser code) P done fail)
|
@ -2,10 +2,10 @@ Kind.Term.parser.def
|
||||
: (Parser.Guard Kind.PreTerm)
|
||||
= (Parser.Guard.text
|
||||
Kind.PreTerm
|
||||
"let "
|
||||
"use "
|
||||
(Kind.Term.parser.bind
|
||||
Unit
|
||||
(Parser.text "let ")
|
||||
(Parser.text "use ")
|
||||
λ_
|
||||
(Kind.Term.parser.bind
|
||||
String
|
||||
|
@ -1,7 +1,7 @@
|
||||
Kind.Term.parser
|
||||
: (Parser Kind.PreTerm)
|
||||
= let TRY = (List.cons (Parser.Guard Kind.PreTerm))
|
||||
let END = (List.nil (Parser.Guard Kind.PreTerm))
|
||||
= use TRY = (List.cons (Parser.Guard Kind.PreTerm))
|
||||
use END = (List.nil (Parser.Guard Kind.PreTerm))
|
||||
(Parser.variant
|
||||
Kind.PreTerm
|
||||
(TRY
|
||||
|
@ -1,8 +1,8 @@
|
||||
Kind.Term.show.go
|
||||
: ∀(term: Kind.Term) ∀(dep: Nat) String.Concatenator
|
||||
= λterm λdep
|
||||
let P = λX String.Concatenator
|
||||
let all = λnam λinp λbod λnil
|
||||
use P = λX String.Concatenator
|
||||
use all = λnam λinp λbod λnil
|
||||
(Kind.Text.show.go
|
||||
"∀("
|
||||
(Kind.Text.show.go
|
||||
@ -24,7 +24,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let lam = λnam λbod λnil
|
||||
use lam = λnam λbod λnil
|
||||
(Kind.Text.show.go
|
||||
"λ"
|
||||
(Kind.Text.show.go
|
||||
@ -39,7 +39,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let app = λfun λarg λnil
|
||||
use app = λfun λarg λnil
|
||||
(Kind.Text.show.go
|
||||
"("
|
||||
(Kind.Term.show.go
|
||||
@ -51,7 +51,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let ann = λval λtyp λnil
|
||||
use ann = λval λtyp λnil
|
||||
(Kind.Text.show.go
|
||||
"{"
|
||||
(Kind.Term.show.go
|
||||
@ -63,7 +63,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let slf = λnam λbod λnil
|
||||
use slf = λnam λbod λnil
|
||||
(Kind.Text.show.go
|
||||
"$"
|
||||
(Kind.Text.show.go
|
||||
@ -78,12 +78,12 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let ins = λval λnil
|
||||
use ins = λval λnil
|
||||
(Kind.Text.show.go "~" (Kind.Term.show.go val dep nil))
|
||||
let ref = λnam λval λnil (Kind.Text.show.go nam nil)
|
||||
let def = λnam λval λbod λnil
|
||||
use ref = λnam λval λnil (Kind.Text.show.go nam nil)
|
||||
use def = λnam λval λbod λnil
|
||||
(Kind.Text.show.go
|
||||
"let "
|
||||
"use "
|
||||
(Kind.Text.show.go
|
||||
nam
|
||||
(Kind.Text.show.go
|
||||
@ -103,10 +103,10 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let set = λnil (Kind.Text.show.go "*" nil)
|
||||
let u60 = λnil (Kind.Text.show.go "#U60" nil)
|
||||
let num = λval λnil (Kind.Text.show.go "#" (U60.show.go val nil))
|
||||
let op2 = λopr λfst λsnd λnil
|
||||
use set = λnil (Kind.Text.show.go "*" nil)
|
||||
use u60 = λnil (Kind.Text.show.go "#U60" nil)
|
||||
use num = λval λnil (Kind.Text.show.go "#" (U60.show.go val nil))
|
||||
use op2 = λopr λfst λsnd λnil
|
||||
(Kind.Text.show.go
|
||||
"#("
|
||||
(Kind.Oper.show.go
|
||||
@ -124,7 +124,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let mat = λnam λx λz λs λp λnil
|
||||
use mat = λnam λx λz λs λp λnil
|
||||
(Kind.Text.show.go
|
||||
"#match "
|
||||
(Kind.Text.show.go
|
||||
@ -160,7 +160,7 @@ Kind.Term.show.go
|
||||
)
|
||||
)
|
||||
)
|
||||
let txt = λtext λnil
|
||||
use txt = λtext λnil
|
||||
(Kind.Text.show.go
|
||||
String.quote
|
||||
(Kind.Text.show.go
|
||||
@ -168,9 +168,9 @@ Kind.Term.show.go
|
||||
(Kind.Text.show.go String.quote nil)
|
||||
)
|
||||
)
|
||||
let hol = λnam λctx λnil
|
||||
use hol = λnam λctx λnil
|
||||
(Kind.Text.show.go "?" (Kind.Text.show.go nam nil))
|
||||
let var = λnam λidx λnil (Kind.Text.show.go nam nil)
|
||||
use var = λnam λidx λnil (Kind.Text.show.go nam nil)
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -2,38 +2,38 @@ Kind.check
|
||||
: ∀(term: Kind.Term) ∀(type: Kind.Term) ∀(dep: Nat)
|
||||
(Maybe Kind.Term)
|
||||
= λterm λtype λdep
|
||||
let bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
let pure = (Maybe.some Kind.Term)
|
||||
let none = (Maybe.none Kind.Term)
|
||||
let P = λx ∀(type: Kind.Term) ∀(dep: Nat) (Maybe Kind.Term)
|
||||
let all = λterm.nam λterm.inp λterm.bod λtype λdep
|
||||
use bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
use pure = (Maybe.some Kind.Term)
|
||||
use none = (Maybe.none Kind.Term)
|
||||
use P = λx ∀(type: Kind.Term) ∀(dep: Nat) (Maybe Kind.Term)
|
||||
use all = λterm.nam λterm.inp λterm.bod λtype λdep
|
||||
(Kind.verify
|
||||
(Kind.all term.nam term.inp term.bod)
|
||||
type
|
||||
dep
|
||||
)
|
||||
let lam = λterm.nam λterm.bod λtype λdep
|
||||
use lam = λterm.nam λterm.bod λtype λdep
|
||||
(Kind.if.all
|
||||
(Kind.reduce Bool.true type)
|
||||
∀(dep: Nat) ∀(term.bod: ∀(x: Kind.Term) Kind.Term)
|
||||
(Maybe Kind.Term)
|
||||
λtype.nam λtype.inp λtype.bod λdep λterm.bod
|
||||
let ann = (Kind.ann (Kind.var term.nam dep) type.inp)
|
||||
let term = (term.bod ann)
|
||||
let type = (type.bod ann)
|
||||
use ann = (Kind.ann (Kind.var term.nam dep) type.inp)
|
||||
use term = (term.bod ann)
|
||||
use type = (type.bod ann)
|
||||
(Kind.check term type (Nat.succ dep))
|
||||
λtype λdep λterm.bod
|
||||
(Kind.infer (Kind.lam term.nam term.bod) dep)
|
||||
dep
|
||||
term.bod
|
||||
)
|
||||
let app = λterm.fun λterm.arg λtype λdep
|
||||
use app = λterm.fun λterm.arg λtype λdep
|
||||
(Kind.verify (Kind.app term.fun term.arg) type dep)
|
||||
let ann = λval λtyp λtype λdep
|
||||
use ann = λval λtyp λtype λdep
|
||||
(Kind.verify (Kind.ann val typ) type dep)
|
||||
let slf = λterm.nam λterm.bod λtype λdep
|
||||
use slf = λterm.nam λterm.bod λtype λdep
|
||||
(Kind.verify (Kind.slf term.nam term.bod) type dep)
|
||||
let ins = λterm.val λtype λdep
|
||||
use ins = λterm.val λtype λdep
|
||||
(Kind.if.slf
|
||||
(Kind.reduce Bool.true type)
|
||||
∀(term.val: Kind.Term) (Maybe Kind.Term)
|
||||
@ -42,30 +42,30 @@ Kind.check
|
||||
λtype λterm.val (Kind.infer (Kind.ins term.val) dep)
|
||||
term.val
|
||||
)
|
||||
let ref = λterm.nam λterm.val λtype λdep
|
||||
use ref = λterm.nam λterm.val λtype λdep
|
||||
(Kind.check term.val type dep)
|
||||
let def = λterm.nam λterm.val λterm.bod λtype λdep
|
||||
use def = λterm.nam λterm.val λterm.bod λtype λdep
|
||||
(Kind.check (term.bod term.val) type (Nat.succ dep))
|
||||
let set = λtype λdep (Kind.verify Kind.set type dep)
|
||||
let u60 = λtype λdep (Kind.verify Kind.u60 type dep)
|
||||
let num = λterm.num λtype λdep
|
||||
use set = λtype λdep (Kind.verify Kind.set type dep)
|
||||
use u60 = λtype λdep (Kind.verify Kind.u60 type dep)
|
||||
use num = λterm.num λtype λdep
|
||||
(Kind.verify (Kind.num term.num) type dep)
|
||||
let op2 = λterm.opr λterm.fst λterm.snd λtype λdep
|
||||
use op2 = λterm.opr λterm.fst λterm.snd λtype λdep
|
||||
(Kind.verify
|
||||
(Kind.op2 term.opr term.fst term.snd)
|
||||
type
|
||||
dep
|
||||
)
|
||||
let mat = λterm.nam λterm.x λterm.z λterm.s λterm.p λtype λdep
|
||||
use mat = λterm.nam λterm.x λterm.z λterm.s λterm.p λtype λdep
|
||||
(Kind.verify
|
||||
(Kind.mat term.nam term.x term.z term.s term.p)
|
||||
type
|
||||
dep
|
||||
)
|
||||
let txt = λterm.txt λtype λdep
|
||||
use txt = λterm.txt λtype λdep
|
||||
(Kind.verify (Kind.txt term.txt) type dep)
|
||||
let hol = λterm.nam λterm.ctx λtype λdep (pure Kind.set)
|
||||
let var = λterm.nam λterm.idx λtype λdep
|
||||
use hol = λterm.nam λterm.ctx λtype λdep (pure Kind.set)
|
||||
use var = λterm.nam λterm.idx λtype λdep
|
||||
(Kind.verify (Kind.var term.nam term.idx) type dep)
|
||||
(~term
|
||||
P
|
||||
|
@ -7,20 +7,20 @@ Kind.comparer
|
||||
∀(dep: Nat)
|
||||
Bool
|
||||
= λrec λa λb λdep
|
||||
let VAR = Kind.var
|
||||
let SUC = Nat.succ
|
||||
let a = (Kind.skip a)
|
||||
let b = (Kind.skip b)
|
||||
let R = ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
let Y = λa.nam λa.ctx λb λdep Bool.true
|
||||
let N = λa λb λdep
|
||||
let R = ∀(dep: Nat) ∀(a: Kind.Term) Bool
|
||||
let Y = λb.nam λb.ctx λdep λa Bool.true
|
||||
let N = λb λdep λa
|
||||
let P = λx ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
let all = λa.nam λa.inp λa.bod λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.inp λb.bod λdep
|
||||
use VAR = Kind.var
|
||||
use SUC = Nat.succ
|
||||
use a = (Kind.skip a)
|
||||
use b = (Kind.skip b)
|
||||
use R = ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
use Y = λa.nam λa.ctx λb λdep Bool.true
|
||||
use N = λa λb λdep
|
||||
use R = ∀(dep: Nat) ∀(a: Kind.Term) Bool
|
||||
use Y = λb.nam λb.ctx λdep λa Bool.true
|
||||
use N = λb λdep λa
|
||||
use P = λx ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
use all = λa.nam λa.inp λa.bod λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.inp λb.bod λdep
|
||||
(Bool.and
|
||||
(rec a.inp b.inp dep)
|
||||
(rec
|
||||
@ -29,66 +29,66 @@ Kind.comparer
|
||||
(SUC dep)
|
||||
)
|
||||
)
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.all b P Y N dep)
|
||||
let lam = λa.nam λa.bod λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.bod λdep
|
||||
use lam = λa.nam λa.bod λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.bod λdep
|
||||
(rec
|
||||
(a.bod (VAR a.nam dep))
|
||||
(b.bod (VAR b.nam dep))
|
||||
(SUC dep)
|
||||
)
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.lam b P Y N dep)
|
||||
let app = λa.fun λa.arg λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.fun λb.arg λdep
|
||||
use app = λa.fun λa.arg λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.fun λb.arg λdep
|
||||
(Bool.and (rec a.fun b.fun dep) (rec a.arg b.arg dep))
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.app b P Y N dep)
|
||||
let ann = λa.val λa.typ λb λdep Bool.false
|
||||
let slf = λa.nam λa.bod λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.bod λdep
|
||||
use ann = λa.val λa.typ λb λdep Bool.false
|
||||
use slf = λa.nam λa.bod λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.bod λdep
|
||||
(rec
|
||||
(a.bod (VAR a.nam dep))
|
||||
(b.bod (VAR b.nam dep))
|
||||
(SUC dep)
|
||||
)
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.slf b P Y N dep)
|
||||
let ins = λa.val λb λdep Bool.false
|
||||
let ref = λa.nam λa.val λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.val λdep (String.equal a.nam b.nam)
|
||||
let N = λval λdep Bool.false
|
||||
use ins = λa.val λb λdep Bool.false
|
||||
use ref = λa.nam λa.val λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.val λdep (String.equal a.nam b.nam)
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.ref b P Y N dep)
|
||||
let def = λa.nam λa.val λa.bod λb λdep Bool.false
|
||||
let set = λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λdep Bool.true
|
||||
let F = λval λdep Bool.false
|
||||
use def = λa.nam λa.val λa.bod λb λdep Bool.false
|
||||
use set = λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λdep Bool.true
|
||||
use F = λval λdep Bool.false
|
||||
(Kind.if.set b P Y F dep)
|
||||
let u60 = λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λdep Bool.true
|
||||
let N = λval λdep Bool.false
|
||||
use u60 = λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λdep Bool.true
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.u60 b P Y N dep)
|
||||
let num = λa.val λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.val λdep (U60.equal a.val b.val)
|
||||
let N = λval λdep Bool.false
|
||||
use num = λa.val λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.val λdep (U60.equal a.val b.val)
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.num b P Y N dep)
|
||||
let op2 = λa.opr λa.fst λa.snd λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.opr λb.fst λb.snd λdep
|
||||
use op2 = λa.opr λa.fst λa.snd λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.opr λb.fst λb.snd λdep
|
||||
(Bool.and (rec a.fst b.fst dep) (rec a.snd b.snd dep))
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.op2 b P Y N dep)
|
||||
let mat = λa.nam λa.x λa.z λa.s λa.p λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.x λb.z λb.s λb.p λdep
|
||||
use mat = λa.nam λa.x λa.z λa.s λa.p λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.x λb.z λb.s λb.p λdep
|
||||
(Bool.and
|
||||
(rec a.x b.x dep)
|
||||
(Bool.and
|
||||
@ -107,18 +107,18 @@ Kind.comparer
|
||||
)
|
||||
)
|
||||
)
|
||||
let N = λval λdep Bool.false
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.mat b P Y N dep)
|
||||
let txt = λa.txt λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.txt λdep (String.equal a.txt b.txt)
|
||||
let N = λval λdep Bool.false
|
||||
use txt = λa.txt λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.txt λdep (String.equal a.txt b.txt)
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.txt b P Y N dep)
|
||||
let hol = λa.nam λa.ctx λb λdep Bool.false
|
||||
let var = λa.nam λa.idx λb λdep
|
||||
let P = ∀(dep: Nat) Bool
|
||||
let Y = λb.nam λb.idx λdep (Nat.equal a.idx b.idx)
|
||||
let N = λval λdep Bool.false
|
||||
use hol = λa.nam λa.ctx λb λdep Bool.false
|
||||
use var = λa.nam λa.idx λb λdep
|
||||
use P = ∀(dep: Nat) Bool
|
||||
use Y = λb.nam λb.idx λdep (Nat.equal a.idx b.idx)
|
||||
use N = λval λdep Bool.false
|
||||
(Kind.if.var b P Y N dep)
|
||||
(~a
|
||||
P
|
||||
|
@ -5,7 +5,7 @@ Kind.equal.enter
|
||||
∀(dep: Nat)
|
||||
Bool
|
||||
= λe λa λb λdep
|
||||
let P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
let true = λa λb λdep Bool.true
|
||||
let false = λa λb λdep (Kind.comparer Kind.equal a b dep)
|
||||
use P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
use true = λa λb λdep Bool.true
|
||||
use false = λa λb λdep (Kind.comparer Kind.equal a b dep)
|
||||
(~e P true false a b dep)
|
@ -5,11 +5,11 @@ Kind.equal.major
|
||||
∀(dep: Nat)
|
||||
Bool
|
||||
= λe λa λb λdep
|
||||
let P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
let true = λa λb λdep Bool.true
|
||||
let false = λa λb λdep
|
||||
let a_wnf = (Kind.reduce Bool.true a)
|
||||
let b_wnf = (Kind.reduce Bool.true b)
|
||||
use P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
use true = λa λb λdep Bool.true
|
||||
use false = λa λb λdep
|
||||
use a_wnf = (Kind.reduce Bool.true a)
|
||||
use b_wnf = (Kind.reduce Bool.true b)
|
||||
(Kind.equal.enter
|
||||
(Kind.identical a_wnf b_wnf dep)
|
||||
a_wnf
|
||||
|
@ -5,11 +5,11 @@ Kind.equal.minor
|
||||
∀(dep: Nat)
|
||||
Bool
|
||||
= λe λa λb λdep
|
||||
let P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
let true = λa λb λdep Bool.true
|
||||
let false = λa λb λdep
|
||||
let a_wnf = (Kind.reduce Bool.false a)
|
||||
let b_wnf = (Kind.reduce Bool.false b)
|
||||
use P = λx ∀(a: Kind.Term) ∀(b: Kind.Term) ∀(dep: Nat) Bool
|
||||
use true = λa λb λdep Bool.true
|
||||
use false = λa λb λdep
|
||||
use a_wnf = (Kind.reduce Bool.false a)
|
||||
use b_wnf = (Kind.reduce Bool.false b)
|
||||
(Kind.equal.major
|
||||
(Kind.identical a_wnf b_wnf dep)
|
||||
a_wnf
|
||||
|
@ -1,6 +1,6 @@
|
||||
Kind.export
|
||||
: Unit
|
||||
= let x = Kind.Book.get_refs
|
||||
let x = Kind.Book.parse
|
||||
let x = Kind.Book.to_hvm
|
||||
= use x = Kind.Book.get_refs
|
||||
use x = Kind.Book.parse
|
||||
use x = Kind.Book.to_hvm
|
||||
Unit.one
|
@ -10,7 +10,7 @@ Kind.if.all
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(nam: String)
|
||||
∀(inp: Kind.Term)
|
||||
@ -19,22 +19,22 @@ Kind.if.all
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (Y nam inp bod)
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (Y nam inp bod)
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,26 +5,26 @@ Kind.if.ann
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(val: Kind.Term) ∀(typ: Kind.Term) P)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (Y val typ)
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (Y val typ)
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,26 +5,26 @@ Kind.if.app
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(fun: Kind.Term) ∀(arg: Kind.Term) P)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (Y fun arg)
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (Y fun arg)
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -10,7 +10,7 @@ Kind.if.def
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(nam: String)
|
||||
∀(val: Kind.Term)
|
||||
@ -19,22 +19,22 @@ Kind.if.def
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (Y nam val bod)
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (Y nam val bod)
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,26 +5,26 @@ Kind.if.hol
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(nam: String) ∀(ctx: (List Kind.Term)) P)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (Y nam ctx)
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (Y nam ctx)
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,25 +5,25 @@ Kind.if.ins
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(val: Kind.Term) P) ∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (Y val)
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (Y val)
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -7,28 +7,28 @@ Kind.if.lam
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(nam: String) ∀(bod: ∀(x: Kind.Term) Kind.Term) P
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (Y nam bod)
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (Y nam bod)
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -12,7 +12,7 @@ Kind.if.mat
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(nam: String)
|
||||
∀(x: Kind.Term)
|
||||
@ -23,22 +23,22 @@ Kind.if.mat
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (Y nam x z s p)
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (Y nam x z s p)
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,24 +5,24 @@ Kind.if.num
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(val: #U60) P) ∀(N: ∀(val: Kind.Term) P) P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (Y val)
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (Y val)
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -8,29 +8,29 @@ Kind.if.op2
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(opr: Kind.Oper) ∀(fst: Kind.Term) ∀(snd: Kind.Term)
|
||||
P
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (Y opr fst snd)
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (Y opr fst snd)
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,26 +5,26 @@ Kind.if.ref
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(nam: String) ∀(val: Kind.Term) P)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (Y nam val)
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (Y nam val)
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,23 +5,23 @@ Kind.if.set
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx ∀(Y: P) ∀(N: ∀(val: Kind.Term) P) P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN Y
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use P = λx ∀(Y: P) ∀(N: ∀(val: Kind.Term) P) P
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN Y
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -7,28 +7,28 @@ Kind.if.slf
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y:
|
||||
∀(nam: String) ∀(bod: ∀(x: Kind.Term) Kind.Term) P
|
||||
)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (Y nam bod)
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (Y nam bod)
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,25 +5,25 @@ Kind.if.txt
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(lit: Kind.Text) P) ∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (Y lit)
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (Y lit)
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,23 +5,23 @@ Kind.if.u60
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx ∀(Y: P) ∀(N: ∀(val: Kind.Term) P) P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN Y
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
use P = λx ∀(Y: P) ∀(N: ∀(val: Kind.Term) P) P
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN Y
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -5,26 +5,26 @@ Kind.if.var
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
= λterm λP λY λN
|
||||
let P = λx
|
||||
use P = λx
|
||||
∀(Y: ∀(nam: String) ∀(idx: Nat) P)
|
||||
∀(N: ∀(val: Kind.Term) P)
|
||||
P
|
||||
let all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
let lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
let app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
let ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
let slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
let ins = λval λY λN (N (Kind.ins val))
|
||||
let ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
let def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
let set = λY λN (N Kind.set)
|
||||
let u60 = λY λN (N Kind.u60)
|
||||
let num = λval λY λN (N (Kind.num val))
|
||||
let op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
let mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
let txt = λlit λY λN (N (Kind.txt lit))
|
||||
let hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
let var = λnam λidx λY λN (Y nam idx)
|
||||
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
||||
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
||||
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
||||
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
||||
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
||||
use ins = λval λY λN (N (Kind.ins val))
|
||||
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
||||
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
||||
use set = λY λN (N Kind.set)
|
||||
use u60 = λY λN (N Kind.u60)
|
||||
use num = λval λY λN (N (Kind.num val))
|
||||
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
||||
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
||||
use txt = λlit λY λN (N (Kind.txt lit))
|
||||
use hol = λnam λctx λY λN (N (Kind.hol nam ctx))
|
||||
use var = λnam λidx λY λN (Y nam idx)
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -1,11 +1,11 @@
|
||||
Kind.infer
|
||||
: ∀(term: Kind.Term) ∀(dep: Nat) (Maybe Kind.Term)
|
||||
= λterm λdep
|
||||
let bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
let pure = (Maybe.some Kind.Term)
|
||||
let none = (Maybe.none Kind.Term)
|
||||
let P = λx ∀(dep: Nat) (Maybe Kind.Term)
|
||||
let all = λnam λinp λbod λdep
|
||||
use bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
use pure = (Maybe.some Kind.Term)
|
||||
use none = (Maybe.none Kind.Term)
|
||||
use P = λx ∀(dep: Nat) (Maybe Kind.Term)
|
||||
use all = λnam λinp λbod λdep
|
||||
(bind
|
||||
(Kind.check inp Kind.set dep)
|
||||
λ_
|
||||
@ -18,8 +18,8 @@ Kind.infer
|
||||
λ_ (pure Kind.set)
|
||||
)
|
||||
)
|
||||
let lam = λnam λbod λdep none
|
||||
let app = λfun λarg λdep
|
||||
use lam = λnam λbod λdep none
|
||||
use app = λfun λarg λdep
|
||||
(bind
|
||||
(Kind.infer fun dep)
|
||||
λfun_typ
|
||||
@ -36,8 +36,8 @@ Kind.infer
|
||||
arg
|
||||
)
|
||||
)
|
||||
let ann = λval λtyp λdep (pure typ)
|
||||
let slf = λnam λbod λdep
|
||||
use ann = λval λtyp λdep (pure typ)
|
||||
use slf = λnam λbod λdep
|
||||
(bind
|
||||
(Kind.check
|
||||
(bod (Kind.ann (Kind.var nam dep) (Kind.slf nam bod)))
|
||||
@ -46,7 +46,7 @@ Kind.infer
|
||||
)
|
||||
λ_ (pure Kind.set)
|
||||
)
|
||||
let ins = λval λdep
|
||||
use ins = λval λdep
|
||||
(bind
|
||||
(Kind.infer val dep)
|
||||
λval_typ
|
||||
@ -59,19 +59,19 @@ Kind.infer
|
||||
val
|
||||
)
|
||||
)
|
||||
let ref = λnam λval λdep (Kind.infer val dep)
|
||||
let def = λnam λval λbod λdep none
|
||||
let set = λdep (pure Kind.set)
|
||||
let u60 = λdep (pure Kind.set)
|
||||
let num = λnum λdep (pure Kind.u60)
|
||||
let txt = λtxt λdep (pure Kind.Book.String)
|
||||
let op2 = λopr λfst λsnd λdep
|
||||
use ref = λnam λval λdep (Kind.infer val dep)
|
||||
use def = λnam λval λbod λdep none
|
||||
use set = λdep (pure Kind.set)
|
||||
use u60 = λdep (pure Kind.set)
|
||||
use num = λnum λdep (pure Kind.u60)
|
||||
use txt = λtxt λdep (pure Kind.Book.String)
|
||||
use op2 = λopr λfst λsnd λdep
|
||||
(bind
|
||||
(Kind.check fst Kind.u60 dep)
|
||||
λ_
|
||||
(bind (Kind.check snd Kind.u60 dep) λ_ (pure Kind.u60))
|
||||
)
|
||||
let mat = λnam λx λz λs λp λdep
|
||||
use mat = λnam λx λz λs λp λdep
|
||||
(bind
|
||||
(Kind.check x Kind.u60 dep)
|
||||
λx_typ
|
||||
@ -107,8 +107,8 @@ Kind.infer
|
||||
)
|
||||
)
|
||||
)
|
||||
let hol = λnam λctx λdep none
|
||||
let var = λnam λidx λdep none
|
||||
use hol = λnam λctx λdep none
|
||||
use var = λnam λidx λdep none
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -1,14 +1,14 @@
|
||||
Kind
|
||||
: String
|
||||
= let a = (Kind.lam
|
||||
= use a = (Kind.lam
|
||||
"f"
|
||||
λf (Kind.lam "x" λx (Kind.app f (Kind.app f x)))
|
||||
)
|
||||
let b = (Kind.lam
|
||||
use b = (Kind.lam
|
||||
"f"
|
||||
λf (Kind.lam "x" λx (Kind.app f (Kind.app f x)))
|
||||
)
|
||||
let Test = (Kind.all
|
||||
use Test = (Kind.all
|
||||
"A"
|
||||
Kind.set
|
||||
λA
|
||||
@ -18,7 +18,7 @@ Kind
|
||||
λB (Kind.all "a" A λa (Kind.all "b" B λb B))
|
||||
)
|
||||
)
|
||||
let test = (Kind.lam
|
||||
use test = (Kind.lam
|
||||
"A"
|
||||
λA
|
||||
(Kind.lam
|
||||
@ -26,8 +26,8 @@ Kind
|
||||
λB (Kind.lam "a" λa (Kind.lam "b" λb b))
|
||||
)
|
||||
)
|
||||
let P = λx String
|
||||
let some = λvalue (Kind.Term.show value Nat.zero)
|
||||
let none = "error"
|
||||
let chk = (Kind.check test Test Nat.zero)
|
||||
use P = λx String
|
||||
use some = λvalue (Kind.Term.show value Nat.zero)
|
||||
use none = "error"
|
||||
use chk = (Kind.check test Test Nat.zero)
|
||||
(~chk P some none)
|
@ -2,13 +2,13 @@ Kind.load.dependencies
|
||||
: ∀(deps: (List String)) ∀(book: Kind.Book)
|
||||
(IO Kind.Book)
|
||||
= λdeps λbook
|
||||
let P = λx ∀(book: Kind.Book) (IO Kind.Book)
|
||||
let cons = λdeps.head λdeps.tail λbook
|
||||
use P = λx ∀(book: Kind.Book) (IO Kind.Book)
|
||||
use cons = λdeps.head λdeps.tail λbook
|
||||
(IO.bind
|
||||
Kind.Book
|
||||
Kind.Book
|
||||
(Kind.load.dependency deps.head book)
|
||||
λbook (Kind.load.dependencies deps.tail book)
|
||||
)
|
||||
let nil = λbook (IO.done Kind.Book book)
|
||||
use nil = λbook (IO.done Kind.Book book)
|
||||
(~deps P cons nil book)
|
@ -1,8 +1,8 @@
|
||||
Kind.load.dependency
|
||||
: ∀(name: String) ∀(book: Kind.Book) (IO Kind.Book)
|
||||
= λname λbook
|
||||
let has = (String.Map.has Kind.Term name book)
|
||||
let P = λx ∀(book: Kind.Book) (IO Kind.Book)
|
||||
let true = λbook (IO.done Kind.Book book)
|
||||
let false = λbook (Kind.load.name name book)
|
||||
use has = (String.Map.has Kind.Term name book)
|
||||
use P = λx ∀(book: Kind.Book) (IO Kind.Book)
|
||||
use true = λbook (IO.done Kind.Book book)
|
||||
use false = λbook (Kind.load.name name book)
|
||||
(~has P true false book)
|
@ -1,5 +1,5 @@
|
||||
Kind.load
|
||||
: ∀(name: String) (IO Kind.Book)
|
||||
= λname
|
||||
let book = (String.Map.new Kind.Term)
|
||||
use book = (String.Map.new Kind.Term)
|
||||
(Kind.load.name name book)
|
@ -6,11 +6,11 @@ Kind.load.name
|
||||
Kind.Book
|
||||
(Kind.load.code name)
|
||||
λfile
|
||||
let defs = (String.Map.to_list Kind.Term file)
|
||||
let fold = (List.fold (Pair String Kind.Term) defs)
|
||||
let set2 = λnam λval (String.Map.set Kind.Term nam val book)
|
||||
let setP = λdef λbook (~def λx Kind.Book set2)
|
||||
let book = (fold Kind.Book setP book)
|
||||
let deps = (Kind.Book.get_refs file)
|
||||
use defs = (String.Map.to_list Kind.Term file)
|
||||
use fold = (List.fold (Pair String Kind.Term) defs)
|
||||
use set2 = λnam λval (String.Map.set Kind.Term nam val book)
|
||||
use setP = λdef λbook (~def λx Kind.Book set2)
|
||||
use book = (fold Kind.Book setP book)
|
||||
use deps = (Kind.Book.get_refs file)
|
||||
(Kind.load.dependencies deps book)
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
Kind.normal.go
|
||||
: ∀(maj: Bool) ∀(term: Kind.Term) ∀(dep: Nat) Kind.Term
|
||||
= λmaj λterm λdep
|
||||
let P = λx Kind.Term
|
||||
let all = λnam λinp λbod
|
||||
use P = λx Kind.Term
|
||||
use all = λnam λinp λbod
|
||||
(Kind.all
|
||||
nam
|
||||
(Kind.normal maj inp dep)
|
||||
@ -13,7 +13,7 @@ Kind.normal.go
|
||||
(Nat.succ dep)
|
||||
)
|
||||
)
|
||||
let lam = λnam λbod
|
||||
use lam = λnam λbod
|
||||
(Kind.lam
|
||||
nam
|
||||
λx
|
||||
@ -23,17 +23,17 @@ Kind.normal.go
|
||||
(Nat.succ dep)
|
||||
)
|
||||
)
|
||||
let app = λfun λarg
|
||||
use app = λfun λarg
|
||||
(Kind.app
|
||||
(Kind.normal maj fun dep)
|
||||
(Kind.normal maj arg dep)
|
||||
)
|
||||
let ann = λval λtyp
|
||||
use ann = λval λtyp
|
||||
(Kind.ann
|
||||
(Kind.normal maj val dep)
|
||||
(Kind.normal maj typ dep)
|
||||
)
|
||||
let slf = λnam λbod
|
||||
use slf = λnam λbod
|
||||
(Kind.slf
|
||||
nam
|
||||
λx
|
||||
@ -43,9 +43,9 @@ Kind.normal.go
|
||||
(Nat.succ dep)
|
||||
)
|
||||
)
|
||||
let ins = λval (Kind.ins (Kind.normal maj val dep))
|
||||
let ref = λnam λval (Kind.ref nam (Kind.normal maj val dep))
|
||||
let def = λnam λval λbod
|
||||
use ins = λval (Kind.ins (Kind.normal maj val dep))
|
||||
use ref = λnam λval (Kind.ref nam (Kind.normal maj val dep))
|
||||
use def = λnam λval λbod
|
||||
(Kind.def
|
||||
nam
|
||||
(Kind.normal maj val dep)
|
||||
@ -56,16 +56,16 @@ Kind.normal.go
|
||||
(Nat.succ dep)
|
||||
)
|
||||
)
|
||||
let set = Kind.set
|
||||
let u60 = Kind.u60
|
||||
let num = Kind.num
|
||||
let op2 = λopr λfst λsnd
|
||||
use set = Kind.set
|
||||
use u60 = Kind.u60
|
||||
use num = Kind.num
|
||||
use op2 = λopr λfst λsnd
|
||||
(Kind.op2
|
||||
opr
|
||||
(Kind.normal maj fst dep)
|
||||
(Kind.normal maj snd dep)
|
||||
)
|
||||
let mat = λnam λx λz λs λp
|
||||
use mat = λnam λx λz λs λp
|
||||
(Kind.mat
|
||||
nam
|
||||
(Kind.normal maj x dep)
|
||||
@ -75,9 +75,9 @@ Kind.normal.go
|
||||
λk
|
||||
(Kind.normal maj (p (Kind.var nam dep)) (Nat.succ dep))
|
||||
)
|
||||
let txt = λtxt (Kind.txt txt)
|
||||
let hol = λnam λctx (Kind.hol nam ctx)
|
||||
let var = λnam λidx (Kind.var nam idx)
|
||||
use txt = λtxt (Kind.txt txt)
|
||||
use hol = λnam λctx (Kind.hol nam ctx)
|
||||
use var = λnam λidx (Kind.var nam idx)
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -2,8 +2,8 @@ Kind.reduce.app
|
||||
: ∀(maj: Bool) ∀(fun: Kind.Term) ∀(arg: Kind.Term)
|
||||
Kind.Term
|
||||
= λmaj λfun λarg
|
||||
let P = ∀(arg: Kind.Term) Kind.Term
|
||||
let Y = λnam λbod λarg
|
||||
use P = ∀(arg: Kind.Term) Kind.Term
|
||||
use Y = λnam λbod λarg
|
||||
(Kind.reduce maj (bod (Kind.reduce maj arg)))
|
||||
let N = λfun λarg (Kind.app fun arg)
|
||||
use N = λfun λarg (Kind.app fun arg)
|
||||
(Kind.if.lam fun P Y N arg)
|
@ -1,24 +1,24 @@
|
||||
Kind.reduce
|
||||
: ∀(maj: Bool) ∀(term: Kind.Term) Kind.Term
|
||||
= λmaj λterm
|
||||
let P = λx Kind.Term
|
||||
let all = Kind.all
|
||||
let lam = Kind.lam
|
||||
let app = λfun λarg
|
||||
use P = λx Kind.Term
|
||||
use all = Kind.all
|
||||
use lam = Kind.lam
|
||||
use app = λfun λarg
|
||||
(Kind.reduce.app maj (Kind.reduce maj fun) arg)
|
||||
let slf = Kind.slf
|
||||
let ann = λval λtyp (Kind.reduce maj val)
|
||||
let ins = λval (Kind.reduce maj val)
|
||||
let ref = λnam λval (Kind.reduce.ref maj nam val)
|
||||
let def = λnam λval λbod (Kind.reduce maj (bod val))
|
||||
let set = Kind.set
|
||||
let u60 = Kind.u60
|
||||
let num = Kind.num
|
||||
let op2 = λopr λfst λsnd (Kind.reduce.op2 opr fst snd)
|
||||
let mat = λnam λx λz λs λp (Kind.reduce.mat maj nam x z s p)
|
||||
let txt = λtxt (Kind.reduce.txt txt)
|
||||
let hol = Kind.hol
|
||||
let var = Kind.var
|
||||
use slf = Kind.slf
|
||||
use ann = λval λtyp (Kind.reduce maj val)
|
||||
use ins = λval (Kind.reduce maj val)
|
||||
use ref = λnam λval (Kind.reduce.ref maj nam val)
|
||||
use def = λnam λval λbod (Kind.reduce maj (bod val))
|
||||
use set = Kind.set
|
||||
use u60 = Kind.u60
|
||||
use num = Kind.num
|
||||
use op2 = λopr λfst λsnd (Kind.reduce.op2 opr fst snd)
|
||||
use mat = λnam λx λz λs λp (Kind.reduce.mat maj nam x z s p)
|
||||
use txt = λtxt (Kind.reduce.txt txt)
|
||||
use hol = Kind.hol
|
||||
use var = Kind.var
|
||||
(~term
|
||||
P
|
||||
all
|
||||
|
@ -7,13 +7,13 @@ Kind.reduce.mat
|
||||
∀(p: ∀(x: Kind.Term) Kind.Term)
|
||||
Kind.Term
|
||||
= λmaj λnam λx λz λs λp
|
||||
let P = ∀(z: Kind.Term) ∀(s: ∀(x: Kind.Term) Kind.Term)
|
||||
use P = ∀(z: Kind.Term) ∀(s: ∀(x: Kind.Term) Kind.Term)
|
||||
Kind.Term
|
||||
let Y = λx.val
|
||||
use Y = λx.val
|
||||
#match x = x.val {
|
||||
#0: λz λs (Kind.reduce maj z)
|
||||
#+: λz λs (Kind.reduce maj (s (Kind.num x-1)))
|
||||
}: ∀(z: Kind.Term) ∀(s: ∀(x: Kind.Term) Kind.Term)
|
||||
Kind.Term
|
||||
let N = λx λz λs (Kind.mat nam x z s p)
|
||||
use N = λx λz λs (Kind.mat nam x z s p)
|
||||
(Kind.if.num x P Y N z s)
|
@ -2,27 +2,27 @@ Kind.reduce.op2
|
||||
: ∀(opr: Kind.Oper) ∀(fst: Kind.Term) ∀(snd: Kind.Term)
|
||||
Kind.Term
|
||||
= λopr λfst λsnd
|
||||
let P = ∀(snd: Kind.Term) Kind.Term
|
||||
let Y = λfst_val λsnd
|
||||
let P = ∀(fst_val: #U60) Kind.Term
|
||||
let Y = λsnd_val λfst_val
|
||||
let P = λx ∀(fst_val: #U60) ∀(snd_val: #U60) Kind.Term
|
||||
let add = λfst_val λsnd_val (Kind.num #(+ fst_val snd_val))
|
||||
let mul = λfst_val λsnd_val (Kind.num #(* fst_val snd_val))
|
||||
let sub = λfst_val λsnd_val (Kind.num #(- fst_val snd_val))
|
||||
let div = λfst_val λsnd_val (Kind.num #(/ fst_val snd_val))
|
||||
let mod = λfst_val λsnd_val (Kind.num #(% fst_val snd_val))
|
||||
let eq = λfst_val λsnd_val (Kind.num #(== fst_val snd_val))
|
||||
let ne = λfst_val λsnd_val (Kind.num #(!= fst_val snd_val))
|
||||
let lt = λfst_val λsnd_val (Kind.num #(< fst_val snd_val))
|
||||
let gt = λfst_val λsnd_val (Kind.num #(> fst_val snd_val))
|
||||
let lte = λfst_val λsnd_val (Kind.num #(<= fst_val snd_val))
|
||||
let gte = λfst_val λsnd_val (Kind.num #(>= fst_val snd_val))
|
||||
let and = λfst_val λsnd_val (Kind.num #(& fst_val snd_val))
|
||||
let or = λfst_val λsnd_val (Kind.num #(| fst_val snd_val))
|
||||
let xor = λfst_val λsnd_val (Kind.num #(^ fst_val snd_val))
|
||||
let lsh = λfst_val λsnd_val (Kind.num #(<< fst_val snd_val))
|
||||
let rsh = λfst_val λsnd_val (Kind.num #(>> fst_val snd_val))
|
||||
use P = ∀(snd: Kind.Term) Kind.Term
|
||||
use Y = λfst_val λsnd
|
||||
use P = ∀(fst_val: #U60) Kind.Term
|
||||
use Y = λsnd_val λfst_val
|
||||
use P = λx ∀(fst_val: #U60) ∀(snd_val: #U60) Kind.Term
|
||||
use add = λfst_val λsnd_val (Kind.num #(+ fst_val snd_val))
|
||||
use mul = λfst_val λsnd_val (Kind.num #(* fst_val snd_val))
|
||||
use sub = λfst_val λsnd_val (Kind.num #(- fst_val snd_val))
|
||||
use div = λfst_val λsnd_val (Kind.num #(/ fst_val snd_val))
|
||||
use mod = λfst_val λsnd_val (Kind.num #(% fst_val snd_val))
|
||||
use eq = λfst_val λsnd_val (Kind.num #(== fst_val snd_val))
|
||||
use ne = λfst_val λsnd_val (Kind.num #(!= fst_val snd_val))
|
||||
use lt = λfst_val λsnd_val (Kind.num #(< fst_val snd_val))
|
||||
use gt = λfst_val λsnd_val (Kind.num #(> fst_val snd_val))
|
||||
use lte = λfst_val λsnd_val (Kind.num #(<= fst_val snd_val))
|
||||
use gte = λfst_val λsnd_val (Kind.num #(>= fst_val snd_val))
|
||||
use and = λfst_val λsnd_val (Kind.num #(& fst_val snd_val))
|
||||
use or = λfst_val λsnd_val (Kind.num #(| fst_val snd_val))
|
||||
use xor = λfst_val λsnd_val (Kind.num #(^ fst_val snd_val))
|
||||
use lsh = λfst_val λsnd_val (Kind.num #(<< fst_val snd_val))
|
||||
use rsh = λfst_val λsnd_val (Kind.num #(>> fst_val snd_val))
|
||||
(~opr
|
||||
P
|
||||
add
|
||||
@ -44,7 +44,7 @@ Kind.reduce.op2
|
||||
fst_val
|
||||
snd_val
|
||||
)
|
||||
let N = λsnd λfst_val (Kind.op2 opr (Kind.num fst_val) snd)
|
||||
use N = λsnd λfst_val (Kind.op2 opr (Kind.num fst_val) snd)
|
||||
(Kind.if.num snd P Y N fst_val)
|
||||
let N = λfst λsnd (Kind.op2 opr fst snd)
|
||||
use N = λfst λsnd (Kind.op2 opr fst snd)
|
||||
(Kind.if.num fst P Y N snd)
|
@ -2,7 +2,7 @@ Kind.reduce.ref
|
||||
: ∀(maj: Bool) ∀(nam: String) ∀(val: Kind.Term)
|
||||
Kind.Term
|
||||
= λmaj λnam λval
|
||||
let P = λx ∀(nam: String) ∀(val: Kind.Term) Kind.Term
|
||||
let true = λnam λval (Kind.reduce maj val)
|
||||
let false = Kind.ref
|
||||
use P = λx ∀(nam: String) ∀(val: Kind.Term) Kind.Term
|
||||
use true = λnam λval (Kind.reduce maj val)
|
||||
use false = Kind.ref
|
||||
(~maj P true false nam val)
|
@ -1,8 +1,8 @@
|
||||
Kind.reduce.txt
|
||||
: ∀(txt: Kind.Text) Kind.Term
|
||||
= λtxt
|
||||
let P = λx Kind.Term
|
||||
let cons = λx λxs
|
||||
use P = λx Kind.Term
|
||||
use cons = λx λxs
|
||||
(Kind.reduce
|
||||
Bool.true
|
||||
(Kind.app
|
||||
@ -10,5 +10,5 @@ Kind.reduce.txt
|
||||
(Kind.txt xs)
|
||||
)
|
||||
)
|
||||
let nil = (Kind.reduce Bool.true Kind.Book.String.nil)
|
||||
use nil = (Kind.reduce Bool.true Kind.Book.String.nil)
|
||||
(~txt P cons nil)
|
@ -6,14 +6,14 @@ Kind.report
|
||||
∀(dep: Nat)
|
||||
(Maybe Kind.Term)
|
||||
= λe λinferred λexpected λvalue λdep
|
||||
let pure = (Maybe.some Kind.Term)
|
||||
let none = (Maybe.none Kind.Term)
|
||||
let P = λx
|
||||
use pure = (Maybe.some Kind.Term)
|
||||
use none = (Maybe.none Kind.Term)
|
||||
use P = λx
|
||||
∀(inferred: Kind.Term)
|
||||
∀(expected: Kind.Term)
|
||||
∀(value: Kind.Term)
|
||||
∀(dep: Nat)
|
||||
(Maybe Kind.Term)
|
||||
let true = λinferred λexpected λvalue λdep (pure Kind.set)
|
||||
let false = λinferred λexpected λvalue λdep none
|
||||
use true = λinferred λexpected λvalue λdep (pure Kind.set)
|
||||
use false = λinferred λexpected λvalue λdep none
|
||||
(~e P true false inferred expected value dep)
|
@ -1,23 +1,23 @@
|
||||
Kind.skip
|
||||
: ∀(x: Kind.Term) Kind.Term
|
||||
= λx
|
||||
let P = λx Kind.Term
|
||||
let all = Kind.all
|
||||
let lam = Kind.lam
|
||||
let app = Kind.app
|
||||
let ann = λval λtyp (Kind.skip val)
|
||||
let slf = Kind.slf
|
||||
let ins = λval (Kind.skip val)
|
||||
let ref = Kind.ref
|
||||
let def = λnam λval λbod (Kind.skip (bod val))
|
||||
let set = Kind.set
|
||||
let u60 = Kind.u60
|
||||
let num = Kind.num
|
||||
let op2 = Kind.op2
|
||||
let mat = Kind.mat
|
||||
let txt = Kind.txt
|
||||
let hol = Kind.hol
|
||||
let var = Kind.var
|
||||
use P = λx Kind.Term
|
||||
use all = Kind.all
|
||||
use lam = Kind.lam
|
||||
use app = Kind.app
|
||||
use ann = λval λtyp (Kind.skip val)
|
||||
use slf = Kind.slf
|
||||
use ins = λval (Kind.skip val)
|
||||
use ref = Kind.ref
|
||||
use def = λnam λval λbod (Kind.skip (bod val))
|
||||
use set = Kind.set
|
||||
use u60 = Kind.u60
|
||||
use num = Kind.num
|
||||
use op2 = Kind.op2
|
||||
use mat = Kind.mat
|
||||
use txt = Kind.txt
|
||||
use hol = Kind.hol
|
||||
use var = Kind.var
|
||||
(~x
|
||||
P
|
||||
all
|
||||
|
@ -2,9 +2,9 @@ Kind.verify
|
||||
: ∀(term: Kind.Term) ∀(type: Kind.Term) ∀(dep: Nat)
|
||||
(Maybe Kind.Term)
|
||||
= λterm λtype λdep
|
||||
let bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
let pure = (Maybe.some Kind.Term)
|
||||
let none = (Maybe.none Kind.Term)
|
||||
use bind = (Maybe.bind Kind.Term Kind.Term)
|
||||
use pure = (Maybe.some Kind.Term)
|
||||
use none = (Maybe.none Kind.Term)
|
||||
(bind
|
||||
(Kind.infer term dep)
|
||||
λinfer
|
||||
|
@ -1,12 +1,12 @@
|
||||
List.Concatenator.from_list
|
||||
: ∀(T: *) ∀(xs: (List T)) (List.Concatenator T)
|
||||
= λT λxs
|
||||
let P = λxs (List.Concatenator T)
|
||||
let cons = λhead λtail λnil
|
||||
use P = λxs (List.Concatenator T)
|
||||
use cons = λhead λtail λnil
|
||||
(List.cons
|
||||
T
|
||||
head
|
||||
(List.Concatenator.from_list T tail nil)
|
||||
)
|
||||
let nil = λnil nil
|
||||
use nil = λnil nil
|
||||
(~xs P cons nil)
|
@ -2,12 +2,12 @@ List.Concatenator.join
|
||||
: ∀(T: *) ∀(xs: (List (List.Concatenator T)))
|
||||
(List.Concatenator T)
|
||||
= λT λxs
|
||||
let P = λxs (List.Concatenator T)
|
||||
let cons = λhead λtail
|
||||
use P = λxs (List.Concatenator T)
|
||||
use cons = λhead λtail
|
||||
(List.Concatenator.concat
|
||||
T
|
||||
head
|
||||
(List.Concatenator.join T tail)
|
||||
)
|
||||
let nil = (List.Concatenator.nil T)
|
||||
use nil = (List.Concatenator.nil T)
|
||||
(~xs P cons nil)
|
@ -2,7 +2,7 @@ List.app
|
||||
: ∀(A: *) ∀(B: *) ∀(f: ∀(x: A) B) ∀(x: (List A))
|
||||
(List B)
|
||||
= λA λB λf λx
|
||||
let P = λx (List B)
|
||||
let cons = λh λt (List.cons B (f h) (List.app A B f t))
|
||||
let nil = (List.nil B)
|
||||
use P = λx (List B)
|
||||
use cons = λh λt (List.cons B (f h) (List.app A B f t))
|
||||
use nil = (List.nil B)
|
||||
(~x P cons nil)
|
@ -1,12 +1,12 @@
|
||||
List.begin
|
||||
: ∀(A: *) ∀(list: (List A)) (List A)
|
||||
= λA λlist
|
||||
let P = λx (List A)
|
||||
let cons = λx0 λxs
|
||||
let P = λx (List A)
|
||||
let cons = λx1 λxs
|
||||
use P = λx (List A)
|
||||
use cons = λx0 λxs
|
||||
use P = λx (List A)
|
||||
use cons = λx1 λxs
|
||||
(List.cons A x0 (List.begin A (List.cons A x1 xs)))
|
||||
let nil = (List.nil A)
|
||||
use nil = (List.nil A)
|
||||
(~xs P cons nil)
|
||||
let nil = (List.nil A)
|
||||
use nil = (List.nil A)
|
||||
(~list P cons nil)
|
@ -1,8 +1,8 @@
|
||||
List.concat
|
||||
: ∀(T: *) ∀(xs: (List T)) ∀(ys: (List T)) (List T)
|
||||
= λT λxs λys
|
||||
let P = λxs ∀(ys: (List T)) (List T)
|
||||
let cons = λhead λtail λys
|
||||
use P = λxs ∀(ys: (List T)) (List T)
|
||||
use cons = λhead λtail λys
|
||||
(List.cons T head (List.concat T tail ys))
|
||||
let nil = λys ys
|
||||
use nil = λys ys
|
||||
(~xs P cons nil ys)
|
@ -2,12 +2,12 @@ List.find
|
||||
: ∀(A: *) ∀(cond: ∀(x: A) Bool) ∀(list: (List A))
|
||||
(Maybe A)
|
||||
= λA λcond λlist
|
||||
let P = λx (Maybe A)
|
||||
let cons = λhead λtail
|
||||
let found = (cond head)
|
||||
let P = λx (Maybe A)
|
||||
let true = (Maybe.some A head)
|
||||
let false = (List.find A cond tail)
|
||||
use P = λx (Maybe A)
|
||||
use cons = λhead λtail
|
||||
use found = (cond head)
|
||||
use P = λx (Maybe A)
|
||||
use true = (Maybe.some A head)
|
||||
use false = (List.find A cond tail)
|
||||
(~found P true false)
|
||||
let nil = (Maybe.none A)
|
||||
use nil = (Maybe.none A)
|
||||
(~list P cons nil)
|
@ -1,7 +1,7 @@
|
||||
List.fold
|
||||
: ∀(T: *) ∀(list: (List T)) (List.Folder T)
|
||||
= λT λlist λP λcons λnil
|
||||
let fold_P = λxs P
|
||||
let fold_cons = λhead λtail (cons head (List.fold T tail P cons nil))
|
||||
let fold_nil = nil
|
||||
use fold_P = λxs P
|
||||
use fold_cons = λhead λtail (cons head (List.fold T tail P cons nil))
|
||||
use fold_nil = nil
|
||||
(~list fold_P fold_cons fold_nil)
|
@ -1,7 +1,7 @@
|
||||
List.length
|
||||
: ∀(A: *) ∀(a: (List A)) Nat
|
||||
= λA λa
|
||||
let P = λx Nat
|
||||
let cons = λa.head λa.tail (Nat.succ (List.length A a.tail))
|
||||
let nil = Nat.zero
|
||||
use P = λx Nat
|
||||
use cons = λa.head λa.tail (Nat.succ (List.length A a.tail))
|
||||
use nil = Nat.zero
|
||||
(~a P cons nil)
|
@ -5,7 +5,7 @@ Maybe.bind
|
||||
∀(b: ∀(x: A) (Maybe B))
|
||||
(Maybe B)
|
||||
= λA λB λa λb
|
||||
let P = λx ∀(b: ∀(x: A) (Maybe B)) (Maybe B)
|
||||
let some = λa.value λb (b a.value)
|
||||
let none = λb (Maybe.none B)
|
||||
use P = λx ∀(b: ∀(x: A) (Maybe B)) (Maybe B)
|
||||
use some = λa.value λb (b a.value)
|
||||
use none = λb (Maybe.none B)
|
||||
(~a P some none b)
|
@ -1,15 +1,15 @@
|
||||
Nat.equal
|
||||
: ∀(a: Nat) ∀(b: Nat) Bool
|
||||
= λa λb
|
||||
let P = λx ∀(b: Nat) Bool
|
||||
let succ = λa.pred λb
|
||||
let P = λx ∀(a.pred: Nat) Bool
|
||||
let succ = λb.pred λa.pred (Nat.equal a.pred b.pred)
|
||||
let zero = λa.pred Bool.false
|
||||
use P = λx ∀(b: Nat) Bool
|
||||
use succ = λa.pred λb
|
||||
use P = λx ∀(a.pred: Nat) Bool
|
||||
use succ = λb.pred λa.pred (Nat.equal a.pred b.pred)
|
||||
use zero = λa.pred Bool.false
|
||||
(~b P succ zero a.pred)
|
||||
let zero = λb
|
||||
let P = λx Bool
|
||||
let succ = λb.pred Bool.false
|
||||
let zero = Bool.true
|
||||
use zero = λb
|
||||
use P = λx Bool
|
||||
use succ = λb.pred Bool.false
|
||||
use zero = Bool.true
|
||||
(~b P succ zero)
|
||||
(~a P succ zero b)
|
@ -1,5 +1,5 @@
|
||||
Pair.fst
|
||||
: ∀(A: *) ∀(B: *) ∀(p: (Pair A B)) A
|
||||
= λA λB λp let P = λx A
|
||||
let new = λa λb a
|
||||
= λA λB λp use P = λx A
|
||||
use new = λa λb a
|
||||
(~p P new)
|
@ -1,5 +1,5 @@
|
||||
Pair.snd
|
||||
: ∀(A: *) ∀(B: *) ∀(p: (Pair A B)) B
|
||||
= λA λB λp let P = λx B
|
||||
let new = λa λb b
|
||||
= λA λB λp use P = λx B
|
||||
use new = λa λb b
|
||||
(~p P new)
|
@ -5,7 +5,7 @@ Parser.bind
|
||||
∀(b: ∀(x: A) (Parser B))
|
||||
(Parser B)
|
||||
= λA λB λa λb λcode
|
||||
let P = λx ∀(b: ∀(x: A) (Parser B)) (Parser.Result B)
|
||||
let done = λa.code λa.value λb (b a.value a.code)
|
||||
let fail = λa.error λb (Parser.Result.fail B a.error)
|
||||
use P = λx ∀(b: ∀(x: A) (Parser B)) (Parser.Result B)
|
||||
use done = λa.code λa.value λb (b a.value a.code)
|
||||
use fail = λa.error λb (Parser.Result.fail B a.error)
|
||||
(~(a code) P done fail b)
|
@ -1,11 +1,11 @@
|
||||
Parser.char
|
||||
: (Parser Char)
|
||||
= λcode
|
||||
let P = λx (Parser.Result Char)
|
||||
let cons = λhead λtail
|
||||
let P = λx (Parser.Result Char)
|
||||
let true = (Parser.Result.done Char tail head)
|
||||
let false = (Parser.Result.done Char tail head)
|
||||
use P = λx (Parser.Result Char)
|
||||
use cons = λhead λtail
|
||||
use P = λx (Parser.Result Char)
|
||||
use true = (Parser.Result.done Char tail head)
|
||||
use false = (Parser.Result.done Char tail head)
|
||||
(~(Char.is_slash head) P true false)
|
||||
let nil = (Parser.Result.fail Char "eof")
|
||||
use nil = (Parser.Result.fail Char "eof")
|
||||
(~code P cons nil)
|
@ -1,12 +1,12 @@
|
||||
Parser.is_eof
|
||||
: (Parser Bool)
|
||||
= λcode
|
||||
let P = λx (Parser.Result Bool)
|
||||
let cons = λcode.head λcode.tail
|
||||
use P = λx (Parser.Result Bool)
|
||||
use cons = λcode.head λcode.tail
|
||||
(Parser.Result.done
|
||||
Bool
|
||||
(String.cons code.head code.tail)
|
||||
Bool.false
|
||||
)
|
||||
let nil = (Parser.Result.done Bool String.nil Bool.true)
|
||||
use nil = (Parser.Result.done Bool String.nil Bool.true)
|
||||
(~(String.skip code) P cons nil)
|
@ -2,7 +2,7 @@ Parser.map
|
||||
: ∀(A: *) ∀(B: *) ∀(f: ∀(a: A) B) ∀(p: (Parser A))
|
||||
(Parser B)
|
||||
= λA λB λf λp λcode
|
||||
let P = λx (Parser.Result B)
|
||||
let done = λcode λvalue (Parser.Result.done B code (f value))
|
||||
let fail = λerror (Parser.Result.fail B error)
|
||||
use P = λx (Parser.Result B)
|
||||
use done = λcode λvalue (Parser.Result.done B code (f value))
|
||||
use fail = λerror (Parser.Result.fail B error)
|
||||
(~(p code) P done fail)
|
@ -1,7 +1,7 @@
|
||||
Parser.pick
|
||||
: (Parser Char)
|
||||
= λcode
|
||||
let P = λx (Parser.Result Char)
|
||||
let cons = λhead λtail (Parser.Result.done Char tail head)
|
||||
let nil = (Parser.Result.fail Char "empty")
|
||||
use P = λx (Parser.Result Char)
|
||||
use cons = λhead λtail (Parser.Result.done Char tail head)
|
||||
use nil = (Parser.Result.fail Char "empty")
|
||||
(~code P cons nil)
|
@ -1,22 +1,22 @@
|
||||
Parser.pick_while.go
|
||||
: ∀(cond: ∀(chr: Char) Bool) (Parser String)
|
||||
= λcond λcode
|
||||
let P = λx (Parser.Result String)
|
||||
let cons = λhead λtail
|
||||
let P = λx
|
||||
use P = λx (Parser.Result String)
|
||||
use cons = λhead λtail
|
||||
use P = λx
|
||||
∀(head: Char) ∀(tail: String) (Parser.Result String)
|
||||
let true = λhead λtail
|
||||
let P = λx (Parser.Result String)
|
||||
let done = λcode λvalue
|
||||
use true = λhead λtail
|
||||
use P = λx (Parser.Result String)
|
||||
use done = λcode λvalue
|
||||
(Parser.Result.done String code (String.cons head value))
|
||||
let fail = λerror (Parser.Result.fail String error)
|
||||
use fail = λerror (Parser.Result.fail String error)
|
||||
(~(Parser.pick_while.go cond tail) P done fail)
|
||||
let false = λhead λtail
|
||||
use false = λhead λtail
|
||||
(Parser.Result.done
|
||||
String
|
||||
(String.cons head tail)
|
||||
String.nil
|
||||
)
|
||||
(~(cond head) P true false head tail)
|
||||
let nil = (Parser.Result.done String String.nil String.nil)
|
||||
use nil = (Parser.Result.done String String.nil String.nil)
|
||||
(~code P cons nil)
|
@ -2,8 +2,8 @@ Parser.repeat
|
||||
: ∀(n: Nat) ∀(A: *) ∀(p: (Parser A))
|
||||
(Parser (List A))
|
||||
= λn λA λp
|
||||
let P = λx (Parser (List A))
|
||||
let succ = λn.pred
|
||||
use P = λx (Parser (List A))
|
||||
use succ = λn.pred
|
||||
(Parser.bind
|
||||
A
|
||||
(List A)
|
||||
@ -16,5 +16,5 @@ Parser.repeat
|
||||
λtail (Parser.pure (List A) (List.cons A head tail))
|
||||
)
|
||||
)
|
||||
let zero = (Parser.pure (List A) (List.nil A))
|
||||
use zero = (Parser.pure (List A) (List.nil A))
|
||||
(~n P succ zero)
|
@ -1,24 +1,24 @@
|
||||
Parser.test
|
||||
: ∀(test: String) (Parser Bool)
|
||||
= λtest λcode
|
||||
let P = λx ∀(code: String) (Parser.Result Bool)
|
||||
let cons = λtest.head λtest.tail λcode
|
||||
let P = λx (Parser.Result Bool)
|
||||
let cons = λcode.head λcode.tail
|
||||
let P = λx
|
||||
use P = λx ∀(code: String) (Parser.Result Bool)
|
||||
use cons = λtest.head λtest.tail λcode
|
||||
use P = λx (Parser.Result Bool)
|
||||
use cons = λcode.head λcode.tail
|
||||
use P = λx
|
||||
∀(code.head: Char) ∀(code.tail: String)
|
||||
(Parser.Result Bool)
|
||||
let true = λcode.head λcode.tail
|
||||
let P = λx (Parser.Result Bool)
|
||||
let done = λcode λvalue
|
||||
use true = λcode.head λcode.tail
|
||||
use P = λx (Parser.Result Bool)
|
||||
use done = λcode λvalue
|
||||
(Parser.Result.done
|
||||
Bool
|
||||
(String.cons code.head code)
|
||||
value
|
||||
)
|
||||
let fail = λerror (Parser.Result.fail Bool error)
|
||||
use fail = λerror (Parser.Result.fail Bool error)
|
||||
(~(Parser.test test.tail code.tail) P done fail)
|
||||
let false = λcode.head λcode.tail
|
||||
use false = λcode.head λcode.tail
|
||||
(Parser.Result.done
|
||||
Bool
|
||||
(String.cons code.head code.tail)
|
||||
@ -31,7 +31,7 @@ Parser.test
|
||||
code.head
|
||||
code.tail
|
||||
)
|
||||
let nil = (Parser.Result.done Bool String.nil Bool.false)
|
||||
use nil = (Parser.Result.done Bool String.nil Bool.false)
|
||||
(~code P cons nil)
|
||||
let nil = λcode (Parser.Result.done Bool code Bool.true)
|
||||
use nil = λcode (Parser.Result.done Bool code Bool.true)
|
||||
(~test P cons nil code)
|
@ -5,15 +5,15 @@ Parser.until.go
|
||||
∀(terms: (List.Concatenator A))
|
||||
(Parser (List.Concatenator A))
|
||||
= λA λuntil λparse λterms λcode
|
||||
let P = λx (Parser.Result (List.Concatenator A))
|
||||
let done = λcode λstop
|
||||
let P = λx
|
||||
use P = λx (Parser.Result (List.Concatenator A))
|
||||
use done = λcode λstop
|
||||
use P = λx
|
||||
∀(code: String) (Parser.Result (List.Concatenator A))
|
||||
let true = λcode
|
||||
use true = λcode
|
||||
(Parser.Result.done (List.Concatenator A) code terms)
|
||||
let false = λcode
|
||||
let P = λx (Parser.Result (List.Concatenator A))
|
||||
let done = λcode λvalue
|
||||
use false = λcode
|
||||
use P = λx (Parser.Result (List.Concatenator A))
|
||||
use done = λcode λvalue
|
||||
(Parser.until.go
|
||||
A
|
||||
until
|
||||
@ -21,8 +21,8 @@ Parser.until.go
|
||||
λx (terms (List.cons A value x))
|
||||
code
|
||||
)
|
||||
let fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
||||
use fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
||||
(~(parse code) P done fail)
|
||||
(~stop P true false code)
|
||||
let fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
||||
use fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
||||
(~(until code) P done fail)
|
@ -2,8 +2,8 @@ Parser.variant
|
||||
: ∀(A: *) ∀(variants: (List (Parser.Guard A)))
|
||||
(Parser A)
|
||||
= λA λvariants
|
||||
let P = λx (Parser A)
|
||||
let cons = λvariant λothers
|
||||
use P = λx (Parser A)
|
||||
use cons = λvariant λothers
|
||||
(Pair.get
|
||||
(Parser Bool)
|
||||
(Parser A)
|
||||
@ -23,5 +23,5 @@ Parser.variant
|
||||
)
|
||||
)
|
||||
)
|
||||
let nil = (Parser.fail A "error")
|
||||
use nil = (Parser.fail A "error")
|
||||
(~variants P cons nil)
|
@ -1,20 +1,20 @@
|
||||
String.cmp
|
||||
: ∀(a: String) ∀(b: String) Cmp
|
||||
= λa λb
|
||||
let P = λx ∀(b: String) Cmp
|
||||
let cons = λa.head λa.tail λb
|
||||
let P = λx ∀(a.head: Char) ∀(a.tail: String) Cmp
|
||||
let cons = λb.head λb.tail λa.head λa.tail
|
||||
let P = λx Cmp
|
||||
let ltn = Cmp.ltn
|
||||
let eql = (String.cmp a.tail b.tail)
|
||||
let gtn = Cmp.gtn
|
||||
use P = λx ∀(b: String) Cmp
|
||||
use cons = λa.head λa.tail λb
|
||||
use P = λx ∀(a.head: Char) ∀(a.tail: String) Cmp
|
||||
use cons = λb.head λb.tail λa.head λa.tail
|
||||
use P = λx Cmp
|
||||
use ltn = Cmp.ltn
|
||||
use eql = (String.cmp a.tail b.tail)
|
||||
use gtn = Cmp.gtn
|
||||
(~(U60.cmp a.head b.head) P ltn eql gtn)
|
||||
let nil = λa.head λa.tail Cmp.gtn
|
||||
use nil = λa.head λa.tail Cmp.gtn
|
||||
(~b P cons nil a.head a.tail)
|
||||
let nil = λb
|
||||
let P = λx Cmp
|
||||
let cons = λb.head λb.tail Cmp.ltn
|
||||
let nil = Cmp.eql
|
||||
use nil = λb
|
||||
use P = λx Cmp
|
||||
use cons = λb.head λb.tail Cmp.ltn
|
||||
use nil = Cmp.eql
|
||||
(~b P cons nil)
|
||||
(~a P cons nil b)
|
@ -1,19 +1,19 @@
|
||||
String.equal
|
||||
: ∀(a: String) ∀(b: String) Bool
|
||||
= λa λb
|
||||
let P = λx ∀(b: String) Bool
|
||||
let cons = λa.head λa.tail λb
|
||||
let P = λx ∀(a.head: Char) ∀(a.tail: String) Bool
|
||||
let cons = λb.head λb.tail λa.head λa.tail
|
||||
use P = λx ∀(b: String) Bool
|
||||
use cons = λa.head λa.tail λb
|
||||
use P = λx ∀(a.head: Char) ∀(a.tail: String) Bool
|
||||
use cons = λb.head λb.tail λa.head λa.tail
|
||||
(Bool.and
|
||||
(U60.equal a.head b.head)
|
||||
(String.equal a.tail b.tail)
|
||||
)
|
||||
let nil = λa.head λa.tail Bool.false
|
||||
use nil = λa.head λa.tail Bool.false
|
||||
(~b P cons nil a.head a.tail)
|
||||
let nil = λb
|
||||
let P = λx Bool
|
||||
let cons = λb.head λb.tail Bool.false
|
||||
let nil = Bool.true
|
||||
use nil = λb
|
||||
use P = λx Bool
|
||||
use cons = λb.head λb.tail Bool.false
|
||||
use nil = Bool.true
|
||||
(~b P cons nil)
|
||||
(~a P cons nil b)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user