Theorem: Combinatorics.exists_mono_homothetic_copy
File: Mathlib/Combinatorics/HalesJewett.lean

tactic: obtain ⟨ι, _inst, hι⟩ := Line.exists_mono_in_high_dimension S κ
state_before: M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c
state_after: case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → { x // x ∈ S }) → κ), ∃ l, Line.IsMono C l
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c

tactic: specialize hι fun v => C <| ∑ i, v i
state_before: case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∀ (C : (ι → { x // x ∈ S }) → κ), ∃ l, Line.IsMono C l
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c
state_after: case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∃ l, Line.IsMono (fun v => C (∑ i : ι, ↑(v i))) l
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c

tactic: obtain ⟨l, c, hl⟩ := hι
state_before: case intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
hι : ∃ l, Line.IsMono (fun v => C (∑ i : ι, ↑(v i))) l
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c
state_after: case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c

tactic: set s : Finset ι := Finset.univ.filter (fun i => l.idxFun i = none) with hs
state_before: case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c
state_after: case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c

tactic: refine
  ⟨s.card, Finset.card_pos.mpr ⟨l.proper.choose, ?_⟩, ∑ i ∈ sᶜ, ((l.idxFun i).map ?_).getD 0,
    c, ?_⟩
state_before: case intro.intro.intro.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ∃ a > 0, ∃ b c, ∀ s ∈ S, C (a • s + b) = c
state_after: case intro.intro.intro.intro.refine_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ⋯.choose ∈ s

case intro.intro.intro.intro.refine_2
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
i : ι
⊢ { x // x ∈ S } → M

case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ∀ s_1 ∈ S, C (s.card • s_1 + ∑ i ∈ sᶜ, (Option.map (?m.15652 i) (l.idxFun i)).getD 0) = c

tactic: intro x xs
state_before: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ∀ s_1 ∈ S, C (s.card • s_1 + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) = c
state_after: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) = c

tactic: rw [← hl ⟨x, xs⟩]
state_before: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) = c
state_after: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩)

tactic: clear hl
state_before: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩)
state_after: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩)

tactic: congr
state_before: case intro.intro.intro.intro.refine_3
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ C (s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0) =
    (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩)
state_after: case intro.intro.intro.intro.refine_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 =
    ∑ i : ι, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: rw [← Finset.sum_add_sum_compl s]
state_before: case intro.intro.intro.intro.refine_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 =
    ∑ i : ι, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 =
    ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i) + ∑ i ∈ sᶜ, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: congr 1
state_before: case intro.intro.intro.intro.refine_3.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x + ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 =
    ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i) + ∑ i ∈ sᶜ, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x = ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ∑ i ∈ sᶜ, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: rw [hs, Finset.mem_filter]
state_before: case intro.intro.intro.intro.refine_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ⋯.choose ∈ s
state_after: case intro.intro.intro.intro.refine_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ⋯.choose ∈ Finset.univ ∧ l.idxFun ⋯.choose = none

tactic: exact ⟨Finset.mem_univ _, l.proper.choose_spec⟩
state_before: case intro.intro.intro.intro.refine_1
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
⊢ ⋯.choose ∈ Finset.univ ∧ l.idxFun ⋯.choose = none
state_after: no goals

tactic: exact fun m => m
state_before: case intro.intro.intro.intro.refine_2
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
hl : ∀ (x : { x // x ∈ S }), (fun v => C (∑ i : ι, ↑(v i))) ((fun x i => (l.idxFun i).getD x) x) = c
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
i : ι
⊢ { x // x ∈ S } → M
state_after: no goals

tactic: rw [← Finset.sum_const]
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ s.card • x = ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ _x ∈ s, x = ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: apply Finset.sum_congr rfl
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ _x ∈ s, x = ∑ i ∈ s, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ x_1 ∈ s, x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ x_1)

tactic: intro i hi
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ x_1 ∈ s, x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ x_1)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ s
⊢ x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: rw [hs, Finset.mem_filter] at hi
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ s
⊢ x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ l.idxFun i = none
⊢ x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: rw [l.apply_none _ _ hi.right, Subtype.coe_mk]
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ l.idxFun i = none
⊢ x = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: no goals

tactic: apply Finset.sum_congr rfl
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∑ i ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ∑ i ∈ sᶜ, ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ x_1 ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun x_1)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ x_1)

tactic: intro i hi
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
⊢ ∀ x_1 ∈ sᶜ, (Option.map (fun m => ↑m) (l.idxFun x_1)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ x_1)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ sᶜ
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: rw [hs, Finset.compl_filter, Finset.mem_filter] at hi
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ sᶜ
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬l.idxFun i = none
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: obtain ⟨y, hy⟩ := Option.ne_none_iff_exists.mp hi.right
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬l.idxFun i = none
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: case intro.intro.intro.intro.refine_3.e_a.e_a.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬l.idxFun i = none
y : { x // x ∈ S }
hy : some y = l.idxFun i
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)

tactic: simp_rw [← hy, Option.map_some', Option.getD]
state_before: case intro.intro.intro.intro.refine_3.e_a.e_a.intro
M : Type u_1
κ : Type u_2
inst✝¹ : AddCommMonoid M
S : Finset M
inst✝ : Finite κ
C : M → κ
ι : Type
_inst : Fintype ι
l : Line { x // x ∈ S } ι
c : κ
s : Finset ι := Finset.filter (fun i => l.idxFun i = none) Finset.univ
hs : s = Finset.filter (fun i => l.idxFun i = none) Finset.univ
x : M
xs : x ∈ S
i : ι
hi : i ∈ Finset.univ ∧ ¬l.idxFun i = none
y : { x // x ∈ S }
hy : some y = l.idxFun i
⊢ (Option.map (fun m => ↑m) (l.idxFun i)).getD 0 = ↑((fun x i => (l.idxFun i).getD x) ⟨x, xs⟩ i)
state_after: no goals