l3lab/ntp-mathlib huggingface dataset:
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  

Proof state:
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this : Monoid.npow = Monoid.npow
⊢ m₁ = m₂

Next tactic:
have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    

Proof state:
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this : Monoid.npow = Monoid.npow
⊢ DivInvMonoid.zpow = DivInvMonoid.zpow

Next tactic:
ext m x
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    

Proof state:
case h.h
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this : Monoid.npow = Monoid.npow
m : ℤ
x : M
⊢ DivInvMonoid.zpow m x = DivInvMonoid.zpow m x

Next tactic:
exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  

Proof state:
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝ : Monoid.npow = Monoid.npow
this : DivInvMonoid.zpow = DivInvMonoid.zpow
⊢ m₁ = m₂

Next tactic:
have : m₁.div = m₂.div := by
    ext a b
    exact @map_div' _ _
      (@MonoidHom _ _ (_) _) (id _) _
      (@MonoidHom.monoidHomClass _ _ (_) _) f (congr_fun h_inv) a b
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  have : m₁.div = m₂.div := by
    

Proof state:
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝ : Monoid.npow = Monoid.npow
this : DivInvMonoid.zpow = DivInvMonoid.zpow
⊢ Div.div = Div.div

Next tactic:
ext a b
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  have : m₁.div = m₂.div := by
    ext a b
    

Proof state:
case h.h
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝ : Monoid.npow = Monoid.npow
this : DivInvMonoid.zpow = DivInvMonoid.zpow
a b : M
⊢ Div.div a b = Div.div a b

Next tactic:
exact @map_div' _ _
      (@MonoidHom _ _ (_) _) (id _) _
      (@MonoidHom.monoidHomClass _ _ (_) _) f (congr_fun h_inv) a b
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  have : m₁.div = m₂.div := by
    ext a b
    exact @map_div' _ _
      (@MonoidHom _ _ (_) _) (id _) _
      (@MonoidHom.monoidHomClass _ _ (_) _) f (congr_fun h_inv) a b
  

Proof state:
M : Type u_1
m₁ m₂ : DivInvMonoid M
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝¹ : Monoid.npow = Monoid.npow
this✝ : DivInvMonoid.zpow = DivInvMonoid.zpow
this : Div.div = Div.div
⊢ m₁ = m₂

Next tactic:
rcases m₁ with @⟨_, ⟨_⟩, ⟨_⟩⟩
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  have : m₁.div = m₂.div := by
    ext a b
    exact @map_div' _ _
      (@MonoidHom _ _ (_) _) (id _) _
      (@MonoidHom.monoidHomClass _ _ (_) _) f (congr_fun h_inv) a b
  rcases m₁ with @⟨_, ⟨_⟩, ⟨_⟩⟩
  

Proof state:
case mk.mk.mk
M : Type u_1
m₂ : DivInvMonoid M
toMonoid✝ : Monoid M
zpow✝ : ℤ → M → M
zpow_zero'✝ : ∀ (a : M), zpow✝ 0 a = 1
zpow_succ'✝ : ∀ (n : ℕ) (a : M), zpow✝ (Int.ofNat (Nat.succ n)) a = a * zpow✝ (Int.ofNat n) a
inv✝ : M → M
zpow_neg'✝ : ∀ (n : ℕ) (a : M), zpow✝ (Int.negSucc n) a = (zpow✝ (↑(Nat.succ n)) a)⁻¹
div✝ : M → M → M
div_eq_mul_inv✝ : ∀ (a b : M), a / b = a * b⁻¹
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝¹ : Monoid.npow = Monoid.npow
this✝ : DivInvMonoid.zpow = DivInvMonoid.zpow
this : Div.div = Div.div
⊢ mk zpow✝ = m₂

Next tactic:
rcases m₂ with @⟨_, ⟨_⟩, ⟨_⟩⟩
@[to_additive (attr := ext)]
theorem DivInvMonoid.ext {M : Type*} ⦃m₁ m₂ : DivInvMonoid M⦄
    (h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M))
    (h_inv : (letI := m₁; Inv.inv : M → M) = (letI := m₂; Inv.inv : M → M)) : m₁ = m₂ := by
  have h_mon := Monoid.ext h_mul
  have h₁ : m₁.one = m₂.one := congr_arg (·.one) h_mon
  let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  have : m₁.npow = m₂.npow := congr_arg (·.npow) h_mon
  have : m₁.zpow = m₂.zpow := by
    ext m x
    exact @MonoidHom.map_zpow' M M m₁ m₂ f (congr_fun h_inv) x m
  have : m₁.div = m₂.div := by
    ext a b
    exact @map_div' _ _
      (@MonoidHom _ _ (_) _) (id _) _
      (@MonoidHom.monoidHomClass _ _ (_) _) f (congr_fun h_inv) a b
  rcases m₁ with @⟨_, ⟨_⟩, ⟨_⟩⟩
  rcases m₂ with @⟨_, ⟨_⟩, ⟨_⟩⟩
  

Proof state:
case mk.mk.mk.mk.mk.mk
M : Type u_1
toMonoid✝¹ : Monoid M
zpow✝¹ : ℤ → M → M
zpow_zero'✝¹ : ∀ (a : M), zpow✝¹ 0 a = 1
zpow_succ'✝¹ : ∀ (n : ℕ) (a : M), zpow✝¹ (Int.ofNat (Nat.succ n)) a = a * zpow✝¹ (Int.ofNat n) a
inv✝¹ : M → M
zpow_neg'✝¹ : ∀ (n : ℕ) (a : M), zpow✝¹ (Int.negSucc n) a = (zpow✝¹ (↑(Nat.succ n)) a)⁻¹
div✝¹ : M → M → M
div_eq_mul_inv✝¹ : ∀ (a b : M), a / b = a * b⁻¹
toMonoid✝ : Monoid M
zpow✝ : ℤ → M → M
zpow_zero'✝ : ∀ (a : M), zpow✝ 0 a = 1
zpow_succ'✝ : ∀ (n : ℕ) (a : M), zpow✝ (Int.ofNat (Nat.succ n)) a = a * zpow✝ (Int.ofNat n) a
inv✝ : M → M
zpow_neg'✝ : ∀ (n : ℕ) (a : M), zpow✝ (Int.negSucc n) a = (zpow✝ (↑(Nat.succ n)) a)⁻¹
div✝ : M → M → M
div_eq_mul_inv✝ : ∀ (a b : M), a / b = a * b⁻¹
h_mul : HMul.hMul = HMul.hMul
h_inv : Inv.inv = Inv.inv
h_mon : toMonoid = toMonoid
h₁ : One.one = One.one
f : M →* M := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : M), x * y = x * y) }
this✝¹ : Monoid.npow = Monoid.npow
this✝ : DivInvMonoid.zpow = DivInvMonoid.zpow
this : Div.div = Div.div
⊢ mk zpow✝¹ = mk zpow✝

Next tactic:
congr
@[to_additive (attr := ext)]
theorem Group.ext {G : Type*} ⦃g₁ g₂ : Group G⦄ (h_mul : g₁.mul = g₂.mul) : g₁ = g₂ := by
  

Proof state:
G : Type u_1
g₁ g₂ : Group G
h_mul : Mul.mul = Mul.mul
⊢ g₁ = g₂

Next tactic:
have h₁ : g₁.one = g₂.one := congr_arg (·.one) (Monoid.ext h_mul)
@[to_additive (attr := ext)]
theorem Group.ext {G : Type*} ⦃g₁ g₂ : Group G⦄ (h_mul : g₁.mul = g₂.mul) : g₁ = g₂ := by
  have h₁ : g₁.one = g₂.one := congr_arg (·.one) (Monoid.ext h_mul)
  

Proof state:
G : Type u_1
g₁ g₂ : Group G
h_mul : Mul.mul = Mul.mul
h₁ : One.one = One.one
⊢ g₁ = g₂

Next tactic:
let f : @MonoidHom G G g₁.toMulOneClass g₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
@[to_additive (attr := ext)]
theorem Group.ext {G : Type*} ⦃g₁ g₂ : Group G⦄ (h_mul : g₁.mul = g₂.mul) : g₁ = g₂ := by
  have h₁ : g₁.one = g₂.one := congr_arg (·.one) (Monoid.ext h_mul)
  let f : @MonoidHom G G g₁.toMulOneClass g₂.toMulOneClass :=
    @MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
      (fun x y => congr_fun (congr_fun h_mul x) y)
  

Proof state:
G : Type u_1
g₁ g₂ : Group G
h_mul : Mul.mul = Mul.mul
h₁ : One.one = One.one
f : G →* G := { toOneHom := { toFun := id, map_one' := h₁ }, map_mul' := (_ : ∀ (x y : G), Mul.mul x y = Mul.mul x y) }
⊢ g₁ = g₂

Next tactic:
exact
    Group.toDivInvMonoid_injective
      (DivInvMonoid.ext h_mul
        (funext <| @MonoidHom.map_inv G G g₁ g₂.toDivisionMonoid f))
theorem coeFn_univ_ne_zero (ν : ProbabilityMeasure Ω) : ν univ ≠ 0 := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
ν : ProbabilityMeasure Ω
⊢ (fun s => ENNReal.toNNReal (↑↑↑ν s)) univ ≠ 0

Next tactic:
simp only [coeFn_univ, Ne.def, one_ne_zero, not_false_iff]
@[simp]
theorem ennreal_coeFn_eq_coeFn_toMeasure (ν : ProbabilityMeasure Ω) (s : Set Ω) :
    (ν s : ℝ≥0∞) = (ν : Measure Ω) s := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
ν : ProbabilityMeasure Ω
s : Set Ω
⊢ ↑((fun s => ENNReal.toNNReal (↑↑↑ν s)) s) = ↑↑↑ν s

Next tactic:
rw [← coeFn_comp_toFiniteMeasure_eq_coeFn, FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure,
    toMeasure_comp_toFiniteMeasure_eq_toMeasure]
theorem apply_mono (μ : ProbabilityMeasure Ω) {s₁ s₂ : Set Ω} (h : s₁ ⊆ s₂) : μ s₁ ≤ μ s₂ := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
s₁ s₂ : Set Ω
h : s₁ ⊆ s₂
⊢ (fun s => ENNReal.toNNReal (↑↑↑μ s)) s₁ ≤ (fun s => ENNReal.toNNReal (↑↑↑μ s)) s₂

Next tactic:
rw [← coeFn_comp_toFiniteMeasure_eq_coeFn]
theorem apply_mono (μ : ProbabilityMeasure Ω) {s₁ s₂ : Set Ω} (h : s₁ ⊆ s₂) : μ s₁ ≤ μ s₂ := by
  rw [← coeFn_comp_toFiniteMeasure_eq_coeFn]
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
s₁ s₂ : Set Ω
h : s₁ ⊆ s₂
⊢ (fun s => ENNReal.toNNReal (↑↑↑(toFiniteMeasure μ) s)) s₁ ≤ (fun s => ENNReal.toNNReal (↑↑↑(toFiniteMeasure μ) s)) s₂

Next tactic:
exact MeasureTheory.FiniteMeasure.apply_mono _ h
@[simp] theorem apply_le_one (μ : ProbabilityMeasure Ω) (s : Set Ω) : μ s ≤ 1 := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
s : Set Ω
⊢ (fun s => ENNReal.toNNReal (↑↑↑μ s)) s ≤ 1

Next tactic:
simpa using apply_mono μ (subset_univ s)
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
⊢ Nonempty Ω

Next tactic:
by_contra maybe_empty
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
  by_contra maybe_empty
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
maybe_empty : ¬Nonempty Ω
⊢ False

Next tactic:
have zero : (μ : Measure Ω) univ = 0 := by
    rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty]
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
  by_contra maybe_empty
  have zero : (μ : Measure Ω) univ = 0 := by
    

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
maybe_empty : ¬Nonempty Ω
⊢ ↑↑↑μ univ = 0

Next tactic:
rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty]
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
  by_contra maybe_empty
  have zero : (μ : Measure Ω) univ = 0 := by
    rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty]
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
maybe_empty : ¬Nonempty Ω
zero : ↑↑↑μ univ = 0
⊢ False

Next tactic:
rw [measure_univ] at zero
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
  by_contra maybe_empty
  have zero : (μ : Measure Ω) univ = 0 := by
    rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty]
  rw [measure_univ] at zero
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
maybe_empty : ¬Nonempty Ω
zero : 1 = 0
⊢ False

Next tactic:
exact zero_ne_one zero.symm
@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ ν : ProbabilityMeasure Ω
h : ∀ (s : Set Ω), MeasurableSet s → ↑↑↑μ s = ↑↑↑ν s
⊢ μ = ν

Next tactic:
apply toMeasure_injective
@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by
  apply toMeasure_injective
  

Proof state:
case a
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ ν : ProbabilityMeasure Ω
h : ∀ (s : Set Ω), MeasurableSet s → ↑↑↑μ s = ↑↑↑ν s
⊢ ↑μ = ↑ν

Next tactic:
ext1 s s_mble
@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by
  apply toMeasure_injective
  ext1 s s_mble
  

Proof state:
case a.h
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ ν : ProbabilityMeasure Ω
h : ∀ (s : Set Ω), MeasurableSet s → ↑↑↑μ s = ↑↑↑ν s
s : Set Ω
s_mble : MeasurableSet s
⊢ ↑↑↑μ s = ↑↑↑ν s

Next tactic:
exact h s s_mble
theorem eq_of_forall_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → μ s = ν s) : μ = ν := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ ν : ProbabilityMeasure Ω
h : ∀ (s : Set Ω), MeasurableSet s → (fun s => ENNReal.toNNReal (↑↑↑μ s)) s = (fun s => ENNReal.toNNReal (↑↑↑ν s)) s
⊢ μ = ν

Next tactic:
ext1 s s_mble
theorem eq_of_forall_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → μ s = ν s) : μ = ν := by
  ext1 s s_mble
  

Proof state:
case h
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ ν : ProbabilityMeasure Ω
h : ∀ (s : Set Ω), MeasurableSet s → (fun s => ENNReal.toNNReal (↑↑↑μ s)) s = (fun s => ENNReal.toNNReal (↑↑↑ν s)) s
s : Set Ω
s_mble : MeasurableSet s
⊢ ↑↑↑μ s = ↑↑↑ν s

Next tactic:
simpa [ennreal_coeFn_eq_coeFn_toMeasure] using congr_arg ((↑) : ℝ≥0 → ℝ≥0∞) (h s s_mble)
theorem toFiniteMeasure_nonzero (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure ≠ 0 := by
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
⊢ toFiniteMeasure μ ≠ 0

Next tactic:
rw [← FiniteMeasure.mass_nonzero_iff, μ.mass_toFiniteMeasure]
theorem toFiniteMeasure_nonzero (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure ≠ 0 := by
  rw [← FiniteMeasure.mass_nonzero_iff, μ.mass_toFiniteMeasure]
  

Proof state:
Ω : Type u_1
inst✝ : MeasurableSpace Ω
μ : ProbabilityMeasure Ω
⊢ 1 ≠ 0

Next tactic:
exact one_ne_zero
/-- A characterization of weak convergence of probability measures by the condition that the
integrals of every continuous bounded nonnegative function converge to the integral of the function
against the limit measure. -/
theorem tendsto_iff_forall_lintegral_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ≥0,
        Tendsto (fun i => ∫⁻ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫⁻ ω, f ω ∂(μ : Measure Ω))) := by
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → ProbabilityMeasure Ω
μ : ProbabilityMeasure Ω
⊢ Tendsto μs F (𝓝 μ) ↔ ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (ω : Ω), ↑(f ω) ∂↑(μs i)) F (𝓝 (∫⁻ (ω : Ω), ↑(f ω) ∂↑μ))

Next tactic:
rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
/-- A characterization of weak convergence of probability measures by the condition that the
integrals of every continuous bounded nonnegative function converge to the integral of the function
against the limit measure. -/
theorem tendsto_iff_forall_lintegral_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ≥0,
        Tendsto (fun i => ∫⁻ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫⁻ ω, f ω ∂(μ : Measure Ω))) := by
  rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → ProbabilityMeasure Ω
μ : ProbabilityMeasure Ω
⊢ Tendsto (toFiniteMeasure ∘ μs) F (𝓝 (toFiniteMeasure μ)) ↔
    ∀ (f : Ω →ᵇ ℝ≥0), Tendsto (fun i => ∫⁻ (ω : Ω), ↑(f ω) ∂↑(μs i)) F (𝓝 (∫⁻ (ω : Ω), ↑(f ω) ∂↑μ))

Next tactic:
exact FiniteMeasure.tendsto_iff_forall_lintegral_tendsto
/-- The characterization of weak convergence of probability measures by the usual (defining)
condition that the integrals of every continuous bounded function converge to the integral of the
function against the limit measure. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ,
        Tendsto (fun i => ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → ProbabilityMeasure Ω
μ : ProbabilityMeasure Ω
⊢ Tendsto μs F (𝓝 μ) ↔ ∀ (f : Ω →ᵇ ℝ), Tendsto (fun i => ∫ (ω : Ω), f ω ∂↑(μs i)) F (𝓝 (∫ (ω : Ω), f ω ∂↑μ))

Next tactic:
rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
/-- The characterization of weak convergence of probability measures by the usual (defining)
condition that the integrals of every continuous bounded function converge to the integral of the
function against the limit measure. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ,
        Tendsto (fun i => ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
  rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → ProbabilityMeasure Ω
μ : ProbabilityMeasure Ω
⊢ Tendsto (toFiniteMeasure ∘ μs) F (𝓝 (toFiniteMeasure μ)) ↔
    ∀ (f : Ω →ᵇ ℝ), Tendsto (fun i => ∫ (ω : Ω), f ω ∂↑(μs i)) F (𝓝 (∫ (ω : Ω), f ω ∂↑μ))

Next tactic:
rw [FiniteMeasure.tendsto_iff_forall_integral_tendsto]
/-- The characterization of weak convergence of probability measures by the usual (defining)
condition that the integrals of every continuous bounded function converge to the integral of the
function against the limit measure. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ,
        Tendsto (fun i => ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
  rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
  rw [FiniteMeasure.tendsto_iff_forall_integral_tendsto]
  

Proof state:
Ω : Type u_1
inst✝² : MeasurableSpace Ω
inst✝¹ : TopologicalSpace Ω
inst✝ : OpensMeasurableSpace Ω
γ : Type u_2
F : Filter γ
μs : γ → ProbabilityMeasure Ω
μ : ProbabilityMeasure Ω
⊢ (∀ (f : Ω →ᵇ ℝ),
      Tendsto (fun i => ∫ (x : Ω), f x ∂↑((toFiniteMeasure ∘ μs) i)) F (𝓝 (∫ (x : Ω), f x ∂↑(toFiniteMeasure μ)))) ↔
    ∀ (f : Ω →ᵇ ℝ), Tendsto (fun i => ∫ (ω : Ω), f ω ∂↑(μs i)) F (𝓝 (∫ (ω : Ω), f ω ∂↑μ))

Next tactic:
rfl
/-- Normalize a finite measure so that it becomes a probability measure, i.e., divide by the
total mass. -/
def normalize : ProbabilityMeasure Ω :=
  if zero : μ.mass = 0 then ⟨Measure.dirac ‹Nonempty Ω›.some, Measure.dirac.isProbabilityMeasure⟩
  else
    { val := ↑(μ.mass⁻¹ • μ)
      property := by
        

Proof state:
Ω : Type u_1
inst✝ : Nonempty Ω
m0 : MeasurableSpace Ω
μ : FiniteMeasure Ω
zero : ¬mass μ = 0
⊢ IsProbabilityMeasure ↑((mass μ)⁻¹ • μ)

Next tactic:
refine' ⟨_⟩