l3lab/ntp-mathlib huggingface dataset:
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X Y =>
        { toFun := fun f => completionHom X ≫ f
          invFun := fun f => extensionHom f
          left_inv := fun f => by dsimp; erw [extension_comp_coe]
          right_inv := fun f => by
            apply Subtype.eq; funext x; cases f
            exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.separatedSpace _)
              ‹_› _ }
      homEquiv_naturality_left_symm := fun {X' X Y} f g => by
        apply hom_ext; funext x; dsimp
        

Proof state:
case a.h
X' X : UniformSpaceCat
Y : CpltSepUniformSpace
f : X' ⟶ X
g : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y
x : (forget UniformSpaceCat).obj (toUniformSpace (completionFunctor.obj X'))
⊢ (forget UniformSpaceCat).map (extensionHom (f ≫ g)) x =
    (forget UniformSpaceCat).map (completionFunctor.map f ≫ extensionHom g) x

Next tactic:
erw [coe_comp]
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X Y =>
        { toFun := fun f => completionHom X ≫ f
          invFun := fun f => extensionHom f
          left_inv := fun f => by dsimp; erw [extension_comp_coe]
          right_inv := fun f => by
            apply Subtype.eq; funext x; cases f
            exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.separatedSpace _)
              ‹_› _ }
      homEquiv_naturality_left_symm := fun {X' X Y} f g => by
        apply hom_ext; funext x; dsimp
        erw [coe_comp]
        -- Porting note : used to be `erw [← Completion.extension_map]`
        

Proof state:
case a.h
X' X : UniformSpaceCat
Y : CpltSepUniformSpace
f : X' ⟶ X
g : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y
x : (forget UniformSpaceCat).obj (toUniformSpace (completionFunctor.obj X'))
⊢ (forget UniformSpaceCat).map (extensionHom (f ≫ g)) x =
    ((forget UniformSpaceCat).map (extensionHom g) ∘ (forget UniformSpaceCat).map (completionFunctor.map f)) x

Next tactic:
have := (Completion.extension_map (γ := Y) (f := g) g.2 f.2)
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X Y =>
        { toFun := fun f => completionHom X ≫ f
          invFun := fun f => extensionHom f
          left_inv := fun f => by dsimp; erw [extension_comp_coe]
          right_inv := fun f => by
            apply Subtype.eq; funext x; cases f
            exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.separatedSpace _)
              ‹_› _ }
      homEquiv_naturality_left_symm := fun {X' X Y} f g => by
        apply hom_ext; funext x; dsimp
        erw [coe_comp]
        -- Porting note : used to be `erw [← Completion.extension_map]`
        have := (Completion.extension_map (γ := Y) (f := g) g.2 f.2)
        

Proof state:
case a.h
X' X : UniformSpaceCat
Y : CpltSepUniformSpace
f : X' ⟶ X
g : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y
x : (forget UniformSpaceCat).obj (toUniformSpace (completionFunctor.obj X'))
this :
  Completion.extension ((forget UniformSpaceCat).map g) ∘ Completion.map ↑f =
    Completion.extension ((forget UniformSpaceCat).map g ∘ ↑f)
⊢ (forget UniformSpaceCat).map (extensionHom (f ≫ g)) x =
    ((forget UniformSpaceCat).map (extensionHom g) ∘ (forget UniformSpaceCat).map (completionFunctor.map f)) x

Next tactic:
simp only [forget_map_eq_coe] at this ⊢
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X Y =>
        { toFun := fun f => completionHom X ≫ f
          invFun := fun f => extensionHom f
          left_inv := fun f => by dsimp; erw [extension_comp_coe]
          right_inv := fun f => by
            apply Subtype.eq; funext x; cases f
            exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.separatedSpace _)
              ‹_› _ }
      homEquiv_naturality_left_symm := fun {X' X Y} f g => by
        apply hom_ext; funext x; dsimp
        erw [coe_comp]
        -- Porting note : used to be `erw [← Completion.extension_map]`
        have := (Completion.extension_map (γ := Y) (f := g) g.2 f.2)
        simp only [forget_map_eq_coe] at this ⊢
        

Proof state:
case a.h
X' X : UniformSpaceCat
Y : CpltSepUniformSpace
f : X' ⟶ X
g : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y
x : (forget UniformSpaceCat).obj (toUniformSpace (completionFunctor.obj X'))
this : Completion.extension ⇑g ∘ Completion.map ↑f = Completion.extension (⇑g ∘ ↑f)
⊢ (extensionHom (f ≫ g)) x = (⇑(extensionHom g) ∘ ⇑(completionFunctor.map f)) x

Next tactic:
erw [this]
/-- The completion functor is left adjoint to the forgetful functor. -/
noncomputable def adj : completionFunctor ⊣ forget₂ CpltSepUniformSpace UniformSpaceCat :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X Y =>
        { toFun := fun f => completionHom X ≫ f
          invFun := fun f => extensionHom f
          left_inv := fun f => by dsimp; erw [extension_comp_coe]
          right_inv := fun f => by
            apply Subtype.eq; funext x; cases f
            exact @Completion.extension_coe _ _ _ _ _ (CpltSepUniformSpace.separatedSpace _)
              ‹_› _ }
      homEquiv_naturality_left_symm := fun {X' X Y} f g => by
        apply hom_ext; funext x; dsimp
        erw [coe_comp]
        -- Porting note : used to be `erw [← Completion.extension_map]`
        have := (Completion.extension_map (γ := Y) (f := g) g.2 f.2)
        simp only [forget_map_eq_coe] at this ⊢
        erw [this]
        

Proof state:
case a.h
X' X : UniformSpaceCat
Y : CpltSepUniformSpace
f : X' ⟶ X
g : X ⟶ (forget₂ CpltSepUniformSpace UniformSpaceCat).obj Y
x : (forget UniformSpaceCat).obj (toUniformSpace (completionFunctor.obj X'))
this : Completion.extension ⇑g ∘ Completion.map ↑f = Completion.extension (⇑g ∘ ↑f)
⊢ (extensionHom (f ≫ g)) x = Completion.extension (⇑g ∘ ↑f) x

Next tactic:
rfl
@[simp]
theorem map_one_add (x : ℝ) : f (1 + x) = 1 + f x := by 

Proof state:
f g : CircleDeg1Lift
x : ℝ
⊢ f (1 + x) = 1 + f x

Next tactic:
rw [add_comm, map_add_one, add_comm 1]
instance : Monoid CircleDeg1Lift where
  mul f g :=
    { toOrderHom := f.1.comp g.1
      map_add_one' := fun x => by 

Proof state:
f✝ g✝ f g : CircleDeg1Lift
x : ℝ
⊢ OrderHom.toFun (OrderHom.comp f.toOrderHom g.toOrderHom) (x + 1) =
    OrderHom.toFun (OrderHom.comp f.toOrderHom g.toOrderHom) x + 1

Next tactic:
simp [map_add_one]
@[simp]
theorem units_inv_apply_apply (f : CircleDeg1Liftˣ) (x : ℝ) : (f⁻¹ : CircleDeg1Liftˣ) (f x) = x :=
  by 

Proof state:
f✝ g : CircleDeg1Lift
f : CircleDeg1Liftˣ
x : ℝ
⊢ ↑f⁻¹ (↑f x) = x

Next tactic:
simp only [← mul_apply, f.inv_mul, coe_one, id]
@[simp]
theorem units_apply_inv_apply (f : CircleDeg1Liftˣ) (x : ℝ) : f ((f⁻¹ : CircleDeg1Liftˣ) x) = x :=
  by 

Proof state:
f✝ g : CircleDeg1Lift
f : CircleDeg1Liftˣ
x : ℝ
⊢ ↑f (↑f⁻¹ x) = x

Next tactic:
simp only [← mul_apply, f.mul_inv, coe_one, id]
/-- If a lift of a circle map is bijective, then it is an order automorphism of the line. -/
def toOrderIso : CircleDeg1Liftˣ →* ℝ ≃o ℝ where
  toFun f :=
    { toFun := f
      invFun := ⇑f⁻¹
      left_inv := units_inv_apply_apply f
      right_inv := units_apply_inv_apply f
      map_rel_iff' := ⟨fun h => by 

Proof state:
f✝ g : CircleDeg1Lift
f : CircleDeg1Liftˣ
a✝ b✝ : ℝ
h :
  { toFun := ⇑↑f, invFun := ⇑↑f⁻¹, left_inv := (_ : ∀ (x : ℝ), ↑f⁻¹ (↑f x) = x),
        right_inv := (_ : ∀ (x : ℝ), ↑f (↑f⁻¹ x) = x) }
      a✝ ≤
    { toFun := ⇑↑f, invFun := ⇑↑f⁻¹, left_inv := (_ : ∀ (x : ℝ), ↑f⁻¹ (↑f x) = x),
        right_inv := (_ : ∀ (x : ℝ), ↑f (↑f⁻¹ x) = x) }
      b✝
⊢ a✝ ≤ b✝

Next tactic:
simpa using mono (↑f⁻¹) h
theorem isUnit_iff_bijective {f : CircleDeg1Lift} : IsUnit f ↔ Bijective f :=
  ⟨fun ⟨u, h⟩ => h ▸ (toOrderIso u).bijective, fun h =>
    Units.isUnit
      { val := f
        inv :=
          { toFun := (Equiv.ofBijective f h).symm
            monotone' := fun x y hxy =>
              (f.strictMono_iff_injective.2 h.1).le_iff_le.1
                (by 

Proof state:
f✝ g f : CircleDeg1Lift
h : Bijective ⇑f
x y : ℝ
hxy : x ≤ y
⊢ f ((Equiv.ofBijective (⇑f) h).symm x) ≤ f ((Equiv.ofBijective (⇑f) h).symm y)

Next tactic:
simp only [Equiv.ofBijective_apply_symm_apply f h, hxy]
theorem isUnit_iff_bijective {f : CircleDeg1Lift} : IsUnit f ↔ Bijective f :=
  ⟨fun ⟨u, h⟩ => h ▸ (toOrderIso u).bijective, fun h =>
    Units.isUnit
      { val := f
        inv :=
          { toFun := (Equiv.ofBijective f h).symm
            monotone' := fun x y hxy =>
              (f.strictMono_iff_injective.2 h.1).le_iff_le.1
                (by simp only [Equiv.ofBijective_apply_symm_apply f h, hxy])
            map_add_one' := fun x =>
              h.1 <| by 

Proof state:
f✝ g f : CircleDeg1Lift
h : Bijective ⇑f
x : ℝ
⊢ f
      (OrderHom.toFun
        { toFun := ⇑(Equiv.ofBijective (⇑f) h).symm,
          monotone' :=
            (_ : ∀ (x y : ℝ), x ≤ y → (Equiv.ofBijective (⇑f) h).symm x ≤ (Equiv.ofBijective (⇑f) h).symm y) }
        (x + 1)) =
    f
      (OrderHom.toFun
          { toFun := ⇑(Equiv.ofBijective (⇑f) h).symm,
            monotone' :=
              (_ : ∀ (x y : ℝ), x ≤ y → (Equiv.ofBijective (⇑f) h).symm x ≤ (Equiv.ofBijective (⇑f) h).symm y) }
          x +
        1)

Next tactic:
simp only [Equiv.ofBijective_apply_symm_apply f, f.map_add_one]
theorem coe_pow : ∀ n : ℕ, ⇑(f ^ n) = f^[n]
  | 0 => rfl
  | n + 1 => by
    

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ ⇑(f ^ (n + 1)) = (⇑f)^[n + 1]

Next tactic:
ext x
theorem coe_pow : ∀ n : ℕ, ⇑(f ^ n) = f^[n]
  | 0 => rfl
  | n + 1 => by
    ext x
    

Proof state:
case h
f g : CircleDeg1Lift
n : ℕ
x : ℝ
⊢ (f ^ (n + 1)) x = (⇑f)^[n + 1] x

Next tactic:
simp [coe_pow n, pow_succ']
@[simp]
theorem translate_zpow (x : ℝ) (n : ℤ) :
    translate (Multiplicative.ofAdd x) ^ n = translate (Multiplicative.ofAdd <| ↑n * x) := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
n : ℤ
⊢ translate (Multiplicative.ofAdd x) ^ n = translate (Multiplicative.ofAdd (↑n * x))

Next tactic:
simp only [← zsmul_eq_mul, ofAdd_zsmul, MonoidHom.map_zpow]
@[simp]
theorem translate_iterate (x : ℝ) (n : ℕ) :
    (translate (Multiplicative.ofAdd x))^[n] = translate (Multiplicative.ofAdd <| ↑n * x) := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
n : ℕ
⊢ (⇑↑(translate (Multiplicative.ofAdd x)))^[n] = ⇑↑(translate (Multiplicative.ofAdd (↑n * x)))

Next tactic:
rw [← coe_pow, ← Units.val_pow_eq_pow_val, translate_pow]
theorem commute_nat_add (n : ℕ) : Function.Commute f (n + ·) := by
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ Function.Commute ⇑f fun x => ↑n + x

Next tactic:
simpa only [nsmul_one, add_left_iterate] using Function.Commute.iterate_right f.map_one_add n
theorem commute_add_nat (n : ℕ) : Function.Commute f (· + n) := by
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ Function.Commute ⇑f fun x => x + ↑n

Next tactic:
simp only [add_comm _ (n : ℝ), f.commute_nat_add n]
theorem commute_sub_nat (n : ℕ) : Function.Commute f (· - n) := by
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ Function.Commute ⇑f fun x => x - ↑n

Next tactic:
simpa only [sub_eq_add_neg] using
    (f.commute_add_nat n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv
theorem commute_add_int : ∀ n : ℤ, Function.Commute f (· + n)
  | (n : ℕ) => f.commute_add_nat n
  | -[n+1] => by 

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ Function.Commute ⇑f fun x => x + ↑-[n+1]

Next tactic:
simpa [sub_eq_add_neg] using f.commute_sub_nat (n + 1)
theorem commute_int_add (n : ℤ) : Function.Commute f (n + ·) := by
  

Proof state:
f g : CircleDeg1Lift
n : ℤ
⊢ Function.Commute ⇑f fun x => ↑n + x

Next tactic:
simpa only [add_comm _ (n : ℝ)] using f.commute_add_int n
theorem commute_sub_int (n : ℤ) : Function.Commute f (· - n) := by
  

Proof state:
f g : CircleDeg1Lift
n : ℤ
⊢ Function.Commute ⇑f fun x => x - ↑n

Next tactic:
simpa only [sub_eq_add_neg] using
    (f.commute_add_int n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv
theorem map_int_of_map_zero (n : ℤ) : f n = f 0 + n := by 

Proof state:
f g : CircleDeg1Lift
n : ℤ
⊢ f ↑n = f 0 + ↑n

Next tactic:
rw [← f.map_add_int, zero_add]
@[simp]
theorem map_fract_sub_fract_eq (x : ℝ) : f (fract x) - fract x = f x - x := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
⊢ f (fract x) - fract x = f x - x

Next tactic:
rw [Int.fract, f.map_sub_int, sub_sub_sub_cancel_right]
/-- Monotone circle maps form a lattice with respect to the pointwise order -/
noncomputable instance : Lattice CircleDeg1Lift where
  sup f g :=
    { toFun := fun x => max (f x) (g x)
      monotone' := fun x y h => max_le_max (f.mono h) (g.mono h)
      -- TODO: generalize to `Monotone.max`
      map_add_one' := fun x => by 

Proof state:
f✝ g✝ f g : CircleDeg1Lift
x : ℝ
⊢ OrderHom.toFun
      { toFun := fun x => max (f x) (g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → max (f x) (g x) ≤ max (f y) (g y)) }
      (x + 1) =
    OrderHom.toFun
        { toFun := fun x => max (f x) (g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → max (f x) (g x) ≤ max (f y) (g y)) }
        x +
      1

Next tactic:
simp [max_add_add_right]
/-- Monotone circle maps form a lattice with respect to the pointwise order -/
noncomputable instance : Lattice CircleDeg1Lift where
  sup f g :=
    { toFun := fun x => max (f x) (g x)
      monotone' := fun x y h => max_le_max (f.mono h) (g.mono h)
      -- TODO: generalize to `Monotone.max`
      map_add_one' := fun x => by simp [max_add_add_right] }
  le f g := ∀ x, f x ≤ g x
  le_refl f x := le_refl (f x)
  le_trans f₁ f₂ f₃ h₁₂ h₂₃ x := le_trans (h₁₂ x) (h₂₃ x)
  le_antisymm f₁ f₂ h₁₂ h₂₁ := ext fun x => le_antisymm (h₁₂ x) (h₂₁ x)
  le_sup_left f g x := le_max_left (f x) (g x)
  le_sup_right f g x := le_max_right (f x) (g x)
  sup_le f₁ f₂ f₃ h₁ h₂ x := max_le (h₁ x) (h₂ x)
  inf f g :=
    { toFun := fun x => min (f x) (g x)
      monotone' := fun x y h => min_le_min (f.mono h) (g.mono h)
      map_add_one' := fun x => by 

Proof state:
f✝ g✝ f g : CircleDeg1Lift
x : ℝ
⊢ OrderHom.toFun
      { toFun := fun x => min (f x) (g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → min (f x) (g x) ≤ min (f y) (g y)) }
      (x + 1) =
    OrderHom.toFun
        { toFun := fun x => min (f x) (g x), monotone' := (_ : ∀ (x y : ℝ), x ≤ y → min (f x) (g x) ≤ min (f y) (g y)) }
        x +
      1

Next tactic:
simp [min_add_add_right]
theorem pow_mono {f g : CircleDeg1Lift} (h : f ≤ g) (n : ℕ) : f ^ n ≤ g ^ n := fun x => by
  

Proof state:
f✝ g✝ f g : CircleDeg1Lift
h : f ≤ g
n : ℕ
x : ℝ
⊢ (f ^ n) x ≤ (g ^ n) x

Next tactic:
simp only [coe_pow, iterate_mono h n x]
theorem dist_map_map_zero_lt : dist (f 0 + g 0) (f (g 0)) < 1 := by
  

Proof state:
f g : CircleDeg1Lift
⊢ dist (f 0 + g 0) (f (g 0)) < 1

Next tactic:
rw [dist_comm, Real.dist_eq, abs_lt, lt_sub_iff_add_lt', sub_lt_iff_lt_add', ← sub_eq_add_neg]
theorem dist_map_map_zero_lt : dist (f 0 + g 0) (f (g 0)) < 1 := by
  rw [dist_comm, Real.dist_eq, abs_lt, lt_sub_iff_add_lt', sub_lt_iff_lt_add', ← sub_eq_add_neg]
  

Proof state:
f g : CircleDeg1Lift
⊢ f 0 + g 0 - 1 < f (g 0) ∧ f (g 0) < f 0 + g 0 + 1

Next tactic:
exact ⟨f.lt_map_map_zero g, f.map_map_zero_lt g⟩
theorem dist_map_zero_lt_of_semiconj {f g₁ g₂ : CircleDeg1Lift} (h : Function.Semiconj f g₁ g₂) :
    dist (g₁ 0) (g₂ 0) < 2 :=
  calc
    dist (g₁ 0) (g₂ 0) ≤ dist (g₁ 0) (f (g₁ 0) - f 0) + dist _ (g₂ 0) := dist_triangle _ _ _
    _ = dist (f 0 + g₁ 0) (f (g₁ 0)) + dist (g₂ 0 + f 0) (g₂ (f 0)) := by
      

Proof state:
f✝ g f g₁ g₂ : CircleDeg1Lift
h : Semiconj ⇑f ⇑g₁ ⇑g₂
⊢ dist (g₁ 0) (f (g₁ 0) - f 0) + dist (f (g₁ 0) - f 0) (g₂ 0) =
    dist (f 0 + g₁ 0) (f (g₁ 0)) + dist (g₂ 0 + f 0) (g₂ (f 0))

Next tactic:
simp only [h.eq, Real.dist_eq, sub_sub, add_comm (f 0), sub_sub_eq_add_sub,
        abs_sub_comm (g₂ (f 0))]
protected theorem tendsto_atTop : Tendsto f atTop atTop :=
  tendsto_atTop_mono f.le_map_of_map_zero <| tendsto_atTop_add_const_left _ _ <|
    (tendsto_atTop_mono fun x => (sub_one_lt_floor x).le) <| by
      

Proof state:
f g : CircleDeg1Lift
⊢ Tendsto (fun x => x - 1) atTop atTop

Next tactic:
simpa [sub_eq_add_neg] using tendsto_atTop_add_const_right _ _ tendsto_id
theorem iterate_le_of_map_le_add_int {x : ℝ} {m : ℤ} (h : f x ≤ x + m) (n : ℕ) :
    f^[n] x ≤ x + n * m := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
h : f x ≤ x + ↑m
n : ℕ
⊢ (⇑f)^[n] x ≤ x + ↑n * ↑m

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using
    (f.commute_add_int m).iterate_le_of_map_le f.monotone (monotone_id.add_const (m : ℝ)) h n
theorem le_iterate_of_add_int_le_map {x : ℝ} {m : ℤ} (h : x + m ≤ f x) (n : ℕ) :
    x + n * m ≤ f^[n] x := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
h : x + ↑m ≤ f x
n : ℕ
⊢ x + ↑n * ↑m ≤ (⇑f)^[n] x

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using
    (f.commute_add_int m).symm.iterate_le_of_map_le (monotone_id.add_const (m : ℝ)) f.monotone h n
theorem iterate_eq_of_map_eq_add_int {x : ℝ} {m : ℤ} (h : f x = x + m) (n : ℕ) :
    f^[n] x = x + n * m := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
h : f x = x + ↑m
n : ℕ
⊢ (⇑f)^[n] x = x + ↑n * ↑m

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_eq_of_map_eq n h
theorem iterate_pos_le_iff {x : ℝ} {m : ℤ} {n : ℕ} (hn : 0 < n) :
    f^[n] x ≤ x + n * m ↔ f x ≤ x + m := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
n : ℕ
hn : 0 < n
⊢ (⇑f)^[n] x ≤ x + ↑n * ↑m ↔ f x ≤ x + ↑m

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using
    (f.commute_add_int m).iterate_pos_le_iff_map_le f.monotone (strictMono_id.add_const (m : ℝ)) hn
theorem iterate_pos_lt_iff {x : ℝ} {m : ℤ} {n : ℕ} (hn : 0 < n) :
    f^[n] x < x + n * m ↔ f x < x + m := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
n : ℕ
hn : 0 < n
⊢ (⇑f)^[n] x < x + ↑n * ↑m ↔ f x < x + ↑m

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using
    (f.commute_add_int m).iterate_pos_lt_iff_map_lt f.monotone (strictMono_id.add_const (m : ℝ)) hn
theorem iterate_pos_eq_iff {x : ℝ} {m : ℤ} {n : ℕ} (hn : 0 < n) :
    f^[n] x = x + n * m ↔ f x = x + m := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
n : ℕ
hn : 0 < n
⊢ (⇑f)^[n] x = x + ↑n * ↑m ↔ f x = x + ↑m

Next tactic:
simpa only [nsmul_eq_mul, add_right_iterate] using
    (f.commute_add_int m).iterate_pos_eq_iff_map_eq f.monotone (strictMono_id.add_const (m : ℝ)) hn
theorem le_iterate_pos_iff {x : ℝ} {m : ℤ} {n : ℕ} (hn : 0 < n) :
    x + n * m ≤ f^[n] x ↔ x + m ≤ f x := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
n : ℕ
hn : 0 < n
⊢ x + ↑n * ↑m ≤ (⇑f)^[n] x ↔ x + ↑m ≤ f x

Next tactic:
simpa only [not_lt] using not_congr (f.iterate_pos_lt_iff hn)
theorem lt_iterate_pos_iff {x : ℝ} {m : ℤ} {n : ℕ} (hn : 0 < n) :
    x + n * m < f^[n] x ↔ x + m < f x := by
  

Proof state:
f g : CircleDeg1Lift
x : ℝ
m : ℤ
n : ℕ
hn : 0 < n
⊢ x + ↑n * ↑m < (⇑f)^[n] x ↔ x + ↑m < f x

Next tactic:
simpa only [not_le] using not_congr (f.iterate_pos_le_iff hn)
theorem mul_floor_map_zero_le_floor_iterate_zero (n : ℕ) : ↑n * ⌊f 0⌋ ≤ ⌊f^[n] 0⌋ := by
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ ↑n * ⌊f 0⌋ ≤ ⌊(⇑f)^[n] 0⌋

Next tactic:
rw [le_floor, Int.cast_mul, Int.cast_ofNat, ← zero_add ((n : ℝ) * _)]
theorem mul_floor_map_zero_le_floor_iterate_zero (n : ℕ) : ↑n * ⌊f 0⌋ ≤ ⌊f^[n] 0⌋ := by
  rw [le_floor, Int.cast_mul, Int.cast_ofNat, ← zero_add ((n : ℝ) * _)]
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ 0 + ↑n * ↑⌊f 0⌋ ≤ (⇑f)^[n] 0

Next tactic:
apply le_iterate_of_add_int_le_map
theorem mul_floor_map_zero_le_floor_iterate_zero (n : ℕ) : ↑n * ⌊f 0⌋ ≤ ⌊f^[n] 0⌋ := by
  rw [le_floor, Int.cast_mul, Int.cast_ofNat, ← zero_add ((n : ℝ) * _)]
  apply le_iterate_of_add_int_le_map
  

Proof state:
case h
f g : CircleDeg1Lift
n : ℕ
⊢ 0 + ↑⌊f 0⌋ ≤ f 0

Next tactic:
simp [floor_le]
theorem translationNumber_eq_of_tendsto₀ {τ' : ℝ}
    (h : Tendsto (fun n : ℕ => f^[n] 0 / n) atTop (𝓝 τ')) : τ f = τ' :=
  f.translationNumber_eq_of_tendsto_aux <| by
    

Proof state:
f g : CircleDeg1Lift
τ' : ℝ
h : Tendsto (fun n => (⇑f)^[n] 0 / ↑n) atTop (𝓝 τ')
⊢ Tendsto (transnumAuxSeq f) atTop (𝓝 τ')

Next tactic:
simpa [(· ∘ ·), transnumAuxSeq_def, coe_pow] using
      h.comp (Nat.tendsto_pow_atTop_atTop_of_one_lt one_lt_two)
theorem transnumAuxSeq_zero : f.transnumAuxSeq 0 = f 0 := by 

Proof state:
f g : CircleDeg1Lift
⊢ transnumAuxSeq f 0 = f 0

Next tactic:
simp [transnumAuxSeq]
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / 2 / 2 ^ n

Next tactic:
have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
this : 0 < 2 ^ (n + 1)
⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / 2 / 2 ^ n

Next tactic:
rw [div_div, ← pow_succ, ← abs_of_pos this]
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
  rw [div_div, ← pow_succ, ← abs_of_pos this]
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
this : 0 < 2 ^ (n + 1)
⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / |2 ^ (n + 1)|

Next tactic:
replace := abs_pos.2 (ne_of_gt this)
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
  rw [div_div, ← pow_succ, ← abs_of_pos this]
  replace := abs_pos.2 (ne_of_gt this)
  

Proof state:
f g : CircleDeg1Lift
n : ℕ
this : 0 < |2 ^ (n + 1)|
⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) < 1 / |2 ^ (n + 1)|

Next tactic:
convert (div_lt_div_right this).2 ((f ^ 2 ^ n).dist_map_map_zero_lt (f ^ 2 ^ n)) using 1
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
  rw [div_div, ← pow_succ, ← abs_of_pos this]
  replace := abs_pos.2 (ne_of_gt this)
  convert (div_lt_div_right this).2 ((f ^ 2 ^ n).dist_map_map_zero_lt (f ^ 2 ^ n)) using 1
  

Proof state:
case h.e'_3
f g : CircleDeg1Lift
n : ℕ
this : 0 < |2 ^ (n + 1)|
⊢ dist (transnumAuxSeq f n) (transnumAuxSeq f (n + 1)) =
    dist ((f ^ 2 ^ n) 0 + (f ^ 2 ^ n) 0) ((f ^ 2 ^ n) ((f ^ 2 ^ n) 0)) / |2 ^ (n + 1)|

Next tactic:
simp_rw [transnumAuxSeq, Real.dist_eq]
theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n := by
  have : 0 < (2 ^ (n + 1) : ℝ) := pow_pos zero_lt_two _
  rw [div_div, ← pow_succ, ← abs_of_pos this]
  replace := abs_pos.2 (ne_of_gt this)
  convert (div_lt_div_right this).2 ((f ^ 2 ^ n).dist_map_map_zero_lt (f ^ 2 ^ n)) using 1
  simp_rw [transnumAuxSeq, Real.dist_eq]
  

Proof state:
case h.e'_3
f g : CircleDeg1Lift
n : ℕ
this : 0 < |2 ^ (n + 1)|
⊢ |(f ^ 2 ^ n) 0 / 2 ^ n - (f ^ 2 ^ (n + 1)) 0 / 2 ^ (n + 1)| =
    |(f ^ 2 ^ n) 0 + (f ^ 2 ^ n) 0 - (f ^ 2 ^ n) ((f ^ 2 ^ n) 0)| / |2 ^ (n + 1)|

Next tactic:
rw [← abs_div, sub_div, pow_succ', pow_succ, ← two_mul, mul_div_mul_left _ _ (two_ne_zero' ℝ),
    pow_mul, sq, mul_apply]
theorem tendsto_translationNumber_of_dist_bounded_aux (x : ℕ → ℝ) (C : ℝ)
    (H : ∀ n : ℕ, dist ((f ^ n) 0) (x n) ≤ C) :
    Tendsto (fun n : ℕ => x (2 ^ n) / 2 ^ n) atTop (𝓝 <| τ f) := by
  

Proof state:
f g : CircleDeg1Lift
x : ℕ → ℝ
C : ℝ
H : ∀ (n : ℕ), dist ((f ^ n) 0) (x n) ≤ C
⊢ Tendsto (fun n => x (2 ^ n) / 2 ^ n) atTop (𝓝 (τ f))

Next tactic:
refine' f.tendsto_translationNumber_aux.congr_dist (squeeze_zero (fun _ => dist_nonneg) _ _)