/-
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
-/
module
public import Mathlib.Algebra.CharP.Lemmas
public 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.
-/
@[expose] public section
namespace Counterexample
@[simp]
theorem add_one_eq_one (x : WithZero Unit) : x + 1 = 1 :=
WithZero.cases_on x 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 simp [-Nat.reduceAdd])
end Counterexample
¤ Dauer der Verarbeitung: 0.17 Sekunden
¤
*© Formatika GbR, Deutschland