-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhoas.tiny
More file actions
28 lines (21 loc) · 737 Bytes
/
hoas.tiny
File metadata and controls
28 lines (21 loc) · 737 Bytes
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
inductive Maybe (A : U) := nothing | just A;
magic sqc : (T → T) → Maybe T;
inductive Exp :=
var T
| lam (T → Exp)
| app Exp Exp
;
conj : Exp → √ (Exp → Exp) :=
λ[ var i. rintro λ u. case (sqc (λ j. i[j])) [
nothing. u;
just c. var c
];
lam f. rintro λ u. lam (λ j. (relim i. conj (f[i] j)) u);
app f a. rintro λ u. app ((relim i. conj f[i]) u) ((relim i. conj a[i]) u)
];
subst (u : Exp) (v : T → Exp) : Exp :=
(relim i. conj (v i)) u;
exp1 : T → Exp := λ i. lam (λ j. var i);
exp2 : T → Exp := λ i. lam (λ j. app (var j) (var i));
u : Exp := u;
subst u exp2 -- Gives `lam (λ j. app (var j) u)` !!