khanh2023 commited on
Commit
c52049f
·
verified ·
1 Parent(s): f61df24

Add files using upload-large-folder tool

Browse files
data_5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib.CategoryTheory.Sites.Abelian.decl.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"id":{"original":true,"range":[1006,1020]},"kind":"instance","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["CategoryTheory","sheafIsAbelian"],"params":[],"ref":{"original":true,"pp":"instance sheafIsAbelian : Abelian (Sheaf J D) :=\n let adj := sheafificationAdjunction J D\n abelianOfAdjunction _ _ (asIso adj.counit) adj","range":[997,1136]},"scopeInfo":{"currNamespace":["CategoryTheory"],"includeVars":[],"levelNames":[["u"],["v"],["w"],["w'"]],"omitVars":[],"openDecl":[{"simple":{"except":[],"namespace":["CategoryTheory","Limits"]}}],"scopedOpenDecl":[["CategoryTheory","Limits"],["CategoryTheory"]],"varDecls":["variable {C : Type u}","variable [Category.{v} C]","variable {D : Type w}","variable [Category.{w'} D]","variable [Abelian D]","variable {J : GrothendieckTopology C}","variable [HasSheafify J D]"]},"signature":{"original":true,"pp":" : Abelian (Sheaf J D)","range":[1021,1042]},"type":{"original":true,"pp":"Abelian (Sheaf J D)","range":[1023,1042]},"value":{"original":true,"pp":" :=\n let adj := sheafificationAdjunction J D\n abelianOfAdjunction _ _ (asIso adj.counit) adj","range":[1043,1136]}},{"id":{"original":true,"range":[1228,1252]},"kind":"instance","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["CategoryTheory","presheafToSheaf_additive"],"params":[],"ref":{"original":true,"pp":"instance presheafToSheaf_additive : (presheafToSheaf J D).Additive :=\n (presheafToSheaf J D).additive_of_preservesBinaryBiproducts","range":[1219,1350]},"scopeInfo":{"currNamespace":["CategoryTheory"],"includeVars":[],"levelNames":[["u"],["v"],["w"],["w'"]],"omitVars":[],"openDecl":[{"simple":{"except":[],"namespace":["CategoryTheory","Limits"]}}],"scopedOpenDecl":[["CategoryTheory","Limits"],["CategoryTheory"]],"varDecls":["variable {C : Type u}","variable [Category.{v} C]","variable {D : Type w}","variable [Category.{w'} D]","variable [Abelian D]","variable {J : GrothendieckTopology C}","variable [HasSheafify J D]"]},"signature":{"original":true,"pp":" : (presheafToSheaf J D).Additive","range":[1253,1285]},"type":{"original":true,"pp":"(presheafToSheaf J D).Additive","range":[1255,1285]},"value":{"original":true,"pp":" :=\n (presheafToSheaf J D).additive_of_preservesBinaryBiproducts","range":[1286,1350]}}]
data_5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib.CategoryTheory.Sites.Abelian.mod.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"docstring":["# Category of sheaves is abelian\nLet `C, D` be categories and `J` be a Grothendieck topology on `C`, when `D` is abelian and\nsheafification is possible in `C`, `Sheaf J D` is abelian as well (`sheafIsAbelian`).\n\nHence, `presheafToSheaf` is an additive functor (`presheafToSheaf_additive`).\n\n"],"imports":[["Init"],["Mathlib","CategoryTheory","Abelian","FunctorCategory"],["Mathlib","CategoryTheory","Preadditive","AdditiveFunctor"],["Mathlib","CategoryTheory","Abelian","Transfer"],["Mathlib","CategoryTheory","Sites","Limits"]]}
data_5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib.CategoryTheory.Sites.Hypercover.Zero.mod.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"docstring":["# 0-hypercovers\n\nGiven a coverage `J` on a category `C`, we define the type\nof `0`-hypercovers of an object `S : C`. They consist of a covering family\nof morphisms `X i ⟶ S` indexed by a type `I₀` such that the induced presieve is in `J`.\n\nWe define this with respect to a coverage and not to a Grothendieck topology, because this\nyields more control over the components of the cover.\n"],"imports":[["Init"],["Mathlib","CategoryTheory","Sites","Precoverage"],["Mathlib","CategoryTheory","Limits","Shapes","Products"]]}
data_5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib.Data.Nat.Digits.Defs.decl.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"id":{"original":true,"range":[1149,1159]},"kind":"definition","modifiers":{"attrs":[],"computeKind":"regular","docString":["(Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[1044,1144],"visibility":"regular"},"name":["Nat","digitsAux0"],"params":[],"ref":{"original":true,"pp":"/-- (Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. -/\ndef digitsAux0 : ℕ → List ℕ\n | 0 => []\n | n + 1 => [n + 1]","range":[1044,1209]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" : ℕ → List ℕ","range":[1160,1178]},"type":{"original":true,"pp":"ℕ → List ℕ","range":[1162,1178]},"value":{"original":true,"pp":"\n | 0 => []\n | n + 1 => [n + 1]","range":[1181,1209]}},{"id":{"original":true,"range":[1316,1326]},"kind":"definition","modifiers":{"attrs":[],"computeKind":"regular","docString":["(Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[1211,1311],"visibility":"regular"},"name":["Nat","digitsAux1"],"params":[{"bi":"default","id":[1328,1329],"ref":[1328,1329],"type":[1332,1335]}],"ref":{"original":true,"pp":"/-- (Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. -/\ndef digitsAux1 (n : ℕ) : List ℕ :=\n List.replicate n 1","range":[1211,1371]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n : ℕ) : List ℕ","range":[1327,1347]},"type":{"original":true,"pp":"List ℕ","range":[1339,1347]},"value":{"original":true,"pp":" :=\n List.replicate n 1","range":[1348,1371]}},{"id":{"original":true,"range":[1495,1504]},"kind":"definition","modifiers":{"attrs":[{"kind":"global","name":["semireducible"],"stx":[1476,1489]}],"computeKind":"regular","docString":["(Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[1373,1490],"visibility":"regular"},"name":["Nat","digitsAux"],"params":[{"bi":"default","id":[1506,1507],"ref":[1506,1507],"type":[1510,1513]},{"bi":"default","id":[1516,1517],"ref":[1516,1517],"type":[1520,1527]}],"ref":{"original":true,"pp":"/-- (Impl.) An auxiliary definition for `digits`, to help get the desired definitional unfolding. -/\n@[semireducible]\ndef digitsAux (b : ℕ) (h : 2 ≤ b) : ℕ → List ℕ\n | 0 => []\n | n + 1 => ((n + 1) % b) :: digitsAux b h ((n + 1) / b)\ndecreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h","range":[1373,1676]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) (h : 2 ≤ b) : ℕ → List ℕ","range":[1505,1547]},"type":{"original":true,"pp":"ℕ → List ℕ","range":[1531,1547]},"value":{"original":true,"pp":"\n | 0 => []\n | n + 1 => ((n + 1) % b) :: digitsAux b h ((n + 1) / b)\ndecreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h","range":[1550,1676]}},{"id":{"original":true,"range":[1694,1708]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[1680,1684]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[1678,1685],"visibility":"regular"},"name":["Nat","digitsAux_zero"],"params":[{"bi":"default","id":[1710,1711],"ref":[1710,1711],"type":[1714,1717]},{"bi":"default","id":[1720,1721],"ref":[1720,1721],"type":[1724,1731]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digitsAux_zero (b : ℕ) (h : 2 ≤ b) : digitsAux b h 0 = [] :=\n rfl","range":[1678,1762]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) (h : 2 ≤ b) : digitsAux b h 0 = []","range":[1709,1755]},"type":{"original":true,"pp":"digitsAux b h 0 = []","range":[1735,1755]},"value":{"original":true,"pp":" :=\n rfl","range":[1756,1762]}},{"id":{"original":true,"range":[1772,1785]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digitsAux_def"],"params":[{"bi":"default","id":[1787,1788],"ref":[1787,1788],"type":[1791,1794]},{"bi":"default","id":[1797,1798],"ref":[1797,1798],"type":[1801,1808]},{"bi":"default","id":[1811,1812],"ref":[1811,1812],"type":[1815,1818]},{"bi":"default","id":[1821,1822],"ref":[1821,1822],"type":[1825,1830]}],"ref":{"original":true,"pp":"theorem digitsAux_def (b : ℕ) (h : 2 ≤ b) (n : ℕ) (w : 0 < n) : digitsAux b h n = (n % b) :: digitsAux b h (n / b) :=\n by\n cases n\n · cases w\n · rw [digitsAux]","range":[1764,1937]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) (h : 2 ≤ b) (n : ℕ) (w : 0 < n) : digitsAux b h n = (n % b) :: digitsAux b h (n / b)","range":[1786,1888]},"type":{"original":true,"pp":"digitsAux b h n = (n % b) :: digitsAux b h (n / b)","range":[1838,1888]},"value":{"original":true,"pp":" := by\n cases n\n · cases w\n · rw [digitsAux]","range":[1889,1937]}},{"id":{"original":true,"range":[2579,2585]},"kind":"definition","modifiers":{"attrs":[],"computeKind":"regular","docString":["`digits b n` gives the digits, in little-endian order,\nof a natural number `n` in a specified base `b`.\n\nIn any base, we have `ofDigits b L = L.foldr (fun x y ↦ x + b * y) 0`.\n* For any `2 ≤ b`, we have `l < b` for any `l ∈ digits b n`,\n and the last digit is not zero.\n This uniquely specifies the behaviour of `digits b`.\n* For `b = 1`, we define `digits 1 n = List.replicate n 1`.\n* For `b = 0`, we define `digits 0 n = [n]`, except `digits 0 0 = []`.\n\nNote this differs from the existing `Nat.toDigits` in core, which is used for printing numerals.\nIn particular, `Nat.toDigits b 0 = ['0']`, while `digits b 0 = []`.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[1939,2574],"visibility":"regular"},"name":["Nat","digits"],"params":[],"ref":{"original":true,"pp":"/-- `digits b n` gives the digits, in little-endian order,\nof a natural number `n` in a specified base `b`.\n\nIn any base, we have `ofDigits b L = L.foldr (fun x y ↦ x + b * y) 0`.\n* For any `2 ≤ b`, we have `l < b` for any `l ∈ digits b n`,\n and the last digit is not zero.\n This uniquely specifies the behaviour of `digits b`.\n* For `b = 1`, we define `digits 1 n = List.replicate n 1`.\n* For `b = 0`, we define `digits 0 n = [n]`, except `digits 0 0 = []`.\n\nNote this differs from the existing `Nat.toDigits` in core, which is used for printing numerals.\nIn particular, `Nat.toDigits b 0 = ['0']`, while `digits b 0 = []`.\n-/\ndef digits : ℕ → ℕ → List ℕ\n | 0 => digitsAux0\n | 1 => digitsAux1\n | b + 2 => digitsAux (b + 2) (by simp)","range":[1939,2693]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" : ℕ → ℕ → List ℕ","range":[2586,2612]},"type":{"original":true,"pp":"ℕ → ℕ → List ℕ","range":[2588,2612]},"value":{"original":true,"pp":"\n | 0 => digitsAux0\n | 1 => digitsAux1\n | b + 2 => digitsAux (b + 2) (by simp)","range":[2615,2693]}},{"id":{"original":true,"range":[2711,2722]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[2697,2701]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[2695,2702],"visibility":"regular"},"name":["Nat","digits_zero"],"params":[{"bi":"default","id":[2724,2725],"ref":[2724,2725],"type":[2728,2731]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_zero (b : ℕ) : digits b 0 = [] := by\n rcases b with (_ | ⟨_ | ⟨_⟩⟩) <;> simp [digits, digitsAux0, digitsAux1]","range":[2695,2838]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) : digits b 0 = []","range":[2723,2750]},"type":{"original":true,"pp":"digits b 0 = []","range":[2735,2750]},"value":{"original":true,"pp":" := by rcases b with (_ | ⟨_ | ⟨_⟩⟩) <;> simp [digits, digitsAux0, digitsAux1]","range":[2751,2838]}},{"id":{"original":true,"range":[2848,2864]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_zero_zero"],"params":[],"ref":{"original":true,"pp":"theorem digits_zero_zero : digits 0 0 = [] :=\n rfl","range":[2840,2891]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" : digits 0 0 = []","range":[2865,2882]},"type":{"original":true,"pp":"digits 0 0 = []","range":[2867,2882]},"value":{"original":true,"pp":" :=\n rfl","range":[2883,2891]}},{"id":{"original":true,"range":[2909,2925]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[2895,2899]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[2893,2900],"visibility":"regular"},"name":["Nat","digits_zero_succ"],"params":[{"bi":"default","id":[2927,2928],"ref":[2927,2928],"type":[2931,2934]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_zero_succ (n : ℕ) : digits 0 n.succ = [n + 1] :=\n rfl","range":[2893,2970]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n : ℕ) : digits 0 n.succ = [n + 1]","range":[2926,2961]},"type":{"original":true,"pp":"digits 0 n.succ = [n + 1]","range":[2938,2961]},"value":{"original":true,"pp":" :=\n rfl","range":[2962,2970]}},{"id":{"original":true,"range":[2980,2997]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_zero_succ'"],"params":[],"ref":{"original":true,"pp":"theorem digits_zero_succ' : ∀ {n : ℕ}, n ≠ 0 → digits 0 n = [n]\n | 0, h => (h rfl).elim\n | _ + 1, _ => rfl","range":[2972,3088]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" : ∀ {n : ℕ}, n ≠ 0 → digits 0 n = [n]","range":[2998,3043]},"type":{"original":true,"pp":"∀ {n : ℕ}, n ≠ 0 → digits 0 n = [n]","range":[3000,3043]},"value":{"original":true,"pp":"\n | 0, h => (h rfl).elim\n | _ + 1, _ => rfl","range":[3046,3088]}},{"id":{"original":true,"range":[3106,3116]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[3092,3096]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[3090,3097],"visibility":"regular"},"name":["Nat","digits_one"],"params":[{"bi":"default","id":[3118,3119],"ref":[3118,3119],"type":[3122,3125]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_one (n : ℕ) : digits 1 n = List.replicate n 1 :=\n rfl","range":[3090,3169]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n : ℕ) : digits 1 n = List.replicate n 1","range":[3117,3160]},"type":{"original":true,"pp":"digits 1 n = List.replicate n 1","range":[3129,3160]},"value":{"original":true,"pp":" :=\n rfl","range":[3161,3169]}},{"id":{"original":true,"range":[3217,3232]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_one_succ"],"params":[{"bi":"default","id":[3234,3235],"ref":[3234,3235],"type":[3238,3241]}],"ref":{"original":true,"pp":"theorem digits_one_succ (n : ℕ) : digits 1 (n + 1) = 1 :: digits 1 n :=\n rfl","range":[3209,3288]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n : ℕ) : digits 1 (n + 1) = 1 :: digits 1 n","range":[3233,3279]},"type":{"original":true,"pp":"digits 1 (n + 1) = 1 :: digits 1 n","range":[3245,3279]},"value":{"original":true,"pp":" :=\n rfl","range":[3280,3288]}},{"id":{"original":true,"range":[3298,3320]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_add_two_add_one"],"params":[{"bi":"default","id":[3322,3323],"ref":[3322,3323],"type":[3328,3331]},{"bi":"default","id":[3324,3325],"ref":[3324,3325],"type":[3328,3331]}],"ref":{"original":true,"pp":"theorem digits_add_two_add_one (b n : ℕ) :\n digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2)) := by\n simp [digits, digitsAux_def]","range":[3290,3458]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b n : ℕ) : digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2))","range":[3321,3421]},"type":{"original":true,"pp":"digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2))","range":[3339,3421]},"value":{"original":true,"pp":" := by simp [digits, digitsAux_def]","range":[3422,3458]}},{"id":{"original":true,"range":[3474,3497]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[3462,3466]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[3460,3467],"visibility":"regular"},"name":["Nat","digits_of_two_le_of_pos"],"params":[{"bi":"implicit","id":[3499,3500],"ref":[3499,3500],"type":[3503,3506]},{"bi":"default","id":[3509,3511],"ref":[3509,3511],"type":[3514,3521]},{"bi":"default","id":[3524,3526],"ref":[3524,3526],"type":[3529,3534]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_of_two_le_of_pos {b : ℕ} (hb : 2 ≤ b) (hn : 0 < n) : Nat.digits b n = n % b :: Nat.digits b (n / b) := by\n rw [Nat.eq_add_of_sub_eq hb rfl, Nat.eq_add_of_sub_eq hn rfl, Nat.digits_add_two_add_one]","range":[3460,3686]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (hb : 2 ≤ b) (hn : 0 < n) : Nat.digits b n = n % b :: Nat.digits b (n / b)","range":[3498,3588]},"type":{"original":true,"pp":"Nat.digits b n = n % b :: Nat.digits b (n / b)","range":[3542,3588]},"value":{"original":true,"pp":" := by rw [Nat.eq_add_of_sub_eq hb rfl, Nat.eq_add_of_sub_eq hn rfl, Nat.digits_add_two_add_one]","range":[3589,3686]}},{"id":{"original":true,"range":[3696,3707]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_def'"],"params":[],"ref":{"original":true,"pp":"theorem digits_def' : ∀ {b : ℕ} (_ : 1 < b) {n : ℕ} (_ : 0 < n), digits b n = (n % b) :: digits b (n / b)\n | 0, h => absurd h (by decide)\n | 1, h => absurd h (by decide)\n | b + 2, _ => digitsAux_def _ (by simp) _","range":[3688,3913]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" : ∀ {b : ℕ} (_ : 1 < b) {n : ℕ} (_ : 0 < n), digits b n = (n % b) :: digits b (n / b)","range":[3708,3803]},"type":{"original":true,"pp":"∀ {b : ℕ} (_ : 1 < b) {n : ℕ} (_ : 0 < n), digits b n = (n % b) :: digits b (n / b)","range":[3714,3803]},"value":{"original":true,"pp":"\n | 0, h => absurd h (by decide)\n | 1, h => absurd h (by decide)\n | b + 2, _ => digitsAux_def _ (by simp) _","range":[3806,3913]}},{"id":{"original":true,"range":[3931,3943]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[3917,3921]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[3915,3922],"visibility":"regular"},"name":["Nat","digits_of_lt"],"params":[{"bi":"default","id":[3945,3946],"ref":[3945,3946],"type":[3951,3954]},{"bi":"default","id":[3947,3948],"ref":[3947,3948],"type":[3951,3954]},{"bi":"default","id":[3957,3959],"ref":[3957,3959],"type":[3962,3969]},{"bi":"default","id":[3972,3975],"ref":[3972,3975],"type":[3978,3983]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_of_lt (b x : ℕ) (hx : x ≠ 0) (hxb : x < b) : digits b x = [x] :=\n by\n rcases exists_eq_succ_of_ne_zero hx with ⟨x, rfl⟩\n rcases Nat.exists_eq_add_of_le' ((Nat.le_add_left 1 x).trans_lt hxb) with ⟨b, rfl⟩\n rw [digits_add_two_add_one, div_eq_of_lt hxb, digits_zero, mod_eq_of_lt hxb]","range":[3915,4233]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b x : ℕ) (hx : x ≠ 0) (hxb : x < b) : digits b x = [x]","range":[3944,4003]},"type":{"original":true,"pp":"digits b x = [x]","range":[3987,4003]},"value":{"original":true,"pp":" := by\n rcases exists_eq_succ_of_ne_zero hx with ⟨x, rfl⟩\n rcases Nat.exists_eq_add_of_le' ((Nat.le_add_left 1 x).trans_lt hxb) with ⟨b, rfl⟩\n rw [digits_add_two_add_one, div_eq_of_lt hxb, digits_zero, mod_eq_of_lt hxb]","range":[4004,4233]}},{"id":{"original":true,"range":[4243,4253]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_add"],"params":[{"bi":"default","id":[4255,4256],"ref":[4255,4256],"type":[4259,4262]},{"bi":"default","id":[4265,4266],"ref":[4265,4266],"type":[4269,4274]},{"bi":"default","id":[4277,4278],"ref":[4277,4278],"type":[4283,4286]},{"bi":"default","id":[4279,4280],"ref":[4279,4280],"type":[4283,4286]},{"bi":"default","id":[4289,4292],"ref":[4289,4292],"type":[4295,4300]},{"bi":"default","id":[4303,4306],"ref":[4303,4306],"type":[4309,4328]}],"ref":{"original":true,"pp":"theorem digits_add (b : ℕ) (h : 1 < b) (x y : ℕ) (hxb : x < b) (hxy : x ≠ 0 ∨ y ≠ 0) :\n digits b (x + b * y) = x :: digits b y :=\n by\n rcases Nat.exists_eq_add_of_le' h with ⟨b, rfl : _ = _ + 2⟩\n cases y\n · simp [hxb, hxy.resolve_right (absurd rfl)]\n dsimp [digits]\n rw [digitsAux_def]\n · congr\n · simp [Nat.add_mod, mod_eq_of_lt hxb]\n · simp [add_mul_div_left, div_eq_of_lt hxb]\n · apply Nat.succ_pos","range":[4235,4670]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) (h : 1 < b) (x y : ℕ) (hxb : x < b) (hxy : x ≠ 0 ∨ y ≠ 0) : digits b (x + b * y) = x :: digits b y","range":[4254,4374]},"type":{"original":true,"pp":"digits b (x + b * y) = x :: digits b y","range":[4336,4374]},"value":{"original":true,"pp":" := by\n rcases Nat.exists_eq_add_of_le' h with ⟨b, rfl : _ = _ + 2⟩\n cases y\n · simp [hxb, hxy.resolve_right (absurd rfl)]\n dsimp [digits]\n rw [digitsAux_def]\n · congr\n · simp [Nat.add_mod, mod_eq_of_lt hxb]\n · simp [add_mul_div_left, div_eq_of_lt hxb]\n · apply Nat.succ_pos","range":[4375,4670]}},{"id":{"original":true,"range":[4972,4980]},"kind":"definition","modifiers":{"attrs":[],"computeKind":"regular","docString":["`ofDigits b L` takes a list `L` of natural numbers, and interprets them\nas a number in semiring, as the little-endian digits in base `b`.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[4823,4967],"visibility":"regular"},"name":["Nat","ofDigits"],"params":[{"bi":"implicit","id":[4982,4984],"ref":[4982,4984],"type":[4987,4992]},{"bi":"instImplicit","id":null,"ref":null,"type":[4995,5006]},{"bi":"default","id":[5009,5010],"ref":[5009,5010],"type":[5013,5015]}],"ref":{"original":true,"pp":"/-- `ofDigits b L` takes a list `L` of natural numbers, and interprets them\nas a number in semiring, as the little-endian digits in base `b`.\n-/\ndef ofDigits {α : Type*} [Semiring α] (b : α) : List ℕ → α\n | [] => 0\n | h :: t => h + b * ofDigits b t","range":[4823,5081]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {α : Type*} [Semiring α] (b : α) : List ℕ → α","range":[4981,5034]},"type":{"original":true,"pp":"List ℕ → α","range":[5019,5034]},"value":{"original":true,"pp":"\n | [] => 0\n | h :: t => h + b * ofDigits b t","range":[5037,5081]}},{"id":{"original":true,"range":[5091,5108]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_eq_foldr"],"params":[{"bi":"implicit","id":[5110,5112],"ref":[5110,5112],"type":[5115,5120]},{"bi":"instImplicit","id":null,"ref":null,"type":[5123,5134]},{"bi":"default","id":[5137,5138],"ref":[5137,5138],"type":[5141,5143]},{"bi":"default","id":[5146,5147],"ref":[5146,5147],"type":[5150,5158]}],"ref":{"original":true,"pp":"theorem ofDigits_eq_foldr {α : Type*} [Semiring α] (b : α) (L : List ℕ) :\n ofDigits b L = List.foldr (fun x y => ↑x + b * y) 0 L := by\n induction L with\n | nil => rfl\n | cons d L ih => dsimp [ofDigits]; rw [ih]","range":[5083,5306]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {α : Type*} [Semiring α] (b : α) (L : List ℕ) : ofDigits b L = List.foldr (fun x y => ↑x + b * y) 0 L","range":[5109,5221]},"type":{"original":true,"pp":"ofDigits b L = List.foldr (fun x y => ↑x + b * y) 0 L","range":[5166,5221]},"value":{"original":true,"pp":" := by\n induction L with\n | nil => rfl\n | cons d L ih => dsimp [ofDigits]; rw [ih]","range":[5222,5306]}},{"id":{"original":true,"range":[5324,5336]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[5310,5314]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[5308,5315],"visibility":"regular"},"name":["Nat","ofDigits_nil"],"params":[{"bi":"implicit","id":[5338,5339],"ref":[5338,5339],"type":[5342,5345]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_nil {b : ℕ} : ofDigits b [] = 0 :=\n rfl","range":[5308,5373]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} : ofDigits b [] = 0","range":[5337,5366]},"type":{"original":true,"pp":"ofDigits b [] = 0","range":[5349,5366]},"value":{"original":true,"pp":" :=\n rfl","range":[5367,5373]}},{"id":{"original":true,"range":[5391,5409]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[5377,5381]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[5375,5382],"visibility":"regular"},"name":["Nat","ofDigits_singleton"],"params":[{"bi":"implicit","id":[5411,5412],"ref":[5411,5412],"type":[5417,5420]},{"bi":"implicit","id":[5413,5414],"ref":[5413,5414],"type":[5417,5420]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_singleton {b n : ℕ} : ofDigits b [n] = n := by simp [ofDigits]","range":[5375,5464]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b n : ℕ} : ofDigits b [n] = n","range":[5410,5442]},"type":{"original":true,"pp":"ofDigits b [n] = n","range":[5424,5442]},"value":{"original":true,"pp":" := by simp [ofDigits]","range":[5443,5464]}},{"id":{"original":true,"range":[5482,5499]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[5468,5472]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[5466,5473],"visibility":"regular"},"name":["Nat","ofDigits_one_cons"],"params":[{"bi":"implicit","id":[5501,5503],"ref":[5501,5503],"type":[5506,5511]},{"bi":"instImplicit","id":null,"ref":null,"type":[5514,5525]},{"bi":"default","id":[5528,5529],"ref":[5528,5529],"type":[5532,5535]},{"bi":"default","id":[5538,5539],"ref":[5538,5539],"type":[5542,5550]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_one_cons {α : Type*} [Semiring α] (h : ℕ) (L : List ℕ) :\n ofDigits (1 : α) (h :: L) = h + ofDigits 1 L := by simp [ofDigits]","range":[5466,5625]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {α : Type*} [Semiring α] (h : ℕ) (L : List ℕ) : ofDigits (1 : α) (h :: L) = h + ofDigits 1 L","range":[5500,5603]},"type":{"original":true,"pp":"ofDigits (1 : α) (h :: L) = h + ofDigits 1 L","range":[5558,5603]},"value":{"original":true,"pp":" := by simp [ofDigits]","range":[5604,5625]}},{"id":{"original":true,"range":[5635,5648]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_cons"],"params":[{"bi":"implicit","id":[5650,5651],"ref":[5650,5651],"type":[5650,5651]},{"bi":"implicit","id":[5652,5654],"ref":[5652,5654],"type":[5652,5654]},{"bi":"implicit","id":[5657,5659],"ref":[5657,5659],"type":[5662,5670]}],"ref":{"original":true,"pp":"theorem ofDigits_cons {b hd} {tl : List ℕ} : ofDigits b (hd :: tl) = hd + b * ofDigits b tl :=\n rfl","range":[5627,5731]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b hd} {tl : List ℕ} : ofDigits b (hd :: tl) = hd + b * ofDigits b tl","range":[5649,5724]},"type":{"original":true,"pp":"ofDigits b (hd :: tl) = hd + b * ofDigits b tl","range":[5678,5724]},"value":{"original":true,"pp":" :=\n rfl","range":[5725,5731]}},{"id":{"original":true,"range":[5741,5756]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_append"],"params":[{"bi":"implicit","id":[5758,5759],"ref":[5758,5759],"type":[5762,5765]},{"bi":"implicit","id":[5768,5770],"ref":[5768,5770],"type":[5776,5784]},{"bi":"implicit","id":[5771,5773],"ref":[5771,5773],"type":[5776,5784]}],"ref":{"original":true,"pp":"theorem ofDigits_append {b : ℕ} {l1 l2 : List ℕ} :\n ofDigits b (l1 ++ l2) = ofDigits b l1 + b ^ l1.length * ofDigits b l2 := by\n induction l1 with\n | nil => simp [ofDigits]\n | cons hd tl IH =>\n rw [ofDigits, List.cons_append, ofDigits, IH, List.length_cons, pow_succ']\n ring","range":[5733,6023]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} {l1 l2 : List ℕ} : ofDigits b (l1 ++ l2) = ofDigits b l1 + b ^ l1.length * ofDigits b l2","range":[5757,5861]},"type":{"original":true,"pp":"ofDigits b (l1 ++ l2) = ofDigits b l1 + b ^ l1.length * ofDigits b l2","range":[5792,5861]},"value":{"original":true,"pp":" := by\n induction l1 with\n | nil => simp [ofDigits]\n | cons hd tl IH =>\n rw [ofDigits, List.cons_append, ofDigits, IH, List.length_cons, pow_succ']\n ring","range":[5862,6023]}},{"id":{"original":true,"range":[6041,6061]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[6027,6031]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[6025,6032],"visibility":"regular"},"name":["Nat","ofDigits_append_zero"],"params":[{"bi":"implicit","id":[6063,6064],"ref":[6063,6064],"type":[6067,6070]},{"bi":"default","id":[6073,6074],"ref":[6073,6074],"type":[6077,6085]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_append_zero {b : ℕ} (l : List ℕ) : ofDigits b (l ++ [0]) = ofDigits b l := by\n rw [ofDigits_append, ofDigits_singleton, mul_zero, add_zero]","range":[6025,6198]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (l : List ℕ) : ofDigits b (l ++ [0]) = ofDigits b l","range":[6062,6129]},"type":{"original":true,"pp":"ofDigits b (l ++ [0]) = ofDigits b l","range":[6093,6129]},"value":{"original":true,"pp":" := by rw [ofDigits_append, ofDigits_singleton, mul_zero, add_zero]","range":[6130,6198]}},{"id":{"original":true,"range":[6216,6239]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[6202,6206]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[6200,6207],"visibility":"regular"},"name":["Nat","ofDigits_replicate_zero"],"params":[{"bi":"implicit","id":[6241,6242],"ref":[6241,6242],"type":[6247,6250]},{"bi":"implicit","id":[6243,6244],"ref":[6243,6244],"type":[6247,6250]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_replicate_zero {b k : ℕ} : ofDigits b (List.replicate k 0) = 0 := by\n induction k with\n | zero => rfl\n | succ k ih => simp [List.replicate, ofDigits_cons, ih]","range":[6200,6388]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b k : ℕ} : ofDigits b (List.replicate k 0) = 0","range":[6240,6289]},"type":{"original":true,"pp":"ofDigits b (List.replicate k 0) = 0","range":[6254,6289]},"value":{"original":true,"pp":" := by\n induction k with\n | zero => rfl\n | succ k ih => simp [List.replicate, ofDigits_cons, ih]","range":[6290,6388]}},{"id":{"original":true,"range":[6406,6436]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[6392,6396]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[6390,6397],"visibility":"regular"},"name":["Nat","ofDigits_append_replicate_zero"],"params":[{"bi":"implicit","id":[6438,6439],"ref":[6438,6439],"type":[6444,6447]},{"bi":"implicit","id":[6440,6441],"ref":[6440,6441],"type":[6444,6447]},{"bi":"default","id":[6450,6451],"ref":[6450,6451],"type":[6454,6462]}],"ref":{"original":true,"pp":"@[simp]\ntheorem ofDigits_append_replicate_zero {b k : ℕ} (l : List ℕ) : ofDigits b (l ++ List.replicate k 0) = ofDigits b l :=\n by\n rw [ofDigits_append]\n simp","range":[6390,6557]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b k : ℕ} (l : List ℕ) : ofDigits b (l ++ List.replicate k 0) = ofDigits b l","range":[6437,6521]},"type":{"original":true,"pp":"ofDigits b (l ++ List.replicate k 0) = ofDigits b l","range":[6470,6521]},"value":{"original":true,"pp":" := by\n rw [ofDigits_append]\n simp","range":[6522,6557]}},{"id":{"original":true,"range":[6567,6588]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_reverse_cons"],"params":[{"bi":"implicit","id":[6590,6591],"ref":[6590,6591],"type":[6594,6597]},{"bi":"default","id":[6600,6601],"ref":[6600,6601],"type":[6604,6612]},{"bi":"default","id":[6615,6616],"ref":[6615,6616],"type":[6619,6622]}],"ref":{"original":true,"pp":"theorem ofDigits_reverse_cons {b : ℕ} (l : List ℕ) (d : ℕ) :\n ofDigits b (d :: l).reverse = ofDigits b l.reverse + b ^ l.length * d :=\n by\n simp only [List.reverse_cons]\n rw [ofDigits_append]\n simp","range":[6559,6767]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (l : List ℕ) (d : ℕ) : ofDigits b (d :: l).reverse = ofDigits b l.reverse + b ^ l.length * d","range":[6589,6699]},"type":{"original":true,"pp":"ofDigits b (d :: l).reverse = ofDigits b l.reverse + b ^ l.length * d","range":[6630,6699]},"value":{"original":true,"pp":" := by\n simp only [List.reverse_cons]\n rw [ofDigits_append]\n simp","range":[6700,6767]}},{"id":{"original":true,"range":[6777,6803]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_reverse_zero_cons"],"params":[{"bi":"implicit","id":[6805,6806],"ref":[6805,6806],"type":[6809,6812]},{"bi":"default","id":[6815,6816],"ref":[6815,6816],"type":[6819,6827]}],"ref":{"original":true,"pp":"theorem ofDigits_reverse_zero_cons {b : ℕ} (l : List ℕ) : ofDigits b (0 :: l).reverse = ofDigits b l.reverse := by\n simp only [List.reverse_cons, ofDigits_append_zero]","range":[6769,6945]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (l : List ℕ) : ofDigits b (0 :: l).reverse = ofDigits b l.reverse","range":[6804,6885]},"type":{"original":true,"pp":"ofDigits b (0 :: l).reverse = ofDigits b l.reverse","range":[6835,6885]},"value":{"original":true,"pp":" := by simp only [List.reverse_cons, ofDigits_append_zero]","range":[6886,6945]}},{"id":{"original":true,"range":[6968,6980]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["norm_cast"],"stx":[6949,6958]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[6947,6959],"visibility":"regular"},"name":["Nat","coe_ofDigits"],"params":[{"bi":"default","id":[6982,6984],"ref":[6982,6984],"type":[6987,6992]},{"bi":"instImplicit","id":null,"ref":null,"type":[6995,7006]},{"bi":"default","id":[7009,7010],"ref":[7009,7010],"type":[7013,7016]},{"bi":"default","id":[7019,7020],"ref":[7019,7020],"type":[7023,7031]}],"ref":{"original":true,"pp":"@[norm_cast]\ntheorem coe_ofDigits (α : Type*) [Semiring α] (b : ℕ) (L : List ℕ) : ((ofDigits b L : ℕ) : α) = ofDigits (b : α) L := by\n induction L with\n | nil => simp [ofDigits]\n | cons d L ih => dsimp [ofDigits]; push_cast; rw [ih]","range":[6947,7196]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (α : Type*) [Semiring α] (b : ℕ) (L : List ℕ) : ((ofDigits b L : ℕ) : α) = ofDigits (b : α) L","range":[6981,7088]},"type":{"original":true,"pp":"((ofDigits b L : ℕ) : α) = ofDigits (b : α) L","range":[7039,7088]},"value":{"original":true,"pp":" := by\n induction L with\n | nil => simp [ofDigits]\n | cons d L ih => dsimp [ofDigits]; push_cast; rw [ih]","range":[7089,7196]}},{"id":{"original":true,"range":[7206,7228]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_zero_of_eq_zero"],"params":[{"bi":"implicit","id":[7230,7231],"ref":[7230,7231],"type":[7234,7237]},{"bi":"default","id":[7240,7241],"ref":[7240,7241],"type":[7244,7251]}],"ref":{"original":true,"pp":"theorem digits_zero_of_eq_zero {b : ℕ} (h : b ≠ 0) : ∀ {L : List ℕ} (_ : ofDigits b L = 0), ∀ l ∈ L, l = 0\n | _ :: _, h0, _, List.Mem.head .. => Nat.eq_zero_of_add_eq_zero_right h0\n | _ :: _, h0, _, List.Mem.tail _ hL =>\n digits_zero_of_eq_zero h (mul_right_injective₀ h (Nat.eq_zero_of_add_eq_zero_left h0)) _ hL","range":[7198,7534]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (h : b ≠ 0) : ∀ {L : List ℕ} (_ : ofDigits b L = 0), ∀ l ∈ L, l = 0","range":[7229,7320]},"type":{"original":true,"pp":"∀ {L : List ℕ} (_ : ofDigits b L = 0), ∀ l ∈ L, l = 0","range":[7259,7320]},"value":{"original":true,"pp":"\n | _ :: _, h0, _, List.Mem.head .. => Nat.eq_zero_of_add_eq_zero_right h0\n | _ :: _, h0, _, List.Mem.tail _ hL =>\n digits_zero_of_eq_zero h (mul_right_injective₀ h (Nat.eq_zero_of_add_eq_zero_left h0)) _ hL","range":[7323,7534]}},{"id":{"original":true,"range":[7544,7559]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_ofDigits"],"params":[{"bi":"default","id":[7561,7562],"ref":[7561,7562],"type":[7565,7568]},{"bi":"default","id":[7571,7572],"ref":[7571,7572],"type":[7575,7580]},{"bi":"default","id":[7583,7584],"ref":[7583,7584],"type":[7587,7595]},{"bi":"default","id":[7598,7602],"ref":[7598,7602],"type":[7605,7623]},{"bi":"default","id":[7630,7634],"ref":[7630,7634],"type":[7637,7672]}],"ref":{"original":true,"pp":"theorem digits_ofDigits (b : ℕ) (h : 1 < b) (L : List ℕ) (w₁ : ∀ l ∈ L, l < b) (w₂ : ∀ h : L ≠ [], L.getLast h ≠ 0) :\n digits b (ofDigits b L) = L := by\n induction L with\n | nil => simp\n | cons d L ih =>\n dsimp [ofDigits]\n replace w₂ := w₂ (by simp)\n rw [digits_add b h]\n · rw [ih]\n · intro l m\n apply w₁\n exact List.mem_cons_of_mem _ m\n · intro h\n rw [List.getLast_cons h] at w₂\n convert w₂\n · exact w₁ d List.mem_cons_self\n · by_cases h' : L = []\n · rcases h' with rfl\n left\n simpa using w₂\n · right\n contrapose! w₂\n refine digits_zero_of_eq_zero h.ne_bot w₂ _ ?_\n rw [List.getLast_cons h']\n exact List.getLast_mem h'","range":[7536,8312]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) (h : 1 < b) (L : List ℕ) (w₁ : ∀ l ∈ L, l < b) (w₂ : ∀ h : L ≠ [], L.getLast h ≠ 0) :\n digits b (ofDigits b L) = L","range":[7560,7703]},"type":{"original":true,"pp":"digits b (ofDigits b L) = L","range":[7676,7703]},"value":{"original":true,"pp":" := by\n induction L with\n | nil => simp\n | cons d L ih =>\n dsimp [ofDigits]\n replace w₂ := w₂ (by simp)\n rw [digits_add b h]\n · rw [ih]\n · intro l m\n apply w₁\n exact List.mem_cons_of_mem _ m\n · intro h\n rw [List.getLast_cons h] at w₂\n convert w₂\n · exact w₁ d List.mem_cons_self\n · by_cases h' : L = []\n · rcases h' with rfl\n left\n simpa using w₂\n · right\n contrapose! w₂\n refine digits_zero_of_eq_zero h.ne_bot w₂ _ ?_\n rw [List.getLast_cons h']\n exact List.getLast_mem h'","range":[7704,8312]}},{"id":{"original":true,"range":[8322,8337]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_digits"],"params":[{"bi":"default","id":[8339,8340],"ref":[8339,8340],"type":[8345,8348]},{"bi":"default","id":[8341,8342],"ref":[8341,8342],"type":[8345,8348]}],"ref":{"original":true,"pp":"theorem ofDigits_digits (b n : ℕ) : ofDigits b (digits b n) = n :=\n by\n rcases b with - | b\n · rcases n with - | n\n · rfl\n · simp\n · rcases b with - | b\n ·\n induction n with\n | zero => rfl\n | succ n ih =>\n rw [Nat.zero_add] at ih ⊢\n simp only [ih, add_comm 1, ofDigits_one_cons, Nat.cast_id, digits_one_succ]\n · induction n using Nat.strongRecOn with\n | ind n h => ?_\n cases n\n · rw [digits_zero]\n rfl\n · simp only [digits_add_two_add_one]\n dsimp [ofDigits]\n rw [h _ (Nat.div_lt_self' _ b)]\n rw [Nat.mod_add_div]","range":[8314,8917]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b n : ℕ) : ofDigits b (digits b n) = n","range":[8338,8379]},"type":{"original":true,"pp":"ofDigits b (digits b n) = n","range":[8352,8379]},"value":{"original":true,"pp":" := by\n rcases b with - | b\n · rcases n with - | n\n · rfl\n · simp\n · rcases b with - | b\n ·\n induction n with\n | zero => rfl\n | succ n ih =>\n rw [Nat.zero_add] at ih ⊢\n simp only [ih, add_comm 1, ofDigits_one_cons, Nat.cast_id, digits_one_succ]\n · induction n using Nat.strongRecOn with\n | ind n h => ?_\n cases n\n · rw [digits_zero]\n rfl\n · simp only [digits_add_two_add_one]\n dsimp [ofDigits]\n rw [h _ (Nat.div_lt_self' _ b)]\n rw [Nat.mod_add_div]","range":[8380,8917]}},{"id":{"original":true,"range":[8927,8939]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_one"],"params":[{"bi":"default","id":[8941,8942],"ref":[8941,8942],"type":[8945,8953]}],"ref":{"original":true,"pp":"theorem ofDigits_one (L : List ℕ) : ofDigits 1 L = L.sum := by\n induction L with\n | nil => rfl\n | cons _ _ ih => simp [ofDigits, List.sum_cons, ih]","range":[8919,9071]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (L : List ℕ) : ofDigits 1 L = L.sum","range":[8940,8977]},"type":{"original":true,"pp":"ofDigits 1 L = L.sum","range":[8957,8977]},"value":{"original":true,"pp":" := by\n induction L with\n | nil => rfl\n | cons _ _ ih => simp [ofDigits, List.sum_cons, ih]","range":[8978,9071]}},{"id":{"original":true,"range":[9194,9219]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_eq_nil_iff_eq_zero"],"params":[{"bi":"implicit","id":[9221,9222],"ref":[9221,9222],"type":[9227,9230]},{"bi":"implicit","id":[9223,9224],"ref":[9223,9224],"type":[9227,9230]}],"ref":{"original":true,"pp":"theorem digits_eq_nil_iff_eq_zero {b n : ℕ} : digits b n = [] ↔ n = 0 :=\n by\n constructor\n · intro h\n have : ofDigits b (digits b n) = ofDigits b [] := by rw [h]\n convert this\n rw [ofDigits_digits]\n · rintro rfl\n simp","range":[9186,9423]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b n : ℕ} : digits b n = [] ↔ n = 0","range":[9220,9259]},"type":{"original":true,"pp":"digits b n = [] ↔ n = 0","range":[9234,9259]},"value":{"original":true,"pp":" := by\n constructor\n · intro h\n have : ofDigits b (digits b n) = ofDigits b [] := by rw [h]\n convert this\n rw [ofDigits_digits]\n · rintro rfl\n simp","range":[9260,9423]}},{"id":{"original":true,"range":[9433,9458]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_ne_nil_iff_ne_zero"],"params":[{"bi":"implicit","id":[9460,9461],"ref":[9460,9461],"type":[9466,9469]},{"bi":"implicit","id":[9462,9463],"ref":[9462,9463],"type":[9466,9469]}],"ref":{"original":true,"pp":"theorem digits_ne_nil_iff_ne_zero {b n : ℕ} : digits b n ≠ [] ↔ n ≠ 0 :=\n not_congr digits_eq_nil_iff_eq_zero","range":[9425,9543]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b n : ℕ} : digits b n ≠ [] ↔ n ≠ 0","range":[9459,9502]},"type":{"original":true,"pp":"digits b n ≠ [] ↔ n ≠ 0","range":[9473,9502]},"value":{"original":true,"pp":" :=\n not_congr digits_eq_nil_iff_eq_zero","range":[9503,9543]}},{"id":{"original":true,"range":[9553,9578]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_eq_cons_digits_div"],"params":[{"bi":"implicit","id":[9580,9581],"ref":[9580,9581],"type":[9586,9589]},{"bi":"implicit","id":[9582,9583],"ref":[9582,9583],"type":[9586,9589]},{"bi":"default","id":[9592,9593],"ref":[9592,9593],"type":[9596,9601]},{"bi":"default","id":[9604,9605],"ref":[9604,9605],"type":[9608,9615]}],"ref":{"original":true,"pp":"theorem digits_eq_cons_digits_div {b n : ℕ} (h : 1 < b) (w : n ≠ 0) : digits b n = (n % b) :: digits b (n / b) :=\n digits_def' h (Nat.pos_of_ne_zero w)","range":[9545,9705]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b n : ℕ} (h : 1 < b) (w : n ≠ 0) : digits b n = (n % b) :: digits b (n / b)","range":[9579,9663]},"type":{"original":true,"pp":"digits b n = (n % b) :: digits b (n / b)","range":[9623,9663]},"value":{"original":true,"pp":" :=\n digits_def' h (Nat.pos_of_ne_zero w)","range":[9664,9705]}},{"id":{"original":true,"range":[9715,9729]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_getLast"],"params":[{"bi":"implicit","id":[9731,9732],"ref":[9731,9732],"type":[9735,9738]},{"bi":"default","id":[9741,9742],"ref":[9741,9742],"type":[9745,9748]},{"bi":"default","id":[9751,9752],"ref":[9751,9752],"type":[9755,9760]},{"bi":"default","id":[9763,9764],"ref":[9763,9764],"type":[9763,9764]},{"bi":"default","id":[9765,9766],"ref":[9765,9766],"type":[9765,9766]}],"ref":{"original":true,"pp":"theorem digits_getLast {b : ℕ} (m : ℕ) (h : 1 < b) (p q) : (digits b m).getLast p = (digits b (m / b)).getLast q :=\n by\n by_cases hm : m = 0\n · simp [hm]\n simp only [digits_eq_cons_digits_div h hm]\n rw [List.getLast_cons]","range":[9707,9940]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (m : ℕ) (h : 1 < b) (p q) : (digits b m).getLast p = (digits b (m / b)).getLast q","range":[9730,9827]},"type":{"original":true,"pp":"(digits b m).getLast p = (digits b (m / b)).getLast q","range":[9774,9827]},"value":{"original":true,"pp":" := by\n by_cases hm : m = 0\n · simp [hm]\n simp only [digits_eq_cons_digits_div h hm]\n rw [List.getLast_cons]","range":[9828,9940]}},{"id":{"original":true,"range":[9950,9966]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits","injective"],"params":[{"bi":"default","id":[9968,9969],"ref":[9968,9969],"type":[9972,9975]}],"ref":{"original":true,"pp":"theorem injective (b : ℕ) : Function.Injective b.digits :=\n Function.LeftInverse.injective (ofDigits_digits b)","range":[9942,10062]},"scopeInfo":{"currNamespace":["Nat","digits"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"],["Nat","digits"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b : ℕ) : Function.Injective b.digits","range":[9967,10006]},"type":{"original":true,"pp":"Function.Injective b.digits","range":[9979,10006]},"value":{"original":true,"pp":" :=\n Function.LeftInverse.injective (ofDigits_digits b)","range":[10007,10062]}},{"id":{"original":true,"range":[10080,10094]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["simp"],"stx":[10066,10070]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[10064,10071],"visibility":"regular"},"name":["Nat","digits_inj_iff"],"params":[{"bi":"implicit","id":[10096,10097],"ref":[10096,10097],"type":[10104,10107]},{"bi":"implicit","id":[10098,10099],"ref":[10098,10099],"type":[10104,10107]},{"bi":"implicit","id":[10100,10101],"ref":[10100,10101],"type":[10104,10107]}],"ref":{"original":true,"pp":"@[simp]\ntheorem digits_inj_iff {b n m : ℕ} : b.digits n = b.digits m ↔ n = m :=\n (digits.injective b).eq_iff","range":[10064,10177]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b n m : ℕ} : b.digits n = b.digits m ↔ n = m","range":[10095,10144]},"type":{"original":true,"pp":"b.digits n = b.digits m ↔ n = m","range":[10111,10144]},"value":{"original":true,"pp":" :=\n (digits.injective b).eq_iff","range":[10145,10177]}},{"id":{"original":true,"range":[10187,10199]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","mul_ofDigits"],"params":[{"bi":"default","id":[10201,10202],"ref":[10201,10202],"type":[10205,10208]},{"bi":"implicit","id":[10211,10212],"ref":[10211,10212],"type":[10215,10218]},{"bi":"implicit","id":[10221,10222],"ref":[10221,10222],"type":[10225,10233]}],"ref":{"original":true,"pp":"theorem mul_ofDigits (n : ℕ) {b : ℕ} {l : List ���} : n * ofDigits b l = ofDigits b (l.map (n * ·)) := by\n induction l with\n | nil => rfl\n | cons hd tl ih =>\n rw [List.map_cons, ofDigits_cons, ofDigits_cons, ← ih]\n ring","range":[10179,10418]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n : ℕ) {b : ℕ} {l : List ℕ} : n * ofDigits b l = ofDigits b (l.map (n * ·))","range":[10200,10287]},"type":{"original":true,"pp":"n * ofDigits b l = ofDigits b (l.map (n * ·))","range":[10241,10287]},"value":{"original":true,"pp":" := by\n induction l with\n | nil => rfl\n | cons hd tl ih =>\n rw [List.map_cons, ofDigits_cons, ofDigits_cons, ← ih]\n ring","range":[10288,10418]}},{"id":{"original":true,"range":[10426,10448]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_inj_of_len_eq"],"params":[{"bi":"implicit","id":[10450,10451],"ref":[10450,10451],"type":[10454,10457]},{"bi":"default","id":[10460,10462],"ref":[10460,10462],"type":[10465,10470]},{"bi":"implicit","id":[10473,10475],"ref":[10473,10475],"type":[10481,10489]},{"bi":"implicit","id":[10476,10478],"ref":[10476,10478],"type":[10481,10489]},{"bi":"default","id":[10496,10499],"ref":[10496,10499],"type":[10502,10523]},{"bi":"default","id":[10526,10528],"ref":[10526,10528],"type":[10531,10550]},{"bi":"default","id":[10553,10555],"ref":[10553,10555],"type":[10558,10577]},{"bi":"default","id":[10584,10585],"ref":[10584,10585],"type":[10588,10617]}],"ref":{"original":false,"pp":"theorem ofDigits_inj_of_len_eq {b : ℕ} (hb : 1 < b) {L1 L2 : List ℕ} (len : L1.length = L2.length)\n (w1 : ∀ l ∈ L1, l < b) (w2 : ∀ l ∈ L2, l < b) (h : ofDigits b L1 = ofDigits b L2) : L1 = L2 :=\n by\n induction L1 generalizing L2 with\n | nil =>\n simp only [List.length_nil] at len\n exact (List.length_eq_zero_iff.mp len.symm).symm\n | cons D L ih => ?_\n obtain ⟨d, l, rfl⟩ := List.exists_cons_of_length_eq_add_one len.symm\n simp only [List.length_cons, add_left_inj] at len\n simp only [ofDigits_cons] at h\n have eqd : D = d := by\n have H : (D + b * ofDigits b L) % b = (d + b * ofDigits b l) % b := by rw [h]\n simpa [mod_eq_of_lt (w2 d List.mem_cons_self), mod_eq_of_lt (w1 D List.mem_cons_self)] using H\n simp only [eqd, add_right_inj, mul_left_cancel_iff_of_pos (zero_lt_of_lt hb)] at h\n have := ih len (fun a ha ↦ w1 a <| List.mem_cons_of_mem D ha) (fun a ha ↦ w2 a <| List.mem_cons_of_mem d ha) h\n rw [eqd, this]","range":[10420,11390]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} (hb : 1 < b) {L1 L2 : List ℕ} (len : L1.length = L2.length) (w1 : ∀ l ∈ L1, l < b) (w2 : ∀ l ∈ L2, l < b)\n (h : ofDigits b L1 = ofDigits b L2) : L1 = L2","range":[10449,10628]},"type":{"original":true,"pp":"L1 = L2","range":[10621,10628]},"value":{"original":true,"pp":" :=\n by\n induction L1 generalizing L2 with\n | nil =>\n simp only [List.length_nil] at len\n exact (List.length_eq_zero_iff.mp len.symm).symm\n | cons D L ih => ?_\n obtain ⟨d, l, rfl⟩ := List.exists_cons_of_length_eq_add_one len.symm\n simp only [List.length_cons, add_left_inj] at len\n simp only [ofDigits_cons] at h\n have eqd : D = d := by\n have H : (D + b * ofDigits b L) % b = (d + b * ofDigits b l) % b := by rw [h]\n simpa [mod_eq_of_lt (w2 d List.mem_cons_self), mod_eq_of_lt (w1 D List.mem_cons_self)] using H\n simp only [eqd, add_right_inj, mul_left_cancel_iff_of_pos (zero_lt_of_lt hb)] at h\n have := ih len (fun a ha ↦ w1 a <| List.mem_cons_of_mem D ha) (fun a ha ↦ w2 a <| List.mem_cons_of_mem d ha) h\n rw [eqd, this]","range":[10629,11390]}},{"id":{"original":true,"range":[11497,11551]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The addition of ofDigits of two lists is equal to ofDigits of digit-wise addition of them ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[11392,11488],"visibility":"regular"},"name":["Nat","ofDigits_add_ofDigits_eq_ofDigits_zipWith_of_length_eq"],"params":[{"bi":"implicit","id":[11553,11554],"ref":[11553,11554],"type":[11557,11560]},{"bi":"implicit","id":[11563,11565],"ref":[11563,11565],"type":[11571,11579]},{"bi":"implicit","id":[11566,11568],"ref":[11566,11568],"type":[11571,11579]},{"bi":"default","id":[11586,11587],"ref":[11586,11587],"type":[11590,11611]}],"ref":{"original":true,"pp":"/-- The addition of ofDigits of two lists is equal to ofDigits of digit-wise addition of them -/\ntheorem ofDigits_add_ofDigits_eq_ofDigits_zipWith_of_length_eq {b : ℕ} {l1 l2 : List ℕ} (h : l1.length = l2.length) :\n ofDigits b l1 + ofDigits b l2 = ofDigits b (l1.zipWith (· + ·) l2) := by\n induction l1 generalizing l2 with\n | nil => simp_all [eq_comm, List.length_eq_zero_iff, ofDigits]\n | cons hd₁ tl₁ ih₁ =>\n induction l2 generalizing tl₁ with\n | nil => simp_all\n | cons hd₂ tl₂\n ih₂ =>\n simp_all only [List.length_cons, ofDigits_cons, add_left_inj, eq_comm, List.zipWith_cons_cons]\n rw [← ih₁ h.symm, mul_add]\n ac_rfl","range":[11392,12078]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} {l1 l2 : List ℕ} (h : l1.length = l2.length) :\n ofDigits b l1 + ofDigits b l2 = ofDigits b (l1.zipWith (· + ·) l2)","range":[11552,11687]},"type":{"original":true,"pp":"ofDigits b l1 + ofDigits b l2 = ofDigits b (l1.zipWith (· + ·) l2)","range":[11619,11687]},"value":{"original":true,"pp":" := by\n induction l1 generalizing l2 with\n | nil => simp_all [eq_comm, List.length_eq_zero_iff, ofDigits]\n | cons hd₁ tl₁ ih₁ =>\n induction l2 generalizing tl₁ with\n | nil => simp_all\n | cons hd₂ tl₂\n ih₂ =>\n simp_all only [List.length_cons, ofDigits_cons, add_left_inj, eq_comm, List.zipWith_cons_cons]\n rw [← ih₁ h.symm, mul_add]\n ac_rfl","range":[11688,12078]}},{"id":{"original":true,"range":[12159,12174]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The digits in the base b+2 expansion of n are all less than b+2 ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[12080,12150],"visibility":"regular"},"name":["Nat","digits_lt_base'"],"params":[{"bi":"implicit","id":[12176,12177],"ref":[12176,12177],"type":[12182,12185]},{"bi":"implicit","id":[12178,12179],"ref":[12178,12179],"type":[12182,12185]}],"ref":{"original":true,"pp":"/-- The digits in the base b+2 expansion of n are all less than b+2 -/\ntheorem digits_lt_base' {b m : ℕ} : ∀ {d}, d ∈ digits (b + 2) m → d < b + 2 :=\n by\n induction m using Nat.strongRecOn with\n | ind n IH => ?_\n intro d hd\n rcases n with - | n\n · rw [digits_zero] at hd\n cases hd\n rw [digits_add_two_add_one] at hd\n cases hd\n · exact n.succ.mod_lt (by linarith)\n · apply IH ((n + 1) / (b + 2))\n · apply Nat.div_lt_self <;> lia\n · assumption","range":[12080,12592]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m : ℕ} : ∀ {d}, d ∈ digits (b + 2) m → d < b + 2","range":[12175,12234]},"type":{"original":true,"pp":"∀ {d}, d ∈ digits (b + 2) m → d < b + 2","range":[12189,12234]},"value":{"original":true,"pp":" :=\n by\n induction m using Nat.strongRecOn with\n | ind n IH => ?_\n intro d hd\n rcases n with - | n\n · rw [digits_zero] at hd\n cases hd\n rw [digits_add_two_add_one] at hd\n cases hd\n · exact n.succ.mod_lt (by linarith)\n · apply IH ((n + 1) / (b + 2))\n · apply Nat.div_lt_self <;> lia\n · assumption","range":[12235,12592]}},{"id":{"original":true,"range":[12681,12695]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The digits in the base b expansion of n are all less than b, if b ≥ 2 ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[12594,12672],"visibility":"regular"},"name":["Nat","digits_lt_base"],"params":[{"bi":"implicit","id":[12697,12698],"ref":[12697,12698],"type":[12705,12708]},{"bi":"implicit","id":[12699,12700],"ref":[12699,12700],"type":[12705,12708]},{"bi":"implicit","id":[12701,12702],"ref":[12701,12702],"type":[12705,12708]},{"bi":"default","id":[12711,12713],"ref":[12711,12713],"type":[12716,12721]},{"bi":"default","id":[12724,12726],"ref":[12724,12726],"type":[12729,12745]}],"ref":{"original":true,"pp":"/-- The digits in the base b expansion of n are all less than b, if b ≥ 2 -/\ntheorem digits_lt_base {b m d : ℕ} (hb : 1 < b) (hd : d ∈ digits b m) : d < b := by\n rcases b with (_ | _ | b) <;> simp_all [@digits_lt_base' _ m d]","range":[12594,12826]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m d : ℕ} (hb : 1 < b) (hd : d ∈ digits b m) : d < b","range":[12696,12754]},"type":{"original":true,"pp":"d < b","range":[12749,12754]},"value":{"original":true,"pp":" := by rcases b with (_ | _ | b) <;> simp_all [@digits_lt_base' _ m d]","range":[12755,12826]}},{"id":{"original":true,"range":[12898,12926]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["an n-digit number in base b + 2 is less than (b + 2)^n ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[12828,12889],"visibility":"regular"},"name":["Nat","ofDigits_lt_base_pow_length'"],"params":[{"bi":"implicit","id":[12928,12929],"ref":[12928,12929],"type":[12932,12935]},{"bi":"implicit","id":[12938,12939],"ref":[12938,12939],"type":[12942,12950]},{"bi":"default","id":[12953,12955],"ref":[12953,12955],"type":[12958,12980]}],"ref":{"original":true,"pp":"/-- an n-digit number in base b + 2 is less than (b + 2)^n -/\ntheorem ofDigits_lt_base_pow_length' {b : ℕ} {l : List ℕ} (hl : ∀ x ∈ l, x < b + 2) :\n ofDigits (b + 2) l < (b + 2) ^ l.length := by\n induction l with\n | nil => simp [ofDigits]\n | cons hd tl IH =>\n rw [ofDigits, List.length_cons, pow_succ]\n have : (ofDigits (b + 2) tl + 1) * (b + 2) ≤ (b + 2) ^ tl.length * (b + 2) :=\n mul_le_mul (IH fun x hx => hl _ (List.mem_cons_of_mem _ hx)) (by rfl) (by simp only [zero_le]) (Nat.zero_le _)\n suffices ↑hd < b + 2 by linarith\n exact hl hd List.mem_cons_self","range":[12828,13429]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} {l : List ℕ} (hl : ∀ x ∈ l, x < b + 2) : ofDigits (b + 2) l < (b + 2) ^ l.length","range":[12927,13027]},"type":{"original":true,"pp":"ofDigits (b + 2) l < (b + 2) ^ l.length","range":[12988,13027]},"value":{"original":true,"pp":" := by\n induction l with\n | nil => simp [ofDigits]\n | cons hd tl IH =>\n rw [ofDigits, List.length_cons, pow_succ]\n have : (ofDigits (b + 2) tl + 1) * (b + 2) ≤ (b + 2) ^ tl.length * (b + 2) :=\n mul_le_mul (IH fun x hx => hl _ (List.mem_cons_of_mem _ hx)) (by rfl) (by simp only [zero_le]) (Nat.zero_le _)\n suffices ↑hd < b + 2 by linarith\n exact hl hd List.mem_cons_self","range":[13028,13429]}},{"id":{"original":true,"range":[13500,13527]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["an n-digit number in base b is less than b^n if b > 1 ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[13431,13491],"visibility":"regular"},"name":["Nat","ofDigits_lt_base_pow_length"],"params":[{"bi":"implicit","id":[13529,13530],"ref":[13529,13530],"type":[13533,13536]},{"bi":"implicit","id":[13539,13540],"ref":[13539,13540],"type":[13543,13551]},{"bi":"default","id":[13554,13556],"ref":[13554,13556],"type":[13559,13564]},{"bi":"default","id":[13567,13569],"ref":[13567,13569],"type":[13572,13590]}],"ref":{"original":true,"pp":"/-- an n-digit number in base b is less than b^n if b > 1 -/\ntheorem ofDigits_lt_base_pow_length {b : ℕ} {l : List ℕ} (hb : 1 < b) (hl : ∀ x ∈ l, x < b) :\n ofDigits b l < b ^ l.length := by rcases b with (_ | _ | b) <;> simp_all [ofDigits_lt_base_pow_length']","range":[13431,13703]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b : ℕ} {l : List ℕ} (hb : 1 < b) (hl : ∀ x ∈ l, x < b) : ofDigits b l < b ^ l.length","range":[13528,13625]},"type":{"original":true,"pp":"ofDigits b l < b ^ l.length","range":[13598,13625]},"value":{"original":true,"pp":" := by rcases b with (_ | _ | b) <;> simp_all [ofDigits_lt_base_pow_length']","range":[13626,13703]}},{"id":{"original":true,"range":[13809,13835]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Any number m is less than (b+2)^(number of digits in the base b + 2 representation of m) ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[13705,13800],"visibility":"regular"},"name":["Nat","lt_base_pow_length_digits'"],"params":[{"bi":"implicit","id":[13837,13838],"ref":[13837,13838],"type":[13843,13846]},{"bi":"implicit","id":[13839,13840],"ref":[13839,13840],"type":[13843,13846]}],"ref":{"original":true,"pp":"/-- Any number m is less than (b+2)^(number of digits in the base b + 2 representation of m) -/\ntheorem lt_base_pow_length_digits' {b m : ℕ} : m < (b + 2) ^ (digits (b + 2) m).length :=\n by\n convert @ofDigits_lt_base_pow_length' b (digits (b + 2) m) fun _ => digits_lt_base'\n rw [ofDigits_digits (b + 2) m]","range":[13705,14014]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m : ℕ} : m < (b + 2) ^ (digits (b + 2) m).length","range":[13836,13889]},"type":{"original":true,"pp":"m < (b + 2) ^ (digits (b + 2) m).length","range":[13850,13889]},"value":{"original":true,"pp":" := by\n convert @ofDigits_lt_base_pow_length' b (digits (b + 2) m) fun _ => digits_lt_base'\n rw [ofDigits_digits (b + 2) m]","range":[13890,14014]}},{"id":{"original":true,"range":[14112,14137]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Any number m is less than b^(number of digits in the base b representation of m) ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[14016,14103],"visibility":"regular"},"name":["Nat","lt_base_pow_length_digits"],"params":[{"bi":"implicit","id":[14139,14140],"ref":[14139,14140],"type":[14145,14148]},{"bi":"implicit","id":[14141,14142],"ref":[14141,14142],"type":[14145,14148]},{"bi":"default","id":[14151,14153],"ref":[14151,14153],"type":[14156,14161]}],"ref":{"original":true,"pp":"/-- Any number m is less than b^(number of digits in the base b representation of m) -/\ntheorem lt_base_pow_length_digits {b m : ℕ} (hb : 1 < b) : m < b ^ (digits b m).length := by\n rcases b with (_ | _ | b) <;> simp_all [lt_base_pow_length_digits']","range":[14016,14268]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m : ℕ} (hb : 1 < b) : m < b ^ (digits b m).length","range":[14138,14192]},"type":{"original":true,"pp":"m < b ^ (digits b m).length","range":[14165,14192]},"value":{"original":true,"pp":" := by rcases b with (_ | _ | b) <;> simp_all [lt_base_pow_length_digits']","range":[14193,14268]}},{"id":{"original":true,"range":[14278,14293]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_base_mul"],"params":[{"bi":"implicit","id":[14295,14296],"ref":[14295,14296],"type":[14301,14304]},{"bi":"implicit","id":[14297,14298],"ref":[14297,14298],"type":[14301,14304]},{"bi":"default","id":[14307,14309],"ref":[14307,14309],"type":[14312,14317]},{"bi":"default","id":[14320,14322],"ref":[14320,14322],"type":[14325,14330]}],"ref":{"original":true,"pp":"theorem digits_base_mul {b m : ℕ} (hb : 1 < b) (hm : 0 < m) : b.digits (b * m) = 0 :: b.digits m :=\n by\n rw [digits_def' hb (by positivity)]\n simp [mul_div_right m (by positivity)]","range":[14270,14457]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m : ℕ} (hb : 1 < b) (hm : 0 < m) : b.digits (b * m) = 0 :: b.digits m","range":[14294,14372]},"type":{"original":true,"pp":"b.digits (b * m) = 0 :: b.digits m","range":[14338,14372]},"value":{"original":true,"pp":" := by\n rw [digits_def' hb (by positivity)]\n simp [mul_div_right m (by positivity)]","range":[14373,14457]}},{"id":{"original":true,"range":[14467,14486]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digits_base_pow_mul"],"params":[{"bi":"implicit","id":[14488,14489],"ref":[14488,14489],"type":[14496,14499]},{"bi":"implicit","id":[14490,14491],"ref":[14490,14491],"type":[14496,14499]},{"bi":"implicit","id":[14492,14493],"ref":[14492,14493],"type":[14496,14499]},{"bi":"default","id":[14502,14504],"ref":[14502,14504],"type":[14507,14512]},{"bi":"default","id":[14515,14517],"ref":[14515,14517],"type":[14520,14525]}],"ref":{"original":true,"pp":"theorem digits_base_pow_mul {b k m : ℕ} (hb : 1 < b) (hm : 0 < m) :\n digits b (b ^ k * m) = List.replicate k 0 ++ digits b m := by\n induction k generalizing m with\n | zero => simp\n | succ k ih =>\n rw [pow_succ', mul_assoc, digits_base_mul hb (by positivity), ih hm, List.replicate_succ, List.cons_append]","range":[14459,14780]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b k m : ℕ} (hb : 1 < b) (hm : 0 < m) : digits b (b ^ k * m) = List.replicate k 0 ++ digits b m","range":[14487,14588]},"type":{"original":true,"pp":"digits b (b ^ k * m) = List.replicate k 0 ++ digits b m","range":[14533,14588]},"value":{"original":true,"pp":" := by\n induction k generalizing m with\n | zero => simp\n | succ k ih =>\n rw [pow_succ', mul_assoc, digits_base_mul hb (by positivity), ih hm, List.replicate_succ, List.cons_append]","range":[14589,14780]}},{"id":{"original":true,"range":[14790,14819]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","ofDigits_digits_append_digits"],"params":[{"bi":"implicit","id":[14821,14822],"ref":[14821,14822],"type":[14829,14832]},{"bi":"implicit","id":[14823,14824],"ref":[14823,14824],"type":[14829,14832]},{"bi":"implicit","id":[14825,14826],"ref":[14825,14826],"type":[14829,14832]}],"ref":{"original":true,"pp":"theorem ofDigits_digits_append_digits {b m n : ℕ} :\n ofDigits b (digits b n ++ digits b m) = n + b ^ (digits b n).length * m := by\n rw [ofDigits_append, ofDigits_digits, ofDigits_digits]","range":[14782,14974]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {b m n : ℕ} : ofDigits b (digits b n ++ digits b m) = n + b ^ (digits b n).length * m","range":[14820,14911]},"type":{"original":true,"pp":"ofDigits b (digits b n ++ digits b m) = n + b ^ (digits b n).length * m","range":[14840,14911]},"value":{"original":true,"pp":" := by rw [ofDigits_append, ofDigits_digits, ofDigits_digits]","range":[14912,14974]}},{"id":{"original":true,"range":[14992,15009]},"kind":"theorem","modifiers":{"attrs":[{"kind":"global","name":["mono"],"stx":[14978,14982]}],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":[14976,14983],"visibility":"regular"},"name":["Nat","ofDigits_monotone"],"params":[{"bi":"implicit","id":[15011,15012],"ref":[15011,15012],"type":[15017,15020]},{"bi":"implicit","id":[15013,15014],"ref":[15013,15014],"type":[15017,15020]},{"bi":"default","id":[15023,15024],"ref":[15023,15024],"type":[15027,15035]},{"bi":"default","id":[15038,15039],"ref":[15038,15039],"type":[15042,15049]}],"ref":{"original":true,"pp":"@[mono]\ntheorem ofDigits_monotone {p q : ℕ} (L : List ℕ) (h : p ≤ q) : ofDigits p L ≤ ofDigits q L := by\n induction L with\n | nil => rfl\n | cons _ _ hi =>\n simp only [ofDigits, cast_id, add_le_add_iff_left]\n exact Nat.mul_le_mul h hi","range":[14976,15226]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p q : ℕ} (L : List ℕ) (h : p ≤ q) : ofDigits p L ≤ ofDigits q L","range":[15010,15082]},"type":{"original":true,"pp":"ofDigits p L ≤ ofDigits q L","range":[15053,15082]},"value":{"original":true,"pp":" := by\n induction L with\n | nil => rfl\n | cons _ _ hi =>\n simp only [ofDigits, cast_id, add_le_add_iff_left]\n exact Nat.mul_le_mul h hi","range":[15083,15226]}},{"id":{"original":true,"range":[15236,15251]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","sum_le_ofDigits"],"params":[{"bi":"implicit","id":[15253,15254],"ref":[15253,15254],"type":[15257,15260]},{"bi":"default","id":[15263,15264],"ref":[15263,15264],"type":[15267,15275]},{"bi":"default","id":[15278,15279],"ref":[15278,15279],"type":[15282,15289]}],"ref":{"original":true,"pp":"theorem sum_le_ofDigits {p : ℕ} (L : List ℕ) (h : 1 ≤ p) : L.sum ≤ ofDigits p L :=\n (ofDigits_one L).symm ▸ ofDigits_monotone L h","range":[15228,15368]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (L : List ℕ) (h : 1 ≤ p) : L.sum ≤ ofDigits p L","range":[15252,15315]},"type":{"original":true,"pp":"L.sum ≤ ofDigits p L","range":[15293,15315]},"value":{"original":true,"pp":" :=\n (ofDigits_one L).symm ▸ ofDigits_monotone L h","range":[15316,15368]}},{"id":{"original":true,"range":[15378,15390]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","digit_sum_le"],"params":[{"bi":"default","id":[15392,15393],"ref":[15392,15393],"type":[15398,15401]},{"bi":"default","id":[15394,15395],"ref":[15394,15395],"type":[15398,15401]}],"ref":{"original":true,"pp":"theorem digit_sum_le (p n : ℕ) : List.sum (digits p n) ≤ n := by\n induction n with\n | zero => exact digits_zero _ ▸ Nat.le_refl (List.sum [])\n | succ n =>\n induction p with\n | zero => rw [digits_zero_succ, List.sum_cons, List.sum_nil, add_zero]\n | succ p =>\n nth_rw 2 [← ofDigits_digits p.succ (n + 1)]\n rw [← ofDigits_one <| digits p.succ n.succ]\n exact ofDigits_monotone (digits p.succ n.succ) <| Nat.succ_pos p","range":[15370,15820]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (p n : ℕ) : List.sum (digits p n) ≤ n","range":[15391,15432]},"type":{"original":true,"pp":"List.sum (digits p n) ≤ n","range":[15405,15432]},"value":{"original":true,"pp":" := by\n induction n with\n | zero => exact digits_zero _ ▸ Nat.le_refl (List.sum [])\n | succ n =>\n induction p with\n | zero => rw [digits_zero_succ, List.sum_cons, List.sum_nil, add_zero]\n | succ p =>\n nth_rw 2 [← ofDigits_digits p.succ (n + 1)]\n rw [← ofDigits_one <| digits p.succ n.succ]\n exact ofDigits_monotone (digits p.succ n.succ) <| Nat.succ_pos p","range":[15433,15820]}},{"id":{"original":true,"range":[15927,15956]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Interpreting as a base `p` number and dividing by `p` is the same as interpreting the tail.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[15822,15920],"visibility":"regular"},"name":["Nat","ofDigits_div_eq_ofDigits_tail"],"params":[{"bi":"implicit","id":[15958,15959],"ref":[15958,15959],"type":[15962,15965]},{"bi":"default","id":[15968,15972],"ref":[15968,15972],"type":[15975,15980]},{"bi":"default","id":[15983,15989],"ref":[15983,15989],"type":[15992,16000]},{"bi":"default","id":[16007,16011],"ref":[16007,16011],"type":[16014,16037]}],"ref":{"original":true,"pp":"/-- Interpreting as a base `p` number and dividing by `p` is the same as interpreting the tail.\n-/\ntheorem ofDigits_div_eq_ofDigits_tail {p : ℕ} (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) :\n ofDigits p digits / p = ofDigits p digits.tail := by\n induction digits with\n | nil => simp [ofDigits]\n | cons hd tl =>\n refine Eq.trans (add_mul_div_left hd _ hpos) ?_\n rw [Nat.div_eq_of_lt <| w₁ _ List.mem_cons_self, zero_add, List.tail_cons]","range":[15822,16295]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) : ofDigits p digits / p = ofDigits p digits.tail","range":[15957,16087]},"type":{"original":true,"pp":"ofDigits p digits / p = ofDigits p digits.tail","range":[16041,16087]},"value":{"original":true,"pp":" := by\n induction digits with\n | nil => simp [ofDigits]\n | cons hd tl =>\n refine Eq.trans (add_mul_div_left hd _ hpos) ?_\n rw [Nat.div_eq_of_lt <| w₁ _ List.mem_cons_self, zero_add, List.tail_cons]","range":[16088,16295]}},{"id":{"original":true,"range":[16395,16428]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Interpreting as a base `p` number and dividing by `p^i` is the same as dropping `i`.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[16297,16388],"visibility":"regular"},"name":["Nat","ofDigits_div_pow_eq_ofDigits_drop"],"params":[{"bi":"implicit","id":[16434,16435],"ref":[16434,16435],"type":[16438,16441]},{"bi":"default","id":[16444,16445],"ref":[16444,16445],"type":[16448,16451]},{"bi":"default","id":[16454,16458],"ref":[16454,16458],"type":[16461,16466]},{"bi":"default","id":[16469,16475],"ref":[16469,16475],"type":[16478,16486]},{"bi":"default","id":[16489,16493],"ref":[16489,16493],"type":[16496,16519]}],"ref":{"original":true,"pp":"/-- Interpreting as a base `p` number and dividing by `p^i` is the same as dropping `i`.\n-/\ntheorem ofDigits_div_pow_eq_ofDigits_drop {p : ℕ} (i : ℕ) (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) :\n ofDigits p digits / p ^ i = ofDigits p (digits.drop i) := by\n induction i with\n | zero => simp\n | succ i hi =>\n rw [Nat.pow_succ, ← Nat.div_div_eq_div_mul, hi,\n ofDigits_div_eq_ofDigits_tail hpos (List.drop i digits) fun x hx ↦ w₁ x <| List.mem_of_mem_drop hx, ←\n List.drop_one, List.drop_drop, add_comm]","range":[16297,16855]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (i : ℕ) (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) :\n ofDigits p digits / p ^ i = ofDigits p (digits.drop i)","range":[16433,16581]},"type":{"original":true,"pp":"ofDigits p digits / p ^ i = ofDigits p (digits.drop i)","range":[16527,16581]},"value":{"original":true,"pp":" := by\n induction i with\n | zero => simp\n | succ i hi =>\n rw [Nat.pow_succ, ← Nat.div_div_eq_div_mul, hi,\n ofDigits_div_eq_ofDigits_tail hpos (List.drop i digits) fun x hx ↦ w₁ x <| List.mem_of_mem_drop hx, ←\n List.drop_one, List.drop_drop, add_comm]","range":[16582,16855]}},{"id":{"original":true,"range":[16952,16981]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Dividing `n` by `p^i` is like truncating the first `i` digits of `n` in base `p`.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[16857,16945],"visibility":"regular"},"name":["Nat","self_div_pow_eq_ofDigits_drop"],"params":[{"bi":"implicit","id":[16983,16984],"ref":[16983,16984],"type":[16987,16990]},{"bi":"default","id":[16993,16994],"ref":[16993,16994],"type":[16999,17002]},{"bi":"default","id":[16995,16996],"ref":[16995,16996],"type":[16999,17002]},{"bi":"default","id":[17005,17006],"ref":[17005,17006],"type":[17009,17016]}],"ref":{"original":true,"pp":"/-- Dividing `n` by `p^i` is like truncating the first `i` digits of `n` in base `p`.\n-/\ntheorem self_div_pow_eq_ofDigits_drop {p : ℕ} (i n : ℕ) (h : 2 ≤ p) : n / p ^ i = ofDigits p ((p.digits n).drop i) :=\n by\n convert ofDigits_div_pow_eq_ofDigits_drop i (zero_lt_of_lt h) (p.digits n) (fun l hl ↦ digits_lt_base h hl)\n exact (ofDigits_digits p n).symm","range":[16857,17225]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (i n : ℕ) (h : 2 ≤ p) : n / p ^ i = ofDigits p ((p.digits n).drop i)","range":[16982,17068]},"type":{"original":true,"pp":"n / p ^ i = ofDigits p ((p.digits n).drop i)","range":[17024,17068]},"value":{"original":true,"pp":" := by\n convert ofDigits_div_pow_eq_ofDigits_drop i (zero_lt_of_lt h) (p.digits n) (fun l hl ↦ digits_lt_base h hl)\n exact (ofDigits_digits p n).symm","range":[17069,17225]}},{"id":{"original":true,"range":[17335,17368]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["Interpreting as a base `p` number and modulo `p^i` is the same as taking the first `i` digits.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[17227,17328],"visibility":"regular"},"name":["Nat","ofDigits_mod_pow_eq_ofDigits_take"],"params":[{"bi":"implicit","id":[17374,17375],"ref":[17374,17375],"type":[17378,17381]},{"bi":"default","id":[17384,17385],"ref":[17384,17385],"type":[17388,17391]},{"bi":"default","id":[17394,17398],"ref":[17394,17398],"type":[17401,17406]},{"bi":"default","id":[17409,17415],"ref":[17409,17415],"type":[17418,17426]},{"bi":"default","id":[17429,17433],"ref":[17429,17433],"type":[17436,17459]}],"ref":{"original":true,"pp":"/-- Interpreting as a base `p` number and modulo `p^i` is the same as taking the first `i` digits.\n-/\ntheorem ofDigits_mod_pow_eq_ofDigits_take {p : ℕ} (i : ℕ) (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) :\n ofDigits p digits % p ^ i = ofDigits p (digits.take i) := by\n induction i generalizing digits with\n | zero => simp [mod_one]\n | succ i ih =>\n cases digits with\n | nil => simp\n | cons hd\n tl =>\n rw [List.take_succ_cons, ofDigits_cons, ofDigits_cons, ← ih _ fun x hx ↦ w₁ x <| List.mem_cons_of_mem hd hx,\n add_mod, mod_eq_of_lt <| lt_of_lt_of_le (w₁ hd List.mem_cons_self) (le_pow <| add_one_pos i), pow_succ',\n mul_mod_mul_left, mod_eq_of_lt]\n apply add_lt_of_lt_sub\n apply lt_of_lt_of_le (b := p)\n · exact w₁ hd List.mem_cons_self\n · rw [← Nat.mul_sub]\n exact Nat.le_mul_of_pos_right _ <| Nat.sub_pos_of_lt <| mod_lt _ <| pow_pos hpos i","range":[17227,18182]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (i : ℕ) (hpos : 0 < p) (digits : List ℕ) (w₁ : ∀ l ∈ digits, l < p) :\n ofDigits p digits % p ^ i = ofDigits p (digits.take i)","range":[17373,17521]},"type":{"original":true,"pp":"ofDigits p digits % p ^ i = ofDigits p (digits.take i)","range":[17467,17521]},"value":{"original":true,"pp":" := by\n induction i generalizing digits with\n | zero => simp [mod_one]\n | succ i ih =>\n cases digits with\n | nil => simp\n | cons hd\n tl =>\n rw [List.take_succ_cons, ofDigits_cons, ofDigits_cons, ← ih _ fun x hx ↦ w₁ x <| List.mem_cons_of_mem hd hx,\n add_mod, mod_eq_of_lt <| lt_of_lt_of_le (w₁ hd List.mem_cons_self) (le_pow <| add_one_pos i), pow_succ',\n mul_mod_mul_left, mod_eq_of_lt]\n apply add_lt_of_lt_sub\n apply lt_of_lt_of_le (b := p)\n · exact w₁ hd List.mem_cons_self\n · rw [← Nat.mul_sub]\n exact Nat.le_mul_of_pos_right _ <| Nat.sub_pos_of_lt <| mod_lt _ <| pow_pos hpos i","range":[17522,18182]}},{"id":{"original":true,"range":[18282,18311]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["`n` modulo `p^i` is like taking the least significant `i` digits of `n` in base `p`.\n",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[18184,18275],"visibility":"regular"},"name":["Nat","self_mod_pow_eq_ofDigits_take"],"params":[{"bi":"implicit","id":[18313,18314],"ref":[18313,18314],"type":[18317,18320]},{"bi":"default","id":[18323,18324],"ref":[18323,18324],"type":[18329,18332]},{"bi":"default","id":[18325,18326],"ref":[18325,18326],"type":[18329,18332]},{"bi":"default","id":[18335,18336],"ref":[18335,18336],"type":[18339,18346]}],"ref":{"original":true,"pp":"/-- `n` modulo `p^i` is like taking the least significant `i` digits of `n` in base `p`.\n-/\ntheorem self_mod_pow_eq_ofDigits_take {p : ℕ} (i n : ℕ) (h : 2 ≤ p) : n % p ^ i = ofDigits p ((p.digits n).take i) :=\n by\n convert ofDigits_mod_pow_eq_ofDigits_take i (zero_lt_of_lt h) (p.digits n) (fun l hl ↦ digits_lt_base h hl)\n exact (ofDigits_digits p n).symm","range":[18184,18555]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" {p : ℕ} (i n : ℕ) (h : 2 ≤ p) : n % p ^ i = ofDigits p ((p.digits n).take i)","range":[18312,18398]},"type":{"original":true,"pp":"n % p ^ i = ofDigits p ((p.digits n).take i)","range":[18354,18398]},"value":{"original":true,"pp":" := by\n convert ofDigits_mod_pow_eq_ofDigits_take i (zero_lt_of_lt h) (p.digits n) (fun l hl ↦ digits_lt_base h hl)\n exact (ofDigits_digits p n).symm","range":[18399,18555]}},{"id":{"original":true,"range":[18597,18621]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","toDigitsCore_lens_eq_aux"],"params":[{"bi":"default","id":[18623,18624],"ref":[18623,18624],"type":[18629,18632]},{"bi":"default","id":[18625,18626],"ref":[18625,18626],"type":[18629,18632]}],"ref":{"original":false,"pp":"theorem toDigitsCore_lens_eq_aux (b f : Nat) :\n ∀ (n : Nat) (l1 l2 : List Char),\n l1.length = l2.length → (Nat.toDigitsCore b f n l1).length = (Nat.toDigitsCore b f n l2).length :=\n by\n induction f with (simp only [Nat.toDigitsCore]; intro n l1 l2 hlen)\n | zero => assumption\n | succ f ih =>\n if hx : n / b = 0 then simp only [hx, if_true, List.length, congrArg (fun l ↦ l + 1) hlen]\n else\n simp only [hx, if_false]\n specialize ih (n / b) (Nat.digitChar (n % b) :: l1) (Nat.digitChar (n % b) :: l2)\n simp only [List.length, congrArg (fun l ↦ l + 1) hlen] at ih\n exact ih trivial","range":[18591,19215]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b f : Nat) :\n ∀ (n : Nat) (l1 l2 : List Char),\n l1.length = l2.length → (Nat.toDigitsCore b f n l1).length = (Nat.toDigitsCore b f n l2).length","range":[18622,18776]},"type":{"original":true,"pp":"∀ (n : Nat) (l1 l2 : List Char),\n l1.length = l2.length → (Nat.toDigitsCore b f n l1).length = (Nat.toDigitsCore b f n l2).length","range":[18640,18776]},"value":{"original":true,"pp":" := by\n induction f with (simp only [Nat.toDigitsCore]; intro n l1 l2 hlen)\n | zero => assumption\n | succ f ih =>\n if hx : n / b = 0 then simp only [hx, if_true, List.length, congrArg (fun l ↦ l + 1) hlen]\n else\n simp only [hx, if_false]\n specialize ih (n / b) (Nat.digitChar (n % b) :: l1) (Nat.digitChar (n % b) :: l2)\n simp only [List.length, congrArg (fun l ↦ l + 1) hlen] at ih\n exact ih trivial","range":[18777,19215]}},{"id":{"original":true,"range":[19223,19243]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","toDigitsCore_lens_eq"],"params":[{"bi":"default","id":[19245,19246],"ref":[19245,19246],"type":[19251,19254]},{"bi":"default","id":[19247,19248],"ref":[19247,19248],"type":[19251,19254]}],"ref":{"original":false,"pp":"theorem toDigitsCore_lens_eq (b f : Nat) :\n ∀ (n : Nat) (c : Char) (tl : List Char),\n (Nat.toDigitsCore b f n (c :: tl)).length = (Nat.toDigitsCore b f n tl).length + 1 :=\n by\n induction f with (intro n c tl; simp only [Nat.toDigitsCore, List.length])\n | succ f ih => grind","range":[19217,19497]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b f : Nat) :\n ∀ (n : Nat) (c : Char) (tl : List Char),\n (Nat.toDigitsCore b f n (c :: tl)).length = (Nat.toDigitsCore b f n tl).length + 1","range":[19244,19387]},"type":{"original":true,"pp":"∀ (n : Nat) (c : Char) (tl : List Char),\n (Nat.toDigitsCore b f n (c :: tl)).length = (Nat.toDigitsCore b f n tl).length + 1","range":[19258,19387]},"value":{"original":true,"pp":" := by\n induction f with (intro n c tl; simp only [Nat.toDigitsCore, List.length])\n | succ f ih => grind","range":[19388,19497]}},{"id":{"original":true,"range":[19505,19521]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","isProtected":false,"isUnsafe":false,"recKind":"default","stx":null,"visibility":"regular"},"name":["Nat","nat_repr_len_aux"],"params":[{"bi":"default","id":[19523,19524],"ref":[19523,19524],"type":[19531,19534]},{"bi":"default","id":[19525,19526],"ref":[19525,19526],"type":[19531,19534]},{"bi":"default","id":[19527,19528],"ref":[19527,19528],"type":[19531,19534]},{"bi":"default","id":[19537,19544],"ref":[19537,19544],"type":[19547,19552]}],"ref":{"original":false,"pp":"theorem nat_repr_len_aux (n b e : Nat) (h_b_pos : 0 < b) : n < b ^ e.succ → n / b < b ^ e :=\n by\n simp only [Nat.pow_succ]\n exact (@Nat.div_lt_iff_lt_mul b n (b ^ e) h_b_pos).mpr","range":[19499,19678]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n b e : Nat) (h_b_pos : 0 < b) : n < b ^ e.succ → n / b < b ^ e","range":[19522,19588]},"type":{"original":true,"pp":"n < b ^ e.succ → n / b < b ^ e","range":[19556,19588]},"value":{"original":true,"pp":" := by\n simp only [Nat.pow_succ]\n exact (@Nat.div_lt_iff_lt_mul b n (b ^ e) h_b_pos).mpr","range":[19589,19678]}},{"id":{"original":true,"range":[19906,19925]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The String representation produced by toDigitsCore has the proper length relative to\nthe number of digits in `n < e` for some base `b`. Since this works with any base,\nit can be used for binary, decimal, and hex. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[19680,19899],"visibility":"regular"},"name":["Nat","toDigitsCore_length"],"params":[{"bi":"default","id":[19927,19928],"ref":[19927,19928],"type":[19937,19940]},{"bi":"default","id":[19929,19930],"ref":[19929,19930],"type":[19937,19940]},{"bi":"default","id":[19931,19932],"ref":[19931,19932],"type":[19937,19940]},{"bi":"default","id":[19933,19934],"ref":[19933,19934],"type":[19937,19940]},{"bi":"default","id":[19943,19950],"ref":[19943,19950],"type":[19953,19958]},{"bi":"default","id":[19961,19964],"ref":[19961,19964],"type":[19967,19976]}],"ref":{"original":true,"pp":"/-- The String representation produced by toDigitsCore has the proper length relative to\nthe number of digits in `n < e` for some base `b`. Since this works with any base,\nit can be used for binary, decimal, and hex. -/\ntheorem toDigitsCore_length (b f n e : Nat) (h_e_pos : 0 < e) (hlt : n < b ^ e) :\n (Nat.toDigitsCore b f n []).length ≤ e := by\n induction f generalizing n e hlt h_e_pos with\n | zero => simp only [toDigitsCore, List.length, zero_le]\n | succ f ih =>\n simp only [toDigitsCore]\n cases e with\n | zero => exact False.elim (Nat.lt_irrefl 0 h_e_pos)\n | succ e =>\n cases e with\n | zero =>\n rw [zero_add, pow_one] at hlt\n simp [Nat.div_eq_of_lt hlt]\n | succ e =>\n specialize ih (n / b) _ (add_one_pos e) (Nat.div_lt_of_lt_mul <| by rwa [← pow_add_one'])\n split_ifs\n · simp only [List.length_singleton, _root_.zero_le, succ_le_succ]\n · simp only [toDigitsCore_lens_eq b f (n / b) (Nat.digitChar <| n % b), Nat.succ_le_succ_iff, ih]","range":[19680,20712]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b f n e : Nat) (h_e_pos : 0 < e) (hlt : n < b ^ e) : (Nat.toDigitsCore b f n []).length ≤ e","range":[19926,20024]},"type":{"original":true,"pp":"(Nat.toDigitsCore b f n []).length ≤ e","range":[19984,20024]},"value":{"original":true,"pp":" := by\n induction f generalizing n e hlt h_e_pos with\n | zero => simp only [toDigitsCore, List.length, zero_le]\n | succ f ih =>\n simp only [toDigitsCore]\n cases e with\n | zero => exact False.elim (Nat.lt_irrefl 0 h_e_pos)\n | succ e =>\n cases e with\n | zero =>\n rw [zero_add, pow_one] at hlt\n simp [Nat.div_eq_of_lt hlt]\n | succ e =>\n specialize ih (n / b) _ (add_one_pos e) (Nat.div_lt_of_lt_mul <| by rwa [← pow_add_one'])\n split_ifs\n · simp only [List.length_singleton, _root_.zero_le, succ_le_succ]\n · simp only [toDigitsCore_lens_eq b f (n / b) (Nat.digitChar <| n % b), Nat.succ_le_succ_iff, ih]","range":[20025,20712]}},{"id":{"original":true,"range":[20995,21010]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The core implementation of `Nat.toDigits` returns a String with length less than or equal to the\nnumber of digits in the base-`b` number (represented by `e`). For example, the string\nrepresentation of any number less than `b ^ 3` has a length less than or equal to 3. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[20714,20988],"visibility":"regular"},"name":["Nat","toDigits_length"],"params":[{"bi":"default","id":[21012,21013],"ref":[21012,21013],"type":[21020,21023]},{"bi":"default","id":[21014,21015],"ref":[21014,21015],"type":[21020,21023]},{"bi":"default","id":[21016,21017],"ref":[21016,21017],"type":[21020,21023]}],"ref":{"original":true,"pp":"/-- The core implementation of `Nat.toDigits` returns a String with length less than or equal to the\nnumber of digits in the base-`b` number (represented by `e`). For example, the string\nrepresentation of any number less than `b ^ 3` has a length less than or equal to 3. -/\ntheorem toDigits_length (b n e : Nat) : 0 < e → n < b ^ e → (Nat.toDigits b n).length ≤ e :=\n toDigitsCore_length _ _ _ _","range":[20714,21115]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (b n e : Nat) : 0 < e → n < b ^ e → (Nat.toDigits b n).length ≤ e","range":[21011,21082]},"type":{"original":true,"pp":"0 < e → n < b ^ e → (Nat.toDigits b n).length ≤ e","range":[21027,21082]},"value":{"original":true,"pp":" :=\n toDigitsCore_length _ _ _ _","range":[21083,21115]}},{"id":{"original":true,"range":[21407,21418]},"kind":"theorem","modifiers":{"attrs":[],"computeKind":"regular","docString":["The core implementation of `Nat.repr` returns a String with length less than or equal to the\nnumber of digits in the decimal number (represented by `e`). For example, the decimal string\nrepresentation of any number less than 1000 (10 ^ 3) has a length less than or equal to 3. ",false],"isProtected":false,"isUnsafe":false,"recKind":"default","stx":[21117,21400],"visibility":"regular"},"name":["Nat","repr_length"],"params":[{"bi":"default","id":[21420,21421],"ref":[21420,21421],"type":[21426,21429]},{"bi":"default","id":[21422,21423],"ref":[21422,21423],"type":[21426,21429]}],"ref":{"original":true,"pp":"/-- The core implementation of `Nat.repr` returns a String with length less than or equal to the\nnumber of digits in the decimal number (represented by `e`). For example, the decimal string\nrepresentation of any number less than 1000 (10 ^ 3) has a length less than or equal to 3. -/\ntheorem repr_length (n e : Nat) : 0 < e → n < 10 ^ e → (Nat.repr n).length ≤ e := by\n simpa [Nat.repr] using toDigits_length _ _ _","range":[21117,21536]},"scopeInfo":{"currNamespace":["Nat"],"includeVars":[],"levelNames":[],"omitVars":[],"openDecl":[],"scopedOpenDecl":[["Nat"]],"varDecls":["variable {n : ℕ}"]},"signature":{"original":true,"pp":" (n e : Nat) : 0 < e → n < 10 ^ e → (Nat.repr n).length ≤ e","range":[21419,21483]},"type":{"original":true,"pp":"0 < e → n < 10 ^ e → (Nat.repr n).length ≤ e","range":[21433,21483]},"value":{"original":true,"pp":" := by simpa [Nat.repr] using toDigits_length _ _ _","range":[21484,21536]}}]
symbol_5e932f97dd25535344f80f9dd8da3aab83df0fe6.db/lock.mdb ADDED
Binary file (8.19 kB). View file