File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11module
22
3- def change_base : Unit :=
4- ()
3+ def changeBase (x : Nat) (base : Nat) : String :=
4+ String.ofList (Nat.toDigits base x)
5+
6+ example : changeBase 8 3 = "22" := by native_decide
7+ example : changeBase 9 3 = "100" := by native_decide
8+ example : changeBase 234 2 = "11101010" := by native_decide
9+ example : changeBase 16 2 = "10000" := by native_decide
10+ example : changeBase 8 2 = "1000" := by native_decide
11+ example : changeBase 7 2 = "111" := by native_decide
12+
13+ theorem ofDigitChars_changeBase {x : Nat} {base : Nat} (hb' : 1 < base) (hb : base ≤ 10 ) :
14+ Nat.ofDigitChars base (changeBase x base).toList 0 = x := by
15+ simp [changeBase, Nat.ofDigitChars_toDigits hb' hb]
516
617/-!
718## Prompt
@@ -51,4 +62,4 @@ def check(candidate):
5162 assert candidate(x, x + 1) == str(x)
5263
5364```
54- -/
65+ -/
You can’t perform that action at this time.
0 commit comments