| 1 |
Reserved Notation "'slet' x .. y := A 'in' b" |
| 2 |
(at level 200, x binder, y binder, b at level 200, format "'slet' x .. y := A 'in' '//' b"). |
| 3 |
Reserved Notation "T x [1] = { A } ; 'return' ( b0 , b1 , .. , b2 )" |
| 4 |
(at level 200, format "T x [1] = { A } ; '//' 'return' ( b0 , b1 , .. , b2 )"). |
| 5 |
|
| 6 |
Delimit Scope ctype_scope with ctype. |
| 7 |
Local Open Scope ctype_scope. |
| 8 |
Delimit Scope expr_scope with expr. |
| 9 |
Inductive base_type := TZ | TWord (logsz : nat). |
| 10 |
Inductive flat_type := Tbase (T : base_type) | Prod (A B : flat_type). |
| 11 |
#[warning="context-outside-section"] Context {var : base_type -> Type}. |
| 12 |
Fixpoint interp_flat_type (interp_base_type : base_type -> Type) (t : |
| 13 |
flat_type) := |
| 14 |
match t with |
| 15 |
| Tbase t => interp_base_type t |
| 16 |
| Prod x y => prod (interp_flat_type interp_base_type x) (interp_flat_type |
| 17 |
interp_base_type y) |
| 18 |
end. |
| 19 |
Inductive exprf : flat_type -> Type := |
| 20 |
| Var {t} (v : var t) : exprf (Tbase t) |
| 21 |
| LetIn {tx} (ex : exprf tx) {tC} (eC : interp_flat_type var tx -> exprf tC) : |
| 22 |
exprf tC |
| 23 |
| Pair {tx} (ex : exprf tx) {ty} (ey : exprf ty) : exprf (Prod tx ty). |
| 24 |
Global Arguments Var {_} _. |
| 25 |
Global Arguments LetIn {_} _ {_} _. |
| 26 |
Global Arguments Pair {_} _ {_} _. |
| 27 |
Notation "T x [1] = { A } ; 'return' ( b0 , b1 , .. , b2 )" := (LetIn (tx:=T) A |
| 28 |
(fun x => Pair .. (Pair b0%expr b1%expr) .. b2%expr)) : expr_scope. |
| 29 |
Definition foo := |
| 30 |
(fun x3 => |
| 31 |
(LetIn (Var x3) (fun x18 : var TZ |
| 32 |
=> (Pair (Var x18) (Var x18))))). |
| 33 |
Print foo. |