type nat = +{'zero : 1, 'succ : nat} type list = +{'nil : 1, 'cons : nat * list} defn rev (l : list) (acc : list) : list = match l with | 'nil() => acc | 'cons(hd, tl) => rev tl ('cons (hd, acc)) end defn revfun (l : list) : list -> list = match l with | 'nil() => fun acc => acc | 'cons(hd, tl) => fun acc => revfun tl ('cons (hd, acc)) end defn revfun2 (l : list) : list -> list = match l with | 'nil() => revfun2_1 | 'cons(hd, tl) => revfun2_2 tl hd end defn revfun2_1 : list -> list = fun acc => acc defn revfun2_2 (tl : list) (hd : nat) : list -> list = fun acc => revfun tl ('cons (hd, acc)) type store = &{'ins : nat -> store, 'del : +{'none : 1, 'some : nat * store}} defn empty : store = record | 'ins => fun x => elem x empty | 'del => 'none() end defn elem (x : nat) (s : store) : store = record | 'ins => fun y => elem y (elem x s) | 'del => 'some (x, s) end defn empty_ : store = record | 'ins => empty_1 | 'del => 'none() end defn empty_1 : nat -> store = fun x => elem_ x empty_ defn elem_ (x : nat) (s : store) : store = record | 'ins => elem_1 x s | 'del => 'some (x, s) end defn elem_1 (x : nat) (s : store) : nat -> store = fun y => elem_ y (elem_ x s)