-- Mathlib/Topology/ContinuousMap/Polynomial.lean
theorem polynomialFunctions.comap_compRightAlgHom_iccHomeoI (a b : ℝ) (h : a < b) :
    (polynomialFunctions I).comap (compRightAlgHom ℝ ℝ (iccHomeoI a b h).symm) =
      polynomialFunctions (Set.Icc a b)

Proof state:
case h.mp.intro.intro.refine_2.h.convert_2.right
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
x : ↑(Set.Icc a b)
w₁ : 0 < (b - a)⁻¹
w₂ : 0 ≤ ↑x - a
w₃ : ↑x - a ≤ b - a
⊢ (↑x - a) * (b - a)⁻¹ ≤ 1

Tactic:
rw [← div_eq_mul_inv, div_le_one (sub_pos.mpr h)]

Result:
case h.mp.intro.intro.refine_2.h.convert_2.right
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
x : ↑(Set.Icc a b)
w₁ : 0 < (b - a)⁻¹
w₂ : 0 ≤ ↑x - a
w₃ : ↑x - a ≤ b - a
⊢ ↑x - a ≤ b - a

Proof state:
case h.mpr.intro.intro
a b : ℝ
h : a < b
p : ℝ[X]
q : ℝ[X] := p.comp ((b - a) • X + Polynomial.C a)
⊢ ↑(toContinuousMapOnAlgHom (Set.Icc a b)) p ∈
    Subalgebra.comap (compRightAlgHom ℝ ℝ ↑(iccHomeoI a b h).symm) (polynomialFunctions I)

Tactic:
refine ⟨q, ⟨?_, ?_⟩⟩

Result:
case h.mpr.intro.intro.refine_1
a b : ℝ
h : a < b
p : ℝ[X]
q : ℝ[X] := p.comp ((b - a) • X + Polynomial.C a)
⊢ q ∈ ↑⊤.toSubsemiring

case h.mpr.intro.intro.refine_2
a b : ℝ
h : a < b
p : ℝ[X]
q : ℝ[X] := p.comp ((b - a) • X + Polynomial.C a)
⊢ ↑(toContinuousMapOnAlgHom I) q =
    ↑(compRightAlgHom ℝ ℝ ↑(iccHomeoI a b h).symm) (↑(toContinuousMapOnAlgHom (Set.Icc a b)) p)

Proof state:
case h.mp.intro.intro
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ↑(toContinuousMapOnAlgHom I) p = ↑(compRightAlgHom ℝ ℝ ↑(iccHomeoI a b h).symm) f
⊢ f ∈ polynomialFunctions (Set.Icc a b)

Tactic:
rw [DFunLike.ext_iff] at w

Result:
case h.mp.intro.intro
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), (↑(toContinuousMapOnAlgHom I) p) x = (↑(compRightAlgHom ℝ ℝ ↑(iccHomeoI a b h).symm) f) x
⊢ f ∈ polynomialFunctions (Set.Icc a b)

Proof state:
case h.e'_3.h.e'_6
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
x : ↑(Set.Icc a b)
⊢ x = (iccHomeoI a b h).symm ⟨(b - a)⁻¹ * ↑x + -(a * (b - a)⁻¹), ?h.mp.intro.intro.refine_2.h.convert_2⟩

Tactic:
ext

Result:
case h.e'_3.h.e'_6.a
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
x : ↑(Set.Icc a b)
⊢ ↑x = ↑((iccHomeoI a b h).symm ⟨(b - a)⁻¹ * ↑x + -(a * (b - a)⁻¹), ?h.mp.intro.intro.refine_2.h.convert_2⟩)

Proof state:
case h.mp.intro.intro
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
⊢ f ∈ polynomialFunctions (Set.Icc a b)

Tactic:
refine ⟨q, ⟨?_, ?_⟩⟩

Result:
case h.mp.intro.intro.refine_1
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
⊢ q ∈ ↑⊤.toSubsemiring

case h.mp.intro.intro.refine_2
a b : ℝ
h : a < b
f : C(↑(Set.Icc a b), ℝ)
p : ℝ[X]
w : ∀ (x : ↑I), Polynomial.eval (↑x) p = f ((iccHomeoI a b h).symm x)
q : ℝ[X] := p.comp ((b - a)⁻¹ • X + Polynomial.C (-a * (b - a)⁻¹))
⊢ ↑(toContinuousMapOnAlgHom (Set.Icc a b)) q = f