mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 17:56:48 +03:00
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.
99 lines
1.8 KiB
Plaintext
99 lines
1.8 KiB
Plaintext
Kind.normal.go
|
|
: ∀(maj: Bool) ∀(term: Kind.Term) ∀(dep: Nat) Kind.Term
|
|
= λmaj λterm λdep
|
|
use P = λx Kind.Term
|
|
use all = λnam λinp λbod
|
|
(Kind.all
|
|
nam
|
|
(Kind.normal maj inp dep)
|
|
λx
|
|
(Kind.normal
|
|
maj
|
|
(bod (Kind.var nam dep))
|
|
(Nat.succ dep)
|
|
)
|
|
)
|
|
use lam = λnam λbod
|
|
(Kind.lam
|
|
nam
|
|
λx
|
|
(Kind.normal
|
|
maj
|
|
(bod (Kind.var nam dep))
|
|
(Nat.succ dep)
|
|
)
|
|
)
|
|
use app = λfun λarg
|
|
(Kind.app
|
|
(Kind.normal maj fun dep)
|
|
(Kind.normal maj arg dep)
|
|
)
|
|
use ann = λval λtyp
|
|
(Kind.ann
|
|
(Kind.normal maj val dep)
|
|
(Kind.normal maj typ dep)
|
|
)
|
|
use slf = λnam λbod
|
|
(Kind.slf
|
|
nam
|
|
λx
|
|
(Kind.normal
|
|
maj
|
|
(bod (Kind.var nam dep))
|
|
(Nat.succ dep)
|
|
)
|
|
)
|
|
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)
|
|
λx
|
|
(Kind.normal
|
|
maj
|
|
(bod (Kind.var nam dep))
|
|
(Nat.succ dep)
|
|
)
|
|
)
|
|
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)
|
|
)
|
|
use mat = λnam λx λz λs λp
|
|
(Kind.mat
|
|
nam
|
|
(Kind.normal maj x dep)
|
|
(Kind.normal maj z dep)
|
|
λk
|
|
(Kind.normal maj (s (Kind.var nam dep)) (Nat.succ dep))
|
|
λk
|
|
(Kind.normal maj (p (Kind.var nam dep)) (Nat.succ dep))
|
|
)
|
|
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
|
|
lam
|
|
app
|
|
ann
|
|
slf
|
|
ins
|
|
ref
|
|
def
|
|
set
|
|
u60
|
|
num
|
|
op2
|
|
mat
|
|
txt
|
|
hol
|
|
var
|
|
) |