Skip to content

Commit

Permalink
feat(data/int/parity): not_even_iff (#1694)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHughes24 authored and mergify[bot] committed Nov 17, 2019
1 parent e863c08 commit 1034357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/data/int/parity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ have ∀ m, 2 * to_nat m = to_nat (2 * m),
theorem even_iff {n : int} : even n ↔ n % 2 = 0 :=
⟨λ ⟨m, hm⟩, by simp [hm], λ h, ⟨n / 2, (mod_add_div n 2).symm.trans (by simp [h])⟩⟩

lemma not_even_iff {n : ℤ} : ¬ even n ↔ n % 2 = 1 :=
by rw [even_iff, mod_two_ne_zero]

instance : decidable_pred even :=
λ n, decidable_of_decidable_of_iff (by apply_instance) even_iff.symm

Expand Down
3 changes: 3 additions & 0 deletions src/data/nat/parity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def even (n : nat) : Prop := 2 ∣ n
theorem even_iff {n : nat} : even n ↔ n % 2 = 0 :=
⟨λ ⟨m, hm⟩, by simp [hm], λ h, ⟨n / 2, (mod_add_div n 2).symm.trans (by simp [h])⟩⟩

lemma not_even_iff {n : ℕ} : ¬ even n ↔ n % 2 = 1 :=
by rw [even_iff, mod_two_ne_zero]

instance : decidable_pred even :=
λ n, decidable_of_decidable_of_iff (by apply_instance) even_iff.symm

Expand Down

0 comments on commit 1034357

Please sign in to comment.