-- Mathlib/LinearAlgebra/Finsupp/Supported.lean
theorem supported_iUnion {δ : Type*} (s : δ → Set α) :
    supported M R (⋃ i, s i) = ⨆ i, supported M R (s i)

Proof state:
case intro.refine_2
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l : α →₀ M
⊢ ∀ (a : α) (b : M) (f : α →₀ M),
    a ∉ f.support →
      b ≠ 0 →
        f ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i)) →
          single a b + f ∈
            comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Tactic:
refine fun x a l _ _ => add_mem ?_

Result:
case intro.refine_2
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
⊢ single x a ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Proof state:
case pos
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
h : ∃ i, x ∈ s i
⊢ single x a ∈ ⨆ i, supported M R (s i)

Tactic:
obtain ⟨i, hi⟩ := h

Result:
case pos.intro
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
i : δ
hi : x ∈ s i
⊢ single x a ∈ ⨆ i, supported M R (s i)

Proof state:
case pos
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
h : ∃ i, x ∈ s i
⊢ single x a ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Tactic:
simp only [mem_comap, coe_comp, coe_subtype, Function.comp_apply, restrictDom_apply,
  mem_iUnion, h, filter_single_of_pos]

Result:
case pos
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
h : ∃ i, x ∈ s i
⊢ single x a ∈ ⨆ i, supported M R (s i)

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ supported M R (⋃ i, s i) ≤ ⨆ i, supported M R (s i)

Tactic:
suffices
  LinearMap.range ((Submodule.subtype _).comp (restrictDom M R (⋃ i, s i))) ≤
    ⨆ i, supported M R (s i) by
  rwa [LinearMap.range_comp, range_restrictDom, Submodule.map_top, range_subtype] at this

Result:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ LinearMap.range ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) ≤ ⨆ i, supported M R (s i)

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ ⊤ ≤ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Tactic:
rintro l ⟨⟩

Result:
case intro
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l : α →₀ M
⊢ l ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this✝ : DecidablePred fun x => x ∈ ⋃ i, s i
this : LinearMap.range ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) ≤ ⨆ i, supported M R (s i)
⊢ supported M R (⋃ i, s i) ≤ ⨆ i, supported M R (s i)

Tactic:
rwa [LinearMap.range_comp, range_restrictDom, Submodule.map_top, range_subtype] at this

Result:
no goals

Proof state:
case intro
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l : α →₀ M
⊢ l ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Tactic:
refine Finsupp.induction l ?_ ?_

Result:
case intro.refine_1
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l : α →₀ M
⊢ 0 ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

case intro.refine_2
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l : α →₀ M
⊢ ∀ (a : α) (b : M) (f : α →₀ M),
    a ∉ f.support →
      b ≠ 0 →
        f ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i)) →
          single a b + f ∈
            comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
⊢ supported M R (⋃ i, s i) = ⨆ i, supported M R (s i)

Tactic:
refine le_antisymm ?_ (iSup_le fun i => supported_mono <| Set.subset_iUnion _ _)

Result:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
⊢ supported M R (⋃ i, s i) ≤ ⨆ i, supported M R (s i)

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ LinearMap.range ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) ≤ ⨆ i, supported M R (s i)

Tactic:
rw [range_le_iff_comap, eq_top_iff]

Result:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ ⊤ ≤ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Proof state:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
⊢ supported M R (⋃ i, s i) ≤ ⨆ i, supported M R (s i)

Tactic:
haveI := Classical.decPred fun x => x ∈ ⋃ i, s i

Result:
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
⊢ supported M R (⋃ i, s i) ≤ ⨆ i, supported M R (s i)

Proof state:
case neg
α : Type u_1
M : Type u_2
R : Type u_5
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
δ : Type u_7
s : δ → Set α
this : DecidablePred fun x => x ∈ ⋃ i, s i
l✝ : α →₀ M
x : α
a : M
l : α →₀ M
x✝¹ : x ∉ l.support
x✝ : a ≠ 0
h : ¬∃ i, x ∈ s i
⊢ single x a ∈ comap ((supported M R (⋃ i, s i)).subtype ∘ₗ restrictDom M R (⋃ i, s i)) (⨆ i, supported M R (s i))

Tactic:
simp [h]

Result:
no goals