-
Notifications
You must be signed in to change notification settings - Fork 408
/
Copy pathCharPZeroNeCharZero.lean
35 lines (24 loc) · 1.1 KB
/
CharPZeroNeCharZero.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/-
Copyright (c) 2022 Damiano Testa. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Damiano Testa, Eric Wieser
-/
import Mathlib.Algebra.CharP.Lemmas
import Mathlib.Algebra.Ring.PUnit
/-! # `CharP R 0` and `CharZero R` need not coincide for semirings
For rings, the two notions coincide.
In fact, `CharP.ofCharZero` shows that `CharZero R` implies `CharP R 0` for any `CharZero`
`AddMonoid R` with `1`.
The reverse implication holds for any `AddLeftCancelMonoid R` with `1`, by `charP_to_charZero`.
This file shows that there are semirings `R` for which `CharP R 0` holds and `CharZero R` does not.
The example is `{0, 1}` with saturating addition.
-/
namespace Counterexample
@[simp]
theorem add_one_eq_one (x : WithZero Unit) : x + 1 = 1 :=
WithZero.cases_on x (by rfl) fun h => by rfl
theorem withZero_unit_charP_zero : CharP (WithZero Unit) 0 :=
⟨fun x => by cases x <;> simp⟩
theorem withZero_unit_not_charZero : ¬CharZero (WithZero Unit) := fun ⟨h⟩ =>
h.ne (by simp : 1 + 1 ≠ 0 + 1) (by set_option simprocs false in simp)
end Counterexample