quox/examples/misc.quox
rhiannon morris 3f06e8d68b allow multiple names in a binder
e.g. "(x y : ℕ) × plus x y ≡ 10 : ℕ"

fixes #2
2023-04-19 21:37:51 +02:00

36 lines
1.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def0 True : ★₀ = {true};
def0 False : ★₀ = {};
def0 Not : 0.★₀ → ★₀ = λ A ⇒ ω.A → False;
def void : 0.(A : ★₀) → 0.False → A =
λ A v ⇒ case0 v return A of { };
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 y : A) → 1.(xy : x ≡ y : A) → Eq [𝑖 ⇒ P (xy @𝑖)] (p x) (p y) =
λ A P p x y xy ⇒ δ 𝑖 ⇒ p (xy @𝑖);
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 q : All A P) →
1.(All A (eq-f A P p q)) → p ≡ q : All A P =
λ A P p q eq ⇒ δ 𝑖 ⇒ λ x ⇒ eq x @𝑖;
def sym : 0.(A : ★₀) → 0.(x y : A) → 1.(x ≡ y : A) → y ≡ x : A =
λ A x y eq ⇒ δ 𝑖 ⇒ comp [A] @0 @1 (eq @0) @𝑖 { 0 𝑗 ⇒ eq @𝑗; 1 _ ⇒ eq @0 };
def trans : 0.(A : ★₀) → 0.(x y z : A) →
ω.(x ≡ y : A) → ω.(y ≡ z : A) → x ≡ z : A =
λ A x y z eq1 eq2 ⇒ δ 𝑖
comp [A] @0 @1 (eq1 @𝑖) @𝑖 { 0 _ ⇒ eq1 @0; 1 𝑗 ⇒ eq2 @𝑗 };