algebra.continued_fractions.basic
⟷
Mathlib.Algebra.ContinuedFractions.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2019 Kevin Kappelmann. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
-/
-import Mathbin.Data.Seq.Seq
-import Mathbin.Algebra.Field.Defs
+import Data.Seq.Seq
+import Algebra.Field.Defs
#align_import algebra.continued_fractions.basic from "leanprover-community/mathlib"@"fe8d0ff42c3c24d789f491dc2622b6cac3d61564"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2019 Kevin Kappelmann. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
-
-! This file was ported from Lean 3 source module algebra.continued_fractions.basic
-! leanprover-community/mathlib commit fe8d0ff42c3c24d789f491dc2622b6cac3d61564
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Seq.Seq
import Mathbin.Algebra.Field.Defs
+#align_import algebra.continued_fractions.basic from "leanprover-community/mathlib"@"fe8d0ff42c3c24d789f491dc2622b6cac3d61564"
+
/-!
# Basic Definitions/Theorems for Continued Fractions
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -94,10 +94,12 @@ instance hasCoeToGeneralizedContinuedFractionPair : Coe (Pair α) (Pair β) :=
⟨map coe⟩
#align generalized_continued_fraction.pair.has_coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair
+#print GeneralizedContinuedFraction.Pair.coe_toPair /-
@[simp, norm_cast]
theorem coe_toPair {a b : α} : (↑(Pair.mk a b) : Pair β) = Pair.mk (a : β) (b : β) :=
rfl
#align generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.coe_toPair
+-/
end coe
@@ -189,12 +191,14 @@ instance hasCoeToGeneralizedContinuedFraction :
⟨fun g => ⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩⟩
#align generalized_continued_fraction.has_coe_to_generalized_continued_fraction GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction
+#print GeneralizedContinuedFraction.coe_toGeneralizedContinuedFraction /-
@[simp, norm_cast]
theorem coe_toGeneralizedContinuedFraction {g : GeneralizedContinuedFraction α} :
(↑(g : GeneralizedContinuedFraction α) : GeneralizedContinuedFraction β) =
⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩ :=
rfl
#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_toGeneralizedContinuedFraction
+-/
end coe
@@ -464,11 +468,13 @@ protected theorem ext_iff {g g' : GeneralizedContinuedFraction α} :
#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
-/
+#print GeneralizedContinuedFraction.ext /-
@[ext]
protected theorem ext {g g' : GeneralizedContinuedFraction α} (hyp : g.h = g'.h ∧ g.s = g'.s) :
g = g' :=
GeneralizedContinuedFraction.ext_iff.right hyp
#align generalized_continued_fraction.ext GeneralizedContinuedFraction.ext
+-/
end GeneralizedContinuedFraction
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -65,7 +65,7 @@ protected structure GeneralizedContinuedFraction.Pair where
open GeneralizedContinuedFraction
-/- ./././Mathport/Syntax/Translate/Command.lean:229:11: unsupported: unusual advanced open style -/
+/- ./././Mathport/Syntax/Translate/Command.lean:230:11: unsupported: unusual advanced open style -/
/-! Interlude: define some expected coercions and instances. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -261,12 +261,10 @@ instance hasCoeToGeneralizedContinuedFraction :
unfold SimpleContinuedFraction; infer_instance
#align simple_continued_fraction.has_coe_to_generalized_continued_fraction SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction
-/- warning: simple_continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align simple_continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
-theorem [anonymous] {s : SimpleContinuedFraction α} :
+theorem coe_to_generalizedContinuedFraction {s : SimpleContinuedFraction α} :
(↑s : GeneralizedContinuedFraction α) = s.val :=
rfl
-#align simple_continued_fraction.coe_to_generalized_continued_fraction [anonymous]
+#align simple_continued_fraction.coe_to_generalized_continued_fraction SimpleContinuedFraction.coe_to_generalizedContinuedFraction
end SimpleContinuedFraction
@@ -318,11 +316,10 @@ instance hasCoeToSimpleContinuedFraction : Coe (ContinuedFraction α) (SimpleCon
by unfold ContinuedFraction; infer_instance
#align continued_fraction.has_coe_to_simple_continued_fraction ContinuedFraction.hasCoeToSimpleContinuedFraction
-/- warning: continued_fraction.coe_to_simple_continued_fraction clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_simple_continued_fraction [anonymous]ₓ'. -/
-theorem [anonymous] {c : ContinuedFraction α} : (↑c : SimpleContinuedFraction α) = c.val :=
+theorem coe_to_simpleContinuedFraction {c : ContinuedFraction α} :
+ (↑c : SimpleContinuedFraction α) = c.val :=
rfl
-#align continued_fraction.coe_to_simple_continued_fraction [anonymous]
+#align continued_fraction.coe_to_simple_continued_fraction ContinuedFraction.coe_to_simpleContinuedFraction
/-- Lift a cf to a scf using the inclusion map. -/
instance hasCoeToGeneralizedContinuedFraction :
@@ -330,11 +327,10 @@ instance hasCoeToGeneralizedContinuedFraction :
⟨fun c => ↑(↑c : SimpleContinuedFraction α)⟩
#align continued_fraction.has_coe_to_generalized_continued_fraction ContinuedFraction.hasCoeToGeneralizedContinuedFraction
-/- warning: continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
-theorem [anonymous] {c : ContinuedFraction α} : (↑c : GeneralizedContinuedFraction α) = c.val :=
+theorem coe_to_generalizedContinuedFraction {c : ContinuedFraction α} :
+ (↑c : GeneralizedContinuedFraction α) = c.val :=
rfl
-#align continued_fraction.coe_to_generalized_continued_fraction [anonymous]
+#align continued_fraction.coe_to_generalized_continued_fraction ContinuedFraction.coe_to_generalizedContinuedFraction
end ContinuedFraction
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -94,12 +94,6 @@ instance hasCoeToGeneralizedContinuedFractionPair : Coe (Pair α) (Pair β) :=
⟨map coe⟩
#align generalized_continued_fraction.pair.has_coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair
-/- warning: generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair -> GeneralizedContinuedFraction.Pair.coe_toPair is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_2}} [_inst_1 : Coe.{succ u_1, succ u_2} α β] {a : α} {b : α}, Eq.{succ u_2} (GeneralizedContinuedFraction.Pair.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair.{u_1, u_2} α β _inst_1)))) (GeneralizedContinuedFraction.Pair.mk.{u_1} α a b)) (GeneralizedContinuedFraction.Pair.mk.{u_2} β ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) a) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) b))
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_1}} [_inst_1 : Coe.{succ u_1, succ u_1} α β] {a : α} {b : α}, Eq.{succ u_1} (GeneralizedContinuedFraction.Pair.{u_1} β) (GeneralizedContinuedFraction.Pair.coeFn.{u_1, u_1} α β _inst_1 (GeneralizedContinuedFraction.Pair.mk.{u_1} α a b)) (GeneralizedContinuedFraction.Pair.mk.{u_1} β (Coe.coe.{succ u_1, succ u_1} α β _inst_1 a) (Coe.coe.{succ u_1, succ u_1} α β _inst_1 b))
-Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.coe_toPairₓ'. -/
@[simp, norm_cast]
theorem coe_toPair {a b : α} : (↑(Pair.mk a b) : Pair β) = Pair.mk (a : β) (b : β) :=
rfl
@@ -195,12 +189,6 @@ instance hasCoeToGeneralizedContinuedFraction :
⟨fun g => ⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩⟩
#align generalized_continued_fraction.has_coe_to_generalized_continued_fraction GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction
-/- warning: generalized_continued_fraction.coe_to_generalized_continued_fraction -> GeneralizedContinuedFraction.coe_toGeneralizedContinuedFraction is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} {β : Type.{u_2}} [_inst_1 : Coe.{succ u_1, succ u_2} α β] {g : GeneralizedContinuedFraction.{u_1} α}, Eq.{succ u_2} (GeneralizedContinuedFraction.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1, u_2} α β _inst_1)))) g) (GeneralizedContinuedFraction.mk.{u_2} β ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) (GeneralizedContinuedFraction.h.{u_1} α g)) (Stream'.Seq.map.{u_1, u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair.{u_1, u_2} α β _inst_1))))) (GeneralizedContinuedFraction.s.{u_1} α g)))
-but is expected to have type
- forall {α : Type.{u_1}} {β : Type.{u_1}} [_inst_1 : Coe.{succ u_1, succ u_1} α β] {g : GeneralizedContinuedFraction.{u_1} α}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} β) (GeneralizedContinuedFraction.coeFn.{u_1} α β _inst_1 g) (GeneralizedContinuedFraction.mk.{u_1} β (Coe.coe.{succ u_1, succ u_1} α β _inst_1 (GeneralizedContinuedFraction.h.{u_1} α g)) (Stream'.Seq.map.{u_1, u_1} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_1} β) (GeneralizedContinuedFraction.Pair.coeFn.{u_1, u_1} α β _inst_1) (GeneralizedContinuedFraction.s.{u_1} α g)))
-Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_toGeneralizedContinuedFractionₓ'. -/
@[simp, norm_cast]
theorem coe_toGeneralizedContinuedFraction {g : GeneralizedContinuedFraction α} :
(↑(g : GeneralizedContinuedFraction α) : GeneralizedContinuedFraction β) =
@@ -274,11 +262,6 @@ instance hasCoeToGeneralizedContinuedFraction :
#align simple_continued_fraction.has_coe_to_generalized_continued_fraction SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction
/- warning: simple_continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
-warning: simple_continued_fraction.coe_to_generalized_continued_fraction -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] {s : SimpleContinuedFraction.{u_1} α _inst_1}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1)))) s) (Subtype.val.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) (fun (g : GeneralizedContinuedFraction.{u_1} α) => GeneralizedContinuedFraction.IsSimpleContinuedFraction.{u_1} α g _inst_1) s)
-but is expected to have type
- forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
Case conversion may be inaccurate. Consider using '#align simple_continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
theorem [anonymous] {s : SimpleContinuedFraction α} :
(↑s : GeneralizedContinuedFraction α) = s.val :=
@@ -336,11 +319,6 @@ instance hasCoeToSimpleContinuedFraction : Coe (ContinuedFraction α) (SimpleCon
#align continued_fraction.has_coe_to_simple_continued_fraction ContinuedFraction.hasCoeToSimpleContinuedFraction
/- warning: continued_fraction.coe_to_simple_continued_fraction clashes with [anonymous] -> [anonymous]
-warning: continued_fraction.coe_to_simple_continued_fraction -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] [_inst_2 : Zero.{u_1} α] [_inst_3 : LT.{u_1} α] {c : ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3}, Eq.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Sort.{max 1 (succ u_1)}) [self : HasLiftT.{max 1 (succ u_1), max 1 (succ u_1)} a b] => self.0) (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (HasLiftT.mk.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (CoeTCₓ.coe.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (coeBase.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (ContinuedFraction.hasCoeToSimpleContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3)))) c) (Subtype.val.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) (fun (s : SimpleContinuedFraction.{u_1} α _inst_1) => SimpleContinuedFraction.IsContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3 s) c)
-but is expected to have type
- forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_simple_continued_fraction [anonymous]ₓ'. -/
theorem [anonymous] {c : ContinuedFraction α} : (↑c : SimpleContinuedFraction α) = c.val :=
rfl
@@ -353,11 +331,6 @@ instance hasCoeToGeneralizedContinuedFraction :
#align continued_fraction.has_coe_to_generalized_continued_fraction ContinuedFraction.hasCoeToGeneralizedContinuedFraction
/- warning: continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
-warning: continued_fraction.coe_to_generalized_continued_fraction -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] [_inst_2 : Zero.{u_1} α] [_inst_3 : LT.{u_1} α] {c : ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (ContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3)))) c) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1)))) (Subtype.val.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) (fun (s : SimpleContinuedFraction.{u_1} α _inst_1) => SimpleContinuedFraction.IsContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3 s) c))
-but is expected to have type
- forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
theorem [anonymous] {c : ContinuedFraction α} : (↑c : GeneralizedContinuedFraction α) = c.val :=
rfl
@@ -495,12 +468,6 @@ protected theorem ext_iff {g g' : GeneralizedContinuedFraction α} :
#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
-/
-/- warning: generalized_continued_fraction.ext -> GeneralizedContinuedFraction.ext is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {g : GeneralizedContinuedFraction.{u1} α} {g' : GeneralizedContinuedFraction.{u1} α}, (And (Eq.{succ u1} α (GeneralizedContinuedFraction.h.{u1} α g) (GeneralizedContinuedFraction.h.{u1} α g')) (Eq.{succ u1} (Stream'.Seq.{u1} (GeneralizedContinuedFraction.Pair.{u1} α)) (GeneralizedContinuedFraction.s.{u1} α g) (GeneralizedContinuedFraction.s.{u1} α g'))) -> (Eq.{succ u1} (GeneralizedContinuedFraction.{u1} α) g g')
-but is expected to have type
- forall {α : Type.{u1}} (g : GeneralizedContinuedFraction.{u1} α) (g' : GeneralizedContinuedFraction.{u1} α), (Eq.{succ u1} α (GeneralizedContinuedFraction.h.{u1} α g) (GeneralizedContinuedFraction.h.{u1} α g')) -> (Eq.{succ u1} (Stream'.Seq.{u1} (GeneralizedContinuedFraction.Pair.{u1} α)) (GeneralizedContinuedFraction.s.{u1} α g) (GeneralizedContinuedFraction.s.{u1} α g')) -> (Eq.{succ u1} (GeneralizedContinuedFraction.{u1} α) g g')
-Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.ext GeneralizedContinuedFraction.extₓ'. -/
@[ext]
protected theorem ext {g g' : GeneralizedContinuedFraction α} (hyp : g.h = g'.h ∧ g.s = g'.s) :
g = g' :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -170,9 +170,7 @@ def TerminatedAt (g : GeneralizedContinuedFraction α) (n : ℕ) : Prop :=
#print GeneralizedContinuedFraction.terminatedAtDecidable /-
/-- It is decidable whether a gcf terminated at a given position. -/
instance terminatedAtDecidable (g : GeneralizedContinuedFraction α) (n : ℕ) :
- Decidable (g.TerminatedAt n) := by
- unfold terminated_at
- infer_instance
+ Decidable (g.TerminatedAt n) := by unfold terminated_at; infer_instance
#align generalized_continued_fraction.terminated_at_decidable GeneralizedContinuedFraction.terminatedAtDecidable
-/
@@ -271,10 +269,8 @@ instance : Inhabited (SimpleContinuedFraction α) :=
/-- Lift a scf to a gcf using the inclusion map. -/
instance hasCoeToGeneralizedContinuedFraction :
- Coe (SimpleContinuedFraction α) (GeneralizedContinuedFraction α) :=
- by
- unfold SimpleContinuedFraction
- infer_instance
+ Coe (SimpleContinuedFraction α) (GeneralizedContinuedFraction α) := by
+ unfold SimpleContinuedFraction; infer_instance
#align simple_continued_fraction.has_coe_to_generalized_continued_fraction SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction
/- warning: simple_continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
@@ -336,9 +332,7 @@ instance : Inhabited (ContinuedFraction α) :=
/-- Lift a cf to a scf using the inclusion map. -/
instance hasCoeToSimpleContinuedFraction : Coe (ContinuedFraction α) (SimpleContinuedFraction α) :=
- by
- unfold ContinuedFraction
- infer_instance
+ by unfold ContinuedFraction; infer_instance
#align continued_fraction.has_coe_to_simple_continued_fraction ContinuedFraction.hasCoeToSimpleContinuedFraction
/- warning: continued_fraction.coe_to_simple_continued_fraction clashes with [anonymous] -> [anonymous]
@@ -497,10 +491,7 @@ namespace GeneralizedContinuedFraction
#print GeneralizedContinuedFraction.ext_iff /-
/-- Two gcfs `g` and `g'` are equal if and only if their components are equal. -/
protected theorem ext_iff {g g' : GeneralizedContinuedFraction α} :
- g = g' ↔ g.h = g'.h ∧ g.s = g'.s := by
- cases g
- cases g'
- simp
+ g = g' ↔ g.h = g'.h ∧ g.s = g'.s := by cases g; cases g'; simp
#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/738054fa93d43512da144ec45ce799d18fd44248
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
! This file was ported from Lean 3 source module algebra.continued_fractions.basic
-! leanprover-community/mathlib commit a7e36e48519ab281320c4d192da6a7b348ce40ad
+! leanprover-community/mathlib commit fe8d0ff42c3c24d789f491dc2622b6cac3d61564
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.Algebra.Field.Defs
/-!
# Basic Definitions/Theorems for Continued Fractions
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
## Summary
We define generalised, simple, and regular continued fractions and functions to evaluate their
mathlib commit https://github.com/leanprover-community/mathlib/commit/36b8aa61ea7c05727161f96a0532897bd72aedab
@@ -51,12 +51,14 @@ variable (α : Type _)
/-!### Definitions-/
+#print GeneralizedContinuedFraction.Pair /-
/-- We collect a partial numerator `aᵢ` and partial denominator `bᵢ` in a pair `⟨aᵢ,bᵢ⟩`. -/
protected structure GeneralizedContinuedFraction.Pair where
a : α
b : α
deriving Inhabited
#align generalized_continued_fraction.pair GeneralizedContinuedFraction.Pair
+-/
open GeneralizedContinuedFraction
@@ -72,10 +74,12 @@ variable {α}
instance [Repr α] : Repr (Pair α) :=
⟨fun p => "(a : " ++ repr p.a ++ ", b : " ++ repr p.b ++ ")"⟩
+#print GeneralizedContinuedFraction.Pair.map /-
/-- Maps a function `f` on both components of a given pair. -/
def map {β : Type _} (f : α → β) (gp : Pair α) : Pair β :=
⟨f gp.a, f gp.b⟩
#align generalized_continued_fraction.pair.map GeneralizedContinuedFraction.Pair.map
+-/
section coe
@@ -87,11 +91,16 @@ instance hasCoeToGeneralizedContinuedFractionPair : Coe (Pair α) (Pair β) :=
⟨map coe⟩
#align generalized_continued_fraction.pair.has_coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair
+/- warning: generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair -> GeneralizedContinuedFraction.Pair.coe_toPair is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u_1}} {β : Type.{u_2}} [_inst_1 : Coe.{succ u_1, succ u_2} α β] {a : α} {b : α}, Eq.{succ u_2} (GeneralizedContinuedFraction.Pair.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair.{u_1, u_2} α β _inst_1)))) (GeneralizedContinuedFraction.Pair.mk.{u_1} α a b)) (GeneralizedContinuedFraction.Pair.mk.{u_2} β ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) a) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) b))
+but is expected to have type
+ forall {α : Type.{u_1}} {β : Type.{u_1}} [_inst_1 : Coe.{succ u_1, succ u_1} α β] {a : α} {b : α}, Eq.{succ u_1} (GeneralizedContinuedFraction.Pair.{u_1} β) (GeneralizedContinuedFraction.Pair.coeFn.{u_1, u_1} α β _inst_1 (GeneralizedContinuedFraction.Pair.mk.{u_1} α a b)) (GeneralizedContinuedFraction.Pair.mk.{u_1} β (Coe.coe.{succ u_1, succ u_1} α β _inst_1 a) (Coe.coe.{succ u_1, succ u_1} α β _inst_1 b))
+Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.coe_toPairₓ'. -/
@[simp, norm_cast]
-theorem coe_to_generalized_continued_fraction_pair {a b : α} :
- (↑(Pair.mk a b) : Pair β) = Pair.mk (a : β) (b : β) :=
+theorem coe_toPair {a b : α} : (↑(Pair.mk a b) : Pair β) = Pair.mk (a : β) (b : β) :=
rfl
-#align generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.coe_to_generalized_continued_fraction_pair
+#align generalized_continued_fraction.pair.coe_to_generalized_continued_fraction_pair GeneralizedContinuedFraction.Pair.coe_toPair
end coe
@@ -99,6 +108,7 @@ end GeneralizedContinuedFraction.Pair
variable (α)
+#print GeneralizedContinuedFraction /-
/-- A *generalised continued fraction* (gcf) is a potentially infinite expression of the form
$$
h + \dfrac{a_0}
@@ -117,45 +127,58 @@ structure GeneralizedContinuedFraction where
h : α
s : Seq <| Pair α
#align generalized_continued_fraction GeneralizedContinuedFraction
+-/
variable {α}
namespace GeneralizedContinuedFraction
+#print GeneralizedContinuedFraction.ofInteger /-
/-- Constructs a generalized continued fraction without fractional part. -/
def ofInteger (a : α) : GeneralizedContinuedFraction α :=
⟨a, Seq.nil⟩
#align generalized_continued_fraction.of_integer GeneralizedContinuedFraction.ofInteger
+-/
instance [Inhabited α] : Inhabited (GeneralizedContinuedFraction α) :=
⟨ofInteger default⟩
+#print GeneralizedContinuedFraction.partialNumerators /-
/-- Returns the sequence of partial numerators `aᵢ` of `g`. -/
def partialNumerators (g : GeneralizedContinuedFraction α) : Seq α :=
g.s.map Pair.a
#align generalized_continued_fraction.partial_numerators GeneralizedContinuedFraction.partialNumerators
+-/
+#print GeneralizedContinuedFraction.partialDenominators /-
/-- Returns the sequence of partial denominators `bᵢ` of `g`. -/
def partialDenominators (g : GeneralizedContinuedFraction α) : Seq α :=
g.s.map Pair.b
#align generalized_continued_fraction.partial_denominators GeneralizedContinuedFraction.partialDenominators
+-/
+#print GeneralizedContinuedFraction.TerminatedAt /-
/-- A gcf terminated at position `n` if its sequence terminates at position `n`. -/
def TerminatedAt (g : GeneralizedContinuedFraction α) (n : ℕ) : Prop :=
g.s.TerminatedAt n
#align generalized_continued_fraction.terminated_at GeneralizedContinuedFraction.TerminatedAt
+-/
+#print GeneralizedContinuedFraction.terminatedAtDecidable /-
/-- It is decidable whether a gcf terminated at a given position. -/
instance terminatedAtDecidable (g : GeneralizedContinuedFraction α) (n : ℕ) :
Decidable (g.TerminatedAt n) := by
unfold terminated_at
infer_instance
#align generalized_continued_fraction.terminated_at_decidable GeneralizedContinuedFraction.terminatedAtDecidable
+-/
+#print GeneralizedContinuedFraction.Terminates /-
/-- A gcf terminates if its sequence terminates. -/
def Terminates (g : GeneralizedContinuedFraction α) : Prop :=
g.s.Terminates
#align generalized_continued_fraction.terminates GeneralizedContinuedFraction.Terminates
+-/
section coe
@@ -171,17 +194,24 @@ instance hasCoeToGeneralizedContinuedFraction :
⟨fun g => ⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩⟩
#align generalized_continued_fraction.has_coe_to_generalized_continued_fraction GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction
+/- warning: generalized_continued_fraction.coe_to_generalized_continued_fraction -> GeneralizedContinuedFraction.coe_toGeneralizedContinuedFraction is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u_1}} {β : Type.{u_2}} [_inst_1 : Coe.{succ u_1, succ u_2} α β] {g : GeneralizedContinuedFraction.{u_1} α}, Eq.{succ u_2} (GeneralizedContinuedFraction.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.{u_1} α) (GeneralizedContinuedFraction.{u_2} β) (GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1, u_2} α β _inst_1)))) g) (GeneralizedContinuedFraction.mk.{u_2} β ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) α β (HasLiftT.mk.{succ u_1, succ u_2} α β (CoeTCₓ.coe.{succ u_1, succ u_2} α β (coeBase.{succ u_1, succ u_2} α β _inst_1))) (GeneralizedContinuedFraction.h.{u_1} α g)) (Stream'.Seq.map.{u_1, u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) ((fun (a : Type.{u_1}) (b : Type.{u_2}) [self : HasLiftT.{succ u_1, succ u_2} a b] => self.0) (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (HasLiftT.mk.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (CoeTCₓ.coe.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (coeBase.{succ u_1, succ u_2} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_2} β) (GeneralizedContinuedFraction.Pair.hasCoeToGeneralizedContinuedFractionPair.{u_1, u_2} α β _inst_1))))) (GeneralizedContinuedFraction.s.{u_1} α g)))
+but is expected to have type
+ forall {α : Type.{u_1}} {β : Type.{u_1}} [_inst_1 : Coe.{succ u_1, succ u_1} α β] {g : GeneralizedContinuedFraction.{u_1} α}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} β) (GeneralizedContinuedFraction.coeFn.{u_1} α β _inst_1 g) (GeneralizedContinuedFraction.mk.{u_1} β (Coe.coe.{succ u_1, succ u_1} α β _inst_1 (GeneralizedContinuedFraction.h.{u_1} α g)) (Stream'.Seq.map.{u_1, u_1} (GeneralizedContinuedFraction.Pair.{u_1} α) (GeneralizedContinuedFraction.Pair.{u_1} β) (GeneralizedContinuedFraction.Pair.coeFn.{u_1, u_1} α β _inst_1) (GeneralizedContinuedFraction.s.{u_1} α g)))
+Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_toGeneralizedContinuedFractionₓ'. -/
@[simp, norm_cast]
-theorem coe_to_generalizedContinuedFraction {g : GeneralizedContinuedFraction α} :
+theorem coe_toGeneralizedContinuedFraction {g : GeneralizedContinuedFraction α} :
(↑(g : GeneralizedContinuedFraction α) : GeneralizedContinuedFraction β) =
⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩ :=
rfl
-#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_to_generalizedContinuedFraction
+#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_toGeneralizedContinuedFraction
end coe
end GeneralizedContinuedFraction
+#print GeneralizedContinuedFraction.IsSimpleContinuedFraction /-
/-- A generalized continued fraction is a *simple continued fraction* if all partial numerators are
equal to one.
$$
@@ -196,9 +226,11 @@ def GeneralizedContinuedFraction.IsSimpleContinuedFraction (g : GeneralizedConti
[One α] : Prop :=
∀ (n : ℕ) (aₙ : α), g.partialNumerators.get? n = some aₙ → aₙ = 1
#align generalized_continued_fraction.is_simple_continued_fraction GeneralizedContinuedFraction.IsSimpleContinuedFraction
+-/
variable (α)
+#print SimpleContinuedFraction /-
/-- A *simple continued fraction* (scf) is a generalized continued fraction (gcf) whose partial
numerators are equal to one.
$$
@@ -215,6 +247,7 @@ It is encoded as the subtype of gcfs that satisfy
def SimpleContinuedFraction [One α] :=
{ g : GeneralizedContinuedFraction α // g.IsSimpleContinuedFraction }
#align simple_continued_fraction SimpleContinuedFraction
+-/
variable {α}
@@ -223,10 +256,12 @@ namespace SimpleContinuedFraction
variable [One α]
+#print SimpleContinuedFraction.ofInteger /-
/-- Constructs a simple continued fraction without fractional part. -/
def ofInteger (a : α) : SimpleContinuedFraction α :=
⟨GeneralizedContinuedFraction.ofInteger a, fun n aₙ h => by cases h⟩
#align simple_continued_fraction.of_integer SimpleContinuedFraction.ofInteger
+-/
instance : Inhabited (SimpleContinuedFraction α) :=
⟨ofInteger 1⟩
@@ -239,13 +274,21 @@ instance hasCoeToGeneralizedContinuedFraction :
infer_instance
#align simple_continued_fraction.has_coe_to_generalized_continued_fraction SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction
-theorem coe_to_generalizedContinuedFraction {s : SimpleContinuedFraction α} :
+/- warning: simple_continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
+warning: simple_continued_fraction.coe_to_generalized_continued_fraction -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] {s : SimpleContinuedFraction.{u_1} α _inst_1}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1)))) s) (Subtype.val.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) (fun (g : GeneralizedContinuedFraction.{u_1} α) => GeneralizedContinuedFraction.IsSimpleContinuedFraction.{u_1} α g _inst_1) s)
+but is expected to have type
+ forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
+Case conversion may be inaccurate. Consider using '#align simple_continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
+theorem [anonymous] {s : SimpleContinuedFraction α} :
(↑s : GeneralizedContinuedFraction α) = s.val :=
rfl
-#align simple_continued_fraction.coe_to_generalized_continued_fraction SimpleContinuedFraction.coe_to_generalizedContinuedFraction
+#align simple_continued_fraction.coe_to_generalized_continued_fraction [anonymous]
end SimpleContinuedFraction
+#print SimpleContinuedFraction.IsContinuedFraction /-
/--
A simple continued fraction is a *(regular) continued fraction* ((r)cf) if all partial denominators
`bᵢ` are positive, i.e. `0 < bᵢ`.
@@ -255,9 +298,11 @@ def SimpleContinuedFraction.IsContinuedFraction [One α] [Zero α] [LT α]
∀ (n : ℕ) (bₙ : α),
(↑s : GeneralizedContinuedFraction α).partialDenominators.get? n = some bₙ → 0 < bₙ
#align simple_continued_fraction.is_continued_fraction SimpleContinuedFraction.IsContinuedFraction
+-/
variable (α)
+#print ContinuedFraction /-
/-- A *(regular) continued fraction* ((r)cf) is a simple continued fraction (scf) whose partial
denominators are all positive. It is the subtype of scfs that satisfy
`simple_continued_fraction.is_continued_fraction`.
@@ -265,6 +310,7 @@ denominators are all positive. It is the subtype of scfs that satisfy
def ContinuedFraction [One α] [Zero α] [LT α] :=
{ s : SimpleContinuedFraction α // s.IsContinuedFraction }
#align continued_fraction ContinuedFraction
+-/
variable {α}
@@ -275,10 +321,12 @@ namespace ContinuedFraction
variable [One α] [Zero α] [LT α]
+#print ContinuedFraction.ofInteger /-
/-- Constructs a continued fraction without fractional part. -/
def ofInteger (a : α) : ContinuedFraction α :=
⟨SimpleContinuedFraction.ofInteger a, fun n bₙ h => by cases h⟩
#align continued_fraction.of_integer ContinuedFraction.ofInteger
+-/
instance : Inhabited (ContinuedFraction α) :=
⟨ofInteger 0⟩
@@ -290,10 +338,16 @@ instance hasCoeToSimpleContinuedFraction : Coe (ContinuedFraction α) (SimpleCon
infer_instance
#align continued_fraction.has_coe_to_simple_continued_fraction ContinuedFraction.hasCoeToSimpleContinuedFraction
-theorem coe_to_simpleContinuedFraction {c : ContinuedFraction α} :
- (↑c : SimpleContinuedFraction α) = c.val :=
+/- warning: continued_fraction.coe_to_simple_continued_fraction clashes with [anonymous] -> [anonymous]
+warning: continued_fraction.coe_to_simple_continued_fraction -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] [_inst_2 : Zero.{u_1} α] [_inst_3 : LT.{u_1} α] {c : ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3}, Eq.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Sort.{max 1 (succ u_1)}) [self : HasLiftT.{max 1 (succ u_1), max 1 (succ u_1)} a b] => self.0) (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (HasLiftT.mk.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (CoeTCₓ.coe.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (coeBase.{max 1 (succ u_1), max 1 (succ u_1)} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (SimpleContinuedFraction.{u_1} α _inst_1) (ContinuedFraction.hasCoeToSimpleContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3)))) c) (Subtype.val.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) (fun (s : SimpleContinuedFraction.{u_1} α _inst_1) => SimpleContinuedFraction.IsContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3 s) c)
+but is expected to have type
+ forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
+Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_simple_continued_fraction [anonymous]ₓ'. -/
+theorem [anonymous] {c : ContinuedFraction α} : (↑c : SimpleContinuedFraction α) = c.val :=
rfl
-#align continued_fraction.coe_to_simple_continued_fraction ContinuedFraction.coe_to_simpleContinuedFraction
+#align continued_fraction.coe_to_simple_continued_fraction [anonymous]
/-- Lift a cf to a scf using the inclusion map. -/
instance hasCoeToGeneralizedContinuedFraction :
@@ -301,10 +355,16 @@ instance hasCoeToGeneralizedContinuedFraction :
⟨fun c => ↑(↑c : SimpleContinuedFraction α)⟩
#align continued_fraction.has_coe_to_generalized_continued_fraction ContinuedFraction.hasCoeToGeneralizedContinuedFraction
-theorem coe_to_generalizedContinuedFraction {c : ContinuedFraction α} :
- (↑c : GeneralizedContinuedFraction α) = c.val :=
+/- warning: continued_fraction.coe_to_generalized_continued_fraction clashes with [anonymous] -> [anonymous]
+warning: continued_fraction.coe_to_generalized_continued_fraction -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u_1}} [_inst_1 : One.{u_1} α] [_inst_2 : Zero.{u_1} α] [_inst_3 : LT.{u_1} α] {c : ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3}, Eq.{succ u_1} (GeneralizedContinuedFraction.{u_1} α) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (ContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3) (GeneralizedContinuedFraction.{u_1} α) (ContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3)))) c) ((fun (a : Sort.{max 1 (succ u_1)}) (b : Type.{u_1}) [self : HasLiftT.{max 1 (succ u_1), succ u_1} a b] => self.0) (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (HasLiftT.mk.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (CoeTCₓ.coe.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (coeBase.{max 1 (succ u_1), succ u_1} (SimpleContinuedFraction.{u_1} α _inst_1) (GeneralizedContinuedFraction.{u_1} α) (SimpleContinuedFraction.hasCoeToGeneralizedContinuedFraction.{u_1} α _inst_1)))) (Subtype.val.{max 1 (succ u_1)} (SimpleContinuedFraction.{u_1} α _inst_1) (fun (s : SimpleContinuedFraction.{u_1} α _inst_1) => SimpleContinuedFraction.IsContinuedFraction.{u_1} α _inst_1 _inst_2 _inst_3 s) c))
+but is expected to have type
+ forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
+Case conversion may be inaccurate. Consider using '#align continued_fraction.coe_to_generalized_continued_fraction [anonymous]ₓ'. -/
+theorem [anonymous] {c : ContinuedFraction α} : (↑c : GeneralizedContinuedFraction α) = c.val :=
rfl
-#align continued_fraction.coe_to_generalized_continued_fraction ContinuedFraction.coe_to_generalizedContinuedFraction
+#align continued_fraction.coe_to_generalized_continued_fraction [anonymous]
end ContinuedFraction
@@ -333,20 +393,25 @@ We start with the definition of the recurrence relation. Given a gcf `g`, for al
-/
+#print GeneralizedContinuedFraction.nextNumerator /-
/-- Returns the next numerator `Aₙ = bₙ₋₁ * Aₙ₋₁ + aₙ₋₁ * Aₙ₋₂`, where `predA` is `Aₙ₋₁`,
`ppredA` is `Aₙ₋₂`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
-/
def nextNumerator (a b ppredA predA : K) : K :=
b * predA + a * ppredA
#align generalized_continued_fraction.next_numerator GeneralizedContinuedFraction.nextNumerator
+-/
+#print GeneralizedContinuedFraction.nextDenominator /-
/-- Returns the next denominator `Bₙ = bₙ₋₁ * Bₙ₋₁ + aₙ₋₁ * Bₙ₋₂``, where `predB` is `Bₙ₋₁` and
`ppredB` is `Bₙ₋₂`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
-/
def nextDenominator (aₙ bₙ ppredB predB : K) : K :=
bₙ * predB + aₙ * ppredB
#align generalized_continued_fraction.next_denominator GeneralizedContinuedFraction.nextDenominator
+-/
+#print GeneralizedContinuedFraction.nextContinuants /-
/--
Returns the next continuants `⟨Aₙ, Bₙ⟩` using `next_numerator` and `next_denominator`, where `pred`
is `⟨Aₙ₋₁, Bₙ₋₁⟩`, `ppred` is `⟨Aₙ₋₂, Bₙ₋₂⟩`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
@@ -354,7 +419,9 @@ is `⟨Aₙ₋₁, Bₙ₋₁⟩`, `ppred` is `⟨Aₙ₋₂, Bₙ₋₂⟩`, `a
def nextContinuants (a b : K) (ppred pred : Pair K) : Pair K :=
⟨nextNumerator a b ppred.a pred.a, nextDenominator a b ppred.b pred.b⟩
#align generalized_continued_fraction.next_continuants GeneralizedContinuedFraction.nextContinuants
+-/
+#print GeneralizedContinuedFraction.continuantsAux /-
/-- Returns the continuants `⟨Aₙ₋₁, Bₙ₋₁⟩` of `g`. -/
def continuantsAux (g : GeneralizedContinuedFraction K) : Stream' (Pair K)
| 0 => ⟨1, 0⟩
@@ -364,27 +431,37 @@ def continuantsAux (g : GeneralizedContinuedFraction K) : Stream' (Pair K)
| none => continuants_aux (n + 1)
| some gp => nextContinuants gp.a gp.b (continuants_aux n) (continuants_aux <| n + 1)
#align generalized_continued_fraction.continuants_aux GeneralizedContinuedFraction.continuantsAux
+-/
+#print GeneralizedContinuedFraction.continuants /-
/-- Returns the continuants `⟨Aₙ, Bₙ⟩` of `g`. -/
def continuants (g : GeneralizedContinuedFraction K) : Stream' (Pair K) :=
g.continuantsAux.tail
#align generalized_continued_fraction.continuants GeneralizedContinuedFraction.continuants
+-/
+#print GeneralizedContinuedFraction.numerators /-
/-- Returns the numerators `Aₙ` of `g`. -/
def numerators (g : GeneralizedContinuedFraction K) : Stream' K :=
g.continuants.map Pair.a
#align generalized_continued_fraction.numerators GeneralizedContinuedFraction.numerators
+-/
+#print GeneralizedContinuedFraction.denominators /-
/-- Returns the denominators `Bₙ` of `g`. -/
def denominators (g : GeneralizedContinuedFraction K) : Stream' K :=
g.continuants.map Pair.b
#align generalized_continued_fraction.denominators GeneralizedContinuedFraction.denominators
+-/
+#print GeneralizedContinuedFraction.convergents /-
/-- Returns the convergents `Aₙ / Bₙ` of `g`, where `Aₙ, Bₙ` are the nth continuants of `g`. -/
def convergents (g : GeneralizedContinuedFraction K) : Stream' K := fun n : ℕ =>
g.numerators n / g.denominators n
#align generalized_continued_fraction.convergents GeneralizedContinuedFraction.convergents
+-/
+#print GeneralizedContinuedFraction.convergents'Aux /-
/--
Returns the approximation of the fraction described by the given sequence up to a given position n.
For example, `convergents'_aux [(1, 2), (3, 4), (5, 6)] 2 = 1 / (2 + 3 / 4)` and
@@ -397,7 +474,9 @@ def convergents'Aux : Seq (Pair K) → ℕ → K
| none => 0
| some gp => gp.a / (gp.b + convergents'_aux s.tail n)
#align generalized_continued_fraction.convergents'_aux GeneralizedContinuedFraction.convergents'Aux
+-/
+#print GeneralizedContinuedFraction.convergents' /-
/-- Returns the convergents of `g` by evaluating the fraction described by `g` up to a given
position `n`. For example, `convergents' [9; (1, 2), (3, 4), (5, 6)] 2 = 9 + 1 / (2 + 3 / 4)` and
`convergents' [9; (1, 2), (3, 4), (5, 6)] 0 = 9`
@@ -405,12 +484,14 @@ position `n`. For example, `convergents' [9; (1, 2), (3, 4), (5, 6)] 2 = 9 + 1 /
def convergents' (g : GeneralizedContinuedFraction K) (n : ℕ) : K :=
g.h + convergents'Aux g.s n
#align generalized_continued_fraction.convergents' GeneralizedContinuedFraction.convergents'
+-/
end GeneralizedContinuedFraction
-- Now, some basic, general theorems
namespace GeneralizedContinuedFraction
+#print GeneralizedContinuedFraction.ext_iff /-
/-- Two gcfs `g` and `g'` are equal if and only if their components are equal. -/
protected theorem ext_iff {g g' : GeneralizedContinuedFraction α} :
g = g' ↔ g.h = g'.h ∧ g.s = g'.s := by
@@ -418,7 +499,14 @@ protected theorem ext_iff {g g' : GeneralizedContinuedFraction α} :
cases g'
simp
#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
+-/
+/- warning: generalized_continued_fraction.ext -> GeneralizedContinuedFraction.ext is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {g : GeneralizedContinuedFraction.{u1} α} {g' : GeneralizedContinuedFraction.{u1} α}, (And (Eq.{succ u1} α (GeneralizedContinuedFraction.h.{u1} α g) (GeneralizedContinuedFraction.h.{u1} α g')) (Eq.{succ u1} (Stream'.Seq.{u1} (GeneralizedContinuedFraction.Pair.{u1} α)) (GeneralizedContinuedFraction.s.{u1} α g) (GeneralizedContinuedFraction.s.{u1} α g'))) -> (Eq.{succ u1} (GeneralizedContinuedFraction.{u1} α) g g')
+but is expected to have type
+ forall {α : Type.{u1}} (g : GeneralizedContinuedFraction.{u1} α) (g' : GeneralizedContinuedFraction.{u1} α), (Eq.{succ u1} α (GeneralizedContinuedFraction.h.{u1} α g) (GeneralizedContinuedFraction.h.{u1} α g')) -> (Eq.{succ u1} (Stream'.Seq.{u1} (GeneralizedContinuedFraction.Pair.{u1} α)) (GeneralizedContinuedFraction.s.{u1} α g) (GeneralizedContinuedFraction.s.{u1} α g')) -> (Eq.{succ u1} (GeneralizedContinuedFraction.{u1} α) g g')
+Case conversion may be inaccurate. Consider using '#align generalized_continued_fraction.ext GeneralizedContinuedFraction.extₓ'. -/
@[ext]
protected theorem ext {g g' : GeneralizedContinuedFraction α} (hyp : g.h = g'.h ∧ g.s = g'.s) :
g = g' :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/09079525fd01b3dda35e96adaa08d2f943e1648c
@@ -60,7 +60,7 @@ protected structure GeneralizedContinuedFraction.Pair where
open GeneralizedContinuedFraction
-/- ./././Mathport/Syntax/Translate/Command.lean:224:11: unsupported: unusual advanced open style -/
+/- ./././Mathport/Syntax/Translate/Command.lean:229:11: unsupported: unusual advanced open style -/
/-! Interlude: define some expected coercions and instances. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/b685f506164f8d17a6404048bc4d696739c5d976
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
! This file was ported from Lean 3 source module algebra.continued_fractions.basic
-! leanprover-community/mathlib commit 2738d2ca56cbc63be80c3bd48e9ed90ad94e947d
+! leanprover-community/mathlib commit a7e36e48519ab281320c4d192da6a7b348ce40ad
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -60,6 +60,7 @@ protected structure GeneralizedContinuedFraction.Pair where
open GeneralizedContinuedFraction
+/- ./././Mathport/Syntax/Translate/Command.lean:224:11: unsupported: unusual advanced open style -/
/-! Interlude: define some expected coercions and instances. -/
@@ -114,7 +115,7 @@ For convenience, one often writes `[h; (a₀, b₀), (a₁, b₁), (a₂, b₂),
-/
structure GeneralizedContinuedFraction where
h : α
- s : SeqCat <| Pair α
+ s : Seq <| Pair α
#align generalized_continued_fraction GeneralizedContinuedFraction
variable {α}
@@ -123,19 +124,19 @@ namespace GeneralizedContinuedFraction
/-- Constructs a generalized continued fraction without fractional part. -/
def ofInteger (a : α) : GeneralizedContinuedFraction α :=
- ⟨a, SeqCat.nil⟩
+ ⟨a, Seq.nil⟩
#align generalized_continued_fraction.of_integer GeneralizedContinuedFraction.ofInteger
instance [Inhabited α] : Inhabited (GeneralizedContinuedFraction α) :=
⟨ofInteger default⟩
/-- Returns the sequence of partial numerators `aᵢ` of `g`. -/
-def partialNumerators (g : GeneralizedContinuedFraction α) : SeqCat α :=
+def partialNumerators (g : GeneralizedContinuedFraction α) : Seq α :=
g.s.map Pair.a
#align generalized_continued_fraction.partial_numerators GeneralizedContinuedFraction.partialNumerators
/-- Returns the sequence of partial denominators `bᵢ` of `g`. -/
-def partialDenominators (g : GeneralizedContinuedFraction α) : SeqCat α :=
+def partialDenominators (g : GeneralizedContinuedFraction α) : Seq α :=
g.s.map Pair.b
#align generalized_continued_fraction.partial_denominators GeneralizedContinuedFraction.partialDenominators
@@ -167,13 +168,13 @@ variable {β : Type _} [Coe α β]
/-- Coerce a gcf by elementwise coercion. -/
instance hasCoeToGeneralizedContinuedFraction :
Coe (GeneralizedContinuedFraction α) (GeneralizedContinuedFraction β) :=
- ⟨fun g => ⟨(g.h : β), (g.s.map coe : SeqCat <| Pair β)⟩⟩
+ ⟨fun g => ⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩⟩
#align generalized_continued_fraction.has_coe_to_generalized_continued_fraction GeneralizedContinuedFraction.hasCoeToGeneralizedContinuedFraction
@[simp, norm_cast]
theorem coe_to_generalizedContinuedFraction {g : GeneralizedContinuedFraction α} :
(↑(g : GeneralizedContinuedFraction α) : GeneralizedContinuedFraction β) =
- ⟨(g.h : β), (g.s.map coe : SeqCat <| Pair β)⟩ :=
+ ⟨(g.h : β), (g.s.map coe : Seq <| Pair β)⟩ :=
rfl
#align generalized_continued_fraction.coe_to_generalized_continued_fraction GeneralizedContinuedFraction.coe_to_generalizedContinuedFraction
@@ -389,7 +390,7 @@ Returns the approximation of the fraction described by the given sequence up to
For example, `convergents'_aux [(1, 2), (3, 4), (5, 6)] 2 = 1 / (2 + 3 / 4)` and
`convergents'_aux [(1, 2), (3, 4), (5, 6)] 0 = 0`.
-/
-def convergents'Aux : SeqCat (Pair K) → ℕ → K
+def convergents'Aux : Seq (Pair K) → ℕ → K
| s, 0 => 0
| s, n + 1 =>
match s.headI with
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -42,7 +42,7 @@ numerics, number theory, approximations, fractions
-/
-- Fix a carrier `α`.
-variable (α : Type _)
+variable (α : Type*)
/-!### Definitions-/
@@ -69,14 +69,14 @@ instance [Repr α] : Repr (Pair α) :=
⟨fun p _ ↦ "(a : " ++ repr p.a ++ ", b : " ++ repr p.b ++ ")"⟩
/-- Maps a function `f` on both components of a given pair. -/
-def map {β : Type _} (f : α → β) (gp : Pair α) : Pair β :=
+def map {β : Type*} (f : α → β) (gp : Pair α) : Pair β :=
⟨f gp.a, f gp.b⟩
#align generalized_continued_fraction.pair.map GeneralizedContinuedFraction.Pair.map
section coe
-- Fix another type `β` which we will convert to.
-variable {β : Type _} [Coe α β]
+variable {β : Type*} [Coe α β]
-- Porting note: added so we can add the `@[coe]` attribute
/-- The coercion between numerator-denominator pairs happens componentwise. -/
@@ -163,7 +163,7 @@ section coe
/-! Interlude: define some expected coercions. -/
-- Fix another type `β` which we will convert to.
-variable {β : Type _} [Coe α β]
+variable {β : Type*} [Coe α β]
-- Porting note: Added to put `@[coe]` attr on it.
/-- The coercion between `GeneralizedContinuedFraction` happens on the head term
@@ -317,7 +317,7 @@ For (r)cfs, these computations are equivalent as shown in
-/
-- Fix a division ring for the computations.
-variable {K : Type _} [DivisionRing K]
+variable {K : Type*} [DivisionRing K]
/-!
We start with the definition of the recurrence relation. Given a gcf `g`, for all `n ≥ 1`, we define
@@ -2,15 +2,12 @@
Copyright (c) 2019 Kevin Kappelmann. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
-
-! This file was ported from Lean 3 source module algebra.continued_fractions.basic
-! leanprover-community/mathlib commit a7e36e48519ab281320c4d192da6a7b348ce40ad
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Seq.Seq
import Mathlib.Algebra.Field.Defs
+#align_import algebra.continued_fractions.basic from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
+
/-!
# Basic Definitions/Theorems for Continued Fractions
@@ -112,13 +112,15 @@ We store the sequence of partial numerators and denominators in a sequence of
`GeneralizedContinuedFraction.Pair`s `s`.
For convenience, one often writes `[h; (a₀, b₀), (a₁, b₁), (a₂, b₂),...]`.
-/
-@[ext] -- Porting note: added to replace the manually written ext lemmas
+@[ext]
structure GeneralizedContinuedFraction where
/-- Head term -/
h : α
/-- Sequence of partial numerator and denominator pairs. -/
s : Stream'.Seq <| Pair α
#align generalized_continued_fraction GeneralizedContinuedFraction
+#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
+#align generalized_continued_fraction.ext GeneralizedContinuedFraction.ext
variable {α}
@@ -403,8 +405,3 @@ def convergents' (g : GeneralizedContinuedFraction K) (n : ℕ) : K :=
#align generalized_continued_fraction.convergents' GeneralizedContinuedFraction.convergents'
end GeneralizedContinuedFraction
-
--- Porting note: The `ext`-lemmas that were here can be autogenerated by
--- the `@[ext]` attribute on `GeneralizedContinuedFraction`.
-#align generalized_continued_fraction.ext_iff GeneralizedContinuedFraction.ext_iff
-#align generalized_continued_fraction.ext GeneralizedContinuedFraction.ext
The unported dependencies are