1 Curnel Forms
Curnel forms are the core forms provided cur. These forms come directly from the trusted core and are all that remain after macro expansion. TODO: Link to guide regarding macro expansion The core of cur is essentially TT with an impredicative universe (Type 0). For a very understandable in-depth look at TT, see chapter 2 of Practical Implementation of a Dependently Typed Functional Programming Language, by Edwin C. Brady.
syntax
(Type n)
Changed in version 0.20 of package cur-lib: Removed Type synonym from Curnel; changed run-time representation from symbolic '(Unv n) to transparent struct.
syntax
(λ (id : type-expr) body-expr)
Currently, Cur will return the underlying representation of a procedure when a λ is evaluated at the top-level. Do not rely on this representation.
Changed in version 0.20 of package cur-lib: Changed run-time representation from symbolic '(λ (x : t) e) to Racket procedure
syntax
(#%app procedure argument)
syntax
(Π (id : type-expr) body-expr)
> (Π (x : (Type 0)) (Type 0)) (Π-- (Type- 0) #<procedure:.../cur/curnel/coc.rkt:61:47>)
> (λ (x : (Π (x : (Type 1)) (Type 0))) (x (Type 0))) #<procedure>
Changed in version 0.20 of package cur-lib: Changed run-time representation from symbolic '(Π (x : t) e) to a transparent struct.
syntax
(data id : nat type-expr (id* : type-expr*) ...)
> (data Bool : 0 (Type 0) (true : Bool) (false : Bool)) > ((λ (x : Bool) x) true) (true)
> (data False : 0 (Type 0))
> (data And : 2 (Π (A : (Type 0)) (Π (B : (Type 0)) (Type 0))) (conj : (Π (A : (Type 0)) (Π (B : (Type 0)) (Π (a : A) (Π (b : B) ((And A) B))))))) > ((((conj Bool) Bool) true) false) (conj (Bool) (Bool) (true) (false))
Changed in version 0.20 of package cur-lib: Added strict positivity checking. (or, at least, documented it)
syntax
(elim inductive-type motive (method ...) target)
The following example runs (sub1 (s z)).
> (data Nat : 0 (Type 0) (z : Nat) (s : (Π (n : Nat) Nat)))
> (elim Nat (λ (x : Nat) Nat) (z (λ (n : Nat) (λ (IH : Nat) n))) (s z)) (z)
> (elim And (λ (_ : ((And Nat) Bool)) ((And Bool) Nat)) ((λ (n : Nat) (λ (b : Bool) ((((conj Bool) Nat) b) n)))) ((((conj Nat) Bool) z) true)) (conj (Bool) (Nat) (true) (z))
NOTE: This function is deprecated; use new-elim, instead.
syntax
(new-elim target motive (method ...))
Added in version 0.20 of package cur-lib.
syntax
(define id expr)
> (data Nat : 0 (Type 0) (z : Nat) (s : (Π (n : Nat) Nat)))
> (define sub1 (λ (n : Nat) (elim Nat (λ (x : Nat) Nat) (z (λ (n : Nat) (λ (IH : Nat) n))) n))) > (sub1 (s (s z))) (s (z))
> (sub1 (s z)) (z)
> (sub1 z) (z)
Added in version 0.20 of package cur-lib.
syntax
(void)
Added in version 0.20 of package cur-lib.