2023-04-18 18:42:40 -04:00
|
|
|
load "misc.quox";
|
|
|
|
|
|
|
|
namespace bool {
|
|
|
|
|
2023-05-21 14:09:34 -04:00
|
|
|
def0 Bool : ★⁰ = {true, false};
|
2023-04-18 18:42:40 -04:00
|
|
|
|
|
|
|
def boolω : 1.Bool → [ω.Bool] =
|
|
|
|
λ b ⇒ case1 b return [ω.Bool] of { 'true ⇒ ['true]; 'false ⇒ ['false] };
|
|
|
|
|
2023-05-21 14:09:34 -04:00
|
|
|
def if : 0.(A : ★⁰) → 1.Bool → ω.A → ω.A → A =
|
2023-04-18 18:42:40 -04:00
|
|
|
λ A b t f ⇒ case1 b return A of { 'true ⇒ t; 'false ⇒ f };
|
|
|
|
|
|
|
|
-- [todo]: universe lifting
|
2023-05-21 14:09:34 -04:00
|
|
|
def0 If : 1.Bool → 0.★⁰ → 0.★⁰ → ★⁰ =
|
|
|
|
λ b T F ⇒ case1 b return ★⁰ of { 'true ⇒ T; 'false ⇒ F };
|
2023-04-18 18:42:40 -04:00
|
|
|
|
2023-05-21 14:09:34 -04:00
|
|
|
def0 T : ω.Bool → ★⁰ = λ b ⇒ If b True False;
|
2023-04-18 18:42:40 -04:00
|
|
|
|
|
|
|
def true-not-false : Not ('true ≡ 'false : Bool) =
|
2023-05-16 12:14:42 -04:00
|
|
|
λ eq ⇒ coe (i ⇒ T (eq @i)) 'true;
|
2023-04-18 18:42:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
-- [todo] infix
|
2023-04-19 15:36:57 -04:00
|
|
|
def and : 1.Bool → ω.Bool → Bool = λ a b ⇒ if Bool a b 'false;
|
|
|
|
def or : 1.Bool → ω.Bool → Bool = λ a b ⇒ if Bool a 'true b;
|
2023-04-18 18:42:40 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
def0 Bool = bool.Bool;
|