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

Commit b0eeea4

Browse files
gebnermergify[bot]
andauthored
fix(data/bool): remove simp attribute from commutativity lemmas (#2027)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent aefdb86 commit b0eeea4

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/data/bool.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,23 @@ theorem eq_tt_of_ne_ff : ∀ {a : bool}, a ≠ ff → a = tt := dec_trivial
8181

8282
theorem eq_ff_of_ne_tt : ∀ {a : bool}, a ≠ tt → a = ff := dec_trivial
8383

84-
@[simp] theorem bor_comm : ∀ a b, a || b = b || a := dec_trivial
84+
theorem bor_comm : ∀ a b, a || b = b || a := dec_trivial
8585

8686
@[simp] theorem bor_assoc : ∀ a b c, (a || b) || c = a || (b || c) := dec_trivial
8787

88-
@[simp] theorem bor_left_comm : ∀ a b c, a || (b || c) = b || (a || c) := dec_trivial
88+
theorem bor_left_comm : ∀ a b c, a || (b || c) = b || (a || c) := dec_trivial
8989

9090
theorem bor_inl {a b : bool} (H : a) : a || b :=
9191
by simp [H]
9292

9393
theorem bor_inr {a b : bool} (H : b) : a || b :=
9494
by simp [H]
9595

96-
@[simp] theorem band_comm : ∀ a b, a && b = b && a := dec_trivial
96+
theorem band_comm : ∀ a b, a && b = b && a := dec_trivial
9797

9898
@[simp] theorem band_assoc : ∀ a b c, (a && b) && c = a && (b && c) := dec_trivial
9999

100-
@[simp] theorem band_left_comm : ∀ a b c, a && (b && c) = b && (a && c) := dec_trivial
100+
theorem band_left_comm : ∀ a b c, a && (b && c) = b && (a && c) := dec_trivial
101101

102102
theorem band_elim_left : ∀ {a b : bool}, a && b → a := dec_trivial
103103

@@ -113,9 +113,9 @@ theorem eq_tt_of_bnot_eq_ff : ∀ {a : bool}, bnot a = ff → a = tt := dec_triv
113113

114114
theorem eq_ff_of_bnot_eq_tt : ∀ {a : bool}, bnot a = tt → a = ff := dec_trivial
115115

116-
@[simp] theorem bxor_comm : ∀ a b, bxor a b = bxor b a := dec_trivial
116+
theorem bxor_comm : ∀ a b, bxor a b = bxor b a := dec_trivial
117117
@[simp] theorem bxor_assoc : ∀ a b c, bxor (bxor a b) c = bxor a (bxor b c) := dec_trivial
118-
@[simp] theorem bxor_left_comm : ∀ a b c, bxor a (bxor b c) = bxor b (bxor a c) := dec_trivial
118+
theorem bxor_left_comm : ∀ a b c, bxor a (bxor b c) = bxor b (bxor a c) := dec_trivial
119119
@[simp] theorem bxor_bnot_left : ∀ a, bxor (!a) a = tt := dec_trivial
120120
@[simp] theorem bxor_bnot_right : ∀ a, bxor a (!a) = tt := dec_trivial
121121
@[simp] theorem bxor_bnot_bnot : ∀ a b, bxor (!a) (!b) = bxor a b := dec_trivial

src/data/int/basic.lean

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ meta instance : has_to_format ℤ := ⟨λ z, to_string z⟩
1919
meta instance : has_reflect ℤ := by tactic.mk_has_reflect_instance
2020

2121
attribute [simp] int.coe_nat_add int.coe_nat_mul int.coe_nat_zero int.coe_nat_one int.coe_nat_succ
22-
attribute [simp] int.of_nat_eq_coe
22+
attribute [simp] int.of_nat_eq_coe int.bodd
2323

2424
@[simp] theorem add_def {a b : ℤ} : int.add a b = a + b := rfl
2525
@[simp] theorem mul_def {a b : ℤ} : int.mul a b = a * b := rfl
@@ -810,9 +810,11 @@ lemma units_inv_eq_self (u : units ℤ) : u⁻¹ = u :=
810810
@[simp] lemma bodd_one : bodd 1 = tt := rfl
811811
@[simp] lemma bodd_two : bodd 2 = ff := rfl
812812

813+
@[simp, elim_cast] lemma bodd_coe (n : ℕ) : int.bodd n = nat.bodd n := rfl
814+
813815
@[simp] lemma bodd_sub_nat_nat (m n : ℕ) : bodd (sub_nat_nat m n) = bxor m.bodd n.bodd :=
814816
by apply sub_nat_nat_elim m n (λ m n i, bodd i = bxor m.bodd n.bodd); intros;
815-
simp [bodd, -of_nat_eq_coe]
817+
simp; cases i.bodd; simp
816818

817819
@[simp] lemma bodd_neg_of_nat (n : ℕ) : bodd (neg_of_nat n) = n.bodd :=
818820
by cases n; simp; refl
@@ -821,10 +823,12 @@ by cases n; simp; refl
821823
by cases n; simp [has_neg.neg, int.coe_nat_eq, int.neg, bodd, -of_nat_eq_coe]
822824

823825
@[simp] lemma bodd_add (m n : ℤ) : bodd (m + n) = bxor (bodd m) (bodd n) :=
824-
by cases m with m m; cases n with n n; unfold has_add.add; simp [int.add, bodd, -of_nat_eq_coe]
826+
by cases m with m m; cases n with n n; unfold has_add.add;
827+
simp [int.add, -of_nat_eq_coe, bool.bxor_comm]
825828

826829
@[simp] lemma bodd_mul (m n : ℤ) : bodd (m * n) = bodd m && bodd n :=
827-
by cases m with m m; cases n with n n; unfold has_mul.mul; simp [int.mul, bodd, -of_nat_eq_coe]
830+
by cases m with m m; cases n with n n; unfold has_mul.mul;
831+
simp [int.mul, -of_nat_eq_coe, bool.bxor_comm]
828832

829833
theorem bodd_add_div2 : ∀ n, cond (bodd n) 1 0 + 2 * div2 n = n
830834
| (n : ℕ) :=

0 commit comments

Comments
 (0)