The areas / V01. The language of Mathlib
Mathlib.Data.Bool.Basic
61 declarations. Mathlib docs · Source
Booleans
This file proves various trivial lemmas about Booleans and their relation to decidable propositions.
Tags
bool, boolean, Bool, De Morgan
This section contains lemmas about Booleans which were present in core Lean 3. The remainder of this file contains lemmas about Booleans from mathlib 3.
De Morgan's laws for Booleans
theorem Decidable.decide.hcongr_2 E1 #
∀ (p p' : Prop), p = p' → ∀ (self : Decidable p) (self' : Decidable p'), self ≍ self' → decide p ≍ decide p'
theorem Bool.true_eq_false_eq_False E1 #
¬true = false
theorem Bool.false_eq_true_eq_False E1 #
¬false = true
theorem Bool.and_eq_true_eq_eq_true_and_eq_true E1 #
∀ (a b : Bool), ((a && b) = true) = (a = true ∧ b = true)
theorem Bool.or_eq_true_eq_eq_true_or_eq_true E1 #
∀ (a b : Bool), ((a || b) = true) = (a = true ∨ b = true)
theorem Bool.not_eq_true_eq_eq_false E1 #
∀ (a : Bool), ((!a) = true) = (a = false)
theorem Bool.and_eq_false_eq_eq_false_or_eq_false E1 #
∀ (a b : Bool), ((a && b) = false) = (a = false ∨ b = false)
theorem Bool.or_eq_false_eq_eq_false_and_eq_false E1 #
∀ (a b : Bool), ((a || b) = false) = (a = false ∧ b = false)
theorem Bool.not_eq_false_eq_eq_true E1 #
∀ (a : Bool), ((!a) = false) = (a = true)
theorem Bool.coe_false E0 #
(false = true) = False
theorem Bool.coe_true E0 #
(true = true) = True
theorem Bool.coe_sort_false E0 #
(false = true) = False
theorem Bool.coe_sort_true E0 #
(true = true) = True
theorem Bool.decide_iff E0 #
∀ (p : Prop) [d : Decidable p], decide p = true ↔ p
theorem Bool.decide_true E1 #
∀ {p : Prop} [inst : Decidable p], p → decide p = true
theorem Bool.of_decide_true E1 #
∀ {p : Prop} [inst : Decidable p], decide p = true → p
theorem Bool.bool_iff_false E1 #
∀ {b : Bool}, ¬b = true ↔ b = false
theorem Bool.bool_eq_false E1 #
∀ {b : Bool}, ¬b = true → b = false
theorem Bool.decide_false_iff E0 #
∀ (p : Prop) {x : Decidable p}, decide p = false ↔ ¬p
theorem Bool.decide_false E1 #
∀ {p : Prop} [inst : Decidable p], ¬p → decide p = false
theorem Bool.of_decide_false E1 #
∀ {p : Prop} [inst : Decidable p], decide p = false → ¬p
theorem Bool.decide_congr E1 #
∀ {p q : Prop} [inst : Decidable p] [inst_1 : Decidable q], (p ↔ q) → decide p = decide q
theorem Bool.coe_xor_iff E0 #
∀ (a b : Bool), (a ^^ b) = true ↔ Xor (a = true) (b = true)
theorem Bool.dichotomy E1 #
∀ (b : Bool), b = false ∨ b = true
theorem Bool.not_ne_id E1 #
not ≠ id
theorem Bool.or_inl E1 #
∀ {a b : Bool}, a = true → (a || b) = true
theorem Bool.or_inr E1 #
∀ {a b : Bool}, b = true → (a || b) = true
theorem Bool.and_elim_left E1 #
∀ {a b : Bool}, (a && b) = true → a = true
theorem Bool.and_intro E1 #
∀ {a b : Bool}, a = true → b = true → (a && b) = true
theorem Bool.and_elim_right E1 #
∀ {a b : Bool}, (a && b) = true → b = true
theorem Bool.not_eq_iff E0 #
∀ {a b : Bool}, (!a) = b ↔ a ≠ b
theorem Bool.ne_not E1 #
∀ {a b : Bool}, a ≠ !b ↔ a = b
theorem Bool.not_ne_self E1 #
∀ (b : Bool), (!b) ≠ b
theorem Bool.self_ne_not E1 #
∀ (b : Bool), b ≠ !b
theorem Bool.not_iff_not E1 #
∀ {b : Bool}, (!b) = true ↔ ¬b = true
theorem Bool.bne_eq_xor E1 #
bne = xor
theorem Bool.xor_iff_ne E1 #
∀ {x y : Bool}, (x ^^ y) = true ↔ x ≠ y
instance Bool.linearOrder E0 #
LinearOrder Bool
theorem Bool.lt_iff E0 #
∀ {x y : Bool}, x < y ↔ x = false ∧ y = true
theorem Bool.false_lt_true E0 #
false < true
theorem Bool.le_iff_imp E1 #
∀ {x y : Bool}, x ≤ y ↔ x = true → y = true
theorem Bool.and_le_left E1 #
∀ (x y : Bool), (x && y) ≤ x
theorem Bool.and_le_right E1 #
∀ (x y : Bool), (x && y) ≤ y
theorem Bool.le_and E1 #
∀ {x y z : Bool}, x ≤ y → x ≤ z → x ≤ (y && z)
theorem Bool.left_le_or E1 #
∀ (x y : Bool), x ≤ (x || y)
theorem Bool.right_le_or E1 #
∀ (x y : Bool), y ≤ (x || y)
theorem Bool.or_le E1 #
∀ {x y z : Bool}, x ≤ z → y ≤ z → (x || y) ≤ z
def Bool.ofNat E1 #
ℕ → Bool
convert a ℕ to a Bool, 0 -> false, everything else -> true
theorem Bool.ofNat_zero E0 #
Bool.ofNat 0 = false
theorem Bool.ofNat_add_one E0 #
∀ {n : ℕ}, Bool.ofNat (n + 1) = true
theorem Bool.toNat_beq_zero E0 #
∀ (b : Bool), (b.toNat == 0) = !b
theorem Bool.toNat_bne_zero E0 #
∀ (b : Bool), (b.toNat != 0) = b
theorem Bool.toNat_beq_one E0 #
∀ (b : Bool), (b.toNat == 1) = b
theorem Bool.toNat_bne_one E0 #
∀ (b : Bool), (b.toNat != 1) = !b
theorem Bool.ofNat_le_ofNat E1 #
∀ {n m : ℕ}, n ≤ m → Bool.ofNat n ≤ Bool.ofNat m
theorem Bool.toNat_le_toNat E1 #
∀ {b₀ b₁ : Bool}, b₀ ≤ b₁ → b₀.toNat ≤ b₁.toNat
theorem Bool.ofNat_toNat E1 #
∀ (b : Bool), Bool.ofNat b.toNat = b
theorem Bool.injective_iff E0 #
∀ {α : Sort u_1} {f : Bool → α}, Function.Injective f ↔ f false ≠ f true
theorem Bool.apply_apply_apply E0 #
∀ (f : Bool → Bool) (x : Bool), f (f (f x)) = f x
Kaminski's Equation
def Bool.xor3 E1 #
Bool → Bool → Bool → Bool
xor3 x y c is ((x XOR y) XOR c).
def Bool.carry E1 #
Bool → Bool → Bool → Bool
carry x y c is x && y || x && c || y && c.