Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 44c394b

Browse files
committed
feat(data/bool/basic): add several lemmas (#17153)
Also rename `bool.bnot_false`/`bool.bnot_true` to more predictable names `bool.bnot_ff`/`bool.bnot_tt`.
1 parent 3b3cd89 commit 44c394b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/data/bool/basic.lean

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ eq_comm.trans of_to_bool_iff
5050
@[simp] lemma ff_eq_to_bool_iff {p : Prop} [decidable p] : ff = to_bool p ↔ ¬ p :=
5151
eq_comm.trans (to_bool_ff_iff _)
5252

53-
@[simp] theorem to_bool_not (p : Prop) [decidable p] : to_bool (¬ p) = bnot (to_bool p) :=
53+
@[simp] theorem to_bool_not (p : Prop) [decidable p] : to_bool (¬ p) = !(to_bool p) :=
5454
by by_cases p; simp *
5555

5656
@[simp] theorem to_bool_and (p q : Prop) [decidable p] [decidable q] :
@@ -137,21 +137,29 @@ lemma band_bor_distrib_right (a b c : bool) : (a || b) && c = a && c || b && c :
137137
lemma bor_band_distrib_left (a b c : bool) : a || b && c = (a || b) && (a || c) := by cases a; simp
138138
lemma bor_band_distrib_right (a b c : bool) : a && b || c = (a || c) && (b || c) := by cases c; simp
139139

140-
@[simp] theorem bnot_false : bnot ff = tt := rfl
140+
@[simp] theorem bnot_ff : !ff = tt := rfl
141141

142-
@[simp] theorem bnot_true : bnot tt = ff := rfl
142+
@[simp] theorem bnot_tt : !tt = ff := rfl
143+
144+
lemma eq_bnot_iff : ∀ {a b : bool}, a = !b ↔ a ≠ b := dec_trivial
145+
lemma bnot_eq_iff : ∀ {a b : bool}, !a = b ↔ a ≠ b := dec_trivial
143146

144147
@[simp] lemma not_eq_bnot : ∀ {a b : bool}, ¬a = !b ↔ a = b := dec_trivial
145148
@[simp] lemma bnot_not_eq : ∀ {a b : bool}, ¬!a = b ↔ a = b := dec_trivial
146149

147150
lemma ne_bnot {a b : bool} : a ≠ !b ↔ a = b := not_eq_bnot
148151
lemma bnot_ne {a b : bool} : !a ≠ b ↔ a = b := bnot_not_eq
149152

153+
lemma bnot_ne_self : ∀ b : bool, !b ≠ b := dec_trivial
154+
lemma self_ne_bnot : ∀ b : bool, b ≠ !b := dec_trivial
155+
156+
lemma eq_or_eq_bnot : ∀ a b, a = b ∨ a = !b := dec_trivial
157+
150158
@[simp] theorem bnot_iff_not : ∀ {b : bool}, !b ↔ ¬b := dec_trivial
151159

152-
theorem eq_tt_of_bnot_eq_ff : ∀ {a : bool}, bnot a = ff → a = tt := dec_trivial
160+
theorem eq_tt_of_bnot_eq_ff : ∀ {a : bool}, !a = ff → a = tt := dec_trivial
153161

154-
theorem eq_ff_of_bnot_eq_tt : ∀ {a : bool}, bnot a = tt → a = ff := dec_trivial
162+
theorem eq_ff_of_bnot_eq_tt : ∀ {a : bool}, !a = tt → a = ff := dec_trivial
155163

156164
@[simp] lemma band_bnot_self : ∀ x, x && !x = ff := dec_trivial
157165
@[simp] lemma bnot_band_self : ∀ x, !x && x = ff := dec_trivial

0 commit comments

Comments
 (0)