doc-next-gen

Init.Data.Bool

Module docstring

{"### and ","### or ","### distributivity ","### eq/beq/bne ","### coercision related normal forms ","### beq properties ","### xor ","### le/lt ","### min/max ","### injectivity lemmas ","## toNat ","## toInt ","### ite ","### forall ","### exists ","### cond ","# decidability ","### decide ","### coercions ","### subtypes "}

Bool.xor abbrev
: Bool → Bool → Bool
Full source
/--
Boolean “exclusive or”. `xor x y` can be written `x ^^ y`.

`x ^^ y` is `true` when precisely one of `x` or `y` is `true`. Unlike `and` and `or`, it does not
have short-circuiting behavior, because one argument's value never determines the final value. Also
unlike `and` and `or`, there is no commonly-used corresponding propositional connective.

Examples:
 * `false ^^ false = false`
 * `true ^^ false = true`
 * `false ^^ true = true`
 * `true ^^ true = false`
-/
abbrev xor : BoolBoolBool := bne
Boolean Exclusive OR (XOR) Operation
Informal description
The boolean exclusive or (XOR) operation, denoted as $x \oplus y$, is defined for two boolean values $x$ and $y$. It evaluates to $\mathtt{true}$ if exactly one of $x$ or $y$ is $\mathtt{true}$, and $\mathtt{false}$ otherwise. Unlike logical AND or OR, XOR does not short-circuit and requires evaluation of both operands.
Bool.term_^^_ definition
: Lean.TrailingParserDescr✝
Full source
@[inherit_doc] infixl:33 " ^^ " => xor
Boolean XOR operator
Informal description
The infix notation `^^` with precedence 33 represents the exclusive or (XOR) operation on boolean values.
Bool.instDecidableForallOfDecidablePred instance
(p : Bool → Prop) [inst : DecidablePred p] : Decidable (∀ x, p x)
Full source
instance (p : Bool → Prop) [inst : DecidablePred p] : Decidable (∀ x, p x) :=
  match inst true, inst false with
  | isFalse ht, _ => isFalse fun h => absurd (h _) ht
  | _, isFalse hf => isFalse fun h => absurd (h _) hf
  | isTrue ht, isTrue hf => isTrue fun | true => ht | false => hf
Decidability of Universal Quantifiers on Booleans
Informal description
For any decidable predicate $p$ on the Boolean type, the universal statement $\forall x : \mathtt{Bool}, p(x)$ is decidable.
Bool.instDecidableExistsOfDecidablePred instance
(p : Bool → Prop) [inst : DecidablePred p] : Decidable (∃ x, p x)
Full source
instance (p : Bool → Prop) [inst : DecidablePred p] : Decidable (∃ x, p x) :=
  match inst true, inst false with
  | isTrue ht, _ => isTrue ⟨_, ht⟩
  | _, isTrue hf => isTrue ⟨_, hf⟩
  | isFalse ht, isFalse hf => isFalse fun | ⟨true, h⟩ => absurd h ht | ⟨false, h⟩ => absurd h hf
Decidability of Existential Quantifiers on Booleans
Informal description
For any decidable predicate $p$ on the Boolean type, the existential statement $\exists x : \mathtt{Bool}, p(x)$ is decidable.
Bool.default_bool theorem
: default = false
Full source
@[simp] theorem default_bool : default = false := rfl
Default Boolean Value is False
Informal description
The default value of the Boolean type is `false`, i.e., $\mathtt{default} = \mathtt{false}$.
Bool.instLE instance
: LE Bool
Full source
instance : LE Bool := ⟨(. → .)⟩
The "Less Than or Equal To" Relation on Booleans
Informal description
The Boolean type $\mathtt{Bool}$ is equipped with a canonical "less than or equal to" relation, where $\mathtt{false} \leq \mathtt{true}$ and $\mathtt{false} \leq \mathtt{false}$, $\mathtt{true} \leq \mathtt{true}$.
Bool.instLT instance
: LT Bool
Full source
instance : LT Bool := ⟨(!. && .)⟩
The "Less Than" Relation on Booleans
Informal description
The Boolean type $\mathtt{Bool}$ is equipped with a canonical "less than" relation, where $\mathtt{false} < \mathtt{true}$ and $\mathtt{false} \not< \mathtt{false}$, $\mathtt{true} \not< \mathtt{true}$.
Bool.instDecidableLe instance
(x y : Bool) : Decidable (x ≤ y)
Full source
instance (x y : Bool) : Decidable (x ≤ y) := inferInstanceAs (Decidable (x → y))
Decidability of the Order Relation on Booleans
Informal description
For any two boolean values $x$ and $y$, the relation $x \leq y$ is decidable.
Bool.instDecidableLt instance
(x y : Bool) : Decidable (x < y)
Full source
instance (x y : Bool) : Decidable (x < y) := inferInstanceAs (Decidable (!x!x && y))
Decidability of the Less Than Relation on Booleans
Informal description
For any two boolean values $x$ and $y$, the proposition $x < y$ is decidable.
Bool.instMax instance
: Max Bool
Full source
instance : Max Bool := ⟨or⟩
Maximum Operation on Boolean Values
Informal description
The Boolean type `Bool` is equipped with a maximum operation, where the maximum of two Boolean values is defined using the logical OR operation.
Bool.instMin instance
: Min Bool
Full source
instance : Min Bool := ⟨and⟩
Minimum Operation on Boolean Values
Informal description
The Boolean type `Bool` is equipped with a minimum operation, where the minimum of two Boolean values is defined using the logical AND operation.
Bool.false_ne_true theorem
: false ≠ true
Full source
theorem false_ne_true : falsefalse ≠ true := Bool.noConfusion
Inequality of Boolean Constants: $\text{false} \neq \text{true}$
Informal description
The Boolean values `false` and `true` are not equal, i.e., $\text{false} \neq \text{true}$.
Bool.ne_false_iff theorem
: {b : Bool} → b ≠ false ↔ b = true
Full source
theorem ne_false_iff : {b : Bool} → b ≠ falseb ≠ false ↔ b = true := by decide
Boolean Inequality to False is Equivalent to Equality to True
Informal description
For any boolean value $b$, the inequality $b \neq \text{false}$ holds if and only if $b = \text{true}$.
Bool.decide_eq_true theorem
{b : Bool} [Decidable (b = true)] : decide (b = true) = b
Full source
@[simp] theorem decide_eq_true  {b : Bool} [Decidable (b = true)]  : decide (b = true)  =  b := by cases b <;> simp
Decision Procedure for Boolean Equality to True
Informal description
For any Boolean value $b$, the decision procedure for the proposition "$b$ is equal to `true`" evaluates to $b$ itself. That is, $\text{decide}(b = \text{true}) = b$.
Bool.decide_eq_false theorem
{b : Bool} [Decidable (b = false)] : decide (b = false) = !b
Full source
@[simp] theorem decide_eq_false {b : Bool} [Decidable (b = false)] : decide (b = false) = !b := by cases b <;> simp
Deciding Equality to False is Negation
Informal description
For any Boolean value $b$ with a decidable equality to `false`, the result of deciding whether $b$ is equal to `false` is equal to the negation of $b$, i.e., $\text{decide}(b = \text{false}) = \neg b$.
Bool.decide_true_eq theorem
{b : Bool} [Decidable (true = b)] : decide (true = b) = b
Full source
theorem decide_true_eq  {b : Bool} [Decidable (true = b)]  : decide (true  = b) =  b := by cases b <;> simp
Boolean Evaluation of $\text{true} = b$ is $b$
Informal description
For any boolean value $b$, the boolean evaluation of the proposition $\text{true} = b$ is equal to $b$.
Bool.decide_false_eq theorem
{b : Bool} [Decidable (false = b)] : decide (false = b) = !b
Full source
theorem decide_false_eq {b : Bool} [Decidable (false = b)] : decide (false = b) = !b := by cases b <;> simp
Decision for False Equality to Boolean Negation: $\text{decide}(\text{false} = b) = \neg b$
Informal description
For any Boolean value $b$ with a decidable equality instance for `false = b`, the decision procedure for `false = b` evaluates to the negation of $b$, i.e., $\text{decide}(\text{false} = b) = \neg b$.
Bool.and_self_left theorem
: ∀ (a b : Bool), (a && (a && b)) = (a && b)
Full source
@[simp] theorem and_self_left  : ∀ (a b : Bool), (a && (a && b)) = (a && b) := by decide
Left Self-Conjunction Property of Boolean AND: $a \land (a \land b) = a \land b$
Informal description
For any boolean values $a$ and $b$, the conjunction $a \land (a \land b)$ is equal to $a \land b$.
Bool.and_self_right theorem
: ∀ (a b : Bool), ((a && b) && b) = (a && b)
Full source
@[simp] theorem and_self_right : ∀ (a b : Bool), ((a && b) && b) = (a && b) := by decide
Right Idempotence of Boolean Conjunction: $(a \land b) \land b = a \land b$
Informal description
For any boolean values $a$ and $b$, the conjunction $(a \land b) \land b$ is equal to $a \land b$.
Bool.not_and_self theorem
: ∀ (x : Bool), (!x && x) = false
Full source
@[simp] theorem not_and_self : ∀ (x : Bool), (!x!x && x) = false := by decide
Negation Conjunction with Self is False: $\neg x \land x = \text{false}$
Informal description
For any boolean value $x$, the conjunction of $\neg x$ (the negation of $x$) and $x$ itself is false, i.e., $\neg x \land x = \text{false}$.
Bool.and_not_self theorem
: ∀ (x : Bool), (x && !x) = false
Full source
@[simp] theorem and_not_self : ∀ (x : Bool), (x && !x) = false := by decide
Contradiction in Boolean Algebra: $x \land \neg x = \text{false}$
Informal description
For any boolean value $x$, the conjunction of $x$ with its negation is false, i.e., $x \land \neg x = \text{false}$.
Bool.and_comm theorem
: ∀ (x y : Bool), (x && y) = (y && x)
Full source
theorem and_comm : ∀ (x y : Bool), (x && y) = (y && x) := by decide
Commutativity of Boolean AND: $x \land y = y \land x$
Informal description
For any boolean values $x$ and $y$, the conjunction $x \land y$ is equal to $y \land x$.
Bool.instCommutativeAnd instance
: Std.Commutative (· && ·)
Full source
instance : Std.Commutative (· && ·) := ⟨and_comm⟩
Commutativity of Boolean AND
Informal description
The Boolean AND operation `&&` is commutative. That is, for any boolean values `x` and `y`, the operation satisfies `x && y = y && x`.
Bool.and_left_comm theorem
: ∀ (x y z : Bool), (x && (y && z)) = (y && (x && z))
Full source
theorem and_left_comm : ∀ (x y z : Bool), (x && (y && z)) = (y && (x && z)) := by decide
Left Commutativity of Boolean AND: $x \land (y \land z) = y \land (x \land z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following equality holds: $$x \land (y \land z) = y \land (x \land z)$$ where $\land$ denotes the logical AND operation.
Bool.and_right_comm theorem
: ∀ (x y z : Bool), ((x && y) && z) = ((x && z) && y)
Full source
theorem and_right_comm : ∀ (x y z : Bool), ((x && y) && z) = ((x && z) && y) := by decide
Right Commutativity of Boolean AND: $(x \land y) \land z = (x \land z) \land y$
Informal description
For any boolean values $x$, $y$, and $z$, the equality $(x \land y) \land z = (x \land z) \land y$ holds, where $\land$ denotes the logical AND operation.
Bool.and_iff_left_iff_imp theorem
: ∀ {a b : Bool}, ((a && b) = a) ↔ (a → b)
Full source
@[simp] theorem and_iff_left_iff_imp  : ∀ {a b : Bool}, ((a && b) = a) ↔ (a → b) := by decide
Boolean Conjunction Equivalence: $(a \land b) = a \leftrightarrow (a \to b)$
Informal description
For any boolean values $a$ and $b$, the equality $(a \land b) = a$ holds if and only if $a$ implies $b$.
Bool.and_iff_right_iff_imp theorem
: ∀ {a b : Bool}, ((a && b) = b) ↔ (b → a)
Full source
@[simp] theorem and_iff_right_iff_imp : ∀ {a b : Bool}, ((a && b) = b) ↔ (b → a) := by decide
Boolean Conjunction Equivalence: $(a \land b) = b \leftrightarrow (b \to a)$
Informal description
For any boolean values $a$ and $b$, the equality $(a \land b) = b$ holds if and only if $b$ implies $a$.
Bool.iff_self_and theorem
: ∀ {a b : Bool}, (a = (a && b)) ↔ (a → b)
Full source
@[simp] theorem iff_self_and : ∀ {a b : Bool}, (a = (a && b)) ↔ (a → b) := by decide
Boolean Equality of Conjunction Implies Implication: $a = (a \land b) \leftrightarrow (a \to b)$
Informal description
For any boolean values $a$ and $b$, the equality $a = (a \land b)$ holds if and only if $a$ implies $b$.
Bool.iff_and_self theorem
: ∀ {a b : Bool}, (b = (a && b)) ↔ (b → a)
Full source
@[simp] theorem iff_and_self : ∀ {a b : Bool}, (b = (a && b)) ↔ (b → a) := by decide
Boolean Conjunction Equivalence: $b = (a \land b) \leftrightarrow (b \to a)$
Informal description
For any boolean values $a$ and $b$, the equality $b = (a \land b)$ holds if and only if $b$ implies $a$.
Bool.not_and_iff_left_iff_imp theorem
: ∀ {a b : Bool}, ((!a && b) = a) ↔ !a ∧ !b
Full source
@[simp] theorem not_and_iff_left_iff_imp  : ∀ {a b : Bool}, ((!a && b) = a) ↔ !a ∧ !b := by decide
Negated Conjunction Equivalence: $(\neg a \land b) = a \leftrightarrow \neg a \land \neg b$
Informal description
For any boolean values $a$ and $b$, the equality $(\neg a \land b) = a$ holds if and only if both $\neg a$ and $\neg b$ hold.
Bool.and_not_iff_right_iff_imp theorem
: ∀ {a b : Bool}, ((a && !b) = b) ↔ !a ∧ !b
Full source
@[simp] theorem and_not_iff_right_iff_imp : ∀ {a b : Bool}, ((a && !b) = b) ↔ !a ∧ !b := by decide
Boolean Conjunction-Negation Equivalence: $(a \land \neg b) = b \leftrightarrow \neg a \land \neg b$
Informal description
For any boolean values $a$ and $b$, the equality $(a \land \neg b) = b$ holds if and only if both $\neg a$ and $\neg b$ hold.
Bool.iff_not_self_and theorem
: ∀ {a b : Bool}, (a = (!a && b)) ↔ !a ∧ !b
Full source
@[simp] theorem iff_not_self_and : ∀ {a b : Bool}, (a = (!a && b)) ↔ !a ∧ !b := by decide
Equivalence of Self-Negation and Conjunction: $a = (\neg a \land b) \leftrightarrow \neg a \land \neg b$
Informal description
For any boolean values $a$ and $b$, the equality $a = (\neg a \land b)$ holds if and only if both $\neg a$ and $\neg b$ hold.
Bool.iff_and_not_self theorem
: ∀ {a b : Bool}, (b = (a && !b)) ↔ !a ∧ !b
Full source
@[simp] theorem iff_and_not_self : ∀ {a b : Bool}, (b = (a && !b)) ↔ !a ∧ !b := by decide
Boolean Equivalence: $b = (a \land \neg b) \leftrightarrow (\neg a \land \neg b)$
Informal description
For any boolean values $a$ and $b$, the equality $b = (a \land \neg b)$ holds if and only if both $\neg a$ and $\neg b$ hold.
Bool.or_self_left theorem
: ∀ (a b : Bool), (a || (a || b)) = (a || b)
Full source
@[simp] theorem or_self_left  : ∀ (a b : Bool), (a || (a || b)) = (a || b) := by decide
Left Idempotence of Boolean OR: $a \lor (a \lor b) = a \lor b$
Informal description
For any boolean values $a$ and $b$, the expression $a \lor (a \lor b)$ is equivalent to $a \lor b$, where $\lor$ denotes the logical OR operation.
Bool.or_self_right theorem
: ∀ (a b : Bool), ((a || b) || b) = (a || b)
Full source
@[simp] theorem or_self_right : ∀ (a b : Bool), ((a || b) || b) = (a || b) := by decide
Right Idempotence of Boolean OR: $(a \lor b) \lor b = a \lor b$
Informal description
For any boolean values $a$ and $b$, the expression $(a \lor b) \lor b$ is equal to $a \lor b$, where $\lor$ denotes the logical OR operation.
Bool.not_or_self theorem
: ∀ (x : Bool), (!x || x) = true
Full source
@[simp] theorem not_or_self : ∀ (x : Bool), (!x!x || x) = true := by decide
Boolean Law of Excluded Middle: $\neg x \lor x = \text{true}$
Informal description
For any boolean value $x$, the disjunction of $\neg x$ and $x$ is true, i.e., $\neg x \lor x = \text{true}$.
Bool.or_not_self theorem
: ∀ (x : Bool), (x || !x) = true
Full source
@[simp] theorem or_not_self : ∀ (x : Bool), (x || !x) = true := by decide
Law of Excluded Middle for Boolean Disjunction
Informal description
For any boolean value $x$, the disjunction of $x$ with its negation evaluates to `true`, i.e., $x \lor \neg x = \text{true}$.
Bool.or_iff_left_iff_imp theorem
: ∀ {a b : Bool}, ((a || b) = a) ↔ (b → a)
Full source
@[simp] theorem or_iff_left_iff_imp  : ∀ {a b : Bool}, ((a || b) = a) ↔ (b → a) := by decide
Boolean OR Left Identity Equivalence: $(a \lor b) = a \leftrightarrow (b \to a)$
Informal description
For any boolean values $a$ and $b$, the equality $(a \lor b) = a$ holds if and only if $b$ implies $a$.
Bool.or_iff_right_iff_imp theorem
: ∀ {a b : Bool}, ((a || b) = b) ↔ (a → b)
Full source
@[simp] theorem or_iff_right_iff_imp : ∀ {a b : Bool}, ((a || b) = b) ↔ (a → b) := by decide
Disjunction Equals Right Operand iff Left Implies Right: $a \lor b = b \leftrightarrow (a \to b)$
Informal description
For any boolean values $a$ and $b$, the equality $a \lor b = b$ holds if and only if $a$ implies $b$.
Bool.iff_self_or theorem
: ∀ {a b : Bool}, (a = (a || b)) ↔ (b → a)
Full source
@[simp] theorem iff_self_or : ∀ {a b : Bool}, (a = (a || b)) ↔ (b → a) := by decide
Boolean Disjunction Identity: $a = (a \lor b) \leftrightarrow (b \to a)$
Informal description
For any boolean values $a$ and $b$, the equality $a = (a \lor b)$ holds if and only if $b$ implies $a$ (i.e., $b \to a$).
Bool.iff_or_self theorem
: ∀ {a b : Bool}, (b = (a || b)) ↔ (a → b)
Full source
@[simp] theorem iff_or_self : ∀ {a b : Bool}, (b = (a || b)) ↔ (a → b) := by decide
Boolean Disjunction Implication Equivalence: $b = (a \lor b) \leftrightarrow (a \to b)$
Informal description
For any boolean values $a$ and $b$, the equality $b = (a \lor b)$ holds if and only if $a$ implies $b$.
Bool.not_or_iff_left_iff_imp theorem
: ∀ {a b : Bool}, ((!a || b) = a) ↔ a ∧ b
Full source
@[simp] theorem not_or_iff_left_iff_imp  : ∀ {a b : Bool}, ((!a || b) = a) ↔ a ∧ b := by decide
Boolean Identity: $(\neg a \lor b) = a \leftrightarrow a \land b$
Informal description
For any boolean values $a$ and $b$, the equality $(\neg a \lor b) = a$ holds if and only if both $a$ and $b$ are true, i.e., $a \land b$.
Bool.or_not_iff_right_iff_imp theorem
: ∀ {a b : Bool}, ((a || !b) = b) ↔ a ∧ b
Full source
@[simp] theorem or_not_iff_right_iff_imp : ∀ {a b : Bool}, ((a || !b) = b) ↔ a ∧ b := by decide
Boolean Disjunction-Negation Equivalence: $(a \lor \neg b) = b \leftrightarrow a \land b$
Informal description
For any boolean values $a$ and $b$, the equality $(a \lor \neg b) = b$ holds if and only if both $a$ and $b$ are true, i.e., $a \land b$.
Bool.iff_not_self_or theorem
: ∀ {a b : Bool}, (a = (!a || b)) ↔ a ∧ b
Full source
@[simp] theorem iff_not_self_or : ∀ {a b : Bool}, (a = (!a || b)) ↔ a ∧ b := by decide
Boolean Identity: $a = (\neg a \lor b) \leftrightarrow a \land b$
Informal description
For any boolean values $a$ and $b$, the equality $a = (\neg a \lor b)$ holds if and only if both $a$ and $b$ are true, i.e., $a \land b$.
Bool.iff_or_not_self theorem
: ∀ {a b : Bool}, (b = (a || !b)) ↔ a ∧ b
Full source
@[simp] theorem iff_or_not_self : ∀ {a b : Bool}, (b = (a || !b)) ↔ a ∧ b := by decide
Boolean Equivalence: $b = (a \lor \neg b) \leftrightarrow a \land b$
Informal description
For any boolean values $a$ and $b$, the equality $b = (a \lor \neg b)$ holds if and only if both $a$ and $b$ are true, i.e., $a \land b$.
Bool.or_comm theorem
: ∀ (x y : Bool), (x || y) = (y || x)
Full source
theorem or_comm : ∀ (x y : Bool), (x || y) = (y || x) := by decide
Commutativity of Boolean OR: $x \lor y = y \lor x$
Informal description
For any boolean values $x$ and $y$, the disjunction $x \lor y$ is equal to $y \lor x$.
Bool.instCommutativeOr instance
: Std.Commutative (· || ·)
Full source
instance : Std.Commutative (· || ·) := ⟨or_comm⟩
Commutativity of Boolean OR Operation
Informal description
The Boolean disjunction operation `||` is commutative. That is, for any boolean values `x` and `y`, we have `x || y = y || x`.
Bool.or_left_comm theorem
: ∀ (x y z : Bool), (x || (y || z)) = (y || (x || z))
Full source
theorem or_left_comm : ∀ (x y z : Bool), (x || (y || z)) = (y || (x || z)) := by decide
Left Commutativity of Boolean OR Operation
Informal description
For any boolean values $x$, $y$, and $z$, the following equality holds: $$x \lor (y \lor z) = y \lor (x \lor z)$$ where $\lor$ denotes the logical OR operation.
Bool.or_right_comm theorem
: ∀ (x y z : Bool), ((x || y) || z) = ((x || z) || y)
Full source
theorem or_right_comm : ∀ (x y z : Bool), ((x || y) || z) = ((x || z) || y) := by decide
Right Commutativity of Boolean OR
Informal description
For any boolean values $x$, $y$, and $z$, the expression $(x \lor y) \lor z$ is equal to $(x \lor z) \lor y$, where $\lor$ denotes the logical OR operation.
Bool.and_or_distrib_left theorem
: ∀ (x y z : Bool), (x && (y || z)) = (x && y || x && z)
Full source
theorem and_or_distrib_left  : ∀ (x y z : Bool), (x && (y || z)) = (x && yx && y || x && z) := by decide
Left Distributivity of AND over OR for Boolean Values
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive law holds: $$x \land (y \lor z) = (x \land y) \lor (x \land z)$$ where $\land$ denotes logical AND and $\lor$ denotes logical OR.
Bool.and_or_distrib_right theorem
: ∀ (x y z : Bool), ((x || y) && z) = (x && z || y && z)
Full source
theorem and_or_distrib_right : ∀ (x y z : Bool), ((x || y) && z) = (x && zx && z || y && z) := by decide
Right Distributivity of AND over OR for Booleans: $(x \lor y) \land z = (x \land z) \lor (y \land z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive property holds: $$(x \lor y) \land z = (x \land z) \lor (y \land z)$$ where $\lor$ denotes logical OR and $\land$ denotes logical AND.
Bool.or_and_distrib_left theorem
: ∀ (x y z : Bool), (x || y && z) = ((x || y) && (x || z))
Full source
theorem or_and_distrib_left  : ∀ (x y z : Bool), (x || y && z) = ((x || y) && (x || z)) := by decide
Left Distributivity of OR over AND for Booleans: $x \lor (y \land z) = (x \lor y) \land (x \lor z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive law holds: $$x \lor (y \land z) = (x \lor y) \land (x \lor z)$$ where $\lor$ denotes logical OR and $\land$ denotes logical AND.
Bool.or_and_distrib_right theorem
: ∀ (x y z : Bool), (x && y || z) = ((x || z) && (y || z))
Full source
theorem or_and_distrib_right : ∀ (x y z : Bool), (x && yx && y || z) = ((x || z) && (y || z)) := by decide
Right Distributivity of OR over AND for Booleans: $(x \land y) \lor z = (x \lor z) \land (y \lor z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive property holds: $$(x \land y) \lor z = (x \lor z) \land (y \lor z)$$ where $\lor$ denotes logical OR and $\land$ denotes logical AND.
Bool.and_xor_distrib_left theorem
: ∀ (x y z : Bool), (x && (y ^^ z)) = ((x && y) ^^ (x && z))
Full source
theorem and_xor_distrib_left  : ∀ (x y z : Bool), (x && (y ^^ z)) = ((x && y) ^^ (x && z)) := by decide
Left Distributivity of AND over XOR for Booleans: $x \land (y \oplus z) = (x \land y) \oplus (x \land z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive property holds: $$x \land (y \oplus z) = (x \land y) \oplus (x \land z)$$ where $\land$ denotes logical AND and $\oplus$ denotes logical XOR (exclusive OR).
Bool.and_xor_distrib_right theorem
: ∀ (x y z : Bool), ((x ^^ y) && z) = ((x && z) ^^ (y && z))
Full source
theorem and_xor_distrib_right : ∀ (x y z : Bool), ((x ^^ y) && z) = ((x && z) ^^ (y && z)) := by decide
Right Distributivity of AND over XOR for Booleans: $(x \oplus y) \land z = (x \land z) \oplus (y \land z)$
Informal description
For any boolean values $x$, $y$, and $z$, the following distributive property holds: $$(x \oplus y) \land z = (x \land z) \oplus (y \land z)$$ where $\oplus$ denotes the exclusive OR (XOR) operation and $\land$ denotes the logical AND operation.
Bool.not_and theorem
: ∀ (x y : Bool), (!(x && y)) = (!x || !y)
Full source
/-- De Morgan's law for boolean and -/
@[simp] theorem not_and : ∀ (x y : Bool), (!(x && y)) = (!x!x || !y) := by decide
De Morgan's Law for Boolean AND: $\neg(x \land y) = \neg x \lor \neg y$
Informal description
For any boolean values $x$ and $y$, the negation of their conjunction equals the disjunction of their negations, i.e., $\neg(x \land y) = (\neg x) \lor (\neg y)$.
Bool.not_or theorem
: ∀ (x y : Bool), (!(x || y)) = (!x && !y)
Full source
/-- De Morgan's law for boolean or -/
@[simp] theorem not_or : ∀ (x y : Bool), (!(x || y)) = (!x!x && !y) := by decide
De Morgan's Law for Boolean Disjunction: $\neg(x \lor y) = \neg x \land \neg y$
Informal description
For any boolean values $x$ and $y$, the negation of the disjunction $x \lor y$ is equal to the conjunction of the negations of $x$ and $y$, i.e., $\neg(x \lor y) = (\neg x) \land (\neg y)$.
Bool.and_eq_true_iff theorem
{x y : Bool} : (x && y) = true ↔ x = true ∧ y = true
Full source
theorem and_eq_true_iff {x y : Bool} : (x && y) = true ↔ x = true ∧ y = true :=
  Iff.of_eq (and_eq_true x y)
Conjunction Equivalence: $(x \land y) = \text{true} \leftrightarrow (x = \text{true}) \land (y = \text{true})$
Informal description
For any boolean values $x$ and $y$, the conjunction $x \land y$ evaluates to `true` if and only if both $x$ and $y$ are `true`. In other words, $(x \land y) = \text{true} \leftrightarrow (x = \text{true}) \land (y = \text{true})$.
Bool.and_eq_false_iff theorem
: ∀ {x y : Bool}, (x && y) = false ↔ x = false ∨ y = false
Full source
theorem and_eq_false_iff : ∀ {x y : Bool}, (x && y) = false ↔ x = false ∨ y = false := by decide
Conjunction to False Equivalence: $(x \land y) = \text{false} \leftrightarrow (x = \text{false}) \lor (y = \text{false})$
Informal description
For any boolean values $x$ and $y$, the conjunction $x \land y$ evaluates to `false` if and only if either $x$ is `false` or $y$ is `false$.
Bool.and_eq_false_imp theorem
: ∀ {x y : Bool}, (x && y) = false ↔ (x = true → y = false)
Full source
@[simp] theorem and_eq_false_imp : ∀ {x y : Bool}, (x && y) = false ↔ (x = true → y = false) := by decide
Conjunction False Implication: $(x \land y) = \text{false} \leftrightarrow (x = \text{true} \to y = \text{false})$
Informal description
For any boolean values $x$ and $y$, the conjunction $x \land y$ evaluates to `false` if and only if whenever $x$ is `true`, $y$ must be `false`. In other words, $(x \land y) = \text{false} \leftrightarrow (x = \text{true} \to y = \text{false})$.
Bool.or_eq_true_iff theorem
: ∀ {x y : Bool}, (x || y) = true ↔ x = true ∨ y = true
Full source
theorem or_eq_true_iff : ∀ {x y : Bool}, (x || y) = true ↔ x = true ∨ y = true := by simp
Disjunction Equivalence: $x \lor y \leftrightarrow (x = \text{true} \lor y = \text{true})$
Informal description
For any boolean values $x$ and $y$, the disjunction $x \lor y$ evaluates to `true` if and only if either $x$ is `true` or $y$ is `true$.
Bool.or_eq_false_iff theorem
: ∀ {x y : Bool}, (x || y) = false ↔ x = false ∧ y = false
Full source
@[simp] theorem or_eq_false_iff : ∀ {x y : Bool}, (x || y) = false ↔ x = false ∧ y = false := by decide
Disjunction to False Equivalence: $x \lor y = \text{false} \leftrightarrow (x = \text{false} \land y = \text{false})$
Informal description
For any boolean values $x$ and $y$, the disjunction $x \lor y$ evaluates to `false` if and only if both $x$ is `false` and $y$ is `false$.
Bool.false_eq_true theorem
: (false = true) = False
Full source
/--
These two rules follow trivially by simp, but are needed to avoid non-termination
in false_eq and true_eq.
-/
@[simp] theorem false_eq_true : (false = true) = False := by simp
$\text{false} = \text{true}$ is False
Informal description
The equality $\text{false} = \text{true}$ is equivalent to the false proposition $\text{False}$.
Bool.true_eq_false theorem
: (true = false) = False
Full source
@[simp] theorem true_eq_false : (true = false) = False := by simp
$\text{true} = \text{false}$ is False
Informal description
The equality $\text{true} = \text{false}$ is equivalent to the false proposition $\text{False}$.
Bool.false_eq theorem
(b : Bool) : (false = b) = (b = false)
Full source
@[simp low] theorem false_eq (b : Bool) : (false = b) = (b = false) := by
  cases b <;> simp
Symmetry of Equality with False: $\text{false} = b \leftrightarrow b = \text{false}$
Informal description
For any Boolean value $b$, the equality $\text{false} = b$ is equivalent to $b = \text{false}$.
Bool.true_eq theorem
(b : Bool) : (true = b) = (b = true)
Full source
@[simp low] theorem true_eq (b : Bool) : (true = b) = (b = true) := by
  cases b <;> simp
Symmetry of Equality with True: $\text{true} = b \leftrightarrow b = \text{true}$
Informal description
For any Boolean value $b$, the equality $\text{true} = b$ is equivalent to $b = \text{true}$.
Bool.true_beq theorem
: ∀ b, (true == b) = b
Full source
@[simp] theorem true_beq  : ∀b, (true  == b) =  b := by decide
Boolean Equality with True: $\text{true} == b = b$
Informal description
For any boolean value $b$, the boolean equality comparison `true == b` evaluates to $b$.
Bool.false_beq theorem
: ∀ b, (false == b) = !b
Full source
@[simp] theorem false_beq : ∀b, (false == b) = !b := by decide
Boolean Equality of False: $\text{false} == b = \neg b$
Informal description
For any boolean value $b$, the boolean equality check `false == b` is equal to the negation of $b$, i.e., $\text{false} == b = \neg b$.
Bool.instLawfulIdentityBeqTrue instance
: Std.LawfulIdentity (· == ·) true
Full source
instance : Std.LawfulIdentity (· == ·) true where
  left_id := true_beq
  right_id := beq_true
Boolean Equality with True as Lawful Identity
Informal description
The boolean equality operation `==` with `true` as the identity element satisfies the properties of a lawful identity. That is, for any boolean value `b`, the operations `true == b` and `b == true` both evaluate to `b`.
Bool.true_bne theorem
: ∀ (b : Bool), (true != b) = !b
Full source
@[simp] theorem true_bne  : ∀(b : Bool), (truetrue  != b) = !b := by decide
Negation via Boolean Not-Equal with True: $\text{true} \neq b = \neg b$
Informal description
For any boolean value $b$, the boolean not-equal operation between `true` and $b$ is equivalent to the negation of $b$, i.e., $\text{true} \neq b = \neg b$.
Bool.false_bne theorem
: ∀ (b : Bool), (false != b) = b
Full source
@[simp] theorem false_bne : ∀(b : Bool), (falsefalse != b) =  b := by decide
Boolean Inequality: $\text{false} \neq b \leftrightarrow b$
Informal description
For any boolean value $b$, the boolean inequality `false != b` evaluates to $b$.
Bool.bne_true theorem
: ∀ (b : Bool), (b != true) = !b
Full source
@[simp] theorem bne_true  : ∀(b : Bool), (b != true)  = !b := by decide
Boolean Not-Equal with True is Negation: $(b \neq \text{true}) = \neg b$
Informal description
For any boolean value $b$, the boolean not-equal operation between $b$ and `true` is equivalent to the negation of $b$, i.e., $(b \neq \text{true}) = \neg b$.
Bool.bne_false theorem
: ∀ (b : Bool), (b != false) = b
Full source
@[simp] theorem bne_false : ∀(b : Bool), (b != false) =  b := by decide
Boolean Not-Equal False Identity: $b \neq \text{false} \leftrightarrow b$
Informal description
For any boolean value $b$, the boolean not-equal operation `b != false` evaluates to $b$.
Bool.instLawfulIdentityBneFalse instance
: Std.LawfulIdentity (· != ·) false
Full source
instance : Std.LawfulIdentity (· != ·) false where
  left_id := false_bne
  right_id := bne_false
`false` as Identity for Boolean Not-Equal Operation
Informal description
The boolean value `false` is a lawful identity element for the boolean not-equal operation `!=`, meaning that for any boolean value `b`, both `(false != b) = b` and `(b != false) = b` hold.
Bool.not_beq_self theorem
: ∀ (x : Bool), ((!x) == x) = false
Full source
@[simp] theorem not_beq_self : ∀ (x : Bool), ((!x) == x) = false := by decide
Negation Inequality: $(\neg x == x) = \text{false}$
Informal description
For any boolean value $x$, the boolean equality comparison between $\neg x$ and $x$ evaluates to `false`, i.e., $(\neg x == x) = \text{false}$.
Bool.beq_not_self theorem
: ∀ (x : Bool), (x == !x) = false
Full source
@[simp] theorem beq_not_self : ∀ (x : Bool), (x   == !x) = false := by decide
Boolean Inequality: $x \neq \neg x$ for all $x$
Informal description
For any boolean value $x$, the equality test $x == \neg x$ evaluates to `false`.
Bool.not_bne theorem
: ∀ (a b : Bool), ((!a) != b) = !(a != b)
Full source
@[simp] theorem not_bne : ∀ (a b : Bool), ((!a) != b) = !(a != b) := by decide
Negation of Boolean Inequality: $(\neg a \neq b) = \neg (a \neq b)$
Informal description
For any boolean values $a$ and $b$, the boolean inequality $\neg a \neq b$ is equivalent to the negation of the boolean inequality $a \neq b$, i.e., $(\neg a \neq b) = \neg (a \neq b)$.
Bool.bne_not theorem
: ∀ (a b : Bool), (a != !b) = !(a != b)
Full source
@[simp] theorem bne_not : ∀ (a b : Bool), (a != !b) = !(a != b) := by decide
Negation Commutes with Boolean Inequality: $(a \neq \neg b) = \neg(a \neq b)$
Informal description
For any boolean values $a$ and $b$, the boolean not-equal operation between $a$ and $\neg b$ is equal to the negation of the boolean not-equal operation between $a$ and $b$, i.e., $(a \neq \neg b) = \neg(a \neq b)$.
Bool.not_bne_self theorem
: ∀ (x : Bool), ((!x) != x) = true
Full source
theorem not_bne_self : ∀ (x : Bool), ((!x) != x) = true := by decide
Negation Inequality Identity: $(\neg x \neq x) = \text{true}$
Informal description
For any boolean value $x$, the boolean not-equal operation between $\neg x$ and $x$ evaluates to `true`, i.e., $(\neg x \neq x) = \text{true}$.
Bool.bne_not_self theorem
: ∀ (x : Bool), (x != !x) = true
Full source
theorem bne_not_self : ∀ (x : Bool), (x   != !x) = true := by decide
Boolean Inequality with Negation: $(x \neq \neg x) = \text{true}$
Informal description
For any boolean value $x$, the boolean not-equal operation between $x$ and its negation $\neg x$ evaluates to `true`, i.e., $(x \neq \neg x) = \text{true}$.
Bool.not_eq_self theorem
: ∀ (b : Bool), ((!b) = b) ↔ False
Full source
theorem not_eq_self : ∀(b : Bool), ((!b) = b) ↔ False := by simp
Negation Self-Equivalence is False for Booleans
Informal description
For any Boolean value $b$, the negation of $b$ is equal to $b$ if and only if the statement is false. In other words, $\neg b = b \leftrightarrow \text{False}$.
Bool.beq_self_left theorem
: ∀ (a b : Bool), (a == (a == b)) = b
Full source
@[simp] theorem beq_self_left  : ∀(a b : Bool), (a == (a == b)) = b := by decide
Boolean Equivalence Self-Left Identity: $a \leftrightarrow (a \leftrightarrow b) \leftrightarrow b$
Informal description
For any boolean values $a$ and $b$, the equality $a = (a = b)$ holds if and only if $b$ is true. In other words, $a \leftrightarrow (a \leftrightarrow b) \leftrightarrow b$.
Bool.beq_self_right theorem
: ∀ (a b : Bool), ((a == b) == b) = a
Full source
@[simp] theorem beq_self_right : ∀(a b : Bool), ((a == b) == b) = a := by decide
Boolean Equality Self-Right Identity: $(a == b) == b = a$
Informal description
For any boolean values $a$ and $b$, the boolean equality comparison $(a == b) == b$ evaluates to $a$.
Bool.bne_self_left theorem
: ∀ (a b : Bool), (a != (a != b)) = b
Full source
@[simp] theorem bne_self_left  : ∀(a b : Bool), (a != (a != b)) = b := by decide
Boolean Inequality Self-Left Identity: $a \neq (a \neq b) = b$
Informal description
For any boolean values $a$ and $b$, the boolean inequality $a \neq (a \neq b)$ is equal to $b$.
Bool.bne_self_right theorem
: ∀ (a b : Bool), ((a != b) != b) = a
Full source
@[simp] theorem bne_self_right : ∀(a b : Bool), ((a != b) != b) = a := by decide
Boolean Not-Equal Self-Right Identity: $(a \neq b) \neq b = a$
Informal description
For any boolean values $a$ and $b$, the expression $(a \neq b) \neq b$ evaluates to $a$, where $\neq$ denotes the boolean not-equal operation.
Bool.not_bne_not theorem
: ∀ (x y : Bool), ((!x) != (!y)) = (x != y)
Full source
theorem not_bne_not : ∀ (x y : Bool), ((!x) != (!y)) = (x != y) := by simp
Negation Commutes with Boolean Inequality: $(\neg x \neq \neg y) = (x \neq y)$
Informal description
For any boolean values $x$ and $y$, the boolean inequality $\neg x \neq \neg y$ is equal to $x \neq y$, where $\neq$ denotes the boolean not-equal operation and $\neg$ denotes boolean negation.
Bool.bne_assoc theorem
: ∀ (x y z : Bool), ((x != y) != z) = (x != (y != z))
Full source
@[simp] theorem bne_assoc : ∀ (x y z : Bool), ((x != y) != z) = (x != (y != z)) := by decide
Associativity of Boolean Not-Equal Operation: $(x \neq y) \neq z = x \neq (y \neq z)$
Informal description
For any boolean values $x, y, z$, the boolean not-equal operation is associative, i.e., $(x \neq y) \neq z = x \neq (y \neq z)$, where $\neq$ denotes the boolean not-equal operation.
Bool.instAssociativeBne instance
: Std.Associative (· != ·)
Full source
instance : Std.Associative (· != ·) := ⟨bne_assoc⟩
Associativity of Boolean Not-Equal Operation
Informal description
The boolean not-equal operation `!=` is associative. That is, for any boolean values `x`, `y`, and `z`, the equality `(x != y) != z = x != (y != z)` holds.
Bool.bne_right_inj theorem
: ∀ {x y z : Bool}, (x != y) = (x != z) ↔ y = z
Full source
@[simp] theorem bne_right_inj  : ∀ {x y z : Bool}, (x != y) = (x != z) ↔ y = z := by decide
Right Injectivity of Boolean Not-Equal Operation: $(x \neq y) = (x \neq z) \leftrightarrow y = z$
Informal description
For any boolean values $x, y, z$, the equality $(x \neq y) = (x \neq z)$ holds if and only if $y = z$.
Bool.bne_left_inj theorem
: ∀ {x y z : Bool}, (x != z) = (y != z) ↔ x = y
Full source
@[simp] theorem bne_left_inj : ∀ {x y z : Bool}, (x != z) = (y != z) ↔ x = y := by decide
Left Injectivity of Boolean Not-Equal Operation: $(x \neq z) = (y \neq z) \leftrightarrow x = y$
Informal description
For any boolean values $x$, $y$, and $z$, the equality $(x \neq z) = (y \neq z)$ holds if and only if $x = y$.
Bool.beq_eq_decide_eq theorem
[BEq α] [LawfulBEq α] [DecidableEq α] (a b : α) : (a == b) = decide (a = b)
Full source
theorem beq_eq_decide_eq [BEq α] [LawfulBEq α] [DecidableEq α] (a b : α) :
    (a == b) = decide (a = b) := by
  cases h : a == b
  · simp [ne_of_beq_false h]
  · simp [eq_of_beq h]
Boolean Equality Test Coincides with Decidable Propositional Equality: $(a == b) = \text{decide}(a = b)$
Informal description
For any type $\alpha$ with a boolean equality relation `==` that is lawful (i.e., agrees with propositional equality) and decidable equality, and for any elements $a, b \in \alpha$, the boolean equality test `a == b` is equal to the boolean evaluation of the proposition $a = b$ via the `decide` function. In other words, $(a == b) = \text{decide}(a = b)$.
Bool.not_eq theorem
: ∀ {a b : Bool}, ((!a) = b) ↔ (a ≠ b)
Full source
theorem not_eq : ∀ {a b : Bool}, ((!a) = b) ↔ (a ≠ b) := by decide
Negation-Equivalence Relation for Booleans: $(\neg a = b) \leftrightarrow (a \neq b)$
Informal description
For any boolean values $a$ and $b$, the negation of $a$ equals $b$ if and only if $a$ is not equal to $b$, i.e., $(\neg a = b) \leftrightarrow (a \neq b)$.
Bool.coe_iff_coe theorem
: ∀ {a b : Bool}, (a ↔ b) ↔ a = b
Full source
@[simp] theorem coe_iff_coe : ∀{a b : Bool}, (a ↔ b) ↔ a = b := by decide
Logical Equivalence of Booleans is Equality
Informal description
For any two boolean values $a$ and $b$, the logical equivalence $a \leftrightarrow b$ holds if and only if $a$ is equal to $b$.
Bool.coe_true_iff_false theorem
: ∀ {a b : Bool}, (a ↔ b = false) ↔ a = (!b)
Full source
@[simp] theorem coe_true_iff_false  : ∀{a b : Bool}, (a ↔ b = false) ↔ a = (!b) := by decide
Equivalence between $a \leftrightarrow (b = \text{false})$ and $a = \neg b$ for booleans
Informal description
For any boolean values $a$ and $b$, the equivalence $a \leftrightarrow (b = \text{false})$ holds if and only if $a$ is equal to the negation of $b$ (i.e., $a = \neg b$).
Bool.coe_false_iff_true theorem
: ∀ {a b : Bool}, (a = false ↔ b) ↔ (!a) = b
Full source
@[simp] theorem coe_false_iff_true  : ∀{a b : Bool}, (a = false ↔ b) ↔ (!a) = b := by decide
Negation Equivalence: $(\neg a) = b \leftrightarrow (a = \text{false} \leftrightarrow b)$
Informal description
For any boolean values $a$ and $b$, the equivalence $(a = \text{false}) \leftrightarrow b$ holds if and only if the negation of $a$ equals $b$, i.e., $(\neg a) = b$.
Bool.coe_false_iff_false theorem
: ∀ {a b : Bool}, (a = false ↔ b = false) ↔ (!a) = (!b)
Full source
@[simp] theorem coe_false_iff_false : ∀{a b : Bool}, (a = false ↔ b = false) ↔ (!a) = (!b) := by decide
Negation Preserves False Equivalence: $\neg a = \neg b \leftrightarrow (a = \text{false} \leftrightarrow b = \text{false})$
Informal description
For any boolean values $a$ and $b$, the equivalence $(a = \text{false}) \leftrightarrow (b = \text{false})$ holds if and only if the negation of $a$ equals the negation of $b$, i.e., $\neg a = \neg b$.
Bool.beq_comm theorem
{α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a)
Full source
theorem beq_comm {α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
  Bool.coe_iff_coe.mp (by simp [@eq_comm α])
Commutativity of Boolean Equality: $a == b = b == a$
Informal description
For any type $\alpha$ with a boolean equality relation `==` that is lawful (i.e., it agrees with propositional equality), and for any elements $a, b \in \alpha$, the boolean equality test $a == b$ is equal to $b == a$.
Bool.false_xor theorem
: ∀ (x : Bool), (false ^^ x) = x
Full source
theorem false_xor : ∀ (x : Bool), (falsefalse ^^ x) = x := false_bne
XOR Identity: $\text{false} \oplus x = x$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between $\text{false}$ and $x$ evaluates to $x$, i.e., $\text{false} \oplus x = x$.
Bool.xor_false theorem
: ∀ (x : Bool), (x ^^ false) = x
Full source
theorem xor_false : ∀ (x : Bool), (x ^^ false) = x := bne_false
XOR with False Identity: $x \oplus \mathtt{false} = x$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between $x$ and $\mathtt{false}$ evaluates to $x$, i.e., $x \oplus \mathtt{false} = x$.
Bool.true_xor theorem
: ∀ (x : Bool), (true ^^ x) = !x
Full source
theorem true_xor : ∀ (x : Bool), (truetrue ^^ x) = !x := true_bne
XOR with True is Negation: $\mathtt{true} \oplus x = \neg x$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between `true` and $x$ is equal to the negation of $x$, i.e., $\mathtt{true} \oplus x = \neg x$.
Bool.xor_true theorem
: ∀ (x : Bool), (x ^^ true) = !x
Full source
theorem xor_true : ∀ (x : Bool), (x ^^ true) = !x := bne_true
XOR with True Yields Negation: $x \oplus \mathtt{true} = \neg x$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between $x$ and $\mathtt{true}$ is equal to the negation of $x$, i.e., $x \oplus \mathtt{true} = \neg x$.
Bool.not_xor_self theorem
: ∀ (x : Bool), (!x ^^ x) = true
Full source
theorem not_xor_self : ∀ (x : Bool), (!x!x ^^ x) = true := not_bne_self
XOR Negation Identity: $(\neg x \oplus x) = \text{true}$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between $\neg x$ and $x$ evaluates to `true`, i.e., $(\neg x \oplus x) = \text{true}$.
Bool.xor_not_self theorem
: ∀ (x : Bool), (x ^^ !x) = true
Full source
theorem xor_not_self : ∀ (x : Bool), (x ^^ !x) = true := bne_not_self
XOR with Negation: $x \oplus \neg x = \text{true}$
Informal description
For any boolean value $x$, the exclusive or (XOR) operation between $x$ and its negation $\neg x$ evaluates to `true`, i.e., $x \oplus \neg x = \text{true}$.
Bool.not_xor theorem
: ∀ (x y : Bool), (!x ^^ y) = !(x ^^ y)
Full source
theorem not_xor : ∀ (x y : Bool), (!x!x ^^ y) = !(x ^^ y) := by decide
Negation-XOR Identity: $(\neg x) \oplus y = \neg (x \oplus y)$
Informal description
For any boolean values $x$ and $y$, the exclusive or (XOR) of $\neg x$ and $y$ is equal to the negation of the XOR of $x$ and $y$, i.e., $(\neg x) \oplus y = \neg (x \oplus y)$.
Bool.xor_not theorem
: ∀ (x y : Bool), (x ^^ !y) = !(x ^^ y)
Full source
theorem xor_not : ∀ (x y : Bool), (x ^^ !y) = !(x ^^ y) := by decide
Negation and XOR Interaction: $x \oplus \neg y = \neg (x \oplus y)$
Informal description
For any boolean values $x$ and $y$, the exclusive or (XOR) of $x$ and the negation of $y$ is equal to the negation of the XOR of $x$ and $y$. In symbols: $$ x \oplus \neg y = \neg (x \oplus y) $$
Bool.not_xor_not theorem
: ∀ (x y : Bool), (!x ^^ !y) = (x ^^ y)
Full source
theorem not_xor_not : ∀ (x y : Bool), (!x!x ^^ !y) = (x ^^ y) := not_bne_not
Negation Invariance of XOR: $(\neg x) \oplus (\neg y) = x \oplus y$
Informal description
For any boolean values $x$ and $y$, the exclusive or (XOR) of $\neg x$ and $\neg y$ is equal to the XOR of $x$ and $y$, i.e., $(\neg x) \oplus (\neg y) = x \oplus y$.
Bool.xor_self theorem
: ∀ (x : Bool), (x ^^ x) = false
Full source
theorem xor_self : ∀ (x : Bool), (x ^^ x) = false := by decide
XOR Self-Inverse: $x \oplus x = \mathtt{false}$
Informal description
For any boolean value $x$, the exclusive or (XOR) of $x$ with itself is false, i.e., $x \oplus x = \mathtt{false}$.
Bool.xor_comm theorem
: ∀ (x y : Bool), (x ^^ y) = (y ^^ x)
Full source
theorem xor_comm : ∀ (x y : Bool), (x ^^ y) = (y ^^ x) := by decide
Commutativity of Boolean XOR: $x \oplus y = y \oplus x$
Informal description
For any boolean values $x$ and $y$, the exclusive or (XOR) operation is commutative, i.e., $x \oplus y = y \oplus x$.
Bool.xor_left_comm theorem
: ∀ (x y z : Bool), (x ^^ (y ^^ z)) = (y ^^ (x ^^ z))
Full source
theorem xor_left_comm : ∀ (x y z : Bool), (x ^^ (y ^^ z)) = (y ^^ (x ^^ z)) := by decide
Left Commutativity of Boolean XOR Operation
Informal description
For any boolean values $x$, $y$, and $z$, the following identity holds for the XOR operation: $$x \oplus (y \oplus z) = y \oplus (x \oplus z)$$
Bool.xor_right_comm theorem
: ∀ (x y z : Bool), ((x ^^ y) ^^ z) = ((x ^^ z) ^^ y)
Full source
theorem xor_right_comm : ∀ (x y z : Bool), ((x ^^ y) ^^ z) = ((x ^^ z) ^^ y) := by decide
Right Commutativity of Boolean XOR: $(x \oplus y) \oplus z = (x \oplus z) \oplus y$
Informal description
For any boolean values $x$, $y$, and $z$, the following equality holds: $$(x \oplus y) \oplus z = (x \oplus z) \oplus y$$ where $\oplus$ denotes the exclusive OR (XOR) operation.
Bool.xor_assoc theorem
: ∀ (x y z : Bool), ((x ^^ y) ^^ z) = (x ^^ (y ^^ z))
Full source
theorem xor_assoc : ∀ (x y z : Bool), ((x ^^ y) ^^ z) = (x ^^ (y ^^ z)) := bne_assoc
Associativity of Boolean XOR: $(x \oplus y) \oplus z = x \oplus (y \oplus z)$
Informal description
For any boolean values $x, y, z$, the exclusive or (XOR) operation is associative, i.e., $(x \oplus y) \oplus z = x \oplus (y \oplus z)$.
Bool.xor_right_inj theorem
: ∀ {x y z : Bool}, (x ^^ y) = (x ^^ z) ↔ y = z
Full source
theorem xor_right_inj : ∀ {x y z : Bool}, (x ^^ y) = (x ^^ z) ↔ y = z := bne_right_inj
Right Injectivity of Boolean XOR: $(x \oplus y) = (x \oplus z) \leftrightarrow y = z$
Informal description
For any boolean values $x, y, z$, the equality $(x \oplus y) = (x \oplus z)$ holds if and only if $y = z$, where $\oplus$ denotes the exclusive OR (XOR) operation.
Bool.xor_left_inj theorem
: ∀ {x y z : Bool}, (x ^^ z) = (y ^^ z) ↔ x = y
Full source
theorem xor_left_inj : ∀ {x y z : Bool}, (x ^^ z) = (y ^^ z) ↔ x = y := bne_left_inj
Left Injectivity of Boolean XOR: $(x \oplus z) = (y \oplus z) \leftrightarrow x = y$
Informal description
For any boolean values $x$, $y$, and $z$, the equality $(x \oplus z) = (y \oplus z)$ holds if and only if $x = y$, where $\oplus$ denotes the exclusive or (XOR) operation.
Bool.le_true theorem
: ∀ (x : Bool), x ≤ true
Full source
@[simp] protected theorem le_true : ∀ (x : Bool), x ≤ true := by decide
Every Boolean is Less Than or Equal to True
Informal description
For any boolean value $x$, the inequality $x \leq \mathtt{true}$ holds.
Bool.false_le theorem
: ∀ (x : Bool), false ≤ x
Full source
@[simp] protected theorem false_le : ∀ (x : Bool), false ≤ x := by decide
False is the Minimum Boolean Value
Informal description
For any boolean value $x$, the inequality $\mathtt{false} \leq x$ holds.
Bool.le_refl theorem
: ∀ (x : Bool), x ≤ x
Full source
@[simp] protected theorem le_refl : ∀ (x : Bool), x ≤ x := by decide
Reflexivity of the Boolean Order Relation: $x \leq x$
Informal description
For any boolean value $x$, the relation $x \leq x$ holds.
Bool.lt_irrefl theorem
: ∀ (x : Bool), ¬x < x
Full source
@[simp] protected theorem lt_irrefl : ∀ (x : Bool), ¬ x < x := by decide
Irreflexivity of the Less Than Relation on Booleans
Informal description
For any boolean value $x$, the relation $x < x$ does not hold.
Bool.le_trans theorem
: ∀ {x y z : Bool}, x ≤ y → y ≤ z → x ≤ z
Full source
protected theorem le_trans : ∀ {x y z : Bool}, x ≤ y → y ≤ z → x ≤ z := by decide
Transitivity of Boolean Order: $x \leq y \leq z \implies x \leq z$
Informal description
For any boolean values $x, y, z$, if $x \leq y$ and $y \leq z$, then $x \leq z$.
Bool.le_antisymm theorem
: ∀ {x y : Bool}, x ≤ y → y ≤ x → x = y
Full source
protected theorem le_antisymm : ∀ {x y : Bool}, x ≤ y → y ≤ x → x = y := by decide
Antisymmetry of the Boolean Order Relation
Informal description
For any two boolean values $x$ and $y$, if $x \leq y$ and $y \leq x$ both hold, then $x = y$.
Bool.le_total theorem
: ∀ (x y : Bool), x ≤ y ∨ y ≤ x
Full source
protected theorem le_total : ∀ (x y : Bool), x ≤ y ∨ y ≤ x := by decide
Total Order on Booleans: $x \leq y \lor y \leq x$
Informal description
For any two boolean values $x$ and $y$, either $x \leq y$ or $y \leq x$ holds.
Bool.lt_asymm theorem
: ∀ {x y : Bool}, x < y → ¬y < x
Full source
protected theorem lt_asymm : ∀ {x y : Bool}, x < y → ¬ y < x := by decide
Asymmetry of the Less Than Relation on Booleans
Informal description
For any two boolean values $x$ and $y$, if $x < y$ holds, then $y < x$ does not hold.
Bool.lt_trans theorem
: ∀ {x y z : Bool}, x < y → y < z → x < z
Full source
protected theorem lt_trans : ∀ {x y z : Bool}, x < y → y < z → x < z := by decide
Transitivity of the Less Than Relation on Booleans
Informal description
For any boolean values $x$, $y$, and $z$, if $x < y$ and $y < z$, then $x < z$.
Bool.lt_iff_le_not_le theorem
: ∀ {x y : Bool}, x < y ↔ x ≤ y ∧ ¬y ≤ x
Full source
protected theorem lt_iff_le_not_le : ∀ {x y : Bool}, x < y ↔ x ≤ y ∧ ¬ y ≤ x := by decide
Characterization of Boolean Strict Order via Non-strict Order: $x < y \leftrightarrow (x \leq y \land \neg y \leq x)$
Informal description
For any two boolean values $x$ and $y$, the relation $x < y$ holds if and only if $x \leq y$ and it is not the case that $y \leq x$.
Bool.lt_of_le_of_lt theorem
: ∀ {x y z : Bool}, x ≤ y → y < z → x < z
Full source
protected theorem lt_of_le_of_lt : ∀ {x y z : Bool}, x ≤ y → y < z → x < z := by decide
Transitivity of Boolean Order: $x \leq y \land y < z \to x < z$
Informal description
For any boolean values $x, y, z$, if $x \leq y$ and $y < z$, then $x < z$.
Bool.lt_of_lt_of_le theorem
: ∀ {x y z : Bool}, x < y → y ≤ z → x < z
Full source
protected theorem lt_of_lt_of_le : ∀ {x y z : Bool}, x < y → y ≤ z → x < z := by decide
Transitivity of Boolean Order: $x < y \land y \leq z \to x < z$
Informal description
For any boolean values $x, y, z$, if $x < y$ and $y \leq z$, then $x < z$.
Bool.le_of_lt theorem
: ∀ {x y : Bool}, x < y → x ≤ y
Full source
protected theorem le_of_lt : ∀ {x y : Bool}, x < y → x ≤ y := by decide
Implication from Strict to Non-Strict Boolean Order: $x < y \to x \leq y$
Informal description
For any boolean values $x$ and $y$, if $x < y$ then $x \leq y$.
Bool.le_of_eq theorem
: ∀ {x y : Bool}, x = y → x ≤ y
Full source
protected theorem le_of_eq : ∀ {x y : Bool}, x = y → x ≤ y := by decide
Equality Implies Order in Booleans
Informal description
For any two boolean values $x$ and $y$, if $x = y$ then $x \leq y$.
Bool.ne_of_lt theorem
: ∀ {x y : Bool}, x < y → x ≠ y
Full source
protected theorem ne_of_lt : ∀ {x y : Bool}, x < y → x ≠ y := by decide
Inequality from Strict Order on Booleans
Informal description
For any two boolean values $x$ and $y$, if $x < y$ then $x \neq y$.
Bool.lt_of_le_of_ne theorem
: ∀ {x y : Bool}, x ≤ y → x ≠ y → x < y
Full source
protected theorem lt_of_le_of_ne : ∀ {x y : Bool}, x ≤ y → x ≠ y → x < y := by decide
Strict inequality from non-strict inequality and distinctness in booleans
Informal description
For any boolean values $x$ and $y$, if $x \leq y$ and $x \neq y$, then $x < y$.
Bool.le_of_lt_or_eq theorem
: ∀ {x y : Bool}, x < y ∨ x = y → x ≤ y
Full source
protected theorem le_of_lt_or_eq : ∀ {x y : Bool}, x < y ∨ x = y → x ≤ y := by decide
Order Relation on Booleans: $x < y \lor x = y \to x \leq y$
Informal description
For any two boolean values $x$ and $y$, if either $x < y$ or $x = y$ holds, then $x \leq y$ holds.
Bool.max_eq_or theorem
: max = or
Full source
@[simp] protected theorem max_eq_or : max = or := rfl
Boolean Maximum Equals Logical OR
Informal description
The maximum operation on Boolean values is equal to the logical OR operation, i.e., $\max(x, y) = x \lor y$ for all $x, y \in \{\text{true}, \text{false}\}$.
Bool.min_eq_and theorem
: min = and
Full source
@[simp] protected theorem min_eq_and : min = and := rfl
Boolean Minimum Equals Logical AND
Informal description
The minimum operation on Boolean values is equal to the logical AND operation, i.e., $\min(x, y) = x \land y$ for all $x, y \in \{\text{true}, \text{false}\}$.
Bool.not_inj theorem
: ∀ {x y : Bool}, (!x) = (!y) → x = y
Full source
theorem not_inj : ∀ {x y : Bool}, (!x) = (!y) → x = y := by decide
Negation is Injective on Boolean Values
Informal description
For any boolean values $x$ and $y$, if the negation of $x$ equals the negation of $y$, then $x = y$.
Bool.not_inj_iff theorem
: ∀ {x y : Bool}, (!x) = (!y) ↔ x = y
Full source
theorem not_inj_iff : ∀ {x y : Bool}, (!x) = (!y) ↔ x = y := by decide
Negation Preserves Equality in Boolean Values
Informal description
For any boolean values $x$ and $y$, the negation of $x$ equals the negation of $y$ if and only if $x = y$. In other words, $\neg x = \neg y \leftrightarrow x = y$.
Bool.and_or_inj_right theorem
: ∀ {m x y : Bool}, (x && m) = (y && m) → (x || m) = (y || m) → x = y
Full source
theorem and_or_inj_right : ∀ {m x y : Bool}, (x && m) = (y && m) → (x || m) = (y || m) → x = y := by
  decide
Injectivity of Boolean Operations: $(x \land m) = (y \land m) \land (x \lor m) = (y \lor m) \to x = y$
Informal description
For any boolean values $m$, $x$, and $y$, if both $(x \land m) = (y \land m)$ and $(x \lor m) = (y \lor m)$ hold, then $x = y$.
Bool.and_or_inj_right_iff theorem
: ∀ {m x y : Bool}, (x && m) = (y && m) ∧ (x || m) = (y || m) ↔ x = y
Full source
theorem and_or_inj_right_iff :
    ∀ {m x y : Bool}, (x && m) = (y && m) ∧ (x || m) = (y || m)(x && m) = (y && m) ∧ (x || m) = (y || m) ↔ x = y := by decide
Injection of Boolean Operations: $\land m = \land m \land \lor m = \lor m \leftrightarrow x = y$
Informal description
For any boolean values $x$, $y$, and $m$, the conjunction of the equalities $(x \land m) = (y \land m)$ and $(x \lor m) = (y \lor m)$ holds if and only if $x = y$.
Bool.and_or_inj_left theorem
: ∀ {m x y : Bool}, (m && x) = (m && y) → (m || x) = (m || y) → x = y
Full source
theorem and_or_inj_left : ∀ {m x y : Bool}, (m && x) = (m && y) → (m || x) = (m || y) → x = y := by
  decide
Left-Injectivity of Boolean AND and OR: $(m \land x = m \land y) \land (m \lor x = m \lor y) \to x = y$
Informal description
For any boolean values $m$, $x$, and $y$, if both the logical AND and OR operations with $m$ on the left yield equal results for $x$ and $y$ (i.e., $m \land x = m \land y$ and $m \lor x = m \lor y$), then $x$ must equal $y$.
Bool.and_or_inj_left_iff theorem
: ∀ {m x y : Bool}, (m && x) = (m && y) ∧ (m || x) = (m || y) ↔ x = y
Full source
theorem and_or_inj_left_iff :
    ∀ {m x y : Bool}, (m && x) = (m && y) ∧ (m || x) = (m || y)(m && x) = (m && y) ∧ (m || x) = (m || y) ↔ x = y := by decide
Boolean Equality via Conjunction and Disjunction: $(m \land x) = (m \land y) \land (m \lor x) = (m \lor y) \leftrightarrow x = y$
Informal description
For any boolean values $m, x, y$, the conjunction $(m \land x) = (m \land y)$ and the disjunction $(m \lor x) = (m \lor y)$ hold if and only if $x = y$.
Bool.toNat definition
(b : Bool) : Nat
Full source
/--
Converts `true` to `1` and `false` to `0`.
-/
def toNat (b : Bool) : Nat := cond b 1 0
Boolean to natural number conversion
Informal description
The function maps a Boolean value `b` to the natural number `1` if `b` is true and to `0` if `b` is false.
Bool.toNat_false theorem
: false.toNat = 0
Full source
@[simp, bitvec_to_nat] theorem toNat_false : false.toNat = 0 := rfl
Boolean to Natural Number Conversion: $\text{toNat}(\text{false}) = 0$
Informal description
The conversion of the Boolean value `false` to a natural number yields $0$, i.e., $\text{toNat}(\text{false}) = 0$.
Bool.toNat_true theorem
: true.toNat = 1
Full source
@[simp, bitvec_to_nat] theorem toNat_true : true.toNat = 1 := rfl
$\text{toNat}(\text{true}) = 1$
Informal description
The natural number conversion of the Boolean value `true` is equal to $1$, i.e., $\text{toNat}(\text{true}) = 1$.
Bool.toNat_le theorem
(c : Bool) : c.toNat ≤ 1
Full source
theorem toNat_le (c : Bool) : c.toNat ≤ 1 := by
  cases c <;> trivial
Boolean to Natural Number Conversion Bounded by One: $c.\text{toNat} \leq 1$
Informal description
For any Boolean value $c$, the natural number conversion of $c$ is less than or equal to $1$, i.e., $c.\text{toNat} \leq 1$.
Bool.toNat_lt theorem
(b : Bool) : b.toNat < 2
Full source
@[bitvec_to_nat]
theorem toNat_lt (b : Bool) : b.toNat < 2 :=
  Nat.lt_succ_of_le (toNat_le _)
Boolean to Natural Number Conversion Bounded by Two: $b.\text{toNat} < 2$
Informal description
For any Boolean value $b$, the natural number conversion of $b$ is strictly less than $2$, i.e., $b.\text{toNat} < 2$.
Bool.toNat_eq_zero theorem
{b : Bool} : b.toNat = 0 ↔ b = false
Full source
@[simp] theorem toNat_eq_zero {b : Bool} : b.toNat = 0 ↔ b = false := by
  cases b <;> simp
Boolean to Natural Number Conversion Yields Zero if and only if False
Informal description
For any Boolean value $b$, the natural number conversion of $b$ equals $0$ if and only if $b$ is `false`. That is, $b.\text{toNat} = 0 \leftrightarrow b = \text{false}$.
Bool.toNat_eq_one theorem
{b : Bool} : b.toNat = 1 ↔ b = true
Full source
@[simp] theorem toNat_eq_one  {b : Bool} : b.toNat = 1 ↔ b = true := by
  cases b <;> simp
Boolean to Natural Number Conversion: $b.\text{toNat} = 1 \leftrightarrow b = \text{true}$
Informal description
For any Boolean value $b$, the natural number conversion of $b$ equals $1$ if and only if $b$ is `true`. In other words, $b.\text{toNat} = 1 \leftrightarrow b = \text{true}$.
Bool.toInt definition
(b : Bool) : Int
Full source
/--
Converts `true` to `1` and `false` to `0`.
-/
def toInt (b : Bool) : Int := cond b 1 0
Boolean to integer conversion
Informal description
The function maps a Boolean value `b` to the integer `1` if `b` is `true` and to `0` if `b` is `false`.
Bool.toInt_false theorem
: false.toInt = 0
Full source
@[simp] theorem toInt_false : false.toInt = 0 := rfl
Boolean to Integer Conversion: $\text{toInt}(\text{false}) = 0$
Informal description
The integer conversion of the Boolean value `false` is equal to $0$, i.e., $\text{toInt}(\text{false}) = 0$.
Bool.toInt_true theorem
: true.toInt = 1
Full source
@[simp] theorem toInt_true : true.toInt = 1 := rfl
Boolean to Integer Conversion: $\text{toInt}(\text{true}) = 1$
Informal description
The integer conversion of the Boolean value `true` is equal to $1$, i.e., $\text{toInt}(\text{true}) = 1$.
Bool.if_true_left theorem
(p : Prop) [h : Decidable p] (f : Bool) : (ite p true f) = (p || f)
Full source
@[simp] theorem if_true_left  (p : Prop) [h : Decidable p] (f : Bool) :
    (ite p true f) = (p || f) := by cases h with | _ p => simp [p]
Conditional with True Left Branch Equals Disjunction: $\text{ite}(p, \text{true}, f) = p \lor f$
Informal description
For any proposition $p$ with a decidability instance and any boolean value $f$, the conditional expression `if p then true else f` is equal to the logical disjunction $p \lor f$.
Bool.if_false_left theorem
(p : Prop) [h : Decidable p] (f : Bool) : (ite p false f) = (!p && f)
Full source
@[simp] theorem if_false_left  (p : Prop) [h : Decidable p] (f : Bool) :
    (ite p false f) = (!p!p && f) := by cases h with | _ p => simp [p]
Conditional False Left Branch Equals Negation AND Value: $\text{ite}(p, \text{false}, f) = (\neg p \land f)$
Informal description
For any proposition $p$ with a decidable instance and any boolean value $f$, the conditional expression $\text{ite}(p, \text{false}, f)$ is equal to the logical AND of the negation of $p$ (as a boolean) and $f$, i.e., $\text{ite}(p, \text{false}, f) = (\neg p \land f)$.
Bool.if_true_right theorem
(p : Prop) [h : Decidable p] (t : Bool) : (ite p t true) = (!(p : Bool) || t)
Full source
@[simp] theorem if_true_right  (p : Prop) [h : Decidable p] (t : Bool) :
    (ite p t true) = (!(p : Bool)!(p : Bool) || t) := by cases h with | _ p => simp [p]
Conditional with True Right Branch: $\text{ite}(p, t, \text{true}) = \neg p \lor t$
Informal description
For any proposition $p$ with a decidability instance and any boolean value $t$, the conditional expression $\text{if } p \text{ then } t \text{ else true}$ is equal to the logical disjunction $\neg p \lor t$.
Bool.if_false_right theorem
(p : Prop) [h : Decidable p] (t : Bool) : (ite p t false) = (p && t)
Full source
@[simp] theorem if_false_right  (p : Prop) [h : Decidable p] (t : Bool) :
    (ite p t false) = (p && t) := by cases h with | _ p => simp [p]
Conditional False Branch Reduces to Logical AND: $\text{ite}(p, t, \text{false}) = p \land t$
Informal description
For any proposition $p$ with a decidability instance and any boolean value $t$, the conditional expression $\text{if } p \text{ then } t \text{ else } \text{false}$ is equal to the logical AND of $p$ and $t$, i.e., $p \land t$.
Bool.ite_eq_true_distrib theorem
(p : Prop) [h : Decidable p] (t f : Bool) : (ite p t f = true) = ite p (t = true) (f = true)
Full source
@[simp] theorem ite_eq_true_distrib (p : Prop) [h : Decidable p] (t f : Bool) :
    (ite p t f = true) = ite p (t = true) (f = true) := by
  cases h with | _ p => simp [p]
Conditional Boolean Equality to True: $(if\ p\ then\ t\ else\ f) = \text{true} \leftrightarrow (p \land t = \text{true}) \lor (\neg p \land f = \text{true})$
Informal description
For any proposition $p$ with a decidability instance and any boolean values $t$ and $f$, the equality $(if\ p\ then\ t\ else\ f) = \text{true}$ holds if and only if either $p$ is true and $t = \text{true}$, or $p$ is false and $f = \text{true}$.
Bool.ite_eq_false_distrib theorem
(p : Prop) [h : Decidable p] (t f : Bool) : (ite p t f = false) = ite p (t = false) (f = false)
Full source
@[simp] theorem ite_eq_false_distrib (p : Prop) [h : Decidable p] (t f : Bool) :
    (ite p t f = false) = ite p (t = false) (f = false) := by
  cases h with | _ p => simp [p]
Conditional Boolean Equality to False: $\text{ite}(p, t, f) = \text{false} \leftrightarrow \text{ite}(p, t = \text{false}, f = \text{false})$
Informal description
For any proposition $p$ with a decidability instance and any boolean values $t$ and $f$, the equality $$(\text{if } p \text{ then } t \text{ else } f) = \text{false}$$ holds if and only if $$\text{if } p \text{ then } (t = \text{false}) \text{ else } (f = \text{false}).$$
Bool.ite_eq_false theorem
: (if b = false then p else q) ↔ if b then q else p
Full source
@[simp] theorem ite_eq_false : (if b = false then p else q) ↔ if b then q else p := by
  cases b <;> simp
Conditional Equivalence under Boolean Negation: $\text{ite}(b = \text{false}, p, q) \leftrightarrow \text{ite}(b, q, p)$
Informal description
For any boolean value $b$ and propositions $p$ and $q$, the conditional expression $\text{if } b = \text{false} \text{ then } p \text{ else } q$ is equivalent to $\text{if } b \text{ then } q \text{ else } p$.
Bool.ite_eq_true_else_eq_false theorem
{q : Prop} : (if b = true then q else b = false) ↔ (b = true → q)
Full source
@[simp] theorem ite_eq_true_else_eq_false {q : Prop} :
    (if b = true then q else b = false) ↔ (b = true → q) := by
  cases b <;> simp [not_eq_self]
Conditional Boolean Equivalence: $\text{ite}(b = \texttt{true}, q, b = \texttt{false}) \leftrightarrow (b = \texttt{true} \to q)$
Informal description
For any boolean value $b$ and proposition $q$, the conditional statement $$(\text{if } b = \texttt{true} \text{ then } q \text{ else } b = \texttt{false})$$ is equivalent to the implication $$(b = \texttt{true} \to q).$$
Bool.not_ite_eq_true_eq_true theorem
{p : Prop} [h : Decidable p] {b c : Bool} : ¬(ite p (b = true) (c = true)) ↔ (ite p (b = false) (c = false))
Full source
@[simp]
theorem not_ite_eq_true_eq_true {p : Prop} [h : Decidable p] {b c : Bool} :
  ¬(ite p (b = true) (c = true))¬(ite p (b = true) (c = true)) ↔ (ite p (b = false) (c = false)) := by
  cases h with | _ p => simp [p]
Negation of Conditional Boolean Equality to True ↔ Conditional Boolean Equality to False
Informal description
For any proposition $p$ with a decidability instance and boolean values $b, c$, the negation of the conditional expression $\text{if } p \text{ then } (b = \texttt{true}) \text{ else } (c = \texttt{true})$ is equivalent to the conditional expression $\text{if } p \text{ then } (b = \texttt{false}) \text{ else } (c = \texttt{false})$.
Bool.not_ite_eq_false_eq_false theorem
{p : Prop} [h : Decidable p] {b c : Bool} : ¬(ite p (b = false) (c = false)) ↔ (ite p (b = true) (c = true))
Full source
@[simp]
theorem not_ite_eq_false_eq_false {p : Prop} [h : Decidable p] {b c : Bool} :
  ¬(ite p (b = false) (c = false))¬(ite p (b = false) (c = false)) ↔ (ite p (b = true) (c = true)) := by
  cases h with | _ p => simp [p]
Negation of Conditional Boolean False Equivalence: $\neg(\text{ite}(p, b = \text{false}, c = \text{false})) \leftrightarrow \text{ite}(p, b = \text{true}, c = \text{true})$
Informal description
For any proposition $p$ with a decidability instance and boolean values $b, c$, the negation of the conditional expression $\text{ite}(p, b = \text{false}, c = \text{false})$ is equivalent to the conditional expression $\text{ite}(p, b = \text{true}, c = \text{true})$.
Bool.not_ite_eq_true_eq_false theorem
{p : Prop} [h : Decidable p] {b c : Bool} : ¬(ite p (b = true) (c = false)) ↔ (ite p (b = false) (c = true))
Full source
@[simp]
theorem not_ite_eq_true_eq_false {p : Prop} [h : Decidable p] {b c : Bool} :
  ¬(ite p (b = true) (c = false))¬(ite p (b = true) (c = false)) ↔ (ite p (b = false) (c = true)) := by
  cases h with | _ p => simp [p]
Negation of Conditional Boolean Equality: $\neg(\text{ite}(p, b=\texttt{true}, c=\texttt{false})) \leftrightarrow \text{ite}(p, b=\texttt{false}, c=\texttt{true})$
Informal description
For any proposition $p$ with a decidability instance and boolean values $b$ and $c$, the negation of the conditional expression $\text{ite}(p, b = \texttt{true}, c = \texttt{false})$ is equivalent to the conditional expression $\text{ite}(p, b = \texttt{false}, c = \texttt{true})$.
Bool.not_ite_eq_false_eq_true theorem
{p : Prop} [h : Decidable p] {b c : Bool} : ¬(ite p (b = false) (c = true)) ↔ (ite p (b = true) (c = false))
Full source
@[simp]
theorem not_ite_eq_false_eq_true {p : Prop} [h : Decidable p] {b c : Bool} :
  ¬(ite p (b = false) (c = true))¬(ite p (b = false) (c = true)) ↔ (ite p (b = true) (c = false)) := by
  cases h with | _ p => simp [p]
Negation of Conditional Boolean Equality: $\neg(\text{ite}(p, b=\text{false}, c=\text{true})) \leftrightarrow \text{ite}(p, b=\text{true}, c=\text{false})$
Informal description
For any proposition $p$ with a decidability instance and boolean values $b$ and $c$, the negation of the conditional expression $\text{ite}(p, b = \text{false}, c = \text{true})$ is equivalent to the conditional expression $\text{ite}(p, b = \text{true}, c = \text{false})$.
Bool.forall_bool' theorem
{p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b
Full source
theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b :=
  ⟨fun h ↦ ⟨h _, h _⟩, fun ⟨h₁, h₂⟩ x ↦ by cases b <;> cases x <;> assumption⟩
Universal Quantification over Boolean Values via Conjunction
Informal description
For any predicate $p$ on the Boolean type and any Boolean value $b$, the statement that $p$ holds for all Boolean values $x$ is equivalent to $p(b)$ and $p(\neg b)$ both holding.
Bool.forall_bool theorem
{p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true
Full source
@[simp]
theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
  forall_bool' false
Universal Quantification over Booleans via Conjunction
Informal description
For any predicate $p$ on the Boolean type, the statement that $p$ holds for all Boolean values $b$ is equivalent to $p$ holding for both `false` and `true`. In other words: $$(\forall b : \text{Bool}, p(b)) \leftrightarrow p(\text{false}) \land p(\text{true})$$
Bool.exists_bool' theorem
{p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b
Full source
theorem exists_bool' {p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b :=
  ⟨fun ⟨x, hx⟩ ↦ by cases x <;> cases b <;> first | exact .inl ‹_› | exact .inr ‹_›,
    fun h ↦ by cases h <;> exact ⟨_, ‹_›⟩⟩
Existence in Boolean Type via Disjunction
Informal description
For any predicate $p$ on the Boolean type and any Boolean value $b$, there exists a Boolean value $x$ such that $p(x)$ holds if and only if either $p(b)$ holds or $p(\neg b)$ holds.
Bool.exists_bool theorem
{p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true
Full source
@[simp]
theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
  exists_bool' false
Existence in Boolean Type via Disjunction of Cases
Informal description
For any predicate $p$ on the Boolean type, there exists a Boolean value $b$ such that $p(b)$ holds if and only if either $p(\text{false})$ holds or $p(\text{true})$ holds.
Bool.cond_eq_ite theorem
{α} (b : Bool) (t e : α) : cond b t e = if b then t else e
Full source
theorem cond_eq_ite {α} (b : Bool) (t e : α) : cond b t e = if b then t else e := by
  cases b <;> simp
Equivalence of Boolean Conditional and If-Then-Else: $\text{cond}(b, t, e) = \text{if } b \text{ then } t \text{ else } e$
Informal description
For any type $\alpha$ and boolean value $b$, the conditional expression $\text{cond}(b, t, e)$ is equal to the if-then-else expression $\text{if } b \text{ then } t \text{ else } e$ for any terms $t, e : \alpha$.
Bool.cond_eq_if theorem
: (bif b then x else y) = (if b then x else y)
Full source
theorem cond_eq_if : (bif b then x else y) = (if b then x else y) := cond_eq_ite b x y
Equivalence of Bif and If-then-else: $\text{bif } b \text{ then } x \text{ else } y = \text{if } b \text{ then } x \text{ else } y$
Informal description
For any Boolean value $b$ and any terms $x, y$ of the same type, the expression `bif b then x else y` is equal to `if b then x else y`.
Bool.cond_not theorem
(b : Bool) (t e : α) : cond (!b) t e = cond b e t
Full source
@[simp] theorem cond_not (b : Bool) (t e : α) : cond (!b) t e = cond b e t := by
  cases b <;> rfl
Conditional Negation Swap: $\text{cond}(\neg b, t, e) = \text{cond}(b, e, t)$
Informal description
For any Boolean value $b$ and any terms $t, e$ of type $\alpha$, the conditional expression $\text{cond}(\neg b, t, e)$ is equal to $\text{cond}(b, e, t)$.
Bool.cond_self theorem
(c : Bool) (t : α) : cond c t t = t
Full source
@[simp] theorem cond_self (c : Bool) (t : α) : cond c t t = t := by cases c <;> rfl
Conditional Self-Identity: $\text{cond}(c, t, t) = t$
Informal description
For any Boolean value $c$ and any term $t$ of type $\alpha$, the conditional expression $\text{cond}(c, t, t)$ evaluates to $t$.
Bool.cond_prop theorem
{b : Bool} {p q : Prop} : (bif b then p else q) ↔ if b then p else q
Full source
/-- If the return values are propositions, there is no harm in simplifying a `bif` to an `if`. -/
@[simp] theorem cond_prop {b : Bool} {p q : Prop} :
    (bif b then p else q) ↔ if b then p else q := by
  cases b <;> simp
Equivalence of Boolean and Logical Conditionals
Informal description
For any Boolean value $b$ and propositions $p$ and $q$, the Boolean conditional expression $\text{bif } b \text{ then } p \text{ else } q$ is equivalent to the logical conditional $\text{if } b \text{ then } p \text{ else } q$.
Bool.cond_decide theorem
{α} (p : Prop) [Decidable p] (t e : α) : cond (decide p) t e = if p then t else e
Full source
theorem cond_decide {α} (p : Prop) [Decidable p] (t e : α) :
    cond (decide p) t e = if p then t else e := by
  simp [cond_eq_ite]
Equivalence of Boolean Conditional and Propositional If-Then-Else: $\text{cond}(\text{decide}(p), t, e) = \text{if } p \text{ then } t \text{ else } e$
Informal description
For any type $\alpha$, decidable proposition $p$, and terms $t, e \in \alpha$, the Boolean conditional expression $\text{cond}(\text{decide}(p), t, e)$ is equal to the if-then-else expression $\text{if } p \text{ then } t \text{ else } e$.
Bool.cond_eq_ite_iff theorem
{a : Bool} {p : Prop} [h : Decidable p] {x y u v : α} : (cond a x y = ite p u v) ↔ ite a x y = ite p u v
Full source
@[simp] theorem cond_eq_ite_iff {a : Bool} {p : Prop} [h : Decidable p] {x y u v : α} :
  (cond a x y = ite p u v) ↔ ite a x y = ite p u v := by
  simp [Bool.cond_eq_ite]
Equivalence of Boolean Conditional and If-Then-Else Equality: $\mathrm{cond}(a, x, y) = \mathrm{ite}(p, u, v) \leftrightarrow \mathrm{ite}(a, x, y) = \mathrm{ite}(p, u, v)$
Informal description
For any Boolean value $a$, proposition $p$ with a decidable instance, and elements $x, y, u, v$ of type $\alpha$, the equality $\mathrm{cond}(a, x, y) = \mathrm{ite}(p, u, v)$ holds if and only if $\mathrm{ite}(a, x, y) = \mathrm{ite}(p, u, v)$.
Bool.ite_eq_cond_iff theorem
{p : Prop} {a : Bool} [h : Decidable p] {x y u v : α} : (ite p x y = cond a u v) ↔ ite p x y = ite a u v
Full source
@[simp] theorem ite_eq_cond_iff {p : Prop} {a : Bool} [h : Decidable p] {x y u v : α} :
  (ite p x y = cond a u v) ↔ ite p x y = ite a u v := by
  simp [Bool.cond_eq_ite]
Equivalence of If-Then-Else and Boolean Conditional: $\text{ite}(p, x, y) = \text{cond}(a, u, v) \leftrightarrow \text{ite}(p, x, y) = \text{ite}(a, u, v)$
Informal description
For any proposition $p$ (with a decidable instance), boolean value $a$, and elements $x, y, u, v$ of type $\alpha$, the equality $\text{if } p \text{ then } x \text{ else } y = \text{cond}(a, u, v)$ holds if and only if $\text{if } p \text{ then } x \text{ else } y = \text{if } a \text{ then } u \text{ else } v$.
Bool.cond_eq_true_distrib theorem
: ∀ (c t f : Bool), (cond c t f = true) = ite (c = true) (t = true) (f = true)
Full source
@[simp] theorem cond_eq_true_distrib : ∀(c t f : Bool),
    (cond c t f = true) = ite (c = true) (t = true) (f = true) := by
  decide
Distributivity of Boolean Conditional Evaluation: $\mathrm{cond}(c, t, f) = \mathrm{true} \leftrightarrow (c = \mathrm{true} \land t = \mathrm{true}) \lor (c = \mathrm{false} \land f = \mathrm{true})$
Informal description
For any boolean values $c$, $t$, and $f$, the equality $\mathrm{cond}(c, t, f) = \mathrm{true}$ holds if and only if either $c$ is true and $t$ is true, or $c$ is false and $f$ is true.
Bool.cond_eq_false_distrib theorem
: ∀ (c t f : Bool), (cond c t f = false) = ite (c = true) (t = false) (f = false)
Full source
@[simp] theorem cond_eq_false_distrib : ∀(c t f : Bool),
    (cond c t f = false) = ite (c = true) (t = false) (f = false) := by decide
Conditional False Evaluation: $\mathrm{cond}(c, t, f) = \mathrm{false} \leftrightarrow (c \to t = \mathrm{false}) \land (\neg c \to f = \mathrm{false})$
Informal description
For any boolean values $c$, $t$, and $f$, the equality $\mathrm{cond}(c, t, f) = \mathrm{false}$ holds if and only if either $c$ is true and $t$ is false, or $c$ is false and $f$ is false.
Bool.cond_true theorem
{α : Sort u} {a b : α} : cond true a b = a
Full source
protected theorem cond_true  {α : Sort u} {a b : α} : cond true  a b = a := cond_true  a b
Conditional Evaluation with True Condition: $\mathrm{cond}(\mathrm{true}, a, b) = a$
Informal description
For any elements $a$ and $b$ of type $\alpha$, the conditional expression $\mathrm{cond}(\mathrm{true}, a, b)$ evaluates to $a$.
Bool.cond_false theorem
{α : Sort u} {a b : α} : cond false a b = b
Full source
protected theorem cond_false {α : Sort u} {a b : α} : cond false a b = b := cond_false a b
Conditional Evaluation for False: $\text{cond}(\text{false}, a, b) = b$
Informal description
For any elements $a$ and $b$ of type $\alpha$, the conditional expression $\text{cond}(\text{false}, a, b)$ evaluates to $b$.
Bool.cond_true_left theorem
: ∀ (c f : Bool), cond c true f = (c || f)
Full source
@[simp] theorem cond_true_left   : ∀(c f : Bool), cond c true f  = ( c || f) := by decide
Conditional with True Left Branch Equals Disjunction: $\mathrm{cond}(c, \mathrm{true}, f) = c \lor f$
Informal description
For any boolean values $c$ and $f$, the conditional expression $\mathrm{cond}(c, \mathrm{true}, f)$ is equal to the logical disjunction $c \lor f$.
Bool.cond_false_left theorem
: ∀ (c f : Bool), cond c false f = (!c && f)
Full source
@[simp] theorem cond_false_left  : ∀(c f : Bool), cond c false f = (!c!c && f) := by decide
Conditional with False Left Branch Equals Negation and Conjunction: $\mathrm{cond}(c, \mathrm{false}, f) = (\neg c) \land f$
Informal description
For any boolean values $c$ and $f$, the conditional expression $\mathrm{cond}(c, \mathrm{false}, f)$ is equal to the logical conjunction of $\neg c$ and $f$, i.e., $\mathrm{cond}(c, \mathrm{false}, f) = (\neg c) \land f$.
Bool.cond_true_right theorem
: ∀ (c t : Bool), cond c t true = (!c || t)
Full source
@[simp] theorem cond_true_right  : ∀(c t : Bool), cond c t true  = (!c!c || t) := by decide
Conditional with True Right Branch Equals Disjunction: $\mathrm{cond}(c, t, \mathrm{true}) = \neg c \lor t$
Informal description
For any boolean values $c$ and $t$, the conditional expression $\mathrm{cond}(c, t, \mathrm{true})$ is equal to the logical disjunction $\neg c \lor t$.
Bool.cond_false_right theorem
: ∀ (c t : Bool), cond c t false = (c && t)
Full source
@[simp] theorem cond_false_right : ∀(c t : Bool), cond c t false = ( c && t) := by decide
Conditional with False Right Branch Equals Conjunction: $\text{cond}(c, t, \text{false}) = c \land t$
Informal description
For any boolean values $c$ and $t$, the conditional expression $\text{cond}(c, t, \text{false})$ is equal to the logical conjunction $c \land t$.
Bool.cond_true_not_same theorem
: ∀ (c b : Bool), cond c (!c) b = (!c && b)
Full source
@[simp] theorem cond_true_not_same  : ∀ (c b : Bool), cond c (!c) b = (!c!c && b) := by decide
Conditional with Negated Condition: $\text{cond}(c, \neg c, b) = \neg c \land b$
Informal description
For any boolean values $c$ and $b$, the conditional expression $\text{cond}(c, \neg c, b)$ is equal to $\neg c \land b$.
Bool.cond_false_not_same theorem
: ∀ (c b : Bool), cond c b (!c) = (!c || b)
Full source
@[simp] theorem cond_false_not_same : ∀ (c b : Bool), cond c b (!c) = (!c!c || b) := by decide
Conditional with Negated Condition: $\text{cond}(c, b, \neg c) = \neg c \lor b$
Informal description
For any boolean values $c$ and $b$, the conditional expression $\text{cond}(c, b, \neg c)$ is equal to the logical disjunction $\neg c \lor b$.
Bool.cond_true_same theorem
: ∀ (c b : Bool), cond c c b = (c || b)
Full source
@[simp] theorem cond_true_same  : ∀(c b : Bool), cond c c b = (c || b) := by decide
Conditional with Same Condition Reduces to Disjunction: $\text{cond}(c, c, b) = c \lor b$
Informal description
For any Boolean values $c$ and $b$, the conditional expression `cond c c b` evaluates to the logical disjunction $c \lor b$.
Bool.cond_false_same theorem
: ∀ (c b : Bool), cond c b c = (c && b)
Full source
@[simp] theorem cond_false_same : ∀(c b : Bool), cond c b c = (c && b) := by decide
Conditional Equivalence to Conjunction: $\text{if } c \text{ then } b \text{ else } c = c \land b$
Informal description
For any boolean values $c$ and $b$, the conditional expression `if c then b else c` is equal to the logical conjunction $c \land b$.
Bool.cond_pos theorem
{b : Bool} {a a' : α} (h : b = true) : (bif b then a else a') = a
Full source
theorem cond_pos {b : Bool} {a a' : α} (h : b = true) : (bif b then a else a') = a := by
  rw [h, cond_true]
Conditional Evaluation with True Condition: $\mathrm{if}\ b\ \mathrm{then}\ a\ \mathrm{else}\ a' = a$ when $b = \mathrm{true}$
Informal description
For any Boolean value $b$ and elements $a, a'$ of type $\alpha$, if $b$ is equal to $\mathrm{true}$, then the conditional expression $\mathrm{if}\ b\ \mathrm{then}\ a\ \mathrm{else}\ a'$ evaluates to $a$.
Bool.cond_neg theorem
{b : Bool} {a a' : α} (h : b = false) : (bif b then a else a') = a'
Full source
theorem cond_neg {b : Bool} {a a' : α} (h : b = false) : (bif b then a else a') = a' := by
  rw [h, cond_false]
Conditional Evaluation for False: $\text{if } b = \text{false} \text{ then } a \text{ else } a' = a'$
Informal description
For any Boolean value $b$ and elements $a, a'$ of type $\alpha$, if $b$ is false, then the conditional expression `if b then a else a'` evaluates to $a'$.
Bool.apply_cond theorem
(f : α → β) {b : Bool} {a a' : α} : f (bif b then a else a') = bif b then f a else f a'
Full source
theorem apply_cond (f : α → β) {b : Bool} {a a' : α} :
    f (bif b then a else a') = bif b then f a else f a' := by
  cases b <;> simp
Function Application Distributes Over Boolean Conditional: $f(\text{if } b \text{ then } a \text{ else } a') = \text{if } b \text{ then } f(a) \text{ else } f(a')$
Informal description
For any function $f : \alpha \to \beta$ and any Boolean condition $b$, the application of $f$ to the conditional expression `if b then a else a'` is equal to the conditional expression `if b then f a else f a'`. In other words, $f(\text{if } b \text{ then } a \text{ else } a') = \text{if } b \text{ then } f(a) \text{ else } f(a')$.
Bool.decide_coe theorem
(b : Bool) [Decidable (b = true)] : decide (b = true) = b
Full source
protected theorem decide_coe (b : Bool) [Decidable (b = true)] : decide (b = true) = b := decide_eq_true
Decision Procedure for Boolean Equality to True Yields Original Value
Informal description
For any Boolean value $b$, the decision procedure for the proposition "$b$ is equal to `true`" evaluates to $b$ itself, i.e., $\text{decide}(b = \text{true}) = b$.
Bool.decide_and theorem
(p q : Prop) [dpq : Decidable (p ∧ q)] [dp : Decidable p] [dq : Decidable q] : decide (p ∧ q) = (p && q)
Full source
@[simp] theorem decide_and (p q : Prop) [dpq : Decidable (p ∧ q)] [dp : Decidable p] [dq : Decidable q] :
    decide (p ∧ q) = (p && q) := by
  cases dp with | _ p => simp [p]
Boolean AND Corresponds to Logical Conjunction for Decidable Propositions
Informal description
For any decidable propositions $p$ and $q$, the boolean evaluation of the conjunction $p \land q$ is equal to the boolean AND of the evaluations of $p$ and $q$, i.e., $\text{decide}(p \land q) = (\text{decide } p \land \text{decide } q)$.
Bool.decide_or theorem
(p q : Prop) [dpq : Decidable (p ∨ q)] [dp : Decidable p] [dq : Decidable q] : decide (p ∨ q) = (p || q)
Full source
@[simp] theorem decide_or (p q : Prop) [dpq : Decidable (p ∨ q)] [dp : Decidable p] [dq : Decidable q] :
    decide (p ∨ q) = (p || q) := by
  cases dp with | _ p => simp [p]
Boolean OR Corresponds to Logical Disjunction for Decidable Propositions
Informal description
For any decidable propositions $p$ and $q$, the boolean evaluation of the disjunction $p \lor q$ is equal to the boolean OR of the evaluations of $p$ and $q$, i.e., $\text{decide}(p \lor q) = (\text{decide } p \lor \text{decide } q)$.
Bool.decide_iff_dist theorem
(p q : Prop) [dpq : Decidable (p ↔ q)] [dp : Decidable p] [dq : Decidable q] : decide (p ↔ q) = (decide p == decide q)
Full source
@[simp] theorem decide_iff_dist (p q : Prop) [dpq : Decidable (p ↔ q)] [dp : Decidable p] [dq : Decidable q] :
    decide (p ↔ q) = (decide p == decide q) := by
  cases dp with | _ p => simp [p]
Boolean Evaluation of Logical Equivalence Equals Boolean Equality of Decisions
Informal description
For any decidable propositions $p$ and $q$, the boolean evaluation of the equivalence $p \leftrightarrow q$ is equal to the boolean equality check between the evaluations of $p$ and $q$, i.e., $\text{decide}(p \leftrightarrow q) = (\text{decide } p == \text{decide } q)$.
Bool.and_eq_decide theorem
(p q : Bool) : (p && q) = decide (p ∧ q)
Full source
@[bool_to_prop]
theorem and_eq_decide (p q : Bool) : (p && q) = decide (p ∧ q) := by simp
Boolean AND Equals Decision of Logical Conjunction
Informal description
For any two boolean values $p$ and $q$, the boolean AND operation $p \land q$ is equal to the result of deciding the logical conjunction of $p$ and $q$ as propositions.
Bool.or_eq_decide theorem
(p q : Bool) : (p || q) = decide (p ∨ q)
Full source
@[bool_to_prop]
theorem or_eq_decide (p q : Bool) : (p || q) = decide (p ∨ q) := by simp
Boolean OR Equals Decision of Logical Disjunction
Informal description
For any two boolean values $p$ and $q$, the boolean disjunction $p \lor q$ is equal to the decision procedure applied to the logical disjunction $p \lor q$.
Bool.decide_beq_decide theorem
(p q : Prop) [dpq : Decidable (p ↔ q)] [dp : Decidable p] [dq : Decidable q] : (decide p == decide q) = decide (p ↔ q)
Full source
@[bool_to_prop]
theorem decide_beq_decide (p q : Prop) [dpq : Decidable (p ↔ q)] [dp : Decidable p] [dq : Decidable q] :
    (decide p == decide q) = decide (p ↔ q) := by
  cases dp with | _ p => simp [p]
Boolean Equality of Decidable Propositions Matches Their Logical Equivalence
Informal description
For any two propositions $p$ and $q$ with decidable equivalence and decidable truth values, the boolean equality check $\text{decide}(p) == \text{decide}(q)$ is equal to $\text{decide}(p \leftrightarrow q)$.
false_eq_decide_iff theorem
{p : Prop} [h : Decidable p] : false = decide p ↔ ¬p
Full source
@[simp] theorem false_eq_decide_iff {p : Prop} [h : Decidable p] : falsefalse = decide p ↔ ¬p := by
  cases h with | _ q => simp [q]
Equivalence of False and Decidable Proposition Evaluation to Negation
Informal description
For any decidable proposition $p$, the boolean evaluation `decide p` is equal to `false` if and only if $\neg p$ holds. In other words, $\text{false} = \text{decide } p \leftrightarrow \neg p$.
true_eq_decide_iff theorem
{p : Prop} [h : Decidable p] : true = decide p ↔ p
Full source
@[simp] theorem true_eq_decide_iff {p : Prop} [h : Decidable p] : truetrue = decide p ↔ p := by
  cases h with | _ q => simp [q]
Equivalence of True and Decidable Proposition Evaluation
Informal description
For any decidable proposition $p$, the equality $\text{true} = \text{decide } p$ holds if and only if $p$ is true.
boolPredToPred definition
: Coe (α → Bool) (α → Prop)
Full source
/--
This should not be turned on globally as an instance because it degrades performance in Mathlib,
but may be used locally.
-/
def boolPredToPred : Coe (α → Bool) (α  → Prop) where
  coe r := fun a => Eq (r a) true
Coercion from Boolean-valued function to predicate
Informal description
The coercion function converts a Boolean-valued function $f : \alpha \to \text{Bool}$ into a predicate on $\alpha$ by interpreting $\text{true}$ as the predicate holds and $\text{false}$ as the predicate does not hold. Specifically, for any $a \in \alpha$, the predicate $f(a)$ holds if and only if $f(a) = \text{true}$.
boolRelToRel definition
: Coe (α → α → Bool) (α → α → Prop)
Full source
/--
This should not be turned on globally as an instance because it degrades performance in Mathlib,
but may be used locally.
-/
def boolRelToRel : Coe (α → α → Bool) (α → α → Prop) where
  coe r := fun a b => Eq (r a b) true
Coercion from Boolean-valued function to binary relation
Informal description
The coercion function converts a binary Boolean-valued function $r : \alpha \times \alpha \to \text{Bool}$ into a binary relation on $\alpha$ by interpreting $\text{true}$ as the relation holds and $\text{false}$ as the relation does not hold. Specifically, for any $a, b \in \alpha$, the relation $r(a, b)$ holds if and only if $r(a, b) = \text{true}$.
Subtype.beq_iff theorem
{α : Type u} [DecidableEq α] {p : α → Prop} {x y : { a : α // p a }} : (x == y) = (x.1 == y.1)
Full source
@[simp] theorem Subtype.beq_iff {α : Type u} [DecidableEq α] {p : α → Prop} {x y : {a : α // p a}} :
    (x == y) = (x.1 == y.1) := by
  cases x
  cases y
  rw [Bool.eq_iff_iff]
  simp [beq_iff_eq]
Boolean Equality Test for Subtypes Reflects Underlying Equality
Informal description
For any type $\alpha$ with decidable equality and any predicate $p$ on $\alpha$, given two elements $x$ and $y$ of the subtype $\{a \in \alpha \mid p(a)\}$, the boolean equality test $x == y$ is equal to the boolean equality test on their underlying values $x.1 == y.1$.