l3lab/ntp-mathlib huggingface dataset:
/-- Create a `selfAdjoint` element from a `skewAdjoint` element by multiplying by the scalar
`-Complex.I`. -/
@[simps]
def skewAdjoint.negISMul : skewAdjoint A →ₗ[ℝ] selfAdjoint A where
  toFun a :=
    ⟨-I • ↑a, by
      simp only [neg_smul, neg_mem_iff, selfAdjoint.mem_iff, star_smul, star_def, conj_I,
        star_val_eq, smul_neg, neg_neg]⟩
  map_add' a b := by
    ext
    simp only [AddSubgroup.coe_add, smul_add, AddMemClass.mk_add_mk]
  map_smul' a b := by
    ext
    simp only [neg_smul, skewAdjoint.val_smul, AddSubgroup.coe_mk, RingHom.id_apply,
      selfAdjoint.val_smul, smul_neg, neg_inj]
    

Proof state:
case a
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : ℝ
b : ↥(skewAdjoint A)
⊢ I • a • ↑b = a • I • ↑b

Next tactic:
rw [smul_comm]
theorem skewAdjoint.I_smul_neg_I (a : skewAdjoint A) : I • (skewAdjoint.negISMul a : A) = a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : ↥(skewAdjoint A)
⊢ I • ↑(negISMul a) = ↑a

Next tactic:
simp only [smul_smul, skewAdjoint.negISMul_apply_coe, neg_smul, smul_neg, I_mul_I, one_smul,
    neg_neg]
theorem realPart_apply_coe (a : A) : (ℜ a : A) = (2 : ℝ)⁻¹ • (a + star a) := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(ℜ a) = 2⁻¹ • (a + star a)

Next tactic:
unfold realPart
theorem realPart_apply_coe (a : A) : (ℜ a : A) = (2 : ℝ)⁻¹ • (a + star a) := by
  unfold realPart
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑((selfAdjointPart ℝ) a) = 2⁻¹ • (a + star a)

Next tactic:
simp only [selfAdjointPart_apply_coe, invOf_eq_inv]
theorem imaginaryPart_apply_coe (a : A) : (ℑ a : A) = -I • (2 : ℝ)⁻¹ • (a - star a) := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(ℑ a) = -I • 2⁻¹ • (a - star a)

Next tactic:
unfold imaginaryPart
theorem imaginaryPart_apply_coe (a : A) : (ℑ a : A) = -I • (2 : ℝ)⁻¹ • (a - star a) := by
  unfold imaginaryPart
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑((LinearMap.comp skewAdjoint.negISMul (skewAdjointPart ℝ)) a) = -I • 2⁻¹ • (a - star a)

Next tactic:
simp only [LinearMap.coe_comp, Function.comp_apply, skewAdjoint.negISMul_apply_coe,
    skewAdjointPart_apply_coe, invOf_eq_inv, neg_smul]
/-- The standard decomposition of `ℜ a + Complex.I • ℑ a = a` of an element of a star module over
`ℂ` into a linear combination of self adjoint elements. -/
theorem realPart_add_I_smul_imaginaryPart (a : A) : (ℜ a : A) + I • (ℑ a : A) = a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(ℜ a) + I • ↑(ℑ a) = a

Next tactic:
simpa only [smul_smul, realPart_apply_coe, imaginaryPart_apply_coe, neg_smul, I_mul_I, one_smul,
    neg_sub, add_add_sub_cancel, smul_sub, smul_add, neg_sub_neg, invOf_eq_inv] using
    invOf_two_smul_add_invOf_two_smul ℝ a
@[simp]
theorem realPart_I_smul (a : A) : ℜ (I • a) = -ℑ a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ℜ (I • a) = -ℑ a

Next tactic:
ext
@[simp]
theorem realPart_I_smul (a : A) : ℜ (I • a) = -ℑ a := by
  ext
  -- Porting note: was
  -- simp [smul_comm I, smul_sub, sub_eq_add_neg, add_comm]
  

Proof state:
case a
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(ℜ (I • a)) = ↑(-ℑ a)

Next tactic:
rw [realPart_apply_coe, AddSubgroupClass.coe_neg, imaginaryPart_apply_coe, neg_smul, neg_neg,
    smul_comm I, star_smul, star_def, conj_I, smul_sub, neg_smul, sub_eq_add_neg]
@[simp]
theorem imaginaryPart_I_smul (a : A) : ℑ (I • a) = ℜ a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ℑ (I • a) = ℜ a

Next tactic:
ext
@[simp]
theorem imaginaryPart_I_smul (a : A) : ℑ (I • a) = ℜ a := by
  ext
  -- Porting note: was
  -- simp [smul_comm I, smul_smul I]
  

Proof state:
case a
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(ℑ (I • a)) = ↑(ℜ a)

Next tactic:
rw [realPart_apply_coe, imaginaryPart_apply_coe, smul_comm]
@[simp]
theorem imaginaryPart_I_smul (a : A) : ℑ (I • a) = ℜ a := by
  ext
  -- Porting note: was
  -- simp [smul_comm I, smul_smul I]
  rw [realPart_apply_coe, imaginaryPart_apply_coe, smul_comm]
  

Proof state:
case a
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
a : A
⊢ 2⁻¹ • -I • (I • a - star (I • a)) = 2⁻¹ • (a + star a)

Next tactic:
simp [← smul_assoc]
theorem realPart_smul (z : ℂ) (a : A) : ℜ (z • a) = z.re • ℜ a - z.im • ℑ a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
⊢ ℜ (z • a) = z.re • ℜ a - z.im • ℑ a

Next tactic:
have := by congrm (ℜ ($((re_add_im z).symm) • a))
theorem realPart_smul (z : ℂ) (a : A) : ℜ (z • a) = z.re • ℜ a - z.im • ℑ a := by
  have := by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
⊢ ?m.748784

Next tactic:
congrm (ℜ ($((re_add_im z).symm) • a))
theorem realPart_smul (z : ℂ) (a : A) : ℜ (z • a) = z.re • ℜ a - z.im • ℑ a := by
  have := by congrm (ℜ ($((re_add_im z).symm) • a))
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
this : ℜ (z • a) = ℜ ((↑z.re + ↑z.im * I) • a)
⊢ ℜ (z • a) = z.re • ℜ a - z.im • ℑ a

Next tactic:
simpa [-re_add_im, add_smul, ← smul_smul, sub_eq_add_neg]
theorem imaginaryPart_smul (z : ℂ) (a : A) : ℑ (z • a) = z.re • ℑ a + z.im • ℜ a := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
⊢ ℑ (z • a) = z.re • ℑ a + z.im • ℜ a

Next tactic:
have := by congrm (ℑ ($((re_add_im z).symm) • a))
theorem imaginaryPart_smul (z : ℂ) (a : A) : ℑ (z • a) = z.re • ℑ a + z.im • ℜ a := by
  have := by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
⊢ ?m.807006

Next tactic:
congrm (ℑ ($((re_add_im z).symm) • a))
theorem imaginaryPart_smul (z : ℂ) (a : A) : ℑ (z • a) = z.re • ℑ a + z.im • ℜ a := by
  have := by congrm (ℑ ($((re_add_im z).symm) • a))
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
a : A
this : ℑ (z • a) = ℑ ((↑z.re + ↑z.im * I) • a)
⊢ ℑ (z • a) = z.re • ℑ a + z.im • ℜ a

Next tactic:
simpa [-re_add_im, add_smul, ← smul_smul]
lemma skewAdjointPart_eq_I_smul_imaginaryPart (x : A) :
    (skewAdjointPart ℝ x : A) = I • (imaginaryPart x : A) := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
x : A
⊢ ↑((skewAdjointPart ℝ) x) = I • ↑(ℑ x)

Next tactic:
simp [imaginaryPart_apply_coe, smul_smul]
nonrec lemma IsSelfAdjoint.imaginaryPart {x : A} (hx : IsSelfAdjoint x) :
    ℑ x = 0 := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
x : A
hx : IsSelfAdjoint x
⊢ ℑ x = 0

Next tactic:
rw [imaginaryPart, LinearMap.comp_apply, hx.skewAdjointPart_apply _, map_zero]
lemma imaginaryPart_comp_subtype_selfAdjoint :
    imaginaryPart.comp (selfAdjoint.submodule ℝ A).subtype = 0 := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
⊢ ℑ ∘ₗ Submodule.subtype (selfAdjoint.submodule ℝ A) = 0

Next tactic:
rw [imaginaryPart, LinearMap.comp_assoc, skewAdjointPart_comp_subtype_selfAdjoint,
    LinearMap.comp_zero]
lemma imaginaryPart_surjective : Function.Surjective (imaginaryPart (A := A)) :=
  fun x ↦
    ⟨I • (x : A), Subtype.ext <| by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
x : ↥(selfAdjoint A)
⊢ ↑(ℑ (I • ↑x)) = ↑x

Next tactic:
simp only [imaginaryPart_I_smul, x.property.coe_realPart]
lemma span_selfAdjoint : span ℂ (selfAdjoint A : Set A) = ⊤ := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
⊢ span ℂ ↑(selfAdjoint A) = ⊤

Next tactic:
refine eq_top_iff'.mpr fun x ↦ ?_
lemma span_selfAdjoint : span ℂ (selfAdjoint A : Set A) = ⊤ := by
  refine eq_top_iff'.mpr fun x ↦ ?_
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
x : A
⊢ x ∈ span ℂ ↑(selfAdjoint A)

Next tactic:
rw [← realPart_add_I_smul_imaginaryPart x]
lemma span_selfAdjoint : span ℂ (selfAdjoint A : Set A) = ⊤ := by
  refine eq_top_iff'.mpr fun x ↦ ?_
  rw [← realPart_add_I_smul_imaginaryPart x]
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
x : A
⊢ ↑(ℜ x) + I • ↑(ℑ x) ∈ span ℂ ↑(selfAdjoint A)

Next tactic:
exact add_mem (subset_span (ℜ x).property) <|
    SMulMemClass.smul_mem _ <| subset_span (ℑ x).property
/-- The natural `ℝ`-linear equivalence between `selfAdjoint ℂ` and `ℝ`. -/
@[simps apply symm_apply]
def Complex.selfAdjointEquiv : selfAdjoint ℂ ≃ₗ[ℝ] ℝ where
  toFun := fun z ↦ (z : ℂ).re
  invFun := fun x ↦ ⟨x, conj_ofReal x⟩
  left_inv := fun z ↦ Subtype.ext <| conj_eq_iff_re.mp z.property.star_eq
  right_inv := fun x ↦ rfl
  map_add' := by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
⊢ ∀ (x y : ↥(selfAdjoint ℂ)), (fun z => (↑z).re) (x + y) = (fun z => (↑z).re) x + (fun z => (↑z).re) y

Next tactic:
simp
/-- The natural `ℝ`-linear equivalence between `selfAdjoint ℂ` and `ℝ`. -/
@[simps apply symm_apply]
def Complex.selfAdjointEquiv : selfAdjoint ℂ ≃ₗ[ℝ] ℝ where
  toFun := fun z ↦ (z : ℂ).re
  invFun := fun x ↦ ⟨x, conj_ofReal x⟩
  left_inv := fun z ↦ Subtype.ext <| conj_eq_iff_re.mp z.property.star_eq
  right_inv := fun x ↦ rfl
  map_add' := by simp
  map_smul' := by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
⊢ ∀ (r : ℝ) (x : ↥(selfAdjoint ℂ)),
    AddHom.toFun
        { toFun := fun z => (↑z).re,
          map_add' := (_ : ∀ (a a_1 : ↥(selfAdjoint ℂ)), (↑a).re + (↑a_1).re = (↑a).re + (↑a_1).re) }
        (r • x) =
      (RingHom.id ℝ) r •
        AddHom.toFun
          { toFun := fun z => (↑z).re,
            map_add' := (_ : ∀ (a a_1 : ↥(selfAdjoint ℂ)), (↑a).re + (↑a_1).re = (↑a).re + (↑a_1).re) }
          x

Next tactic:
simp
lemma Complex.coe_selfAdjointEquiv (z : selfAdjoint ℂ) :
    (selfAdjointEquiv z : ℂ) = z := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ↥(selfAdjoint ℂ)
⊢ ↑(selfAdjointEquiv z) = ↑z

Next tactic:
simpa [selfAdjointEquiv_symm_apply]
    using (congr_arg Subtype.val <| Complex.selfAdjointEquiv.left_inv z)
@[simp]
lemma realPart_ofReal (r : ℝ) : (ℜ (r : ℂ) : ℂ) = r := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
r : ℝ
⊢ ↑(ℜ ↑r) = ↑r

Next tactic:
rw [realPart_apply_coe, star_def, conj_ofReal, ← two_smul ℝ (r : ℂ)]
@[simp]
lemma realPart_ofReal (r : ℝ) : (ℜ (r : ℂ) : ℂ) = r := by
  rw [realPart_apply_coe, star_def, conj_ofReal, ← two_smul ℝ (r : ℂ)]
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
r : ℝ
⊢ 2⁻¹ • 2 • ↑r = ↑r

Next tactic:
simp
@[simp]
lemma imaginaryPart_ofReal (r : ℝ) : ℑ (r : ℂ) = 0 := by
  

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
r : ℝ
⊢ ℑ ↑r = 0

Next tactic:
ext1
@[simp]
lemma imaginaryPart_ofReal (r : ℝ) : ℑ (r : ℂ) = 0 := by
  ext1; 

Proof state:
case a
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
r : ℝ
⊢ ↑(ℑ ↑r) = ↑0

Next tactic:
simp [imaginaryPart_apply_coe, conj_ofReal]
lemma Complex.coe_realPart (z : ℂ) : (ℜ z : ℂ) = z.re := calc
  (ℜ z : ℂ) = _    := by 

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
⊢ ↑(ℜ z) = ?m.973964 z

Next tactic:
congrm (ℜ $((re_add_im z).symm))
lemma Complex.coe_realPart (z : ℂ) : (ℜ z : ℂ) = z.re := calc
  (ℜ z : ℂ) = _    := by congrm (ℜ $((re_add_im z).symm))
  _          = z.re := by
    

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
⊢ ↑(ℜ (↑z.re + ↑z.im * I)) = ↑z.re

Next tactic:
rw [map_add, AddSubmonoid.coe_add, mul_comm, ← smul_eq_mul, realPart_I_smul]
lemma Complex.coe_realPart (z : ℂ) : (ℜ z : ℂ) = z.re := calc
  (ℜ z : ℂ) = _    := by congrm (ℜ $((re_add_im z).symm))
  _          = z.re := by
    rw [map_add, AddSubmonoid.coe_add, mul_comm, ← smul_eq_mul, realPart_I_smul]
    

Proof state:
A : Type u_1
inst✝³ : AddCommGroup A
inst✝² : Module ℂ A
inst✝¹ : StarAddMonoid A
inst✝ : StarModule ℂ A
z : ℂ
⊢ ↑(ℜ ↑z.re) + ↑(-ℑ ↑z.im) = ↑z.re

Next tactic:
simp [conj_ofReal, ← two_mul]
@[simp]
lemma Real.rank_rat_real : Module.rank ℚ ℝ = continuum := by
  

Proof state:
⊢ Module.rank ℚ ℝ = 𝔠

Next tactic:
refine (Free.rank_eq_mk_of_infinite_lt ℚ ℝ ?_).trans mk_real
@[simp]
lemma Real.rank_rat_real : Module.rank ℚ ℝ = continuum := by
  refine (Free.rank_eq_mk_of_infinite_lt ℚ ℝ ?_).trans mk_real
  

Proof state:
⊢ lift.{0, 0} #ℚ < lift.{0, 0} #ℝ

Next tactic:
simpa [mk_real] using aleph0_lt_continuum
@[simp]
lemma Complex.rank_rat_complex : Module.rank ℚ ℂ = continuum := by
  

Proof state:
⊢ Module.rank ℚ ℂ = 𝔠

Next tactic:
refine (Free.rank_eq_mk_of_infinite_lt ℚ ℂ ?_).trans mk_complex
@[simp]
lemma Complex.rank_rat_complex : Module.rank ℚ ℂ = continuum := by
  refine (Free.rank_eq_mk_of_infinite_lt ℚ ℂ ?_).trans mk_complex
  

Proof state:
⊢ Cardinal.lift.{0, 0} #ℚ < Cardinal.lift.{0, 0} #ℂ

Next tactic:
simpa using aleph0_lt_continuum
/-- `ℂ` and `ℝ` are isomorphic as vector spaces over `ℚ`, or equivalently,
as additive groups. -/
theorem Complex.nonempty_linearEquiv_real : Nonempty (ℂ ≃ₗ[ℚ] ℝ) :=
  LinearEquiv.nonempty_equiv_iff_rank_eq.mpr <| by 

Proof state:
⊢ Module.rank ℚ ℂ = Module.rank ℚ ℝ

Next tactic:
simp
@[simp]
theorem pow_nonneg (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ a ^ n
  | 0 => by
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
H : 0 ≤ a
⊢ 0 ≤ a ^ 0

Next tactic:
rw [pow_zero]
@[simp]
theorem pow_nonneg (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ a ^ n
  | 0 => by
    rw [pow_zero]
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
H : 0 ≤ a
⊢ 0 ≤ 1

Next tactic:
exact zero_le_one
@[simp]
theorem pow_nonneg (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ a ^ n
  | 0 => by
    rw [pow_zero]
    exact zero_le_one
  | n + 1 => by
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
H : 0 ≤ a
n : ℕ
⊢ 0 ≤ a ^ (n + 1)

Next tactic:
rw [pow_succ]
@[simp]
theorem pow_nonneg (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ a ^ n
  | 0 => by
    rw [pow_zero]
    exact zero_le_one
  | n + 1 => by
    rw [pow_succ]
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
H : 0 ≤ a
n : ℕ
⊢ 0 ≤ a * a ^ n

Next tactic:
exact mul_nonneg H (pow_nonneg H _)
theorem add_le_mul_two_add (a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b) :=
  calc
    a + (2 + b) ≤ a + (a + a * b) :=
      add_le_add_left (add_le_add a2 <| le_mul_of_one_le_left b0 <| (@one_le_two α).trans a2) a
    _ ≤ a * (2 + b) := by 

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
a2 : 2 ≤ a
b0 : 0 ≤ b
⊢ a + (a + a * b) ≤ a * (2 + b)

Next tactic:
rw [mul_add, mul_two, add_assoc]
theorem bit1_pos' (h : 0 < a) : 0 < bit1 a := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedSemiring α
a b c d : α
h : 0 < a
⊢ 0 < bit1 a

Next tactic:
nontriviality
theorem bit1_pos' (h : 0 < a) : 0 < bit1 a := by
  nontriviality
  

Proof state:
α : Type u
β : Type u_1
inst✝¹ : OrderedSemiring α
a b c d : α
h : 0 < a
inst✝ : Nontrivial α
⊢ 0 < bit1 a

Next tactic:
exact bit1_pos h.le
instance (priority := 100) OrderedRing.toOrderedSemiring : OrderedSemiring α :=
  { ‹OrderedRing α›, (Ring.toSemiring : Semiring α) with
    mul_le_mul_of_nonneg_left := fun a b c h hc => by
      

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a✝ b✝ c✝ d : α
src✝¹ : OrderedRing α := inst✝
src✝ : Semiring α := Ring.toSemiring
a b c : α
h : a ≤ b
hc : 0 ≤ c
⊢ c * a ≤ c * b

Next tactic:
simpa only [mul_sub, sub_nonneg] using OrderedRing.mul_nonneg _ _ hc (sub_nonneg.2 h)
instance (priority := 100) OrderedRing.toOrderedSemiring : OrderedSemiring α :=
  { ‹OrderedRing α›, (Ring.toSemiring : Semiring α) with
    mul_le_mul_of_nonneg_left := fun a b c h hc => by
      simpa only [mul_sub, sub_nonneg] using OrderedRing.mul_nonneg _ _ hc (sub_nonneg.2 h),
    mul_le_mul_of_nonneg_right := fun a b c h hc => by
      

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a✝ b✝ c✝ d : α
src✝¹ : OrderedRing α := inst✝
src✝ : Semiring α := Ring.toSemiring
a b c : α
h : a ≤ b
hc : 0 ≤ c
⊢ a * c ≤ b * c

Next tactic:
simpa only [sub_mul, sub_nonneg] using OrderedRing.mul_nonneg _ _ (sub_nonneg.2 h) hc
theorem mul_le_mul_of_nonpos_left (h : b ≤ a) (hc : c ≤ 0) : c * a ≤ c * b := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
h : b ≤ a
hc : c ≤ 0
⊢ c * a ≤ c * b

Next tactic:
simpa only [neg_mul, neg_le_neg_iff] using mul_le_mul_of_nonneg_left h (neg_nonneg.2 hc)
theorem mul_le_mul_of_nonpos_right (h : b ≤ a) (hc : c ≤ 0) : a * c ≤ b * c := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
h : b ≤ a
hc : c ≤ 0
⊢ a * c ≤ b * c

Next tactic:
simpa only [mul_neg, neg_le_neg_iff] using mul_le_mul_of_nonneg_right h (neg_nonneg.2 hc)
theorem mul_nonneg_of_nonpos_of_nonpos (ha : a ≤ 0) (hb : b ≤ 0) : 0 ≤ a * b := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
ha : a ≤ 0
hb : b ≤ 0
⊢ 0 ≤ a * b

Next tactic:
simpa only [zero_mul] using mul_le_mul_of_nonpos_right ha hb
/-- Variant of `mul_le_of_le_one_left` for `b` non-positive instead of non-negative.  -/
theorem le_mul_of_le_one_left (hb : b ≤ 0) (h : a ≤ 1) : b ≤ a * b := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
hb : b ≤ 0
h : a ≤ 1
⊢ b ≤ a * b

Next tactic:
simpa only [one_mul] using mul_le_mul_of_nonpos_right h hb
/-- Variant of `le_mul_of_one_le_left` for `b` non-positive instead of non-negative. -/
theorem mul_le_of_one_le_left (hb : b ≤ 0) (h : 1 ≤ a) : a * b ≤ b := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
hb : b ≤ 0
h : 1 ≤ a
⊢ a * b ≤ b

Next tactic:
simpa only [one_mul] using mul_le_mul_of_nonpos_right h hb
/-- Variant of `mul_le_of_le_one_right` for `a` non-positive instead of non-negative. -/
theorem le_mul_of_le_one_right (ha : a ≤ 0) (h : b ≤ 1) : a ≤ a * b := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
ha : a ≤ 0
h : b ≤ 1
⊢ a ≤ a * b

Next tactic:
simpa only [mul_one] using mul_le_mul_of_nonpos_left h ha
/-- Variant of `le_mul_of_one_le_right` for `a` non-positive instead of non-negative. -/
theorem mul_le_of_one_le_right (ha : a ≤ 0) (h : 1 ≤ b) : a * b ≤ a := by
  

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a b c d : α
ha : a ≤ 0
h : 1 ≤ b
⊢ a * b ≤ a

Next tactic:
simpa only [mul_one] using mul_le_mul_of_nonpos_left h ha
theorem le_iff_exists_nonneg_add (a b : α) : a ≤ b ↔ ∃ c ≥ 0, b = a + c :=
  ⟨fun h => ⟨b - a, sub_nonneg.mpr h, by 

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a✝ b✝ c d a b : α
h : a ≤ b
⊢ b = a + (b - a)

Next tactic:
simp
theorem le_iff_exists_nonneg_add (a b : α) : a ≤ b ↔ ∃ c ≥ 0, b = a + c :=
  ⟨fun h => ⟨b - a, sub_nonneg.mpr h, by simp⟩, fun ⟨c, hc, h⟩ => by
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a✝ b✝ c✝ d a b : α
x✝ : ∃ c, c ≥ 0 ∧ b = a + c
c : α
hc : c ≥ 0
h : b = a + c
⊢ a ≤ b

Next tactic:
rw [h, le_add_iff_nonneg_right]
theorem le_iff_exists_nonneg_add (a b : α) : a ≤ b ↔ ∃ c ≥ 0, b = a + c :=
  ⟨fun h => ⟨b - a, sub_nonneg.mpr h, by simp⟩, fun ⟨c, hc, h⟩ => by
    rw [h, le_add_iff_nonneg_right]
    

Proof state:
α : Type u
β : Type u_1
inst✝ : OrderedRing α
a✝ b✝ c✝ d a b : α
x✝ : ∃ c, c ≥ 0 ∧ b = a + c
c : α
hc : c ≥ 0
h : b = a + c
⊢ 0 ≤ c

Next tactic:
exact hc
/-- A choice-free version of `StrictOrderedSemiring.toOrderedSemiring` to avoid using choice in
basic `Nat` lemmas. -/
@[reducible]
def StrictOrderedSemiring.toOrderedSemiring' [@DecidableRel α (· ≤ ·)] : OrderedSemiring α :=
  { ‹StrictOrderedSemiring α› with
    mul_le_mul_of_nonneg_left := fun a b c hab hc => by
      

Proof state:
α : Type u
β : Type u_1
inst✝¹ : StrictOrderedSemiring α
a✝ b✝ c✝ d : α
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
src✝ : StrictOrderedSemiring α := inst✝¹
a b c : α
hab : a ≤ b
hc : 0 ≤ c
⊢ c * a ≤ c * b

Next tactic:
obtain rfl | hab := Decidable.eq_or_lt_of_le hab
/-- A choice-free version of `StrictOrderedSemiring.toOrderedSemiring` to avoid using choice in
basic `Nat` lemmas. -/
@[reducible]
def StrictOrderedSemiring.toOrderedSemiring' [@DecidableRel α (· ≤ ·)] : OrderedSemiring α :=
  { ‹StrictOrderedSemiring α› with
    mul_le_mul_of_nonneg_left := fun a b c hab hc => by
      obtain rfl | hab := Decidable.eq_or_lt_of_le hab
      · 

Proof state:
case inl
α : Type u
β : Type u_1
inst✝¹ : StrictOrderedSemiring α
a✝ b c✝ d : α
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
src✝ : StrictOrderedSemiring α := inst✝¹
a c : α
hc : 0 ≤ c
hab : a ≤ a
⊢ c * a ≤ c * a

Next tactic:
rfl
/-- A choice-free version of `StrictOrderedSemiring.toOrderedSemiring` to avoid using choice in
basic `Nat` lemmas. -/
@[reducible]
def StrictOrderedSemiring.toOrderedSemiring' [@DecidableRel α (· ≤ ·)] : OrderedSemiring α :=
  { ‹StrictOrderedSemiring α› with
    mul_le_mul_of_nonneg_left := fun a b c hab hc => by
      obtain rfl | hab := Decidable.eq_or_lt_of_le hab
      · rfl
      

Proof state:
case inr
α : Type u
β : Type u_1
inst✝¹ : StrictOrderedSemiring α
a✝ b✝ c✝ d : α
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
src✝ : StrictOrderedSemiring α := inst✝¹
a b c : α
hab✝ : a ≤ b
hc : 0 ≤ c
hab : a < b
⊢ c * a ≤ c * b

Next tactic:
obtain rfl | hc := Decidable.eq_or_lt_of_le hc
/-- A choice-free version of `StrictOrderedSemiring.toOrderedSemiring` to avoid using choice in
basic `Nat` lemmas. -/
@[reducible]
def StrictOrderedSemiring.toOrderedSemiring' [@DecidableRel α (· ≤ ·)] : OrderedSemiring α :=
  { ‹StrictOrderedSemiring α› with
    mul_le_mul_of_nonneg_left := fun a b c hab hc => by
      obtain rfl | hab := Decidable.eq_or_lt_of_le hab
      · rfl
      obtain rfl | hc := Decidable.eq_or_lt_of_le hc
      · 

Proof state:
case inr.inl
α : Type u
β : Type u_1
inst✝¹ : StrictOrderedSemiring α
a✝ b✝ c d : α
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
src✝ : StrictOrderedSemiring α := inst✝¹
a b : α
hab✝ : a ≤ b
hab : a < b
hc : 0 ≤ 0
⊢ 0 * a ≤ 0 * b

Next tactic:
simp
/-- A choice-free version of `StrictOrderedSemiring.toOrderedSemiring` to avoid using choice in
basic `Nat` lemmas. -/
@[reducible]
def StrictOrderedSemiring.toOrderedSemiring' [@DecidableRel α (· ≤ ·)] : OrderedSemiring α :=
  { ‹StrictOrderedSemiring α› with
    mul_le_mul_of_nonneg_left := fun a b c hab hc => by
      obtain rfl | hab := Decidable.eq_or_lt_of_le hab
      · rfl
      obtain rfl | hc := Decidable.eq_or_lt_of_le hc
      · simp
      · 

Proof state:
case inr.inr
α : Type u
β : Type u_1
inst✝¹ : StrictOrderedSemiring α
a✝ b✝ c✝ d : α
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
src✝ : StrictOrderedSemiring α := inst✝¹
a b c : α
hab✝ : a ≤ b
hc✝ : 0 ≤ c
hab : a < b
hc : 0 < c
⊢ c * a ≤ c * b

Next tactic:
exact (mul_lt_mul_of_pos_left hab hc).le