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)) inspector-superior?: contract violation
expected: inspector?
given: #f
> ((λ (x : Bool) x) true) Bool: unbound identifier in module
> (data False : 0 (Type 0)) inspector-superior?: contract violation
expected: inspector?
given: #f
> (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))))))) inspector-superior?: contract violation
expected: inspector?
given: #f
> ((((conj Bool) Bool) true) false) conj: unbound identifier in module
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))) inspector-superior?: contract violation
expected: inspector?
given: #f
> (elim Nat (λ (x : Nat) Nat) (z (λ (n : Nat) (λ (IH : Nat) n))) (s z)) elim-Nat: unbound identifier in module
> (elim And (λ (_ : ((And Nat) Bool)) ((And Bool) Nat)) ((λ (n : Nat) (λ (b : Bool) ((((conj Bool) Nat) b) n)))) ((((conj Nat) Bool) z) true)) elim-And: unbound identifier in module
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))) inspector-superior?: contract violation
expected: inspector?
given: #f
> (define sub1 (λ (n : Nat) (elim Nat (λ (x : Nat) Nat) (z (λ (n : Nat) (λ (IH : Nat) n))) n))) Nat: unbound identifier in module
> (sub1 (s (s z))) sub1: unbound identifier in module
> (sub1 (s z)) sub1: unbound identifier in module
> (sub1 z) sub1: unbound identifier in module
Added in version 0.20 of package cur-lib.
syntax
(void)
Added in version 0.20 of package cur-lib.