l3lab/ntp-mathlib huggingface dataset:
/-- If the quotient by a subgroup gives a singleton then the subgroup is the whole group. -/
@[to_additive "If the quotient by an additive subgroup gives a singleton then the additive subgroup
is the whole additive group."]
theorem subgroup_eq_top_of_subsingleton (H : Subgroup G) (h : Subsingleton (G ⧸ H)) : H = ⊤ :=
  top_unique fun x _ => by
    

Proof state:
G : Type u
inst✝² : Group G
N : Subgroup G
nN : Subgroup.Normal N
H✝ : Type v
inst✝¹ : Group H✝
M : Type x
inst✝ : Monoid M
φ : G →* H✝
H : Subgroup G
h : Subsingleton (G ⧸ H)
x : G
x✝ : x ∈ ⊤
⊢ x ∈ H

Next tactic:
have this : 1⁻¹ * x ∈ H := QuotientGroup.eq.1 (Subsingleton.elim _ _)
/-- If the quotient by a subgroup gives a singleton then the subgroup is the whole group. -/
@[to_additive "If the quotient by an additive subgroup gives a singleton then the additive subgroup
is the whole additive group."]
theorem subgroup_eq_top_of_subsingleton (H : Subgroup G) (h : Subsingleton (G ⧸ H)) : H = ⊤ :=
  top_unique fun x _ => by
    have this : 1⁻¹ * x ∈ H := QuotientGroup.eq.1 (Subsingleton.elim _ _)
    

Proof state:
G : Type u
inst✝² : Group G
N : Subgroup G
nN : Subgroup.Normal N
H✝ : Type v
inst✝¹ : Group H✝
M : Type x
inst✝ : Monoid M
φ : G →* H✝
H : Subgroup G
h : Subsingleton (G ⧸ H)
x : G
x✝ : x ∈ ⊤
this : 1⁻¹ * x ∈ H
⊢ x ∈ H

Next tactic:
rwa [inv_one, one_mul] at this
@[to_additive]
theorem comap_comap_center {H₁ : Subgroup G} [H₁.Normal] {H₂ : Subgroup (G ⧸ H₁)} [H₂.Normal] :
    ((Subgroup.center ((G ⧸ H₁) ⧸ H₂)).comap (mk' H₂)).comap (mk' H₁) =
      (Subgroup.center (G ⧸ H₂.comap (mk' H₁))).comap (mk' (H₂.comap (mk' H₁))) := by
  

Proof state:
G : Type u
inst✝⁴ : Group G
N : Subgroup G
nN : Subgroup.Normal N
H : Type v
inst✝³ : Group H
M : Type x
inst✝² : Monoid M
φ : G →* H
H₁ : Subgroup G
inst✝¹ : Subgroup.Normal H₁
H₂ : Subgroup (G ⧸ H₁)
inst✝ : Subgroup.Normal H₂
⊢ Subgroup.comap (mk' H₁) (Subgroup.comap (mk' H₂) (Subgroup.center ((G ⧸ H₁) ⧸ H₂))) =
    Subgroup.comap (mk' (Subgroup.comap (mk' H₁) H₂)) (Subgroup.center (G ⧸ Subgroup.comap (mk' H₁) H₂))

Next tactic:
ext x
@[to_additive]
theorem comap_comap_center {H₁ : Subgroup G} [H₁.Normal] {H₂ : Subgroup (G ⧸ H₁)} [H₂.Normal] :
    ((Subgroup.center ((G ⧸ H₁) ⧸ H₂)).comap (mk' H₂)).comap (mk' H₁) =
      (Subgroup.center (G ⧸ H₂.comap (mk' H₁))).comap (mk' (H₂.comap (mk' H₁))) := by
  ext x
  

Proof state:
case h
G : Type u
inst✝⁴ : Group G
N : Subgroup G
nN : Subgroup.Normal N
H : Type v
inst✝³ : Group H
M : Type x
inst✝² : Monoid M
φ : G →* H
H₁ : Subgroup G
inst✝¹ : Subgroup.Normal H₁
H₂ : Subgroup (G ⧸ H₁)
inst✝ : Subgroup.Normal H₂
x : G
⊢ x ∈ Subgroup.comap (mk' H₁) (Subgroup.comap (mk' H₂) (Subgroup.center ((G ⧸ H₁) ⧸ H₂))) ↔
    x ∈ Subgroup.comap (mk' (Subgroup.comap (mk' H₁) H₂)) (Subgroup.center (G ⧸ Subgroup.comap (mk' H₁) H₂))

Next tactic:
simp only [mk'_apply, Subgroup.mem_comap, Subgroup.mem_center_iff, forall_mk, ← mk_mul,
    eq_iff_div_mem, mk_div]
theorem int_not_isCoprime_helper (x y : ℤ) (d : ℕ) (hd : Int.gcd x y = d)
    (h : Nat.beq d 1 = false) : ¬ IsCoprime x y := by
  

Proof state:
x y : ℤ
d : ℕ
hd : Int.gcd x y = d
h : Nat.beq d 1 = false
⊢ ¬IsCoprime x y

Next tactic:
rw [Int.isCoprime_iff_gcd_eq_one, hd]
theorem int_not_isCoprime_helper (x y : ℤ) (d : ℕ) (hd : Int.gcd x y = d)
    (h : Nat.beq d 1 = false) : ¬ IsCoprime x y := by
  rw [Int.isCoprime_iff_gcd_eq_one, hd]
  

Proof state:
x y : ℤ
d : ℕ
hd : Int.gcd x y = d
h : Nat.beq d 1 = false
⊢ ¬d = 1

Next tactic:
exact Nat.ne_of_beq_eq_false h
/-- The dirac measure. -/
def dirac (a : α) : Measure α := (OuterMeasure.dirac a).toMeasure (by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
⊢ inst✝¹ ≤ OuterMeasure.caratheodory (OuterMeasure.dirac a)

Next tactic:
simp
@[simp]
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
h : a ∈ s
⊢ ↑↑(dirac a) s = 1

Next tactic:
have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
@[simp]
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
  have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
h : a ∈ s
this : ∀ (t : Set α), a ∈ t → indicator t 1 a = 1
⊢ ↑↑(dirac a) s = 1

Next tactic:
refine' le_antisymm (this univ trivial ▸ _) (this s h ▸ le_dirac_apply)
@[simp]
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
  have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
  refine' le_antisymm (this univ trivial ▸ _) (this s h ▸ le_dirac_apply)
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
h : a ∈ s
this : ∀ (t : Set α), a ∈ t → indicator t 1 a = 1
⊢ ↑↑(dirac a) s ≤ indicator univ 1 a

Next tactic:
rw [← dirac_apply' a MeasurableSet.univ]
@[simp]
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
  have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
  refine' le_antisymm (this univ trivial ▸ _) (this s h ▸ le_dirac_apply)
  rw [← dirac_apply' a MeasurableSet.univ]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
h : a ∈ s
this : ∀ (t : Set α), a ∈ t → indicator t 1 a = 1
⊢ ↑↑(dirac a) s ≤ ↑↑(dirac a) univ

Next tactic:
exact measure_mono (subset_univ s)
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
    dirac a s = s.indicator 1 a := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
⊢ ↑↑(dirac a) s = indicator s 1 a

Next tactic:
by_cases h : a ∈ s
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
    dirac a s = s.indicator 1 a := by
  by_cases h : a ∈ s; · 

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
h : a ∈ s
⊢ ↑↑(dirac a) s = indicator s 1 a

Next tactic:
rw [dirac_apply_of_mem h, indicator_of_mem h, Pi.one_apply]
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
    dirac a s = s.indicator 1 a := by
  by_cases h : a ∈ s; · rw [dirac_apply_of_mem h, indicator_of_mem h, Pi.one_apply]
  

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
h : a ∉ s
⊢ ↑↑(dirac a) s = indicator s 1 a

Next tactic:
rw [indicator_of_not_mem h, ← nonpos_iff_eq_zero]
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
    dirac a s = s.indicator 1 a := by
  by_cases h : a ∈ s; · rw [dirac_apply_of_mem h, indicator_of_mem h, Pi.one_apply]
  rw [indicator_of_not_mem h, ← nonpos_iff_eq_zero]
  

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
h : a ∉ s
⊢ ↑↑(dirac a) s ≤ 0

Next tactic:
calc
    dirac a s ≤ dirac a {a}ᶜ := measure_mono (subset_compl_comm.1 <| singleton_subset_iff.2 h)
    _ = 0 := by simp [dirac_apply' _ (measurableSet_singleton _).compl]
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
    dirac a s = s.indicator 1 a := by
  by_cases h : a ∈ s; · rw [dirac_apply_of_mem h, indicator_of_mem h, Pi.one_apply]
  rw [indicator_of_not_mem h, ← nonpos_iff_eq_zero]
  calc
    dirac a s ≤ dirac a {a}ᶜ := measure_mono (subset_compl_comm.1 <| singleton_subset_iff.2 h)
    _ = 0 := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
h : a ∉ s
⊢ ↑↑(dirac a) {a}ᶜ = 0

Next tactic:
simp [dirac_apply' _ (measurableSet_singleton _).compl]
theorem map_dirac {f : α → β} (hf : Measurable f) (a : α) : (dirac a).map f = dirac (f a) :=
  ext fun s hs => by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
f : α → β
hf : Measurable f
a : α
s : Set β
hs : MeasurableSet s
⊢ ↑↑(map f (dirac a)) s = ↑↑(dirac (f a)) s

Next tactic:
simp [hs, map_apply hf hs, hf hs, indicator_apply]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a : α
μ : Measure α
c : β
⊢ map (fun x => c) μ = ↑↑μ univ • dirac c

Next tactic:
ext s hs
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
⊢ ↑↑(map (fun x => c) μ) s = ↑↑(↑↑μ univ • dirac c) s

Next tactic:
simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
⊢ ↑↑(map (fun x => c) μ) s = ↑↑μ univ * indicator s 1 c

Next tactic:
classical
  rw [Measure.map_apply measurable_const hs, Set.preimage_const]
  by_cases hsc : c ∈ s
  · rw [(Set.indicator_eq_one_iff_mem _).mpr hsc, mul_one, if_pos hsc]
  · rw [if_neg hsc, (Set.indicator_eq_zero_iff_not_mem _).mpr hsc, measure_empty, mul_zero]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
  classical
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
⊢ ↑↑(map (fun x => c) μ) s = ↑↑μ univ * indicator s 1 c

Next tactic:
rw [Measure.map_apply measurable_const hs, Set.preimage_const]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
  classical
  rw [Measure.map_apply measurable_const hs, Set.preimage_const]
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
⊢ ↑↑μ (if c ∈ s then univ else ∅) = ↑↑μ univ * indicator s 1 c

Next tactic:
by_cases hsc : c ∈ s
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
  classical
  rw [Measure.map_apply measurable_const hs, Set.preimage_const]
  by_cases hsc : c ∈ s
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
hsc : c ∈ s
⊢ ↑↑μ (if c ∈ s then univ else ∅) = ↑↑μ univ * indicator s 1 c

Next tactic:
rw [(Set.indicator_eq_one_iff_mem _).mpr hsc, mul_one, if_pos hsc]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
  ext s hs
  simp only [aemeasurable_const, measurable_const, smul_toOuterMeasure, OuterMeasure.coe_smul,
    Pi.smul_apply, dirac_apply' _ hs, smul_eq_mul]
  classical
  rw [Measure.map_apply measurable_const hs, Set.preimage_const]
  by_cases hsc : c ∈ s
  · rw [(Set.indicator_eq_one_iff_mem _).mpr hsc, mul_one, if_pos hsc]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a : α
μ : Measure α
c : β
s : Set β
hs : MeasurableSet s
hsc : c ∉ s
⊢ ↑↑μ (if c ∈ s then univ else ∅) = ↑↑μ univ * indicator s 1 c

Next tactic:
rw [if_neg hsc, (Set.indicator_eq_zero_iff_not_mem _).mpr hsc, measure_empty, mul_zero]
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ : α
μ : Measure α
a : α
⊢ restrict μ {a} = ↑↑μ {a} • dirac a

Next tactic:
ext1 s hs
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
⊢ ↑↑(restrict μ {a}) s = ↑↑(↑↑μ {a} • dirac a) s

Next tactic:
by_cases ha : a ∈ s
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  by_cases ha : a ∈ s
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
ha : a ∈ s
⊢ ↑↑(restrict μ {a}) s = ↑↑(↑↑μ {a} • dirac a) s

Next tactic:
have : s ∩ {a} = {a} := by simpa
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  by_cases ha : a ∈ s
  · have : s ∩ {a} = {a} := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
ha : a ∈ s
⊢ s ∩ {a} = {a}

Next tactic:
simpa
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  by_cases ha : a ∈ s
  · have : s ∩ {a} = {a} := by simpa
    

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
ha : a ∈ s
this : s ∩ {a} = {a}
⊢ ↑↑(restrict μ {a}) s = ↑↑(↑↑μ {a} • dirac a) s

Next tactic:
simp [*]
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  by_cases ha : a ∈ s
  · have : s ∩ {a} = {a} := by simpa
    simp [*]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
ha : a ∉ s
⊢ ↑↑(restrict μ {a}) s = ↑↑(↑↑μ {a} • dirac a) s

Next tactic:
have : s ∩ {a} = ∅ := inter_singleton_eq_empty.2 ha
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
  ext1 s hs
  by_cases ha : a ∈ s
  · have : s ∩ {a} = {a} := by simpa
    simp [*]
  · have : s ∩ {a} = ∅ := inter_singleton_eq_empty.2 ha
    

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s✝ : Set α
a✝ : α
μ : Measure α
a : α
s : Set α
hs : MeasurableSet s
ha : a ∉ s
this : s ∩ {a} = ∅
⊢ ↑↑(restrict μ {a}) s = ↑↑(↑↑μ {a} • dirac a) s

Next tactic:
simp [*]
/-- If `f` is a map with countable codomain, then `μ.map f` is a sum of Dirac measures. -/
theorem map_eq_sum [Countable β] [MeasurableSingletonClass β] (μ : Measure α) (f : α → β)
    (hf : Measurable f) : μ.map f = sum fun b : β => μ (f ⁻¹' {b}) • dirac b := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s : Set α
a : α
inst✝¹ : Countable β
inst✝ : MeasurableSingletonClass β
μ : Measure α
f : α → β
hf : Measurable f
⊢ map f μ = sum fun b => ↑↑μ (f ⁻¹' {b}) • dirac b

Next tactic:
ext s
/-- If `f` is a map with countable codomain, then `μ.map f` is a sum of Dirac measures. -/
theorem map_eq_sum [Countable β] [MeasurableSingletonClass β] (μ : Measure α) (f : α → β)
    (hf : Measurable f) : μ.map f = sum fun b : β => μ (f ⁻¹' {b}) • dirac b := by
  ext s
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s✝ : Set α
a : α
inst✝¹ : Countable β
inst✝ : MeasurableSingletonClass β
μ : Measure α
f : α → β
hf : Measurable f
s : Set β
a✝ : MeasurableSet s
⊢ ↑↑(map f μ) s = ↑↑(sum fun b => ↑↑μ (f ⁻¹' {b}) • dirac b) s

Next tactic:
have : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y}) := fun y _ => hf (measurableSet_singleton _)
/-- If `f` is a map with countable codomain, then `μ.map f` is a sum of Dirac measures. -/
theorem map_eq_sum [Countable β] [MeasurableSingletonClass β] (μ : Measure α) (f : α → β)
    (hf : Measurable f) : μ.map f = sum fun b : β => μ (f ⁻¹' {b}) • dirac b := by
  ext s
  have : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y}) := fun y _ => hf (measurableSet_singleton _)
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s✝ : Set α
a : α
inst✝¹ : Countable β
inst✝ : MeasurableSingletonClass β
μ : Measure α
f : α → β
hf : Measurable f
s : Set β
a✝ : MeasurableSet s
this : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y})
⊢ ↑↑(map f μ) s = ↑↑(sum fun b => ↑↑μ (f ⁻¹' {b}) • dirac b) s

Next tactic:
simp [← tsum_measure_preimage_singleton (to_countable s) this, *,
    tsum_subtype s fun b => μ (f ⁻¹' {b}), ← indicator_mul_right s fun b => μ (f ⁻¹' {b})]
/-- A measure on a countable type is a sum of Dirac measures. -/
@[simp]
theorem sum_smul_dirac [Countable α] [MeasurableSingletonClass α] (μ : Measure α) :
    (sum fun a => μ {a} • dirac a) = μ := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s : Set α
a : α
inst✝¹ : Countable α
inst✝ : MeasurableSingletonClass α
μ : Measure α
⊢ (sum fun a => ↑↑μ {a} • dirac a) = μ

Next tactic:
simpa using (map_eq_sum μ id measurable_id).symm
/-- Given that `α` is a countable, measurable space with all singleton sets measurable,
write the measure of a set `s` as the sum of the measure of `{x}` for all `x ∈ s`. -/
theorem tsum_indicator_apply_singleton [Countable α] [MeasurableSingletonClass α] (μ : Measure α)
    (s : Set α) (hs : MeasurableSet s) : (∑' x : α, s.indicator (fun x => μ {x}) x) = μ s :=
  calc
    (∑' x : α, s.indicator (fun x => μ {x}) x) =
      Measure.sum (fun a => μ {a} • Measure.dirac a) s := by
      

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s✝ : Set α
a : α
inst✝¹ : Countable α
inst✝ : MeasurableSingletonClass α
μ : Measure α
s : Set α
hs : MeasurableSet s
⊢ ∑' (x : α), indicator s (fun x => ↑↑μ {x}) x = ↑↑(sum fun a => ↑↑μ {a} • dirac a) s

Next tactic:
simp only [Measure.sum_apply _ hs, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply,
        Set.indicator_apply, mul_ite, Pi.one_apply, mul_one, mul_zero]
/-- Given that `α` is a countable, measurable space with all singleton sets measurable,
write the measure of a set `s` as the sum of the measure of `{x}` for all `x ∈ s`. -/
theorem tsum_indicator_apply_singleton [Countable α] [MeasurableSingletonClass α] (μ : Measure α)
    (s : Set α) (hs : MeasurableSet s) : (∑' x : α, s.indicator (fun x => μ {x}) x) = μ s :=
  calc
    (∑' x : α, s.indicator (fun x => μ {x}) x) =
      Measure.sum (fun a => μ {a} • Measure.dirac a) s := by
      simp only [Measure.sum_apply _ hs, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply,
        Set.indicator_apply, mul_ite, Pi.one_apply, mul_one, mul_zero]
    _ = μ s := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
s✝ : Set α
a : α
inst✝¹ : Countable α
inst✝ : MeasurableSingletonClass α
μ : Measure α
s : Set α
hs : MeasurableSet s
⊢ ↑↑(sum fun a => ↑↑μ {a} • dirac a) s = ↑↑μ s

Next tactic:
rw [μ.sum_smul_dirac]
theorem mem_ae_dirac_iff {a : α} (hs : MeasurableSet s) : s ∈ (dirac a).ae ↔ a ∈ s := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
hs : MeasurableSet s
⊢ s ∈ ae (dirac a) ↔ a ∈ s

Next tactic:
by_cases a ∈ s
theorem mem_ae_dirac_iff {a : α} (hs : MeasurableSet s) : s ∈ (dirac a).ae ↔ a ∈ s := by
  by_cases a ∈ s <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
hs : MeasurableSet s
h✝ : a ∈ s
⊢ s ∈ ae (dirac a) ↔ a ∈ s

Next tactic:
simp [mem_ae_iff, dirac_apply', hs.compl, indicator_apply, *]
theorem mem_ae_dirac_iff {a : α} (hs : MeasurableSet s) : s ∈ (dirac a).ae ↔ a ∈ s := by
  by_cases a ∈ s <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : MeasurableSpace α
inst✝ : MeasurableSpace β
s : Set α
a✝ a : α
hs : MeasurableSet s
h✝ : a ∉ s
⊢ s ∈ ae (dirac a) ↔ a ∈ s

Next tactic:
simp [mem_ae_iff, dirac_apply', hs.compl, indicator_apply, *]
@[simp]
theorem ae_dirac_eq [MeasurableSingletonClass α] (a : α) : (dirac a).ae = pure a := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
⊢ ae (dirac a) = pure a

Next tactic:
ext s
@[simp]
theorem ae_dirac_eq [MeasurableSingletonClass α] (a : α) : (dirac a).ae = pure a := by
  ext s
  

Proof state:
case a
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s✝ : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
s : Set α
⊢ s ∈ ae (dirac a) ↔ s ∈ pure a

Next tactic:
simp [mem_ae_iff, imp_false]
theorem ae_eq_dirac [MeasurableSingletonClass α] {a : α} (f : α → δ) :
    f =ᵐ[dirac a] const α (f a) := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a✝ : α
inst✝ : MeasurableSingletonClass α
a : α
f : α → δ
⊢ f =ᶠ[ae (dirac a)] const α (f a)

Next tactic:
simp [Filter.EventuallyEq]
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
    (Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a : α
hs : MeasurableSet s
inst✝ : Decidable (a ∈ s)
⊢ Measure.restrict (dirac a) s = if a ∈ s then dirac a else 0

Next tactic:
split_ifs with has
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
    (Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
  split_ifs with has
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a : α
hs : MeasurableSet s
inst✝ : Decidable (a ∈ s)
has : a ∈ s
⊢ Measure.restrict (dirac a) s = dirac a

Next tactic:
apply restrict_eq_self_of_ae_mem
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
    (Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
  split_ifs with has
  · apply restrict_eq_self_of_ae_mem
    

Proof state:
case pos.hs
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a : α
hs : MeasurableSet s
inst✝ : Decidable (a ∈ s)
has : a ∈ s
⊢ ∀ᵐ (x : α) ∂dirac a, x ∈ s

Next tactic:
rw [ae_dirac_iff]
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
    (Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
  split_ifs with has
  · apply restrict_eq_self_of_ae_mem
    rw [ae_dirac_iff] <;> 

Proof state:
case pos.hs
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
s : Set α
a : α
hs : MeasurableSet s
inst✝ : Decidable (a ∈ s)
has : a ∈ s
⊢ a ∈ s

Next tactic:
assumption