Theorem: Prime.dvd_prod_iff
File: Mathlib/Data/List/Prime.lean

tactic: constructor
state_before: M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
⊢ p ∣ L.prod ↔ ∃ a ∈ L, p ∣ a
state_after: case mp
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
⊢ p ∣ L.prod → ∃ a ∈ L, p ∣ a

case mpr
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
⊢ (∃ a ∈ L, p ∣ a) → p ∣ L.prod

tactic: intro h
state_before: case mp
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
⊢ p ∣ L.prod → ∃ a ∈ L, p ∣ a
state_after: case mp
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
h : p ∣ L.prod
⊢ ∃ a ∈ L, p ∣ a

tactic: induction' L with L_hd L_tl L_ih
state_before: case mp
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
h : p ∣ L.prod
⊢ ∃ a ∈ L, p ∣ a
state_after: case mp.nil
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
h : p ∣ [].prod
⊢ ∃ a ∈ [], p ∣ a

case mp.cons
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ (L_hd :: L_tl).prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a

tactic: rw [prod_nil] at h
state_before: case mp.nil
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
h : p ∣ [].prod
⊢ ∃ a ∈ [], p ∣ a
state_after: case mp.nil
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
h : p ∣ 1
⊢ ∃ a ∈ [], p ∣ a

tactic: exact absurd h pp.not_dvd_one
state_before: case mp.nil
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
h : p ∣ 1
⊢ ∃ a ∈ [], p ∣ a
state_after: no goals

tactic: rw [prod_cons] at h
state_before: case mp.cons
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ (L_hd :: L_tl).prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a
state_after: case mp.cons
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a

tactic: cases' pp.dvd_or_dvd h with hd hd
state_before: case mp.cons
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a
state_after: case mp.cons.inl
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_hd
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a

case mp.cons.inr
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_tl.prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a

tactic: exact ⟨L_hd, mem_cons_self L_hd L_tl, hd⟩
state_before: case mp.cons.inl
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_hd
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a
state_after: no goals

tactic: obtain ⟨x, hx1, hx2⟩ := L_ih hd
state_before: case mp.cons.inr
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_tl.prod
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a
state_after: case mp.cons.inr.intro.intro
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_tl.prod
x : M
hx1 : x ∈ L_tl
hx2 : p ∣ x
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a

tactic: exact ⟨x, mem_cons_of_mem L_hd hx1, hx2⟩
state_before: case mp.cons.inr.intro.intro
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
pp : Prime p
L_hd : M
L_tl : List M
L_ih : p ∣ L_tl.prod → ∃ a ∈ L_tl, p ∣ a
h : p ∣ L_hd * L_tl.prod
hd : p ∣ L_tl.prod
x : M
hx1 : x ∈ L_tl
hx2 : p ∣ x
⊢ ∃ a ∈ L_hd :: L_tl, p ∣ a
state_after: no goals

tactic: exact fun ⟨a, ha1, ha2⟩ => dvd_trans ha2 (dvd_prod ha1)
state_before: case mpr
M : Type u_1
inst✝ : CommMonoidWithZero M
p : M
L : List M
pp : Prime p
⊢ (∃ a ∈ L, p ∣ a) → p ∣ L.prod
state_after: no goals