Theorem: FiniteField.exists_root_sum_quadratic
File: Mathlib/FieldTheory/Finite/Basic.lean

tactic: simp only [disjoint_left, mem_image] at this
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this✝ : DecidableEq R := Classical.decEq R
this : ¬Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ ∃ a b, eval a f + eval b g = 0

tactic: push_neg  at this
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this✝ : DecidableEq R := Classical.decEq R
this : ¬∀ ⦃a : R⦄, (∃ a_1, a_1 ∈ univ ∧ eval a_1 f = a) → ¬∃ a_2, a_2 ∈ univ ∧ eval a_2 (-g) = a
⊢ ∃ a b, eval a f + eval b g = 0

tactic: rcases this with ⟨x, ⟨a, _, ha⟩, ⟨b, _, hb⟩⟩
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this✝ : DecidableEq R := Classical.decEq R
this : Exists fun ⦃a⦄ => (∃ a_1, a_1 ∈ univ ∧ eval a_1 f = a) ∧ ∃ a_1, a_1 ∈ univ ∧ eval a_1 (-g) = a
⊢ ∃ a b, eval a f + eval b g = 0

tactic: exact ⟨a, b, by rw [ha, ← hb, eval_neg, neg_add_self]⟩
state_before: case intro.intro.intro.intro.intro.intro
K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
x a : R
left✝¹ : a ∈ univ
ha : eval a f = x
b : R
left✝ : b ∈ univ
hb : eval b (-g) = x
⊢ ∃ a b, eval a f + eval b g = 0

tactic: rw [ha, ← hb, eval_neg, neg_add_self]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
x a : R
left✝¹ : a ∈ univ
ha : eval a f = x
b : R
left✝ : b ∈ univ
hb : eval b (-g) = x
⊢ eval a f + eval b g = 0

tactic: rw [hf2]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < degree f

tactic: exact by decide
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < 2

tactic: decide
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < 2

tactic: simp [natDegree_eq_of_degree_eq_some hf2, hR]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ ¬Fintype.card R % 2 = natDegree f * card (image (fun x => eval x f) univ) % 2

tactic: rw [degree_neg, hg2]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < degree (-g)

tactic: exact by decide
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < 2

tactic: decide
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ 0 < 2

tactic: rw [card_disjoint_union hd]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ natDegree f * card (image (fun x => eval x f) univ) + natDegree (-g) * card (image (fun x => eval x (-g)) univ) =
    2 * card (image (fun x => eval x f) univ ∪ image (fun x => eval x (-g)) univ)

tactic: simp [natDegree_eq_of_degree_eq_some hf2, natDegree_eq_of_degree_eq_some hg2, mul_add]
state_before: K : Type ?u.86716
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : Fintype R
f g : R[X]
hf2 : degree f = 2
hg2 : degree g = 2
hR : Fintype.card R % 2 = 1
this : DecidableEq R := Classical.decEq R
hd : Disjoint (image (fun x => eval x f) univ) (image (fun x => eval x (-g)) univ)
⊢ natDegree f * card (image (fun x => eval x f) univ) + natDegree (-g) * card (image (fun x => eval x (-g)) univ) =
    2 * (card (image (fun x => eval x f) univ) + card (image (fun x => eval x (-g)) univ))