l3lab/ntp-mathlib huggingface dataset:
/-- A finite Hilbert basis is an orthonormal basis. -/
protected def toOrthonormalBasis [Fintype ι] (b : HilbertBasis ι 𝕜 E) : OrthonormalBasis ι 𝕜 E :=
  OrthonormalBasis.mk b.orthonormal
    (by
      

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁵ : IsROrC 𝕜
E : Type u_3
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝² : (i : ι) → NormedAddCommGroup (G i)
inst✝¹ : (i : ι) → InnerProductSpace 𝕜 (G i)
inst✝ : Fintype ι
b : HilbertBasis ι 𝕜 E
⊢ ⊤ ≤ span 𝕜 (Set.range fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1))

Next tactic:
refine' Eq.ge _
/-- A finite Hilbert basis is an orthonormal basis. -/
protected def toOrthonormalBasis [Fintype ι] (b : HilbertBasis ι 𝕜 E) : OrthonormalBasis ι 𝕜 E :=
  OrthonormalBasis.mk b.orthonormal
    (by
      refine' Eq.ge _
      

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁵ : IsROrC 𝕜
E : Type u_3
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝² : (i : ι) → NormedAddCommGroup (G i)
inst✝¹ : (i : ι) → InnerProductSpace 𝕜 (G i)
inst✝ : Fintype ι
b : HilbertBasis ι 𝕜 E
⊢ span 𝕜 (Set.range fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) = ⊤

Next tactic:
have := (span 𝕜 (Finset.univ.image b : Set E)).closed_of_finiteDimensional
/-- A finite Hilbert basis is an orthonormal basis. -/
protected def toOrthonormalBasis [Fintype ι] (b : HilbertBasis ι 𝕜 E) : OrthonormalBasis ι 𝕜 E :=
  OrthonormalBasis.mk b.orthonormal
    (by
      refine' Eq.ge _
      have := (span 𝕜 (Finset.univ.image b : Set E)).closed_of_finiteDimensional
      

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁵ : IsROrC 𝕜
E : Type u_3
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝² : (i : ι) → NormedAddCommGroup (G i)
inst✝¹ : (i : ι) → InnerProductSpace 𝕜 (G i)
inst✝ : Fintype ι
b : HilbertBasis ι 𝕜 E
this : IsClosed ↑(span 𝕜 ↑(Finset.image (fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) Finset.univ))
⊢ span 𝕜 (Set.range fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) = ⊤

Next tactic:
simpa only [Finset.coe_image, Finset.coe_univ, Set.image_univ, HilbertBasis.dense_span] using
        this.submodule_topologicalClosure_eq.symm
protected theorem hasSum_orthogonalProjection {U : Submodule 𝕜 E} [CompleteSpace U]
    (b : HilbertBasis ι 𝕜 U) (x : E) :
    HasSum (fun i => ⟪(b i : E), x⟫ • b i) (orthogonalProjection U x) := by
  

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁵ : IsROrC 𝕜
E : Type u_3
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝² : (i : ι) → NormedAddCommGroup (G i)
inst✝¹ : (i : ι) → InnerProductSpace 𝕜 (G i)
U : Submodule 𝕜 E
inst✝ : CompleteSpace ↥U
b : HilbertBasis ι 𝕜 ↥U
x : E
⊢ HasSum
    (fun i =>
      inner (↑((fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) i)) x •
        (fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) i)
    ((orthogonalProjection U) x)

Next tactic:
simpa only [b.repr_apply_apply, inner_orthogonalProjection_eq_of_mem_left] using
    b.hasSum_repr (orthogonalProjection U x)
theorem finite_spans_dense (b : HilbertBasis ι 𝕜 E) :
    (⨆ J : Finset ι, span 𝕜 (J.image b : Set E)).topologicalClosure = ⊤ :=
  eq_top_iff.mpr <| b.dense_span.ge.trans (by
    

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
b : HilbertBasis ι 𝕜 E
⊢ topologicalClosure (span 𝕜 (Set.range fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1))) ≤
    topologicalClosure (⨆ J, span 𝕜 ↑(Finset.image (fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) J))

Next tactic:
simp_rw [← Submodule.span_iUnion]
theorem finite_spans_dense (b : HilbertBasis ι 𝕜 E) :
    (⨆ J : Finset ι, span 𝕜 (J.image b : Set E)).topologicalClosure = ⊤ :=
  eq_top_iff.mpr <| b.dense_span.ge.trans (by
    simp_rw [← Submodule.span_iUnion]
    

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
b : HilbertBasis ι 𝕜 E
⊢ topologicalClosure (span 𝕜 (Set.range fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1))) ≤
    topologicalClosure (span 𝕜 (⋃ i, ↑(Finset.image (fun i => (LinearIsometryEquiv.symm b.repr) (lp.single 2 i 1)) i)))

Next tactic:
exact topologicalClosure_mono (span_mono <| Set.range_subset_iff.mpr fun i =>
      Set.mem_iUnion_of_mem {i} <| Finset.mem_coe.mpr <| Finset.mem_image_of_mem _ <|
      Finset.mem_singleton_self i)
theorem _root_.Orthonormal.linearIsometryEquiv_symm_apply_single_one (h i) :
    (hv.isHilbertSum h).linearIsometryEquiv.symm (lp.single 2 i 1) = v i := by
  

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
v : ι → E
hv : Orthonormal 𝕜 v
h : ⊤ ≤ topologicalClosure (span 𝕜 (Set.range v))
i : ι
⊢ (LinearIsometryEquiv.symm
        (IsHilbertSum.linearIsometryEquiv
          (_ : IsHilbertSum 𝕜 (fun x => 𝕜) fun i => LinearIsometry.toSpanSingleton 𝕜 E (_ : ‖v i‖ = 1))))
      (lp.single 2 i 1) =
    v i

Next tactic:
rw [IsHilbertSum.linearIsometryEquiv_symm_apply_single, LinearIsometry.toSpanSingleton_apply,
    one_smul]
@[simp]
protected theorem coe_mk (hsp : ⊤ ≤ (span 𝕜 (Set.range v)).topologicalClosure) :
    ⇑(HilbertBasis.mk hv hsp) = v := by
  

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
v : ι → E
hv : Orthonormal 𝕜 v
hsp : ⊤ ≤ topologicalClosure (span 𝕜 (Set.range v))
⊢ (fun i => (LinearIsometryEquiv.symm (HilbertBasis.mk hv hsp).repr) (lp.single 2 i 1)) = v

Next tactic:
apply funext <| Orthonormal.linearIsometryEquiv_symm_apply_single_one hv hsp
/-- An orthonormal family of vectors whose span has trivial orthogonal complement is a Hilbert
basis. -/
protected def mkOfOrthogonalEqBot (hsp : (span 𝕜 (Set.range v))ᗮ = ⊥) : HilbertBasis ι 𝕜 E :=
  HilbertBasis.mk hv
    (by 

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
v : ι → E
hv : Orthonormal 𝕜 v
hsp : (span 𝕜 (Set.range v))ᗮ = ⊥
⊢ ⊤ ≤ topologicalClosure (span 𝕜 (Set.range v))

Next tactic:
rw [← orthogonal_orthogonal_eq_closure, ← eq_top_iff, orthogonal_eq_top_iff, hsp]
/-- An orthonormal basis is a Hilbert basis. -/
protected def _root_.OrthonormalBasis.toHilbertBasis [Fintype ι] (b : OrthonormalBasis ι 𝕜 E) :
    HilbertBasis ι 𝕜 E :=
  HilbertBasis.mk b.orthonormal <| by
    

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁵ : IsROrC 𝕜
E : Type u_3
inst✝⁴ : NormedAddCommGroup E
inst✝³ : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝² : (i : ι) → NormedAddCommGroup (G i)
inst✝¹ : (i : ι) → InnerProductSpace 𝕜 (G i)
v : ι → E
hv : Orthonormal 𝕜 v
inst✝ : Fintype ι
b : OrthonormalBasis ι 𝕜 E
⊢ ⊤ ≤ topologicalClosure (span 𝕜 (Set.range ⇑b))

Next tactic:
simpa only [← OrthonormalBasis.coe_toBasis, b.toBasis.span_eq, eq_top_iff] using
      @subset_closure E _ _
/-- A Hilbert space admits a Hilbert basis extending a given orthonormal subset. -/
theorem _root_.Orthonormal.exists_hilbertBasis_extension {s : Set E}
    (hs : Orthonormal 𝕜 ((↑) : s → E)) :
    ∃ (w : Set E) (b : HilbertBasis w 𝕜 E), s ⊆ w ∧ ⇑b = ((↑) : w → E) :=
  let ⟨w, hws, hw_ortho, hw_max⟩ := exists_maximal_orthonormal hs
  ⟨w, HilbertBasis.mkOfOrthogonalEqBot hw_ortho
    (by 

Proof state:
ι : Type u_1
𝕜 : Type u_2
inst✝⁴ : IsROrC 𝕜
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : InnerProductSpace 𝕜 E
cplt : CompleteSpace E
G : ι → Type u_4
inst✝¹ : (i : ι) → NormedAddCommGroup (G i)
inst✝ : (i : ι) → InnerProductSpace 𝕜 (G i)
v : ι → E
hv : Orthonormal 𝕜 v
s : Set E
hs : Orthonormal 𝕜 Subtype.val
w : Set E
hws : w ⊇ s
hw_ortho : Orthonormal 𝕜 Subtype.val
hw_max : ∀ u ⊇ w, Orthonormal 𝕜 Subtype.val → u = w
⊢ (span 𝕜 (Set.range Subtype.val))ᗮ = ⊥

Next tactic:
simpa only [Subtype.range_coe_subtype, Set.setOf_mem_eq,
      maximal_orthonormal_iff_orthogonalComplement_eq_bot hw_ortho] using hw_max
example {R : Type*} [OrderedSemiring R] [StarOrderedRing R] {x y : R} (hx : 0 ≤ x) (hy : 0 ≤ y) :
    x * y = y * x := by
  

Proof state:
R : Type u_1
inst✝¹ : OrderedSemiring R
inst✝ : StarOrderedRing R
x y : R
hx : 0 ≤ x
hy : 0 ≤ y
⊢ x * y = y * x

Next tactic:
rw [← IsSelfAdjoint.of_nonneg (mul_nonneg hy hx), star_mul, IsSelfAdjoint.of_nonneg hx,
    IsSelfAdjoint.of_nonneg hy]
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  

Proof state:
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
hc : 0 ≤ c
⊢ c * a ≤ c * b

Next tactic:
rw [StarOrderedRing.nonneg_iff] at hc
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  

Proof state:
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
hc : c ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
⊢ c * a ≤ c * b

Next tactic:
induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  | Hmul x hx y hy =>
    simp only [← nonneg_iff, add_mul] at hx hy ⊢
    apply add_le_add <;> aesop
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  

Proof state:
case Hs
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x✝ : R
h : x✝ ∈ Set.range fun s => star s * s
⊢ x✝ * a ≤ x✝ * b

Next tactic:
| Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    

Proof state:
case Hs
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x✝ : R
h : x✝ ∈ Set.range fun s => star s * s
⊢ x✝ * a ≤ x✝ * b

Next tactic:
obtain ⟨x, rfl⟩ := h
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    

Proof state:
case Hs.intro
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x : R
⊢ (fun s => star s * s) x * a ≤ (fun s => star s * s) x * b

Next tactic:
simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    

Proof state:
case Hs.intro
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x : R
⊢ star x * a * x ≤ star x * b * x

Next tactic:
exact conjugate_le_conjugate hab x
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  

Proof state:
case H1
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
⊢ 0 * a ≤ 0 * b

Next tactic:
| H1 => simp
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => 

Proof state:
case H1
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
⊢ 0 * a ≤ 0 * b

Next tactic:
simp
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  

Proof state:
case Hmul
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x : R
hx : x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
y : R
hy : y ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
a✝¹ : x * a ≤ x * b
a✝ : y * a ≤ y * b
⊢ (x + y) * a ≤ (x + y) * b

Next tactic:
| Hmul x hx y hy =>
    simp only [← nonneg_iff, add_mul] at hx hy ⊢
    apply add_le_add <;> aesop
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  | Hmul x hx y hy =>
    

Proof state:
case Hmul
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x : R
hx : x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
y : R
hy : y ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
a✝¹ : x * a ≤ x * b
a✝ : y * a ≤ y * b
⊢ (x + y) * a ≤ (x + y) * b

Next tactic:
simp only [← nonneg_iff, add_mul] at hx hy ⊢
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  | Hmul x hx y hy =>
    simp only [← nonneg_iff, add_mul] at hx hy ⊢
    

Proof state:
case Hmul
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x y : R
a✝¹ : x * a ≤ x * b
a✝ : y * a ≤ y * b
hx : 0 ≤ x
hy : 0 ≤ y
⊢ x * a + y * a ≤ x * b + y * b

Next tactic:
apply add_le_add
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  | Hmul x hx y hy =>
    simp only [← nonneg_iff, add_mul] at hx hy ⊢
    apply add_le_add <;> 

Proof state:
case Hmul.h₁
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x y : R
a✝¹ : x * a ≤ x * b
a✝ : y * a ≤ y * b
hx : 0 ≤ x
hy : 0 ≤ y
⊢ x * a ≤ x * b

Next tactic:
aesop
private lemma mul_le_mul_of_nonneg_left {R : Type*} [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] {a b c : R} (hab : a ≤ b) (hc : 0 ≤ c) : c * a ≤ c * b := by
  rw [StarOrderedRing.nonneg_iff] at hc
  induction hc using AddSubmonoid.closure_induction' with
  | Hs _ h =>
    obtain ⟨x, rfl⟩ := h
    simp_rw [mul_assoc, mul_comm x, ← mul_assoc]
    exact conjugate_le_conjugate hab x
  | H1 => simp
  | Hmul x hx y hy =>
    simp only [← nonneg_iff, add_mul] at hx hy ⊢
    apply add_le_add <;> 

Proof state:
case Hmul.h₂
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
hab : a ≤ b
x y : R
a✝¹ : x * a ≤ x * b
a✝ : y * a ≤ y * b
hx : 0 ≤ x
hy : 0 ≤ y
⊢ y * a ≤ y * b

Next tactic:
aesop
/-- A commutative star-ordered semiring is an ordered semiring.

This is not registered as an instance because it introduces a type class loop between `CommSemiring`
and `OrderedCommSemiring`, and it seem loops still cause issues sometimes.

See note [reducible non-instances]. -/
@[reducible]
def toOrderedCommSemiring (R : Type*) [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] : OrderedCommSemiring R where
  add_le_add_left _ _ := add_le_add_left
  zero_le_one := by 

Proof state:
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
⊢ 0 ≤ 1

Next tactic:
simpa using star_mul_self_nonneg (1 : R)
/-- A commutative star-ordered semiring is an ordered semiring.

This is not registered as an instance because it introduces a type class loop between `CommSemiring`
and `OrderedCommSemiring`, and it seem loops still cause issues sometimes.

See note [reducible non-instances]. -/
@[reducible]
def toOrderedCommSemiring (R : Type*) [CommSemiring R] [PartialOrder R]
    [StarOrderedRing R] : OrderedCommSemiring R where
  add_le_add_left _ _ := add_le_add_left
  zero_le_one := by simpa using star_mul_self_nonneg (1 : R)
  mul_comm := mul_comm
  mul_le_mul_of_nonneg_left _ _ _ := mul_le_mul_of_nonneg_left
  mul_le_mul_of_nonneg_right a b c := by 

Proof state:
R : Type u_1
inst✝² : CommSemiring R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
a b c : R
⊢ a ≤ b → 0 ≤ c → a * c ≤ b * c

Next tactic:
simpa only [mul_comm _ c] using mul_le_mul_of_nonneg_left
/-- A commutative star-ordered ring is an ordered ring.

This is not registered as an instance because it introduces a type class loop between `CommSemiring`
and `OrderedCommSemiring`, and it seem loops still cause issues sometimes.

See note [reducible non-instances]. -/
@[reducible]
def toOrderedCommRing (R : Type*) [CommRing R] [PartialOrder R]
    [StarOrderedRing R] : OrderedCommRing R where
  add_le_add_left _ _ := add_le_add_left
  zero_le_one := by 

Proof state:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : PartialOrder R
inst✝ : StarOrderedRing R
⊢ 0 ≤ 1

Next tactic:
simpa using star_mul_self_nonneg (1 : R)
@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
    mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
s : Set α
⊢ mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1

Next tactic:
simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def,
    not_imp_comm, and_comm, forall_and]
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    

Proof state:
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hfg : x ∉ f '' mulSupport g
⊢ extend f g 1 x = 1

Next tactic:
by_cases hf : ∃ a, f a = x
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    by_cases hf : ∃ a, f a = x
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hfg : x ∉ f '' mulSupport g
hf : ∃ a, f a = x
⊢ extend f g 1 x = 1

Next tactic:
rw [extend, dif_pos hf, ← nmem_mulSupport]
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    by_cases hf : ∃ a, f a = x
    · rw [extend, dif_pos hf, ← nmem_mulSupport]
      

Proof state:
case pos
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hfg : x ∉ f '' mulSupport g
hf : ∃ a, f a = x
⊢ Classical.choose hf ∉ mulSupport g

Next tactic:
rw [← Classical.choose_spec hf] at hfg
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    by_cases hf : ∃ a, f a = x
    · rw [extend, dif_pos hf, ← nmem_mulSupport]
      rw [← Classical.choose_spec hf] at hfg
      

Proof state:
case pos
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hf : ∃ a, f a = x
hfg : f (Classical.choose hf) ∉ f '' mulSupport g
⊢ Classical.choose hf ∉ mulSupport g

Next tactic:
exact fun hg ↦ hfg ⟨_, hg, rfl⟩
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    by_cases hf : ∃ a, f a = x
    · rw [extend, dif_pos hf, ← nmem_mulSupport]
      rw [← Classical.choose_spec hf] at hfg
      exact fun hg ↦ hfg ⟨_, hg, rfl⟩
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hfg : x ∉ f '' mulSupport g
hf : ¬∃ a, f a = x
⊢ extend f g 1 x = 1

Next tactic:
rw [extend_apply' _ _ _ hf]
@[to_additive]
theorem mulSupport_extend_one_subset {f : α → M} {g : α → N} :
    mulSupport (f.extend g 1) ⊆ f '' mulSupport g :=
  mulSupport_subset_iff'.mpr fun x hfg ↦ by
    by_cases hf : ∃ a, f a = x
    · rw [extend, dif_pos hf, ← nmem_mulSupport]
      rw [← Classical.choose_spec hf] at hfg
      exact fun hg ↦ hfg ⟨_, hg, rfl⟩
    · rw [extend_apply' _ _ _ hf]; 

Proof state:
case neg
α : Type u_1
β : Type u_2
A : Type u_3
B : Type u_4
M : Type u_5
N : Type u_6
P : Type u_7
R : Type u_8
S : Type u_9
G : Type u_10
M₀ : Type u_11
G₀ : Type u_12
ι : Sort u_13
inst✝² : One M
inst✝¹ : One N
inst✝ : One P
f : α → M
g : α → N
x : M
hfg : x ∉ f '' mulSupport g
hf : ¬∃ a, f a = x
⊢ OfNat.ofNat 1 x = 1

Next tactic:
rfl