statement stringlengths 1 3.21k | proof stringlengths 1 23.6k | type stringclasses 3
values | symbolic_name stringlengths 1 31 | library stringclasses 3
values | filename stringclasses 77
values | imports listlengths 0 4 | deps listlengths 0 37 | docstring stringclasses 288
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
head (A : U) (a : A) : list A -> A | = split
nil -> a
cons x _ -> x | def | head | lectures | lectures/lecture1.ctt | [] | [
"list"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
Path (A : U) (a b : A) : U | = PathP (<_> A) a b | def | Path | lectures | lectures/lecture1.ctt | [] | [] | The type PathP is a heterogeneous path type and it corresponds to the Path type introduced in section 9.2 of the cubical type theory paper. The homogeneous Path type, corresponding to the one in section 3 of the paper, can then be defined by: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
truePath : Path bool true true | = <i> true | def | truePath | lectures | lectures/lecture1.ctt | [] | [
"Path",
"bool"
] | A more concrete path: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
face0 (A : U) (a b : A) (p : Path A a b) : A | = p @ 0 | def | face0 | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | The interval II has two end-points 0 and 1. By applying a path to 0 or 1 we obtain the end-points of the path: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
notK : (b : bool) -> Path bool (not (not b)) b | = split
true -> <i> true
false -> <i> false | def | notK | lectures | lectures/lecture1.ctt | [] | [
"Path",
"bool",
"not"
] | We can now prove: (b : bool) -> Path bool (not (not b)) b. The proof is done by case analysis on b and in both cases it is proved by reflexivity. | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
cong (A B : U) (f : A -> B) (a b : A) (p : Path A a b) :
Path B (f a) (f b) | = <i> f (p @ i) | def | cong | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | Using Path types we get a simple proof of cong: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
congbin (A B C : U) (f : A -> B -> C) (a a' : A) (b b' : B)
(p : Path A a a') (q : Path B b b') :
Path C (f a b) (f a' b') | = undefined | def | congbin | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | Exercise: cong for binary functions | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
funExt (A B : U) (f g : A -> B)
(p : (x : A) -> Path B (f x) (g x)) :
Path (A -> B) f g | = <i> \(a : A) -> (p a) @ i | def | funExt | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | We get a short proof of function extensionality using Path types: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
funExt (A : U) (B : A -> U) (f g : (x : A) -> B x)
(p : (x : A) -> Path (B x) (f x) (g x)) :
Path ((x : A) -> B x) f g | = undefined | def | funExt | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | Exercise: dependent function extensionality | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
funExt2 (A B C : U) (f g : A -> B -> C)
(p : (x : A) (y : B) -> Path C (f x y) (g x y)) :
Path (A -> B -> C) f g | = undefined | def | funExt2 | lectures | lectures/lecture1.ctt | [] | [
"Path"
] | Exercise: function extensionality for binary functions | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
compf (f g : bool -> bool) : bool -> bool | =
\(b : bool) -> g (f b) | def | compf | lectures | lectures/lecture1.ctt | [] | [
"bool"
] | Using function extensionality we can prove: not o not = id | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
notK' : Path (bool -> bool) (compf not not) (idfun bool) | =
<i> \(b : bool) -> notK b @ i | def | notK' | lectures | lectures/lecture1.ctt | [] | [
"Path",
"bool",
"compf",
"idfun",
"not",
"notK"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
evenodd : (n : nat) -> Path bool (even n) (odd (suc n)) | = undefined | def | evenodd | lectures | lectures/lecture1.ctt | [] | [
"Path",
"bool",
"nat"
] | Exercise: even n = odd (suc n) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
contrSingl (A : U) (a b : A) (p : Path A a b) :
Path (singl A a) (a,<i> a) (b,p) | =
<i> (p @ i,<j> p @ i /\ j) | def | contrSingl | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"singl"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
compPath (A : U) (a b c : A) (p : Path A a b) (q : Path A b c) : Path A a c | =
<i> comp (<_> A) (p @ i)
[ (i = 0) -> <j> a
, (i = 1) -> q ] | def | compPath | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
compinv (A : U) (a b : A) (p : Path A a b) : Path A a a | =
<i> comp (<_> A) (p @ i) [ (i = 0) -> <j> a, (i = 1) -> <j> p @ -j ] | def | compinv | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path"
] | Another example of a simple composition: compose p with its inverse | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
ex (A : U) (a b : A) (p : Path A a b) :
Path (Path A a a) (compinv A a b p) (<j> a) | = undefined | def | ex | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"compinv"
] | Exercise (hard): is "compinv A a b p" Path equal to <j> a? | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addZero : (a : nat) -> Path nat (add zero a) a | = split
zero -> <i> zero
suc a' -> <i> suc (addZero a' @ i) | def | addZero | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"nat"
] | 0 + a = a | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addSuc (a : nat) : (b : nat) -> Path nat (add (suc a) b) (suc (add a b)) | = split
zero -> <i> suc a
suc n -> <i> suc (addSuc a n @ i) | def | addSuc | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"nat"
] | (suc a) + b = suc (a + b) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addC (a : nat) : (b : nat) -> Path nat (add a b) (add b a) | = split
zero -> <i> addZero a @ -i -- a = 0 + a
suc n -> <i> comp (<_> nat) (suc (addC a n @ i))
[ (i = 0) -> <j> suc (add a n)
, (i = 1) -> <j> addSuc n a @ -j ] | def | addC | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"addSuc",
"addZero",
"nat"
] | a + b = b + a | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addA (a b c : nat) : Path nat (add a (add b c)) (add (add a b) c) | = undefined | def | addA | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"nat"
] | a + (b + c) = (a + b) + c | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addAC (a b c : nat) : Path nat (add (add a b) c) (add (add a c) b) | = undefined | def | addAC | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"nat"
] | (a + b) + c = (a + c) + b | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
addCA (a b c : nat) : Path nat (add a (add b c)) (add b (add a c)) | = undefined | def | addCA | lectures | lectures/lecture2.ctt | [
"lecture1"
] | [
"Path",
"add",
"nat"
] | a + (b + c) = b + (a + c) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
ex (A : U) (a b : A) (p : Path A a b) :
Path (Path A a a) (compinv A a b p) (<j> a) | =
<k j> comp (<_> A) (p @ j /\ -k)
[ (j = 0) -> <i> a
, (j = 1) -> <i> p @ -i /\ -k
, (k = 1) -> <i> a ] | def | ex | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"compinv"
] | We can prove that this is equal to reflexivity using a higher dimensional composition: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
ex (A : U) (a b : A) (p : Path A a b) :
Path (Path A a a) (compinv A a b p) (<j> a) | =
<k j> comp (<_> A) (p @ j /\ -k)
[ (j = 0) -> <_> a
, (j = 1) -> <i> p @ -i /\ -k
, (k = 0) -> fill (<_> A) (p @ j)
[ (j = 0) -> <i> a
, (j = 1) -> <i> p @ -i]
... | def | ex | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"compinv"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
Square (A : U) (a0 a1 b0 b1 : A) (u : Path A a0 a1) (v : Path A b0 b1)
(r0 : Path A a0 b0) (r1 : Path A a1 b1) : U | = PathP (<i> (Path A (u @ i) (v @ i))) r0 r1 | def | Square | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
constSquare (A : U) (a : A) (p : Path A a a) : Square A a a a a p p p p | =
undefined | def | constSquare | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"Square"
] | Exercise construct a constant square: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
transEq (A : U) (a : A) : Path A a (trans A A (<_> A) a) | =
fill (<_> A) a [] | def | transEq | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"trans"
] | Note that transporting a along a constant family is only Path (and not judgmentally) equal to a. This implies that the computation rule for J only holds up to a Path equality, see JEq below. | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
gencomp (A B : U) (P : Path U A B) (a b : A) (c d : B)
(p : Path A a b) (q : PathP P a c) (r : PathP P b d) : Path B c d | =
<i> comp P (p @ i) [ (i = 0) -> q, (i = 1) -> r ] | def | gencomp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path"
] | This uses that the composition operations are heterogeneous. So the lower line of the square can be in type A while the constructed line is in B. The sides then have to connect elements in A to elements in B, so we have to use the heterogeneous PathP type: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
subst (A : U) (P : A -> U) (a b : A)
(p : Path A a b) (e : P a) : P b | = transport (<i> P (p @ i)) e | def | subst | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path"
] | We can use transport to define: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
substEq (A : U) (P : A -> U) (a : A) (e : P a) :
Path (P a) e (subst A P a a (refl A a) e) | = transEq (P a) e | def | substEq | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"refl",
"subst",
"transEq"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
J (A : U) (a : A) (P : (b : A) -> Path A a b -> U)
(d : P a (refl A a)) (b : A) (p : Path A a b) : P b p | =
subst B T (a,refl A a) (b,p) (contrSingl A a b p) d
where
B : U = (b : A) * Path A a b
T (y : B) : U = P y.1 y.2 | def | J | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"contrSingl",
"refl",
"subst"
] | Combined with the contractibility of singletons this gives us the J eliminator: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
JEq (A : U) (a : A) (C : (x : A) -> Path A a x -> U)
(d : C a (refl A a)) :
Path (C a (refl A a)) d (J A a C d a (refl A a)) | =
substEq (singl A a) T (a, refl A a) d
where T (z : singl A a) : U = C (z.1) (z.2) | def | JEq | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"refl",
"singl",
"substEq"
] | Computation rule only holds up to Path equality: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
isProp (A : U) : U | = (x y : A) -> Path A x y | def | isProp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path"
] | A type of h-level 1 is called a "proposition" (written "mere proposition" in the HoTT book or simply "h-proposition"). In such a type all elements are equal, so the only information that it carries is whether it is inhabited or not. | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
isSet (A : U) : U | = (x y : A) -> isProp (Path A x y) | def | isSet | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"isProp"
] | A type of h-level 2 is called a "set" and in such a type all of the equalities between elements are equal. This property is usually called UIP, "uniqueness of identity types", and a very important theorem is Hedberg's theorem which says that types with decidable equality satisfy UIP (so nat, bool, etc. are all sets). | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
propPi (A : U) (B : A -> U) (h : (x : A) -> isProp (B x)) :
isProp ((x : A) -> B x) | = rem
where
rem (f0 f1 : (x : A) -> B x) :
Path ((x : A) -> B x) f0 f1 =
<i> \(x : A) -> h x (f0 x) (f1 x) @ i | def | propPi | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"f0",
"f1",
"isProp",
"rem"
] | Using function extensionality we can prove that a family of propositions is a proposition: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
propSet (A : U) (h : isProp A) : isSet A | = undefined | def | propSet | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isProp",
"isSet"
] | Exercise: Prove that if A is a proposition then it is a set. (hint: use a composition in a suitable cube) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
propIsProp (A : U) : isProp (isProp A) | = undefined | def | propIsProp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isProp"
] | Exercise: Prove that being a proposition is a proposition. (hint: use propSet and function extensionality for binary functions) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
inhPropToIsContr (A : U) (p : and A (isProp A)) : isContr A | = undefined | def | inhPropToIsContr | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"and",
"isContr",
"isProp"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isContrToInhProp (A : U) (p : isContr A) : and A (isProp A) | = undefined | def | isContrToInhProp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"and",
"isContr",
"isProp"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isofhlevel (A : U) : nat -> U | = split
zero -> isContr A
suc n -> (a b : A) -> isofhlevel (Path A a b) n | def | isofhlevel | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"Path",
"isContr",
"nat"
] | We can now define when a type is of h-level n: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
isofhlevel1ToProp (A : U) : isofhlevel A (suc zero) -> isProp A | = undefined | def | isofhlevel1ToProp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isProp",
"isofhlevel"
] | Exercise: Prove that a type is of h-level 1 iff it is a proposition | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
propToIsofhlevel1 (A : U) : isProp A -> isofhlevel A (suc zero) | = undefined | def | propToIsofhlevel1 | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isProp",
"isofhlevel"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isofhlevel2ToSet (A : U) : isofhlevel A (suc (suc zero)) -> isSet A | = undefined | def | isofhlevel2ToSet | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isSet",
"isofhlevel"
] | Exercise: Prove that a type is of h-level 2 iff it is a set | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
setToIsofhlevel2 (A : U) : isSet A -> isofhlevel A (suc (suc zero)) | = undefined | def | setToIsofhlevel2 | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isSet",
"isofhlevel"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isContrProp (A : U) (h : isContr A) : isProp A | = undefined | def | isContrProp | lectures | lectures/lecture3.ctt | [
"lecture2"
] | [
"isContr",
"isProp"
] | Exercise: Prove that if a type is contractible then it is a proposition. | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
isEquiv (A B : U) (f : A -> B) : U | =
(y : B) -> isContr (fiber A B f y) | def | isEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"fiber",
"isContr"
] | A map is an equivalence if its fibers are contractible | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
idIsEquiv (A : U) : isEquiv A A (idfun A) | =
\(a : A) -> ((a,<i> a),
\(z : fiber A A (idfun A) a) -> contrSingl A a z.1 z.2) | def | idIsEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"contrSingl",
"fiber",
"idfun",
"isEquiv"
] | The identity function is an equivalence | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
invEquiv (A B : U) (e : equiv A B) (y : B) : A | = (e.2 y).1.1 | def | invEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"equiv"
] | We can compute the inverse of an equivalence | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
retEq (A B : U) (e : equiv A B) (y : B) : Path B (e.1 (invEquiv A B e y)) y | = undefined | def | retEq | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"equiv",
"invEquiv"
] | Exercises (easy): the inverse is really the inverse | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
secEq (A B : U) (e : equiv A B) (x : A) : Path A (invEquiv A B e (e.1 x)) x | = undefined | def | secEq | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"equiv",
"invEquiv"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isPropIsContr (A : U) : isProp (isContr A) | = undefined | def | isPropIsContr | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"isContr",
"isProp"
] | Exercise (hard): prove that being contractible is a proposition. (hint: use a composition) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
isPropIsEquiv (A B : U) (f : A -> B) : isProp (isEquiv A B f) | =
\(u0 u1 : isEquiv A B f) ->
<i> \(y : B) -> isPropIsContr (fiber A B f y) (u0 y) (u1 y) @ i | def | isPropIsEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"fiber",
"isEquiv",
"isProp",
"isPropIsContr"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
isoToEquiv (A B : U) (f : A -> B) (g : B -> A)
(s : (y : B) -> Path B (f (g y)) y)
(t : (x : A) -> Path A (g (f x)) x) : isEquiv A B f | =
\(y : B) -> ((g y,<i> s y @ -i),\(z : fiber A B f y) ->
lemIso A B f g s t y (g y) z.1 (<i> s y @ -i) z.2)
where
-- Exercise: draw all of the squares in the proof of lemIso to see
-- why sq1 makes sense
lemIso (A B : U) (f : A -> B) (g : B -> A)
(s : (y : B) -> Path B (f (g y)) y)
(t : (x ... | def | isoToEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"Square",
"fiber",
"isEquiv",
"lemIso",
"p0",
"p1"
] | The "isoToEquiv" lemma: any isomorphism is an equivalence | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
ua (A B : U) (e : equiv A B) : Path U A B | =
<i> Glue B [ (i = 0) -> (A,e), (i = 1) -> (B,idEquiv B) ] | def | ua | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"equiv",
"idEquiv"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
notEquiv : equiv bool bool | =
(not,isoToEquiv bool bool not not notK notK) | def | notEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"bool",
"equiv",
"isoToEquiv",
"not",
"notK"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
notEq : Path U bool bool | =
<i> Glue bool [ (i = 0) -> (bool,notEquiv)
, (i = 1) -> (bool,idEquiv bool) ] | def | notEq | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"bool",
"idEquiv",
"notEquiv"
] | Construct an equality in the universe using Glue | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
testFalse : bool | = transport notEq true | def | testFalse | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"bool",
"notEq"
] | Transporting true along this equality gives false | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
sucpredZ : (x : Z) -> Path Z (sucZ (predZ x)) x | = split
inl u -> <i> inl u
inr v -> lem v
where
lem : (u : nat) -> Path Z (sucZ (predZ (inr u))) (inr u) = split
zero -> <i> inr zero
suc n -> <i> inr (suc n) | def | sucpredZ | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"lem",
"nat",
"predZ",
"sucZ"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
predsucZ : (x : Z) -> Path Z (predZ (sucZ x)) x | = split
inl u -> lem u
where
lem : (u : nat) -> Path Z (predZ (sucZ (inl u))) (inl u) = split
zero -> <i> inl zero
suc n -> <i> inl (suc n)
inr v -> <i> inr v | def | predsucZ | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"lem",
"nat",
"predZ",
"sucZ"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
sucPathZ : Path U Z Z | =
<i> Glue Z [ (i = 0) -> (Z,sucZ,isoToEquiv Z Z sucZ predZ sucpredZ predsucZ)
, (i = 1) -> (Z,idEquiv Z) ] | def | sucPathZ | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"idEquiv",
"isoToEquiv",
"predZ",
"predsucZ",
"sucZ",
"sucpredZ"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
sucPathZ2 : Path U Z Z | =
<i> comp (<_> U) (sucPathZ @ i) [ (i = 0) -> <j> Z, (i = 1) -> sucPathZ ] | def | sucPathZ2 | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"sucPathZ"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
testTwoZ : Z | = transport sucPathZ2 zeroZ | def | testTwoZ | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"sucPathZ2",
"zeroZ"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
substEquiv (P : U -> U) (A B : U) (e : equiv A B) (h : P A) : P B | =
subst U P A B (ua A B e) h | def | substEquiv | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"equiv",
"subst",
"ua"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
food | = cheese | beef | chicken | data | food | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [] | We can use this to do generic programming: | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
eats (X : U) : U | = list (and food X) | def | eats | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"and",
"food",
"list"
] | Predicate encoding which food someone eats | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
anders : eats bool | = cons (cheese,true)
(cons (beef,false)
(cons (chicken,false) nil)) | def | anders | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"bool",
"eats"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
cyril : eats bool | = substEquiv eats bool bool notEquiv anders | def | cyril | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"anders",
"bool",
"eats",
"notEquiv",
"substEquiv"
] | Cyril eats the complement of Anders | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
uabeta (A B : U) (e : equiv A B) : Path (A -> B) (trans A B (ua A B e)) e.1 | = undefined | def | uabeta | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"equiv",
"trans",
"ua"
] | Exercise: prove the computation rule for ua (hint: use fill with the empty system) | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
unit (A : U) : Path U A ((a : A) * Unit) | = undefined | def | unit | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"Unit"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
flip (A B : U) (C : A -> B -> U) :
Path U ((a : A) * (b : B) * C a b)
((b : B) * (a : A) * C a b) | = undefined | def | flip | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
contract (A : U) : isContr A -> Path U A Unit | = undefined | def | contract | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"Unit",
"isContr"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
unitbeta (A : U) (a : A) :
Path ((a : A) * Unit) (transport (unit A) a) (a,tt) | = undefined | def | unitbeta | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"Unit",
"unit"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 | |
flipbeta (A B : U) (C : A -> B -> U) (a : A) (b : B) (c : C a b) :
Path ((b : B) * (a : A) * C a b)
(transport (flip A B C) (a,b,c)) (b,a,c) | = undefined | def | flipbeta | lectures | lectures/lecture4.ctt | [
"lecture3"
] | [
"Path",
"flip"
] | https://github.com/mortberg/cubicaltt | 9baa6f2491cc61dbd4fd81d58323c04100381451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.