statement
stringlengths
5
595
proof
stringlengths
0
691
type
stringclasses
2 values
symbolic_name
stringlengths
1
27
library
stringclasses
1 value
filename
stringclasses
30 values
imports
listlengths
0
2
deps
listlengths
0
8
docstring
stringclasses
32 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
hcom-type (i : 𝕀) : type
:= hcom type 0 1 {∂ i} {j => [j=0 => v-test i nat | ∂ i => nat]}
def
hcom-type
test
test/hcom-type.cooltt
[]
[ "v-test" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
hcom-box (i : 𝕀) : hcom-type i
:= [?asdf, [?,?]]
def
hcom-box
test
test/hcom-type.cooltt
[]
[ "hcom-type" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
has-hlevel : nat → type → type
:= let aux : nat → type → type := elim [ | zero => A => (a a' : A) → path A a a' | suc {l => ih} => A => (a : A) (a' : A) → ih {path A a a'} ] in elim [ | zero => A => sig [pt : A, path : (pt' : A) → path A pt pt'] | suc l => aux l ]
def
has-hlevel
test
test/hlevel.cooltt
[ "prelude" ]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
htype : sig [lvl : nat, tp : type] → type
:= a => open a in has-hlevel lvl tp
def
htype
test
test/hlevel.cooltt
[ "prelude" ]
[ "has-hlevel" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
contr : type
:= htype # [lvl := 0]
def
contr
test
test/hlevel.cooltt
[ "prelude" ]
[ "htype" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
prop : type
:= htype # [lvl := 1]
def
prop
test
test/hlevel.cooltt
[ "prelude" ]
[ "htype" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
set : type
:= htype # [lvl := 2]
def
set
test
test/hlevel.cooltt
[ "prelude" ]
[ "htype" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
groupoid : type
:= htype # [lvl := 3]
def
groupoid
test
test/hlevel.cooltt
[ "prelude" ]
[ "htype" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
contr-prop (A : contr) : prop # [tp := A.tp]
:= unfold has-hlevel in pt pt' => trans {A.tp} {symm {A.tp} {A.fib.path pt}} {A.fib.path pt'}
def
contr-prop
test
test/hlevel.cooltt
[ "prelude" ]
[ "contr", "has-hlevel", "path", "prop", "symm", "trans" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
prop-set (A : prop) : set # [tp := A.tp]
:= unfold has-hlevel in a b p q i j => hcom {A.tp} 0 1 {∂ i ∨ ∂ j} {k => [ k=0 ∨ ∂ j ∨ i=0 => A a {p j} k | i=1 => A a {q j} k ] }
def
prop-set
test
test/hlevel.cooltt
[ "prelude" ]
[ "has-hlevel", "prop", "set" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
raise-hlevel (A : htype) : htype # [lvl := suc {A.lvl}, tp := A.tp]
:= let aux : (m : nat) (B : htype # [lvl := suc m]) → htype # [lvl := suc {suc m}, tp := B.tp] := elim [ | zero => prop-set | suc {l => ih} => B => unfold has-hlevel in b b' => {ih {struct [tp := path {B.tp} b b', fib := B b b']}} ] in let aux2 : (m : nat) (B : htype # [lvl := m]) → ...
def
raise-hlevel
test
test/hlevel.cooltt
[ "prelude" ]
[ "contr-prop", "has-hlevel", "htype", "path", "prop-set" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
prop-hlevel : (l : nat) (A : prop) → htype # [lvl := suc l, tp := A.tp]
:= elim [ | zero => A => A | suc {l => ih} => A => raise-hlevel {ih A} ]
def
prop-hlevel
test
test/hlevel.cooltt
[ "prelude" ]
[ "htype", "prop", "raise-hlevel" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
path-hlevel : (l : nat) (A : htype # [lvl := suc l]) (a a' : A.tp) → htype # [lvl := l, tp := path {A.tp} a a']
:= elim [ | zero => A a a' => unfold has-hlevel in struct [pt := A a a', path := {prop-set A} a a' {A a a'}] | suc l => unfold has-hlevel in A => A ]
def
path-hlevel
test
test/hlevel.cooltt
[ "prelude" ]
[ "has-hlevel", "htype", "path", "prop-set" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
path-based-contr (A : type) (a : A) : contr # [tp := (x : A) × path A a x]
:= unfold has-hlevel in struct def pt := [a, i => a] def path := x i => let aux : 𝕀 → A := j => hcom A 0 j {∂ i} {k => [ k=0 ∨ i=0 => a | i=1 => {snd x} k ] } in [aux 1, aux] end
def
path-based-contr
test
test/hlevel.cooltt
[ "prelude" ]
[ "contr", "has-hlevel", "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₁ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! !}
def
incomplete-trans₁
test
test/holes.cooltt
[ "prelude" ]
[ "path" ]
Test that the cone of silence tactic works
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₂ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! trans/filler A ? ? 1 i !}
def
incomplete-trans₂
test
test/holes.cooltt
[ "prelude" ]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₃ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! trans/filler A p q 0 i !}
def
incomplete-trans₃
test
test/holes.cooltt
[ "prelude" ]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₄ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! trans/filler A p q 1 i !}
def
incomplete-trans₄
test
test/holes.cooltt
[ "prelude" ]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₅ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! trans/filler A ?_h1 ?h2 1 i !}
def
incomplete-trans₅
test
test/holes.cooltt
[ "prelude" ]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
incomplete-trans₆ (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= i => {! trans/filler A ?h3 ?_h4 1 i !}
def
incomplete-trans₆
test
test/holes.cooltt
[ "prelude" ]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
cool-tt : p1::u
:= p2::q::t
def
cool-tt
test
test/import.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
i : 𝕀
axiom
i
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
j : 𝕀
axiom
j
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
k : 𝕀
axiom
k
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
ij : [i <= j]
axiom
ij
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
jk : [j <= k]
axiom
jk
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
foo : ext => nat with [i <= k => zero ]
axiom
foo
test
test/inequality.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
bar : ext => nat with [0=0 => zero]
:= foo
def
bar
test
test/inequality.cooltt
[]
[ "foo" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso : type
:= sig def A : type def B : type def fwd : A → B def bwd : B → A def fwd-bwd : (b : B) → path B {fwd {bwd b}} b def bwd-fwd : (a : A) → path A {bwd {fwd a}} a end
def
iso
test
test/isos.cooltt
[ "prelude" ]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/refl (A : type) : iso # [A := A, B := A]
:= struct def fwd := x => x def bwd := x => x def fwd-bwd := b i => b def bwd-fwd := a i => a end
def
iso/refl
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/symm (I : iso) : iso # [A := I.B, B := I.A]
:= open I in struct def fwd := bwd def bwd := fwd def fwd-bwd := bwd-fwd def bwd-fwd := fwd-bwd end
def
iso/symm
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/trans (I1 : iso) (I2 : iso # [ A := I1.B ]) : iso # [A := I1.A, B := I2.B]
:= struct def fwd := a => I2.fwd {I1.fwd a} def bwd := b => I1.bwd {I2.bwd b} def fwd-bwd := b => trans {I2.B} {j => I2.fwd {I1.fwd-bwd {I2.bwd b} j}} {I2.fwd-bwd b} def bwd-fwd := a => trans {I1.A} {j => I1.bwd {I2.bwd-fwd {I1.fwd a} j}} {I1.bwd-fwd a} end
def
iso/trans
test
test/isos.cooltt
[ "prelude" ]
[ "iso", "trans" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/pair/comm (X Y : type) : iso # [A := X × Y, B := Y × X]
:= struct def fwd := ab => [snd ab, fst ab] def bwd := ba => [snd ba, fst ba] def fwd-bwd := ba i => ba def bwd-fwd := ab i => ab end
def
iso/pair/comm
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/pair/assoc (X Y Z : type) : iso # [A := {X × Y × Z}, B := {{X × Y} × Z}]
:= struct def fwd := a_bc => [[fst a_bc, fst {snd a_bc}], snd {snd a_bc}] def bwd := ab_c => [fst {fst ab_c}, [snd {fst ab_c}, snd ab_c]] def fwd-bwd := ab_c i => ab_c def bwd-fwd := a_bc i => a_bc end
def
iso/pair/assoc
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/pair/unit (X : type) : iso # [A := X × unit, B := X]
:= struct def fwd := au => fst au def bwd := a => [a, ⋆] def fwd-bwd := a i => a def bwd-fwd := au i => au end
def
iso/pair/unit
test
test/isos.cooltt
[ "prelude" ]
[ "iso", "unit", "⋆" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
curry (A B C : type) : {{A × B} → C} → {A → B → C}
:= f a b => f [a , b]
def
curry
test
test/isos.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
uncurry (A B C : type) : {A → B → C} → {{A × B} → C}
:= f ab => f {fst ab} {snd ab}
def
uncurry
test
test/isos.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/curry (X Y Z : type) : iso # [A := X → Y → Z, B := {X × Y} → Z]
:= struct def fwd := uncurry X Y Z def bwd := curry X Y Z def fwd-bwd := ab_c i => ab_c def bwd-fwd := a_b_c i => a_b_c end
def
iso/curry
test
test/isos.cooltt
[ "prelude" ]
[ "curry", "iso", "uncurry" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/lhs (C : type) (I : iso) : iso # [A := {I.A} → C, B := {I.B} → C]
:= open I in struct def fwd := ac b => ac {bwd b} def bwd := bc a => bc {fwd a} def fwd-bwd := bc i b => bc {fwd-bwd b i} def bwd-fwd := ac i a => ac {bwd-fwd a i} end
def
iso/lhs
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/rhs (C : type) (I : iso) : iso # [A := C → {I.A}, B := C → {I.B} ]
:= open I in struct def fwd := ca c => fwd {ca c} def bwd := cb c => bwd {cb c} def fwd-bwd := cb i c => fwd-bwd {cb c} i def bwd-fwd := ca i c => bwd-fwd {ca c} i end
def
iso/rhs
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
iso/flip (X Y Z : type) : iso # [A := X → Y → Z, B := Y → X → Z]
:= struct def fwd := abc b a => abc a b def bwd := bac a b => bac b a def fwd-bwd := bac i => bac def bwd-fwd := abc i => abc end
def
iso/flip
test
test/isos.cooltt
[ "prelude" ]
[ "iso" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
x::y : nat
:= 0
def
x::y
test
test/names.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
x (_ : nat) : nat
:= 0
def
x
test
test/names.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
y : nat
:= x x::y
def
y
test
test/names.cooltt
[]
[ "x::y" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
x::y::z (u::v : nat) : nat
:= u::v
def
x::y::z
test
test/names.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
evan-test (A : type) (φ : 𝔽) (a : A) (p : sub {path A a a} φ {_ => a}) : (j : 𝕀) → A
:= p
def
evan-test
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
J (A : type) (p : 𝕀 → A) (C : {(i : 𝕀) → sub A {i=0} {p 0}} → type) (d : C {_ => p 0}) : C p
:= coe {i => C {hfill A 0 {∂ i} {k => [k=0 ∨ i=0 => p 0 | i=1 => p k]}} } 0 1 d
def
J
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
J/eq (A : type) (p : 𝕀 → A) (C : {(i : 𝕀) → sub A {i=0} {p 0}} → type) (d : C {_ => p 0}) : path {C {_ => p 0}} {J A {_ => p 0} C d} d
:= let square : 𝕀 → 𝕀 → A := i => hfill A 0 {∂ i} {_ => p 0} in k => let mot : 𝕀 → type := i => C {hfill A 0 {∂ k ∨ ∂ i} {j => [k=0 => square i j | j=0 ∨ k=1 ∨ ∂ i => p 0]}} in unfold J in com mot 0 1 {∂ k} {i => [k=0 => coe {j => C {square j}} 0 i d | k=1 ∨ i=0 => d]}
def
J/eq
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "path", "square" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
trans-left-unit (A : type) (p : 𝕀 → A) : path {path A {p 0} {p 1}} p {trans A {_ => p 0} p}
:= k i => unfold trans in hcom A 0 1 {k=0 ∨ ∂ i} {j => [ j=0 ∨ i=0 => p 0 | i=1 => p j | k=0 => hcom A 0 1 {∂ i ∨ ∂ j} {l => let filler : 𝕀 → A := k => trans/filler A {_ => p 0} p k l in [ l=0 ∨ i=0 ∨ j=1 => filler i | i=1 ∨ j=0 => filler j ] } ] }
def
trans-left-unit
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "path", "trans", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
trans-right-unit (A : type) (p : 𝕀 → A) : path {path A {p 0} {p 1}} p {trans A p {_ => p 1}}
:= unfold trans in trans/filler A p {_ => p 1}
def
trans-right-unit
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "path", "trans", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
trans-symm-refl (A : type) (p : 𝕀 → A) : path {path A {p 0} {p 0}} {_ => p 0} {trans A p {symm A p}}
:= k i => unfold trans symm in hcom A 0 1 {k=0 ∨ ∂ i} {j => symm/filler A p j i }
def
trans-symm-refl
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "path", "symm", "symm/filler", "trans" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test (p : 𝕀 → nat) : (i : 𝕀) → nat
:= let fun : nat → nat := elim [ | zero => zero | suc _ => zero ] in i => fun {symm nat p i}
def
test
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "symm" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test2 : (i : 𝕀) → nat
:= let fun : nat → nat := elim [ | zero => zero | suc _ => zero ] in i => fun {symm nat {_ => zero} i}
def
test2
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "symm" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test2' : sub {𝕀 → nat} ⊤ {i => hcom nat 0 1 {∂ i} {_ => 0}}
:= unfold symm in test2
def
test2'
test
test/nat-path.cooltt
[ "nat", "prelude" ]
[ "symm", "test2" ]
The following illustrates that although cooltt's quasi-normal forms aren't as fully reduced as they could be, it is of no consequence for definitional equivalence. That is, we don't bother pushing eliminators through all the branches of a disjunction split, but our equational theory acts as if we do.
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+ : nat → nat → nat
:= elim [ | zero => n => n | suc {_ => ih} => n => suc {ih n} ]
def
+
test
test/nat.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
pred : nat → nat
:= elim [ | zero => zero | suc {n => _} => n ]
def
pred
test
test/nat.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-left-unit (x : nat) : path nat {+ 0 x} x
:= unfold + in _ => x
def
+-left-unit
test
test/nat.cooltt
[ "prelude" ]
[ "+", "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-suc-l (x y : nat) : path nat {+ {suc x} y} {suc {+ x y}}
:= unfold + in _ => suc {+ x y}
def
+-suc-l
test
test/nat.cooltt
[ "prelude" ]
[ "+", "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-right-unit : (x : nat) → path nat {+ x 0} x
:= elim [ | zero => +-left-unit 0 | suc {y => ih} => equation nat begin + {suc y} 0 =[ +-suc-l y 0 ] suc {+ y 0} =[ i => suc {ih i} ] suc y end ]
def
+-right-unit
test
test/nat.cooltt
[ "prelude" ]
[ "+", "+-left-unit", "+-suc-l", "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-suc-r : (x y : nat) → path nat {+ x {suc y}} {suc {+ x y}}
:= elim [ | zero => x => equation nat begin + 0 {suc x} =[ +-left-unit {suc x} ] suc x =[ i => suc {symm nat {+-left-unit x} i} ] suc {+ 0 x} end | suc {x => ih} => y => equation nat begin + {suc x} {suc y} =[ +-suc-l x {suc y} ] suc {+ x {suc y}} =[ i => suc {ih y i} ] ...
def
+-suc-r
test
test/nat.cooltt
[ "prelude" ]
[ "+", "+-left-unit", "+-suc-l", "path", "symm" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-comm : (x y : nat) → path nat {+ y x} {+ x y}
:= elim [ | zero => y => equation nat begin + y 0 =[ +-right-unit y ] y =[ symm nat {+-left-unit y} ] + 0 y end | suc {y => ih} => z => equation nat begin + z {suc y} =[ +-suc-r z y ] suc {+ z y} =[ i => suc {ih z i} ] suc {+ y z} =[ symm nat {+-suc-l y z} ]...
def
+-comm
test
test/nat.cooltt
[ "prelude" ]
[ "+", "+-left-unit", "+-right-unit", "+-suc-l", "+-suc-r", "path", "symm" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
+-assoc : (x y z : nat) → path nat {+ {+ x y} z} {+ x {+ y z}}
:= elim [ | zero => y z => equation nat begin + {+ 0 y} z =[ i => + {+-left-unit y i} z ] + y z =[ symm nat {+-left-unit {+ y z}} ] + 0 {+ y z} end | suc {x => ih} => y z => equation nat begin + {+ {suc x} y} z =[ i => + {+-suc-l x y i} z ] + {suc {+ x y}} z =[ +-suc-l {+...
def
+-assoc
test
test/nat.cooltt
[ "prelude" ]
[ "+", "+-left-unit", "+-suc-l", "path", "symm" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
el : type
:= sig def A : type def a : A end
def
el
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
el-patch : type
:= el # [A := nat, a := 4]
def
el-patch
test
test/patch.cooltt
[ "prelude" ]
[ "el" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
el-patch-partial : type
:= el # [ A := nat ]
def
el-patch-partial
test
test/patch.cooltt
[ "prelude" ]
[ "el" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch/inhabit : el-patch
:= struct def A := nat def a := 4 end
def
patch/inhabit
test
test/patch.cooltt
[ "prelude" ]
[ "el-patch" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch-partial/inhabit/infer : el-patch-partial
:= struct def a := 4 end
def
patch-partial/inhabit/infer
test
test/patch.cooltt
[ "prelude" ]
[ "el-patch-partial" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch/inhabit/infer : el-patch
:= struct end
def
patch/inhabit/infer
test
test/patch.cooltt
[ "prelude" ]
[ "el-patch" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch/inhabit/hole : el-patch
:= struct def A := ? def a := ? end
def
patch/inhabit/hole
test
test/patch.cooltt
[ "prelude" ]
[ "el-patch" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch-depends : type
:= {sig [A : type, B : type]} # [A := nat, B := A]
def
patch-depends
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
patch-depends/inhabit : patch-depends
:= struct def A := nat def B := nat end
def
patch-depends/inhabit
test
test/patch.cooltt
[ "prelude" ]
[ "patch-depends" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
testing (A Z : type) (B : A → type) (p : Z → sig [x : A, bx : B x]) (z : Z) : sig [x : A, bx : B x] # [x := p z.x, bx := p z.bx]
:= p z
def
testing
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
category : type
:= sig def ob : type def hom : sig [s : ob, t : ob] → type def idn : (x : ob) → hom # [s := x, t := x] def seq : (f : hom) → (g : hom # [s := f.t]) → hom # [s := f.s, t := g.t] def seqL : abstract seqL∷tp ← (f : hom) → path {hom # [s := f.s, t := f.t]} {seq {idn {f.s}} f} f def s...
def
category
test
test/patch.cooltt
[ "prelude" ]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
types : category
:= unfold category in struct def ob := type def hom := args => {args.s} → {args.t} def idn := _ x => x def seq := f g x => g {f x} def seqL := unfold seqL∷tp in f _ => f def seqR := unfold seqR∷tp in f _ => f def seqA := unfold seqA∷tp in f g h _ x => h {g {f x}} end
def
types
test
test/patch.cooltt
[ "prelude" ]
[ "category" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-auto (fam : sig [x : nat] → type) : type
:= fam
def
test-auto
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-auto-patch (fam : sig [x : nat] → type) : type
:= fam # [x := 0]
def
test-auto-patch
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
U : type
:= type
def
U
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-unfold-total (fam : sig [x : nat] → U) : U
:= fam
def
test-unfold-total
test
test/patch.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-extra-field : sub el true {struct [A := nat, a := 0]}
:= struct [B := 0, A := nat, x := 0, a := 0, y := 0]
def
test-extra-field
test
test/patch.cooltt
[ "prelude" ]
[ "el" ]
Extra fields are ignored and elaborated away
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-extra-field-patch : sub {el # [A := nat]} true {struct [A := nat, a := 0]}
:= struct [B := 0, x := 0, a := 0, y := 0]
def
test-extra-field-patch
test
test/patch.cooltt
[ "prelude" ]
[ "el" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test-extra-field-include : sub el true {struct [A := nat, a := 0]}
:= unfold category in struct include types include test-extra-field include types end
def
test-extra-field-include
test
test/patch.cooltt
[ "prelude" ]
[ "category", "el", "test-extra-field", "types" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
formation : { (A : 𝕀 → type) (a : A 0) (b : A 1) → type }
:= { A a b => ext i => A i with [i=0 => a | i=1 => b] }
def
formation
test
test/path-types.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
path (A : type) (a : A) (b : A) : type
:= ext i => A with [i=0 => a | i=1 => b]
def
path
test
test/path-types.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
myrefl : { (A : type) (a : A) → path A a a }
:= { A a i => a }
def
myrefl
test
test/path-types.cooltt
[]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
funext : { (A B : type) (f : (x : A) → B) (g : (x : A) → B) (h : (x : A) → path B {f x} {g x}) → path {(x : A) → B} f g }
:= { A B f g h i x => h x i }
def
funext
test
test/path-types.cooltt
[]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
funextdep : { (A : 𝕀 → type) (B : (i : 𝕀) → A i → type) (f : (i : 𝕀) → [∂ i] → (x : A i) → B i x) (h : (p : (i : 𝕀) → A i) → ext i => B i {p i} with [∂ i => f i {p i}]) → ext i => (x : A i) → B i x with [∂ i => f i] }
:= { A B f h i x => h {j => coe A i j x} i }
def
funextdep
test
test/path-types.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
pairext : { (A B : type) (p : (x : A) × B) (q : (x : A) × B) (h : (x : path A {fst p} {fst q}) × path B {snd p} {snd q}) → path {(x : A) × B} p q }
:= { A B p q h i => [ {fst h} i , {snd h} i ] }
def
pairext
test
test/path-types.cooltt
[]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
path (A : type) (x y : A) : type
:= ext i => A with [i=0 => x | i=1 => y]
def
path
test
test/prelude.cooltt
[]
[]
Path Types, and some common operations
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
path-p (A : 𝕀 → type) (x : A 0) (y : A 1) : type
:= ext i => A i with [i=0 => x | i=1 => y]
def
path-p
test
test/prelude.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
refl (A : type) (x : A) : path A x x
:= i => x
def
refl
test
test/prelude.cooltt
[]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
symm/filler (A : type) (p : 𝕀 → A) (i : 𝕀) : (j : 𝕀) → sub A {∂ i} [ i=1 => p 0 | i=0 => p j ]
:= hfill 0 {j => [ j=0 ∨ i=1 => p 0 | i=0 => p j ] }
def
symm/filler
test
test/prelude.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
symm (A : type) (p : 𝕀 → A) : path A {p 1} {p 0}
:= i => symm/filler A p i 1
def
symm
test
test/prelude.cooltt
[]
[ "path", "symm/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
trans/filler (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) (j : 𝕀) (i : 𝕀) : A
:= hcom A 0 j {∂ i} {j => [ j=0 ∨ i=0 => p i | i=1 => q j ] }
def
trans/filler
test
test/prelude.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
trans (A : type) (p : 𝕀 → A) (q : (i : 𝕀) → sub A {i=0} {p 1}) : path A {p 0} {q 1}
:= trans/filler A p q 1
def
trans
test
test/prelude.cooltt
[]
[ "path", "trans/filler" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
cong (A : type) (B : A → type) (f : (a : A) → B a) (x y : A) (p : path A x y) : path-p {i => B {p i}} {f x} {f y}
:= i => f {p i}
def
cong
test
test/prelude.cooltt
[]
[ "path", "path-p" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
funext (A : type) (B : type) (f : (x : A) → B) (g : (x : A) → B) (h : (x : A) → path B {f x} {g x}) : path {(x : A) → B} f g
:= i x => h x i
def
funext
test
test/prelude.cooltt
[]
[ "path" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
unit : type
:= ext => nat with [⊤ => 0]
def
unit
test
test/prelude.cooltt
[]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
⋆ : unit
:= 0
def
test
test/prelude.cooltt
[]
[ "unit" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
unit/eta (x : unit) : path unit ⋆ x
:= _ => x
def
unit/eta
test
test/prelude.cooltt
[]
[ "path", "unit", "⋆" ]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
test : type
:= sig def x : type def y : type def fn : x -> y end
def
test
test
test/record.cooltt
[ "prelude" ]
[]
https://github.com/RedPRL/cooltt
b39bf29900451cb43ae6fbd9af5aa33d59e18935
Free AI Image Generator No sign-up. Instant results. Open Now