l3lab/ntp-mathlib huggingface dataset:
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0} (h : ∀ a < 1, a * x ≤ y) : x ≤ y :=
  le_of_forall_ge_of_dense fun a ha => by
    have hx : x ≠ 0 := pos_iff_ne_zero.1 (lt_of_le_of_lt (zero_le _) ha)
    have hx' : x⁻¹ ≠ 0 := by rwa [Ne.def, inv_eq_zero]
    

Proof state:
x y : ℝ≥0
h : ∀ a < 1, a * x ≤ y
a : ℝ≥0
ha : a < x
hx : x ≠ 0
hx' : x⁻¹ ≠ 0
⊢ a ≤ y

Next tactic:
have : a * x⁻¹ < 1 := by rwa [← lt_inv_iff_mul_lt hx', inv_inv]
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0} (h : ∀ a < 1, a * x ≤ y) : x ≤ y :=
  le_of_forall_ge_of_dense fun a ha => by
    have hx : x ≠ 0 := pos_iff_ne_zero.1 (lt_of_le_of_lt (zero_le _) ha)
    have hx' : x⁻¹ ≠ 0 := by rwa [Ne.def, inv_eq_zero]
    have : a * x⁻¹ < 1 := by 

Proof state:
x y : ℝ≥0
h : ∀ a < 1, a * x ≤ y
a : ℝ≥0
ha : a < x
hx : x ≠ 0
hx' : x⁻¹ ≠ 0
⊢ a * x⁻¹ < 1

Next tactic:
rwa [← lt_inv_iff_mul_lt hx', inv_inv]
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0} (h : ∀ a < 1, a * x ≤ y) : x ≤ y :=
  le_of_forall_ge_of_dense fun a ha => by
    have hx : x ≠ 0 := pos_iff_ne_zero.1 (lt_of_le_of_lt (zero_le _) ha)
    have hx' : x⁻¹ ≠ 0 := by rwa [Ne.def, inv_eq_zero]
    have : a * x⁻¹ < 1 := by rwa [← lt_inv_iff_mul_lt hx', inv_inv]
    

Proof state:
x y : ℝ≥0
h : ∀ a < 1, a * x ≤ y
a : ℝ≥0
ha : a < x
hx : x ≠ 0
hx' : x⁻¹ ≠ 0
this : a * x⁻¹ < 1
⊢ a ≤ y

Next tactic:
have : a * x⁻¹ * x ≤ y := h _ this
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0} (h : ∀ a < 1, a * x ≤ y) : x ≤ y :=
  le_of_forall_ge_of_dense fun a ha => by
    have hx : x ≠ 0 := pos_iff_ne_zero.1 (lt_of_le_of_lt (zero_le _) ha)
    have hx' : x⁻¹ ≠ 0 := by rwa [Ne.def, inv_eq_zero]
    have : a * x⁻¹ < 1 := by rwa [← lt_inv_iff_mul_lt hx', inv_inv]
    have : a * x⁻¹ * x ≤ y := h _ this
    

Proof state:
x y : ℝ≥0
h : ∀ a < 1, a * x ≤ y
a : ℝ≥0
ha : a < x
hx : x ≠ 0
hx' : x⁻¹ ≠ 0
this✝ : a * x⁻¹ < 1
this : a * x⁻¹ * x ≤ y
⊢ a ≤ y

Next tactic:
rwa [mul_assoc, inv_mul_cancel hx, mul_one] at this
theorem div_lt_one_of_lt {a b : ℝ≥0} (h : a < b) : a / b < 1 := by
  

Proof state:
a b : ℝ≥0
h : a < b
⊢ a / b < 1

Next tactic:
rwa [div_lt_iff, one_mul]
theorem div_lt_one_of_lt {a b : ℝ≥0} (h : a < b) : a / b < 1 := by
  rwa [div_lt_iff, one_mul]
  

Proof state:
a b : ℝ≥0
h : a < b
⊢ b ≠ 0

Next tactic:
exact ne_of_gt (lt_of_le_of_lt (zero_le _) h)
theorem _root_.Real.toNNReal_inv {x : ℝ} : Real.toNNReal x⁻¹ = (Real.toNNReal x)⁻¹ := by
  

Proof state:
x : ℝ
⊢ toNNReal x⁻¹ = (toNNReal x)⁻¹

Next tactic:
rcases le_total 0 x with hx | hx
theorem _root_.Real.toNNReal_inv {x : ℝ} : Real.toNNReal x⁻¹ = (Real.toNNReal x)⁻¹ := by
  rcases le_total 0 x with hx | hx
  · 

Proof state:
case inl
x : ℝ
hx : 0 ≤ x
⊢ toNNReal x⁻¹ = (toNNReal x)⁻¹

Next tactic:
nth_rw 1 [← Real.coe_toNNReal x hx]
theorem _root_.Real.toNNReal_inv {x : ℝ} : Real.toNNReal x⁻¹ = (Real.toNNReal x)⁻¹ := by
  rcases le_total 0 x with hx | hx
  · nth_rw 1 [← Real.coe_toNNReal x hx]
    

Proof state:
case inl
x : ℝ
hx : 0 ≤ x
⊢ toNNReal (↑(toNNReal x))⁻¹ = (toNNReal x)⁻¹

Next tactic:
rw [← NNReal.coe_inv, Real.toNNReal_coe]
theorem _root_.Real.toNNReal_inv {x : ℝ} : Real.toNNReal x⁻¹ = (Real.toNNReal x)⁻¹ := by
  rcases le_total 0 x with hx | hx
  · nth_rw 1 [← Real.coe_toNNReal x hx]
    rw [← NNReal.coe_inv, Real.toNNReal_coe]
  · 

Proof state:
case inr
x : ℝ
hx : x ≤ 0
⊢ toNNReal x⁻¹ = (toNNReal x)⁻¹

Next tactic:
rw [toNNReal_eq_zero.mpr hx, inv_zero, toNNReal_eq_zero.mpr (inv_nonpos.mpr hx)]
theorem _root_.Real.toNNReal_div {x y : ℝ} (hx : 0 ≤ x) :
    Real.toNNReal (x / y) = Real.toNNReal x / Real.toNNReal y := by
  

Proof state:
x y : ℝ
hx : 0 ≤ x
⊢ toNNReal (x / y) = toNNReal x / toNNReal y

Next tactic:
rw [div_eq_mul_inv, div_eq_mul_inv, ← Real.toNNReal_inv, ← Real.toNNReal_mul hx]
theorem _root_.Real.toNNReal_div' {x y : ℝ} (hy : 0 ≤ y) :
    Real.toNNReal (x / y) = Real.toNNReal x / Real.toNNReal y := by
  

Proof state:
x y : ℝ
hy : 0 ≤ y
⊢ toNNReal (x / y) = toNNReal x / toNNReal y

Next tactic:
rw [div_eq_inv_mul, div_eq_inv_mul, Real.toNNReal_mul (inv_nonneg.2 hy), Real.toNNReal_inv]
theorem inv_lt_one_iff {x : ℝ≥0} (hx : x ≠ 0) : x⁻¹ < 1 ↔ 1 < x := by
  

Proof state:
x : ℝ≥0
hx : x ≠ 0
⊢ x⁻¹ < 1 ↔ 1 < x

Next tactic:
rw [← one_div, div_lt_iff hx, one_mul]
nonrec theorem sSup_of_not_bddAbove {s : Set ℝ≥0} (hs : ¬BddAbove s) : SupSet.sSup s = 0 := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
s : Set ℝ≥0
hs : ¬BddAbove s
⊢ sSup s = 0

Next tactic:
rw [← bddAbove_coe] at hs
nonrec theorem sSup_of_not_bddAbove {s : Set ℝ≥0} (hs : ¬BddAbove s) : SupSet.sSup s = 0 := by
  rw [← bddAbove_coe] at hs
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
s : Set ℝ≥0
hs : ¬BddAbove (toReal '' s)
⊢ sSup s = 0

Next tactic:
rw [← NNReal.coe_eq, coe_sSup, NNReal.coe_zero]
nonrec theorem sSup_of_not_bddAbove {s : Set ℝ≥0} (hs : ¬BddAbove s) : SupSet.sSup s = 0 := by
  rw [← bddAbove_coe] at hs
  rw [← NNReal.coe_eq, coe_sSup, NNReal.coe_zero]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
s : Set ℝ≥0
hs : ¬BddAbove (toReal '' s)
⊢ sSup (toReal '' s) = 0

Next tactic:
exact sSup_of_not_bddAbove hs
theorem iInf_empty [IsEmpty ι] (f : ι → ℝ≥0) : ⨅ i, f i = 0 := by
  

Proof state:
ι : Sort u_1
f✝ : ι → ℝ≥0
inst✝ : IsEmpty ι
f : ι → ℝ≥0
⊢ ⨅ i, f i = 0

Next tactic:
rw [iInf_of_empty', sInf_empty]
@[simp]
theorem iInf_const_zero {α : Sort*} : ⨅ _ : α, (0 : ℝ≥0) = 0 := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
α : Sort u_2
⊢ ⨅ x, 0 = 0

Next tactic:
rw [← NNReal.coe_eq, coe_iInf]
@[simp]
theorem iInf_const_zero {α : Sort*} : ⨅ _ : α, (0 : ℝ≥0) = 0 := by
  rw [← NNReal.coe_eq, coe_iInf]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
α : Sort u_2
⊢ ⨅ i, ↑0 = ↑0

Next tactic:
exact Real.ciInf_const_zero
theorem iInf_mul (f : ι → ℝ≥0) (a : ℝ≥0) : iInf f * a = ⨅ i, f i * a := by
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ iInf f * a = ⨅ i, f i * a

Next tactic:
rw [← NNReal.coe_eq, NNReal.coe_mul, coe_iInf, coe_iInf]
theorem iInf_mul (f : ι → ℝ≥0) (a : ℝ≥0) : iInf f * a = ⨅ i, f i * a := by
  rw [← NNReal.coe_eq, NNReal.coe_mul, coe_iInf, coe_iInf]
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ (⨅ i, ↑(f i)) * ↑a = ⨅ i, ↑(f i * a)

Next tactic:
exact Real.iInf_mul_of_nonneg (NNReal.coe_nonneg _) _
theorem mul_iInf (f : ι → ℝ≥0) (a : ℝ≥0) : a * iInf f = ⨅ i, a * f i := by
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ a * iInf f = ⨅ i, a * f i

Next tactic:
simpa only [mul_comm] using iInf_mul f a
theorem mul_iSup (f : ι → ℝ≥0) (a : ℝ≥0) : (a * ⨆ i, f i) = ⨆ i, a * f i := by
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ a * ⨆ i, f i = ⨆ i, a * f i

Next tactic:
rw [← NNReal.coe_eq, NNReal.coe_mul, NNReal.coe_iSup, NNReal.coe_iSup]
theorem mul_iSup (f : ι → ℝ≥0) (a : ℝ≥0) : (a * ⨆ i, f i) = ⨆ i, a * f i := by
  rw [← NNReal.coe_eq, NNReal.coe_mul, NNReal.coe_iSup, NNReal.coe_iSup]
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ ↑a * ⨆ i, ↑(f i) = ⨆ i, ↑(a * f i)

Next tactic:
exact Real.mul_iSup_of_nonneg (NNReal.coe_nonneg _) _
theorem iSup_mul (f : ι → ℝ≥0) (a : ℝ≥0) : (⨆ i, f i) * a = ⨆ i, f i * a := by
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ (⨆ i, f i) * a = ⨆ i, f i * a

Next tactic:
rw [mul_comm, mul_iSup]
theorem iSup_mul (f : ι → ℝ≥0) (a : ℝ≥0) : (⨆ i, f i) * a = ⨆ i, f i * a := by
  rw [mul_comm, mul_iSup]
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ ⨆ i, a * f i = ⨆ i, f i * a

Next tactic:
simp_rw [mul_comm]
theorem iSup_div (f : ι → ℝ≥0) (a : ℝ≥0) : (⨆ i, f i) / a = ⨆ i, f i / a := by
  

Proof state:
ι : Sort u_1
f✝ f : ι → ℝ≥0
a : ℝ≥0
⊢ (⨆ i, f i) / a = ⨆ i, f i / a

Next tactic:
simp only [div_eq_mul_inv, iSup_mul]
theorem mul_iSup_le {a : ℝ≥0} {g : ℝ≥0} {h : ι → ℝ≥0} (H : ∀ j, g * h j ≤ a) : g * iSup h ≤ a := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
a g : ℝ≥0
h : ι → ℝ≥0
H : ∀ (j : ι), g * h j ≤ a
⊢ g * iSup h ≤ a

Next tactic:
rw [mul_iSup]
theorem mul_iSup_le {a : ℝ≥0} {g : ℝ≥0} {h : ι → ℝ≥0} (H : ∀ j, g * h j ≤ a) : g * iSup h ≤ a := by
  rw [mul_iSup]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
a g : ℝ≥0
h : ι → ℝ≥0
H : ∀ (j : ι), g * h j ≤ a
⊢ ⨆ i, g * h i ≤ a

Next tactic:
exact ciSup_le' H
theorem iSup_mul_le {a : ℝ≥0} {g : ι → ℝ≥0} {h : ℝ≥0} (H : ∀ i, g i * h ≤ a) : iSup g * h ≤ a := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
a : ℝ≥0
g : ι → ℝ≥0
h : ℝ≥0
H : ∀ (i : ι), g i * h ≤ a
⊢ iSup g * h ≤ a

Next tactic:
rw [iSup_mul]
theorem iSup_mul_le {a : ℝ≥0} {g : ι → ℝ≥0} {h : ℝ≥0} (H : ∀ i, g i * h ≤ a) : iSup g * h ≤ a := by
  rw [iSup_mul]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
a : ℝ≥0
g : ι → ℝ≥0
h : ℝ≥0
H : ∀ (i : ι), g i * h ≤ a
⊢ ⨆ i, g i * h ≤ a

Next tactic:
exact ciSup_le' H
theorem le_mul_iInf {a : ℝ≥0} {g : ℝ≥0} {h : ι → ℝ≥0} (H : ∀ j, a ≤ g * h j) : a ≤ g * iInf h := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
inst✝ : Nonempty ι
a g : ℝ≥0
h : ι → ℝ≥0
H : ∀ (j : ι), a ≤ g * h j
⊢ a ≤ g * iInf h

Next tactic:
rw [mul_iInf]
theorem le_mul_iInf {a : ℝ≥0} {g : ℝ≥0} {h : ι → ℝ≥0} (H : ∀ j, a ≤ g * h j) : a ≤ g * iInf h := by
  rw [mul_iInf]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
inst✝ : Nonempty ι
a g : ℝ≥0
h : ι → ℝ≥0
H : ∀ (j : ι), a ≤ g * h j
⊢ a ≤ ⨅ i, g * h i

Next tactic:
exact le_ciInf H
theorem le_iInf_mul {a : ℝ≥0} {g : ι → ℝ≥0} {h : ℝ≥0} (H : ∀ i, a ≤ g i * h) : a ≤ iInf g * h := by
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
inst✝ : Nonempty ι
a : ℝ≥0
g : ι → ℝ≥0
h : ℝ≥0
H : ∀ (i : ι), a ≤ g i * h
⊢ a ≤ iInf g * h

Next tactic:
rw [iInf_mul]
theorem le_iInf_mul {a : ℝ≥0} {g : ι → ℝ≥0} {h : ℝ≥0} (H : ∀ i, a ≤ g i * h) : a ≤ iInf g * h := by
  rw [iInf_mul]
  

Proof state:
ι : Sort u_1
f : ι → ℝ≥0
inst✝ : Nonempty ι
a : ℝ≥0
g : ι → ℝ≥0
h : ℝ≥0
H : ∀ (i : ι), a ≤ g i * h
⊢ a ≤ ⨅ i, g i * h

Next tactic:
exact le_ciInf H
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  

Proof state:
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
⊢ OrdConnected (toNNReal '' s)

Next tactic:
refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  

Proof state:
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
y : ℝ
hy : y ∈ s
z : ℝ≥0
hz : z ∈ Icc (toNNReal x) (toNNReal y)
⊢ z ∈ toNNReal '' s

Next tactic:
rcases le_total y 0 with hy₀ | hy₀
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  rcases le_total y 0 with hy₀ | hy₀
  · 

Proof state:
case inl
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
y : ℝ
hy : y ∈ s
z : ℝ≥0
hz : z ∈ Icc (toNNReal x) (toNNReal y)
hy₀ : y ≤ 0
⊢ z ∈ toNNReal '' s

Next tactic:
rw [mem_Icc, Real.toNNReal_of_nonpos hy₀, nonpos_iff_eq_zero] at hz
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  rcases le_total y 0 with hy₀ | hy₀
  · rw [mem_Icc, Real.toNNReal_of_nonpos hy₀, nonpos_iff_eq_zero] at hz
    

Proof state:
case inl
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
y : ℝ
hy : y ∈ s
z : ℝ≥0
hz : toNNReal x ≤ z ∧ z = 0
hy₀ : y ≤ 0
⊢ z ∈ toNNReal '' s

Next tactic:
exact ⟨y, hy, (toNNReal_of_nonpos hy₀).trans hz.2.symm⟩
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  rcases le_total y 0 with hy₀ | hy₀
  · rw [mem_Icc, Real.toNNReal_of_nonpos hy₀, nonpos_iff_eq_zero] at hz
    exact ⟨y, hy, (toNNReal_of_nonpos hy₀).trans hz.2.symm⟩
  · 

Proof state:
case inr
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
y : ℝ
hy : y ∈ s
z : ℝ≥0
hz : z ∈ Icc (toNNReal x) (toNNReal y)
hy₀ : 0 ≤ y
⊢ z ∈ toNNReal '' s

Next tactic:
lift y to ℝ≥0 using hy₀
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  rcases le_total y 0 with hy₀ | hy₀
  · rw [mem_Icc, Real.toNNReal_of_nonpos hy₀, nonpos_iff_eq_zero] at hz
    exact ⟨y, hy, (toNNReal_of_nonpos hy₀).trans hz.2.symm⟩
  · lift y to ℝ≥0 using hy₀
    

Proof state:
case inr.intro
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
z y : ℝ≥0
hy : ↑y ∈ s
hz : z ∈ Icc (toNNReal x) (toNNReal ↑y)
⊢ z ∈ toNNReal '' s

Next tactic:
rw [toNNReal_coe] at hz
theorem image_real_toNNReal (h : s.OrdConnected) : (Real.toNNReal '' s).OrdConnected := by
  refine' ⟨ball_image_iff.2 fun x hx => ball_image_iff.2 fun y hy z hz => _⟩
  rcases le_total y 0 with hy₀ | hy₀
  · rw [mem_Icc, Real.toNNReal_of_nonpos hy₀, nonpos_iff_eq_zero] at hz
    exact ⟨y, hy, (toNNReal_of_nonpos hy₀).trans hz.2.symm⟩
  · lift y to ℝ≥0 using hy₀
    rw [toNNReal_coe] at hz
    

Proof state:
case inr.intro
s : Set ℝ
t : Set ℝ≥0
h : OrdConnected s
x : ℝ
hx : x ∈ s
z y : ℝ≥0
hy : ↑y ∈ s
hz : z ∈ Icc (toNNReal x) y
⊢ z ∈ toNNReal '' s

Next tactic:
exact ⟨z, h.out hx hy ⟨toNNReal_le_iff_le_coe.1 hz.1, hz.2⟩, toNNReal_coe⟩
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by 

Proof state:
⊢ (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0

Next tactic:
ext
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by ext; 

Proof state:
case a
⊢ ↑((fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0) = ↑0

Next tactic:
simp
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by ext; simp
  map_one' := by 

Proof state:
⊢ ZeroHom.toFun
      { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
        map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
      1 =
    1

Next tactic:
ext
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by ext; simp
  map_one' := by ext; 

Proof state:
case a
⊢ ↑(ZeroHom.toFun
        { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
          map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
        1) =
    ↑1

Next tactic:
simp
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by ext; simp
  map_one' := by ext; simp
  map_mul' x y := by 

Proof state:
x y : ℝ
⊢ ZeroHom.toFun
      { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
        map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
      (x * y) =
    ZeroHom.toFun
        { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
          map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
        x *
      ZeroHom.toFun
        { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
          map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
        y

Next tactic:
ext
/-- The absolute value on `ℝ` as a map to `ℝ≥0`. -/
-- porting note: removed @[pp_nodot]
def nnabs : ℝ →*₀ ℝ≥0 where
  toFun x := ⟨|x|, abs_nonneg x⟩
  map_zero' := by ext; simp
  map_one' := by ext; simp
  map_mul' x y := by ext; 

Proof state:
case a
x y : ℝ
⊢ ↑(ZeroHom.toFun
        { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
          map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
        (x * y)) =
    ↑(ZeroHom.toFun
          { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
            map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
          x *
        ZeroHom.toFun
          { toFun := fun x => { val := |x|, property := (_ : 0 ≤ |x|) },
            map_zero' := (_ : (fun x => { val := |x|, property := (_ : 0 ≤ |x|) }) 0 = 0) }
          y)

Next tactic:
simp [abs_mul]
@[simp]
theorem nnabs_of_nonneg {x : ℝ} (h : 0 ≤ x) : nnabs x = toNNReal x := by
  

Proof state:
x : ℝ
h : 0 ≤ x
⊢ nnabs x = toNNReal x

Next tactic:
ext
@[simp]
theorem nnabs_of_nonneg {x : ℝ} (h : 0 ≤ x) : nnabs x = toNNReal x := by
  ext
  

Proof state:
case a
x : ℝ
h : 0 ≤ x
⊢ ↑(nnabs x) = ↑(toNNReal x)

Next tactic:
rw [coe_toNNReal x h, coe_nnabs, abs_of_nonneg h]
theorem nnabs_coe (x : ℝ≥0) : nnabs x = x := by 

Proof state:
x : ℝ≥0
⊢ nnabs ↑x = x

Next tactic:
simp
theorem cast_natAbs_eq_nnabs_cast (n : ℤ) : (n.natAbs : ℝ≥0) = nnabs n := by
  

Proof state:
n : ℤ
⊢ ↑(Int.natAbs n) = nnabs ↑n

Next tactic:
ext
theorem cast_natAbs_eq_nnabs_cast (n : ℤ) : (n.natAbs : ℝ≥0) = nnabs n := by
  ext
  

Proof state:
case a
n : ℤ
⊢ ↑↑(Int.natAbs n) = ↑(nnabs ↑n)

Next tactic:
rw [NNReal.coe_nat_cast, Int.cast_natAbs, Real.coe_nnabs, Int.cast_abs]
instance setLike : SetLike (StarSubalgebra R A) A where
  coe S := S.carrier
  coe_injective' p q h := by 

Proof state:
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
p q : StarSubalgebra R A
h : (fun S => S.carrier) p = (fun S => S.carrier) q
⊢ p = q

Next tactic:
obtain ⟨⟨⟨⟨⟨_, _⟩, _⟩, _⟩, _⟩, _⟩ := p
theorem toSubalgebra_injective :
    Function.Injective (toSubalgebra : StarSubalgebra R A → Subalgebra R A) := fun S T h =>
  ext fun x => by 

Proof state:
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S T : StarSubalgebra R A
h : S.toSubalgebra = T.toSubalgebra
x : A
⊢ x ∈ S ↔ x ∈ T

Next tactic:
rw [← mem_toSubalgebra, ← mem_toSubalgebra, h]
/-- Copy of a star subalgebra with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (S : StarSubalgebra R A) (s : Set A) (hs : s = ↑S) : StarSubalgebra R A where
  toSubalgebra := Subalgebra.copy S.toSubalgebra s hs
  star_mem' := @fun a ha => hs ▸ (S.star_mem' (by 

Proof state:
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
s : Set A
hs : s = ↑S
a : A
ha : a ∈ (Subalgebra.copy S.toSubalgebra s hs).toSubsemiring.toSubmonoid.toSubsemigroup.carrier
⊢ a ∈ S.carrier

Next tactic:
simpa [hs] using ha
/-- Copy of a star subalgebra with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (S : StarSubalgebra R A) (s : Set A) (hs : s = ↑S) : StarSubalgebra R A where
  toSubalgebra := Subalgebra.copy S.toSubalgebra s hs
  star_mem' := @fun a ha => hs ▸ (S.star_mem' (by 

Proof state:
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
a : A
hs : ↑S = ↑S
ha : a ∈ (Subalgebra.copy S.toSubalgebra (↑S) hs).toSubsemiring.toSubmonoid.toSubsemigroup.carrier
⊢ a ∈ S.carrier

Next tactic:
simpa [hs] using ha
/-- Embedding of a subalgebra into the algebra. -/
def subtype : S →⋆ₐ[R] A := by 

Proof state:
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
⊢ ↥S →⋆ₐ[R] A

Next tactic:
refine' { toFun := ((↑) : S → A), .. }
/-- Embedding of a subalgebra into the algebra. -/
def subtype : S →⋆ₐ[R] A := by refine' { toFun := ((↑) : S → A), .. } <;> 

Proof state:
case refine'_1
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
⊢ ↑1 = 1

Next tactic:
intros
/-- Embedding of a subalgebra into the algebra. -/
def subtype : S →⋆ₐ[R] A := by refine' { toFun := ((↑) : S → A), .. } <;> 

Proof state:
case refine'_2
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
⊢ ∀ (x y : ↥S),
    OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } (x * y) =
      OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } x *
        OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } y

Next tactic:
intros
/-- Embedding of a subalgebra into the algebra. -/
def subtype : S →⋆ₐ[R] A := by refine' { toFun := ((↑) : S → A), .. } <;> 

Proof state:
case refine'_3
F : Type u_1
R : Type u_2
A : Type u_3
B : Type u_4
C : Type u_5
inst✝¹³ : CommSemiring R
inst✝¹² : StarRing R
inst✝¹¹ : Semiring A
inst✝¹⁰ : StarRing A
inst✝⁹ : Algebra R A
inst✝⁸ : StarModule R A
inst✝⁷ : Semiring B
inst✝⁶ : StarRing B
inst✝⁵ : Algebra R B
inst✝⁴ : StarModule R B
inst✝³ : Semiring C
inst✝² : StarRing C
inst✝¹ : Algebra R C
inst✝ : StarModule R C
S : StarSubalgebra R A
⊢ OneHom.toFun
      (↑{ toOneHom := { toFun := Subtype.val, map_one' := ?refine'_1 },
          map_mul' :=
            (_ :
              ∀ (x y : ↥S),
                OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } (x * y) =
                  OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } x *
                    OneHom.toFun { toFun := Subtype.val, map_one' := ?refine'_1 } y) })
      0 =
    0

Next tactic:
intros