Theorem: FirstOrder.Field.charP_iff_model_fieldOfChar
File: Mathlib/ModelTheory/Algebra/Field/CharP.lean

tactic: simp only [Theory.fieldOfChar, Theory.model_union_iff,
  (show (Theory.field.Model K) by infer_instance), true_and]
state_before: p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ K ⊨ Theory.fieldOfChar p ↔ CharP K p
state_after: p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ (K ⊨ if p = 0 then (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} else if Nat.Prime p then {eqZero p} else {⊥}) ↔
    CharP K p

tactic: split_ifs with hp0 hp
state_before: p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ (K ⊨ if p = 0 then (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} else if Nat.Prime p then {eqZero p} else {⊥}) ↔
    CharP K p
state_after: case pos
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : p = 0
⊢ K ⊨ (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} ↔ CharP K p

case pos
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : Nat.Prime p
⊢ K ⊨ {eqZero p} ↔ CharP K p

case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
⊢ K ⊨ {⊥} ↔ CharP K p

tactic: infer_instance
state_before: p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ K ⊨ Theory.field
state_after: no goals

tactic: subst hp0
state_before: case pos
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : p = 0
⊢ K ⊨ (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} ↔ CharP K p
state_after: case pos
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ K ⊨ (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} ↔ CharP K 0

tactic: simp only [Theory.model_iff, Set.mem_image, Set.mem_setOf_eq, Sentence.Realize,
  forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, Formula.realize_not,
  realize_eqZero, ← CharZero.charZero_iff_forall_prime_ne_zero]
state_before: case pos
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ K ⊨ (fun q => ∼(eqZero q)) '' {q | Nat.Prime q} ↔ CharP K 0
state_after: case pos
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ CharZero K ↔ CharP K 0

tactic: exact ⟨fun _ => CharP.ofCharZero _, fun _ => CharP.charP_to_charZero K⟩
state_before: case pos
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
⊢ CharZero K ↔ CharP K 0
state_after: no goals

tactic: simp only [Theory.model_iff, Set.mem_singleton_iff, Sentence.Realize, forall_eq,
  realize_eqZero, ← CharP.charP_iff_prime_eq_zero hp]
state_before: case pos
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : Nat.Prime p
⊢ K ⊨ {eqZero p} ↔ CharP K p
state_after: no goals

tactic: simp only [Theory.model_iff, Set.mem_singleton_iff, Sentence.Realize,
  forall_eq, Formula.realize_bot, false_iff]
state_before: case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
⊢ K ⊨ {⊥} ↔ CharP K p
state_after: case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
⊢ ¬CharP K p

tactic: intro H
state_before: case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
⊢ ¬CharP K p
state_after: case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
H : CharP K p
⊢ False

tactic: cases (CharP.char_is_prime_or_zero K p) <;> simp_all
state_before: case neg
p : ℕ
K : Type u_1
inst✝¹ : Field K
inst✝ : CompatibleRing K
hp0 : ¬p = 0
hp : ¬Nat.Prime p
H : CharP K p
⊢ False
state_after: no goals