l3lab/ntp-mathlib huggingface dataset:
/-- If two functions are a.e. equal on an open set and are continuous on this set, then they are
equal on this set. -/
theorem eqOn_open_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict U] g) (hU : IsOpen U)
    (hf : ContinuousOn f U) (hg : ContinuousOn g U) : EqOn f g U := by
  replace h := ae_imp_of_ae_restrict h
  simp only [EventuallyEq, ae_iff, not_imp] at h
  have : IsOpen (U ∩ { a | f a ≠ g a }) := by
    refine' isOpen_iff_mem_nhds.mpr fun a ha => inter_mem (hU.mem_nhds ha.1) _
    rcases ha with ⟨ha : a ∈ U, ha' : (f a, g a) ∈ (diagonal Y)ᶜ⟩
    exact
      (hf.continuousAt (hU.mem_nhds ha)).prod_mk_nhds (hg.continuousAt (hU.mem_nhds ha))
        (isClosed_diagonal.isOpen_compl.mem_nhds ha')
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
m : MeasurableSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : T2Space Y
μ ν : Measure X
inst✝ : IsOpenPosMeasure μ
s U F : Set X
x : X
f g : X → Y
hU : IsOpen U
hf : ContinuousOn f U
hg : ContinuousOn g U
h : ↑↑μ {a | a ∈ U ∧ ¬f a = g a} = 0
this : IsOpen (U ∩ {a | f a ≠ g a})
⊢ EqOn f g U

Next tactic:
replace := (this.eq_empty_of_measure_zero h).le
/-- If two functions are a.e. equal on an open set and are continuous on this set, then they are
equal on this set. -/
theorem eqOn_open_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict U] g) (hU : IsOpen U)
    (hf : ContinuousOn f U) (hg : ContinuousOn g U) : EqOn f g U := by
  replace h := ae_imp_of_ae_restrict h
  simp only [EventuallyEq, ae_iff, not_imp] at h
  have : IsOpen (U ∩ { a | f a ≠ g a }) := by
    refine' isOpen_iff_mem_nhds.mpr fun a ha => inter_mem (hU.mem_nhds ha.1) _
    rcases ha with ⟨ha : a ∈ U, ha' : (f a, g a) ∈ (diagonal Y)ᶜ⟩
    exact
      (hf.continuousAt (hU.mem_nhds ha)).prod_mk_nhds (hg.continuousAt (hU.mem_nhds ha))
        (isClosed_diagonal.isOpen_compl.mem_nhds ha')
  replace := (this.eq_empty_of_measure_zero h).le
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
m : MeasurableSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : T2Space Y
μ ν : Measure X
inst✝ : IsOpenPosMeasure μ
s U F : Set X
x : X
f g : X → Y
hU : IsOpen U
hf : ContinuousOn f U
hg : ContinuousOn g U
h : ↑↑μ {a | a ∈ U ∧ ¬f a = g a} = 0
this : U ∩ {a | f a ≠ g a} ≤ ∅
⊢ EqOn f g U

Next tactic:
exact fun x hx => Classical.not_not.1 fun h => this ⟨hx, h⟩
theorem _root_.Continuous.isOpenPosMeasure_map [OpensMeasurableSpace X]
    {Z : Type*} [TopologicalSpace Z] [MeasurableSpace Z] [BorelSpace Z]
    {f : X → Z} (hf : Continuous f) (hf_surj : Function.Surjective f) :
    (Measure.map f μ).IsOpenPosMeasure := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝⁷ : TopologicalSpace X
m : MeasurableSpace X
inst✝⁶ : TopologicalSpace Y
inst✝⁵ : T2Space Y
μ ν : Measure X
inst✝⁴ : IsOpenPosMeasure μ
s U F : Set X
x : X
inst✝³ : OpensMeasurableSpace X
Z : Type u_3
inst✝² : TopologicalSpace Z
inst✝¹ : MeasurableSpace Z
inst✝ : BorelSpace Z
f : X → Z
hf : Continuous f
hf_surj : Surjective f
⊢ IsOpenPosMeasure (map f μ)

Next tactic:
refine' ⟨fun U hUo hUne => _⟩
theorem _root_.Continuous.isOpenPosMeasure_map [OpensMeasurableSpace X]
    {Z : Type*} [TopologicalSpace Z] [MeasurableSpace Z] [BorelSpace Z]
    {f : X → Z} (hf : Continuous f) (hf_surj : Function.Surjective f) :
    (Measure.map f μ).IsOpenPosMeasure := by
  refine' ⟨fun U hUo hUne => _⟩
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝⁷ : TopologicalSpace X
m : MeasurableSpace X
inst✝⁶ : TopologicalSpace Y
inst✝⁵ : T2Space Y
μ ν : Measure X
inst✝⁴ : IsOpenPosMeasure μ
s U✝ F : Set X
x : X
inst✝³ : OpensMeasurableSpace X
Z : Type u_3
inst✝² : TopologicalSpace Z
inst✝¹ : MeasurableSpace Z
inst✝ : BorelSpace Z
f : X → Z
hf : Continuous f
hf_surj : Surjective f
U : Set Z
hUo : IsOpen U
hUne : Set.Nonempty U
⊢ ↑↑(map f μ) U ≠ 0

Next tactic:
rw [Measure.map_apply hf.measurable hUo.measurableSet]
theorem _root_.Continuous.isOpenPosMeasure_map [OpensMeasurableSpace X]
    {Z : Type*} [TopologicalSpace Z] [MeasurableSpace Z] [BorelSpace Z]
    {f : X → Z} (hf : Continuous f) (hf_surj : Function.Surjective f) :
    (Measure.map f μ).IsOpenPosMeasure := by
  refine' ⟨fun U hUo hUne => _⟩
  rw [Measure.map_apply hf.measurable hUo.measurableSet]
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝⁷ : TopologicalSpace X
m : MeasurableSpace X
inst✝⁶ : TopologicalSpace Y
inst✝⁵ : T2Space Y
μ ν : Measure X
inst✝⁴ : IsOpenPosMeasure μ
s U✝ F : Set X
x : X
inst✝³ : OpensMeasurableSpace X
Z : Type u_3
inst✝² : TopologicalSpace Z
inst✝¹ : MeasurableSpace Z
inst✝ : BorelSpace Z
f : X → Z
hf : Continuous f
hf_surj : Surjective f
U : Set Z
hUo : IsOpen U
hUne : Set.Nonempty U
⊢ ↑↑μ (f ⁻¹' U) ≠ 0

Next tactic:
exact (hUo.preimage hf).measure_ne_zero μ (hf_surj.nonempty_preimage.mpr hUne)
@[simp] lemma measure_closedBall_pos_iff {X : Type*} [MetricSpace X] {m : MeasurableSpace X}
    (μ : Measure X) [IsOpenPosMeasure μ] [NoAtoms μ] {x : X} {r : ℝ} :
    0 < μ (closedBall x r) ↔ 0 < r := by
  

Proof state:
X✝ : Type u_1
inst✝⁴ : PseudoMetricSpace X✝
m✝ : MeasurableSpace X✝
μ✝ : Measure X✝
inst✝³ : IsOpenPosMeasure μ✝
X : Type u_2
inst✝² : MetricSpace X
m : MeasurableSpace X
μ : Measure X
inst✝¹ : IsOpenPosMeasure μ
inst✝ : NoAtoms μ
x : X
r : ℝ
⊢ 0 < ↑↑μ (closedBall x r) ↔ 0 < r

Next tactic:
refine' ⟨fun h ↦ _, measure_closedBall_pos μ x⟩
@[simp] lemma measure_closedBall_pos_iff {X : Type*} [MetricSpace X] {m : MeasurableSpace X}
    (μ : Measure X) [IsOpenPosMeasure μ] [NoAtoms μ] {x : X} {r : ℝ} :
    0 < μ (closedBall x r) ↔ 0 < r := by
  refine' ⟨fun h ↦ _, measure_closedBall_pos μ x⟩
  

Proof state:
X✝ : Type u_1
inst✝⁴ : PseudoMetricSpace X✝
m✝ : MeasurableSpace X✝
μ✝ : Measure X✝
inst✝³ : IsOpenPosMeasure μ✝
X : Type u_2
inst✝² : MetricSpace X
m : MeasurableSpace X
μ : Measure X
inst✝¹ : IsOpenPosMeasure μ
inst✝ : NoAtoms μ
x : X
r : ℝ
h : 0 < ↑↑μ (closedBall x r)
⊢ 0 < r

Next tactic:
contrapose! h
@[simp] lemma measure_closedBall_pos_iff {X : Type*} [MetricSpace X] {m : MeasurableSpace X}
    (μ : Measure X) [IsOpenPosMeasure μ] [NoAtoms μ] {x : X} {r : ℝ} :
    0 < μ (closedBall x r) ↔ 0 < r := by
  refine' ⟨fun h ↦ _, measure_closedBall_pos μ x⟩
  contrapose! h
  

Proof state:
X✝ : Type u_1
inst✝⁴ : PseudoMetricSpace X✝
m✝ : MeasurableSpace X✝
μ✝ : Measure X✝
inst✝³ : IsOpenPosMeasure μ✝
X : Type u_2
inst✝² : MetricSpace X
m : MeasurableSpace X
μ : Measure X
inst✝¹ : IsOpenPosMeasure μ
inst✝ : NoAtoms μ
x : X
r : ℝ
h : r ≤ 0
⊢ ↑↑μ (closedBall x r) ≤ 0

Next tactic:
rw [(subsingleton_closedBall x h).measure_zero μ]
/-- Finitely supported product of finsets. -/
def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) :=
  (s.pi t).map
    ⟨fun f => DFinsupp.mk s fun i => f i i.2, by
      

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝¹ : DecidableEq ι
inst✝ : (i : ι) → Zero (α i)
s✝ : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
⊢ Function.Injective fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s)

Next tactic:
refine' (mk_injective _).comp fun f g h => _
/-- Finitely supported product of finsets. -/
def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) :=
  (s.pi t).map
    ⟨fun f => DFinsupp.mk s fun i => f i i.2, by
      refine' (mk_injective _).comp fun f g h => _
      

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝¹ : DecidableEq ι
inst✝ : (i : ι) → Zero (α i)
s✝ : Finset ι
f✝ : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
f g : (a : ι) → a ∈ s → α a
h : (fun i => f ↑i (_ : ↑i ∈ ↑s)) = fun i => g ↑i (_ : ↑i ∈ ↑s)
⊢ f = g

Next tactic:
ext i hi
/-- Finitely supported product of finsets. -/
def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) :=
  (s.pi t).map
    ⟨fun f => DFinsupp.mk s fun i => f i i.2, by
      refine' (mk_injective _).comp fun f g h => _
      ext i hi
      

Proof state:
case h.h
ι : Type u_1
α : ι → Type u_2
inst✝¹ : DecidableEq ι
inst✝ : (i : ι) → Zero (α i)
s✝ : Finset ι
f✝ : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
f g : (a : ι) → a ∈ s → α a
h : (fun i => f ↑i (_ : ↑i ∈ ↑s)) = fun i => g ↑i (_ : ↑i ∈ ↑s)
i : ι
hi : i ∈ s
⊢ f i hi = g i hi

Next tactic:
convert congr_fun h ⟨i, hi⟩
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
⊢ f ∈ dfinsupp s t ↔ support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i

Next tactic:
refine' mem_map.trans ⟨_, _⟩
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · 

Proof state:
case refine'_1
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
⊢ (∃ a ∈ pi s t,
      { toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
            inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
          a =
        f) →
    support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i

Next tactic:
rintro ⟨f, hf, rfl⟩
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    

Proof state:
case refine'_1.intro.intro
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
f : (a : ι) → a ∈ s → (fun i => α i) a
hf : f ∈ pi s t
⊢ support
        ({ toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
            inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
          f) ⊆
      s ∧
    ∀ i ∈ s,
      ({ toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
              inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
            f)
          i ∈
        t i

Next tactic:
rw [Function.Embedding.coeFn_mk]
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    

Proof state:
case refine'_1.intro.intro
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
f : (a : ι) → a ∈ s → (fun i => α i) a
hf : f ∈ pi s t
⊢ support (DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s)) ⊆ s ∧ ∀ i ∈ s, (DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s)) i ∈ t i

Next tactic:
refine' ⟨support_mk_subset, fun i hi => _⟩
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    

Proof state:
case refine'_1.intro.intro
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
f : (a : ι) → a ∈ s → (fun i => α i) a
hf : f ∈ pi s t
i : ι
hi : i ∈ s
⊢ (DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s)) i ∈ t i

Next tactic:
convert mem_pi.1 hf i hi
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    convert mem_pi.1 hf i hi
    

Proof state:
case h.e'_4
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
f : (a : ι) → a ∈ s → (fun i => α i) a
hf : f ∈ pi s t
i : ι
hi : i ∈ s
⊢ (DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s)) i = f i hi

Next tactic:
exact mk_of_mem hi
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    convert mem_pi.1 hf i hi
    exact mk_of_mem hi
  · 

Proof state:
case refine'_2
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
⊢ (support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i) →
    ∃ a ∈ pi s t,
      { toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
            inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
          a =
        f

Next tactic:
refine' fun h => ⟨fun i _ => f i, mem_pi.2 h.2, _⟩
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    convert mem_pi.1 hf i hi
    exact mk_of_mem hi
  · refine' fun h => ⟨fun i _ => f i, mem_pi.2 h.2, _⟩
    

Proof state:
case refine'_2
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
h : support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i
⊢ ({ toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
        inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
      fun i x => f i) =
    f

Next tactic:
ext i
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    convert mem_pi.1 hf i hi
    exact mk_of_mem hi
  · refine' fun h => ⟨fun i _ => f i, mem_pi.2 h.2, _⟩
    ext i
    

Proof state:
case refine'_2.h
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
h : support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i
i : ι
⊢ ({ toFun := fun f => DFinsupp.mk s fun i => f ↑i (_ : ↑i ∈ ↑s),
          inj' := (_ : Function.Injective (DFinsupp.mk s ∘ fun f i => f ↑i (_ : ↑i ∈ ↑s))) }
        fun i x => f i)
      i =
    f i

Next tactic:
dsimp
theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by
  refine' mem_map.trans ⟨_, _⟩
  · rintro ⟨f, hf, rfl⟩
    rw [Function.Embedding.coeFn_mk] -- porting note: added to avoid heartbeat timeout
    refine' ⟨support_mk_subset, fun i hi => _⟩
    convert mem_pi.1 hf i hi
    exact mk_of_mem hi
  · refine' fun h => ⟨fun i _ => f i, mem_pi.2 h.2, _⟩
    ext i
    dsimp
    

Proof state:
case refine'_2.h
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
h : support f ⊆ s ∧ ∀ i ∈ s, f i ∈ t i
i : ι
⊢ (if i ∈ s then f i else 0) = f i

Next tactic:
exact ite_eq_left_iff.2 fun hi => (not_mem_support_iff.1 fun H => hi <| h.1 H).symm
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
⊢ f ∈ dfinsupp s ⇑t ↔ ∀ (i : ι), f i ∈ t i

Next tactic:
refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
  · 

Proof state:
case refine'_1
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
i : ι
h : (i ∈ support f → i ∈ s) ∧ (i ∈ s → f i ∈ t i)
⊢ f i ∈ t i

Next tactic:
by_cases hi : i ∈ s
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
  · by_cases hi : i ∈ s
    · 

Proof state:
case pos
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
i : ι
h : (i ∈ support f → i ∈ s) ∧ (i ∈ s → f i ∈ t i)
hi : i ∈ s
⊢ f i ∈ t i

Next tactic:
exact h.2 hi
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
  · by_cases hi : i ∈ s
    · exact h.2 hi
    · 

Proof state:
case neg
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
i : ι
h : (i ∈ support f → i ∈ s) ∧ (i ∈ s → f i ∈ t i)
hi : i ∉ s
⊢ f i ∈ t i

Next tactic:
rw [not_mem_support_iff.1 (mt h.1 hi), not_mem_support_iff.1 (not_mem_mono ht hi)]
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
  · by_cases hi : i ∈ s
    · exact h.2 hi
    · rw [not_mem_support_iff.1 (mt h.1 hi), not_mem_support_iff.1 (not_mem_mono ht hi)]
      

Proof state:
case neg
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
i : ι
h : (i ∈ support f → i ∈ s) ∧ (i ∈ s → f i ∈ t i)
hi : i ∉ s
⊢ 0 ∈ 0

Next tactic:
exact zero_mem_zero
/-- When `t` is supported on `s`, `f ∈ s.dfinsupp t` precisely means that `f` is pointwise in `t`.
-/
@[simp]
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) :
    f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
  refine' mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i =>
      ⟨ fun h => _,
        fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi _, fun _ => h⟩⟩)
  · by_cases hi : i ∈ s
    · exact h.2 hi
    · rw [not_mem_support_iff.1 (mt h.1 hi), not_mem_support_iff.1 (not_mem_mono ht hi)]
      exact zero_mem_zero
  · 

Proof state:
case refine'_2
ι : Type u_1
α : ι → Type u_2
inst✝² : DecidableEq ι
inst✝¹ : (i : ι) → Zero (α i)
s : Finset ι
f : Π₀ (i : ι), α i
t✝ : (i : ι) → Finset (α i)
inst✝ : (i : ι) → DecidableEq (α i)
t : Π₀ (i : ι), Finset (α i)
ht : support t ⊆ s
i : ι
h : f i ∈ t i
hi : i ∈ support f
H : t i = 0
⊢ f i = 0

Next tactic:
rwa [H, mem_zero] at h
/-- Pointwise `Finset.Icc` bundled as a `DFinsupp`. -/
def rangeIcc (f g : Π₀ i, α i) : Π₀ i, Finset (α i) where
  toFun i := Icc (f i) (g i)
  support' := f.support'.bind fun fs => g.support'.map fun gs =>
    ⟨ fs.1 + gs.1,
      fun i => or_iff_not_imp_left.2 fun h => by
        

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝² : (i : ι) → Zero (α i)
inst✝¹ : (i : ι) → PartialOrder (α i)
inst✝ : (i : ι) → LocallyFiniteOrder (α i)
f✝ g✝ : Π₀ (i : ι), α i
i✝ : ι
a : α i✝
f g : Π₀ (i : ι), α i
fs : { s // ∀ (i : ι), i ∈ s ∨ toFun f i = 0 }
gs : { s // ∀ (i : ι), i ∈ s ∨ toFun g i = 0 }
i : ι
h : i ∉ ↑fs + ↑gs
⊢ (fun i => Icc (f i) (g i)) i = 0

Next tactic:
have hf : f i = 0 := (fs.prop i).resolve_left
            (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_right _ _) h)
/-- Pointwise `Finset.Icc` bundled as a `DFinsupp`. -/
def rangeIcc (f g : Π₀ i, α i) : Π₀ i, Finset (α i) where
  toFun i := Icc (f i) (g i)
  support' := f.support'.bind fun fs => g.support'.map fun gs =>
    ⟨ fs.1 + gs.1,
      fun i => or_iff_not_imp_left.2 fun h => by
        have hf : f i = 0 := (fs.prop i).resolve_left
            (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_right _ _) h)
        

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝² : (i : ι) → Zero (α i)
inst✝¹ : (i : ι) → PartialOrder (α i)
inst✝ : (i : ι) → LocallyFiniteOrder (α i)
f✝ g✝ : Π₀ (i : ι), α i
i✝ : ι
a : α i✝
f g : Π₀ (i : ι), α i
fs : { s // ∀ (i : ι), i ∈ s ∨ toFun f i = 0 }
gs : { s // ∀ (i : ι), i ∈ s ∨ toFun g i = 0 }
i : ι
h : i ∉ ↑fs + ↑gs
hf : f i = 0
⊢ (fun i => Icc (f i) (g i)) i = 0

Next tactic:
have hg : g i = 0 := (gs.prop i).resolve_left
            (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_left _ _) h)
/-- Pointwise `Finset.Icc` bundled as a `DFinsupp`. -/
def rangeIcc (f g : Π₀ i, α i) : Π₀ i, Finset (α i) where
  toFun i := Icc (f i) (g i)
  support' := f.support'.bind fun fs => g.support'.map fun gs =>
    ⟨ fs.1 + gs.1,
      fun i => or_iff_not_imp_left.2 fun h => by
        have hf : f i = 0 := (fs.prop i).resolve_left
            (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_right _ _) h)
        have hg : g i = 0 := (gs.prop i).resolve_left
            (Multiset.not_mem_mono (Multiset.Le.subset <| Multiset.le_add_left _ _) h)
        -- porting note: was rw, but was rewriting under lambda, so changed to simp_rw
        

Proof state:
ι : Type u_1
α : ι → Type u_2
inst✝² : (i : ι) → Zero (α i)
inst✝¹ : (i : ι) → PartialOrder (α i)
inst✝ : (i : ι) → LocallyFiniteOrder (α i)
f✝ g✝ : Π₀ (i : ι), α i
i✝ : ι
a : α i✝
f g : Π₀ (i : ι), α i
fs : { s // ∀ (i : ι), i ∈ s ∨ toFun f i = 0 }
gs : { s // ∀ (i : ι), i ∈ s ∨ toFun g i = 0 }
i : ι
h : i ∉ ↑fs + ↑gs
hf : f i = 0
hg : g i = 0
⊢ (fun i => Icc (f i) (g i)) i = 0

Next tactic:
simp_rw [hf, hg]