-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.makam
47 lines (34 loc) · 805 Bytes
/
check.makam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
check : term -> term -> prop.
multistep : term -> term -> prop.
(* Allow User Defined Axioms *)
check (axiom _ A) A.
check set typ.
(* Functions/Dependent Products *)
check (forall A B) L :-
check A _,
(x:term -> check x A -> check (B x) L).
check (lam A N) (forall A B) :-
check A _,
(x:term -> check x A -> check (N x) (B x)).
check (app M N) (B N) :-
check M (forall A B),
check N A.
(* Normalization Rule *)
(* FIXME
check M B :-
check M A,
multistep A B,
check B _. *)
(* Normalization *)
step : term -> term -> prop.
step_ : term -> term -> prop.
multistep X Z :-
if step X Y
then multistep Y Z
else unify X Z.
step X Y :-
if step_ X Y
then success
else structural @step_ X Y.
step_ (app (lam A F) X) (F X) :-
check X A.