quox/examples/misc.quox

43 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-04-03 10:07:51 -04:00
def0 Pred : 0.★₀ → ★₁ = λ A ⇒ 0.A → ★₀;
def0 All : 0.(A : ★₀) → 0.(Pred A) → ★₁ =
λ A P ⇒ 1.(x : A) → P x;
defω cong :
0.(A : ★₀) → 0.(P : Pred A) →
1.(p : All A P) →
0.(x : A) → 0.(y : A) → 1.(xy : x ≡ y : A) →
Eq [i ⇒ P (xy @i)] (p x) (p y) =
λ A P p x y xy ⇒ δ i ⇒ p (xy @i);
def0 eq-f :
0.(A : ★₀) → 0.(P : Pred A) →
0.(p : All A P) → 0.(q : All A P) →
0.A → ★₀ =
λ A P p q x ⇒ p x ≡ q x : P x;
defω funext :
0.(A : ★₀) → 0.(P : Pred A) →
0.(p : All A P) → 0.(q : All A P) →
1.(All A (eq-f A P p q)) →
p ≡ q : All A P =
λ A P p q eq ⇒ δ i ⇒ λ x ⇒ eq x @i;
2023-04-15 09:13:01 -04:00
def0 T : ω.{true, false} → ★₀ =
λ b ⇒ caseω b return ★₀ of { 'true ⇒ {tt}; 'false ⇒ {} };
defω absurd :
0.('true ≡ 'false : {true, false}) → 0.(A : ★₀) → A =
λ eq A ⇒
case0 coe [i ⇒ T (eq @i)] @0 @1 'tt return A of { };
defω sym : 0.(A : ★₀) → 0.(x : A) → 0.(y : A) →
1.(x ≡ y : A) → y ≡ x : A =
λ A x y eq ⇒ δ i ⇒
comp [A] @0 @1 (eq @0) @i { 0 j ⇒ eq @j; 1 _ ⇒ eq @0 };
2023-04-17 15:44:16 -04:00
defω trans : 0.(A : ★₀) → 0.(x : A) → 0.(y : A) → 0.(z : A) →
ω.(x ≡ y : A) → ω.(y ≡ z : A) → x ≡ z : A =
λ A x y z eq1 eq2 ⇒ δ i ⇒
comp [A] @0 @1 (eq1 @i) @i { 0 _ ⇒ eq1 @0; 1 j ⇒ eq2 @j };