example stuff

This commit is contained in:
rhiannon morris 2023-07-22 21:26:20 +02:00
parent f6b8a12fab
commit cf9bfc2159
3 changed files with 64 additions and 7 deletions

View file

@ -4,13 +4,18 @@ load "either.quox";
namespace nat {
def dup : → [ω.] =
def dup! : (n : ) → [ω. Sing n] =
λ n ⇒
case n return [ω.] of {
zero ⇒ [zero];
succ _, 1.d ⇒ case d return [ω.] of { [d] ⇒ [succ d] }
case n return n' ⇒ [ω. Sing n'] of {
zero ⇒ [(zero, [δ _ ⇒ zero])];
succ n, 1.d ⇒
appω (Sing n) (Sing (succ n))
(sing.app n (λ n ⇒ succ n)) d
};
def dup : → [ω.] =
λ n ⇒ appω (Sing n) (sing.val n) (dup! n);
def plus : =
λ m n ⇒
case m return of {