url
stringclasses
147 values
commit
stringclasses
147 values
file_path
stringlengths
7
101
full_name
stringlengths
1
94
start
stringlengths
6
10
end
stringlengths
6
11
tactic
stringlengths
1
11.2k
state_before
stringlengths
3
2.09M
state_after
stringlengths
6
2.09M
input
stringlengths
73
2.09M
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
rw [List.getD_eq_default] at R
a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ (hd :: tl)
a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ (hd :: tl) case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl
Please generate a tactic in lean4 to solve the state. STATE: a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ (hd :: tl) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
. rw [List.getD_reverse] at R . conv => right; unfold toNatΔ toNatAux simp only [List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero, Nat.sub_self, le_refl, tsub_eq_zero_of_le, List.getElem_eq_get, List.get] at R rw [String.toNatAux_accumulates, ← toNatΔ, ← R] simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mul, Nat.sub_self, le_refl, tsub_eq_zero_of_le, add_zero] apply ih . intro i rw [P, List.reverse_cons] cases h: decide ( i < List.length tl) with | true => simp only [decide_eq_true_eq] at h rw [List.getD_append] simp only [List.length_reverse, h] | false => simp only [decide_eq_false_iff_not, not_lt] at h rw [List.getD_append_right, ←R, List.getD_singleton_default_eq, List.getD_eq_default] <;> simp only [List.length_reverse, ge_iff_le, h] . apply Nat.le_of_lt_succ apply Nat.lt_of_le_of_ne Q heq . simp only [List.length_cons, Nat.lt_succ_self]
a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ (hd :: tl) case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl
case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl
Please generate a tactic in lean4 to solve the state. STATE: a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ (hd :: tl) case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
. simp only [List.length_cons] at Q simp only [List.length_reverse, ge_iff_le] apply Nat.le_of_lt_succ apply Nat.lt_of_le_of_ne Q heq
case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl
no goals
Please generate a tactic in lean4 to solve the state. STATE: case hn a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R : List.getD (List.reverse a) (List.length tl) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) ⊢ List.length (List.reverse a) ≤ List.length tl TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
simp only [decide_eq_true_eq] at h
case P.true a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : decide (i < List.length tl) = true ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
case P.true a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case P.true a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : decide (i < List.length tl) = true ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
rw [List.getD_append]
case P.true a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
case P.true.h a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ i < List.length (List.reverse tl)
Please generate a tactic in lean4 to solve the state. STATE: case P.true a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
simp only [List.length_reverse, h]
case P.true.h a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ i < List.length (List.reverse tl)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case P.true.h a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : i < List.length tl ⊢ i < List.length (List.reverse tl) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
simp only [decide_eq_false_iff_not, not_lt] at h
case P.false a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : decide (i < List.length tl) = false ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
case P.false a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : List.length tl ≤ i ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case P.false a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : decide (i < List.length tl) = false ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq_aux
[627, 1]
[689, 41]
rw [List.getD_append_right, ←R, List.getD_singleton_default_eq, List.getD_eq_default] <;> simp only [List.length_reverse, ge_iff_le, h]
case P.false a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : List.length tl ≤ i ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case P.false a : List Char hd : Char tl : List Char ih : (∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48)) → List.length a ≤ List.length tl → toNatΔ a = toNatΔ tl P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) i (Char.ofNat 48) Q : List.length a ≤ List.length (hd :: tl) heq : ¬List.length a = List.length (hd :: tl) R✝ : Char.ofNat 48 = List.getD (List.reverse (hd :: tl)) (List.length tl) (Char.ofNat 48) R : Char.ofNat 48 = hd i : ℕ h : List.length tl ≤ i ⊢ List.getD (List.reverse tl ++ [hd]) i (Char.ofNat 48) = List.getD (List.reverse tl) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
cases h: decide (List.length a ≤ List.length b) with | true => simp only [decide_eq_true_eq] at h apply String.toNatΔ_eq_of_rev_get_eq_aux P h | false => simp only [decide_eq_false_iff_not, not_le] at h apply Eq.symm apply (String.toNatΔ_eq_of_rev_get_eq_aux (a:=b) (b:=a) (Q:=le_of_lt h)) intro i apply Eq.symm apply P
a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ b
no goals
Please generate a tactic in lean4 to solve the state. STATE: a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) ⊢ toNatΔ a = toNatΔ b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
simp only [decide_eq_true_eq] at h
case true a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : decide (List.length a ≤ List.length b) = true ⊢ toNatΔ a = toNatΔ b
case true a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length a ≤ List.length b ⊢ toNatΔ a = toNatΔ b
Please generate a tactic in lean4 to solve the state. STATE: case true a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : decide (List.length a ≤ List.length b) = true ⊢ toNatΔ a = toNatΔ b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
apply String.toNatΔ_eq_of_rev_get_eq_aux P h
case true a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length a ≤ List.length b ⊢ toNatΔ a = toNatΔ b
no goals
Please generate a tactic in lean4 to solve the state. STATE: case true a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length a ≤ List.length b ⊢ toNatΔ a = toNatΔ b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
simp only [decide_eq_false_iff_not, not_le] at h
case false a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : decide (List.length a ≤ List.length b) = false ⊢ toNatΔ a = toNatΔ b
case false a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ a = toNatΔ b
Please generate a tactic in lean4 to solve the state. STATE: case false a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : decide (List.length a ≤ List.length b) = false ⊢ toNatΔ a = toNatΔ b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
apply Eq.symm
case false a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ a = toNatΔ b
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ b = toNatΔ a
Please generate a tactic in lean4 to solve the state. STATE: case false a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ a = toNatΔ b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
apply (String.toNatΔ_eq_of_rev_get_eq_aux (a:=b) (b:=a) (Q:=le_of_lt h))
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ b = toNatΔ a
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ ∀ (i : ℕ), List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ toNatΔ b = toNatΔ a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
intro i
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ ∀ (i : ℕ), List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48)
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a ⊢ ∀ (i : ℕ), List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
apply Eq.symm
case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48)
case false.h.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case false.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse b) i (Char.ofNat 48) = List.getD (List.reverse a) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_eq_of_rev_get_eq
[692, 1]
[703, 12]
apply P
case false.h.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case false.h.h a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) h : List.length b < List.length a i : ℕ ⊢ List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
conv => right; rw [← List.take_append_drop n l]
i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n ⊢ getD (take n l) i d = getD l i d
i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
Please generate a tactic in lean4 to solve the state. STATE: i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n ⊢ getD (take n l) i d = getD l i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
cases h: decide (i < List.length l) with | true => simp only [decide_eq_true_eq] at h rw [List.getD_append] simp only [length_take, min_le_iff, ge_iff_le, lt_min_iff] exact ⟨P,h⟩ | false => simp only [decide_eq_false_iff_not, not_lt] at h rw [List.getD_eq_default, List.getD_eq_default] . simp only [take_append_drop, ge_iff_le, h] . simp only [length_take, min_le_iff, ge_iff_le, h, or_true]
i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
no goals
Please generate a tactic in lean4 to solve the state. STATE: i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
simp only [decide_eq_true_eq] at h
case true i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : decide (i < length l) = true ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
case true i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
Please generate a tactic in lean4 to solve the state. STATE: case true i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : decide (i < length l) = true ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
rw [List.getD_append]
case true i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < length (take n l)
Please generate a tactic in lean4 to solve the state. STATE: case true i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
simp only [length_take, min_le_iff, ge_iff_le, lt_min_iff]
case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < length (take n l)
case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < n ∧ i < length l
Please generate a tactic in lean4 to solve the state. STATE: case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < length (take n l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
exact ⟨P,h⟩
case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < n ∧ i < length l
no goals
Please generate a tactic in lean4 to solve the state. STATE: case true.h i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : i < length l ⊢ i < n ∧ i < length l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
simp only [decide_eq_false_iff_not, not_lt] at h
case false i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : decide (i < length l) = false ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
case false i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
Please generate a tactic in lean4 to solve the state. STATE: case false i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : decide (i < length l) = false ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
rw [List.getD_eq_default, List.getD_eq_default]
case false i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d
case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l ++ drop n l) ≤ i case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i
Please generate a tactic in lean4 to solve the state. STATE: case false i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ getD (take n l) i d = getD (take n l ++ drop n l) i d TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
. simp only [take_append_drop, ge_iff_le, h]
case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l ++ drop n l) ≤ i case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i
case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i
Please generate a tactic in lean4 to solve the state. STATE: case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l ++ drop n l) ≤ i case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_take
[705, 1]
[718, 65]
. simp only [length_take, min_le_iff, ge_iff_le, h, or_true]
case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i
no goals
Please generate a tactic in lean4 to solve the state. STATE: case false.hn i n : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < n h : length l ≤ i ⊢ length (take n l) ≤ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
apply String.toNatΔ_eq_of_rev_get_eq
b n i : ℕ Q : b > 1 ⊢ toNatΔ (List.lastN i (Nat.toDigits b n)) = toNatΔ (Nat.toDigits b (n % b ^ i))
case P b n i : ℕ Q : b > 1 ⊢ ∀ (i_1 : ℕ), List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) i_1 (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) i_1 (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: b n i : ℕ Q : b > 1 ⊢ toNatΔ (List.lastN i (Nat.toDigits b n)) = toNatΔ (Nat.toDigits b (n % b ^ i)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
intro ind
case P b n i : ℕ Q : b > 1 ⊢ ∀ (i_1 : ℕ), List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) i_1 (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) i_1 (Char.ofNat 48)
case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case P b n i : ℕ Q : b > 1 ⊢ ∀ (i_1 : ℕ), List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) i_1 (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) i_1 (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [ge_iff_le, List.lastN_eq_reverse_take, List.reverse_reverse]
case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48)
case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take i (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.reverse (List.lastN i (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
cases i
case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take i (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48)
case P.zero b n : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take Nat.zero (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.zero))) ind (Char.ofNat 48) case P.succ b n : ℕ Q : b > 1 ind n✝ : ℕ ⊢ List.getD (List.take (Nat.succ n✝) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ n✝))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case P b n i : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take i (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
case zero => simp only [List.take, List.length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.getD_eq_default, Nat.zero_eq, pow_zero, Nat.mod_one, Nat.toDigits_zero, List.reverse_cons, List.reverse_nil, List.nil_append, List.length_singleton, List.getD_singleton_default_eq]
b n : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take Nat.zero (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.zero))) ind (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take Nat.zero (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.zero))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
case succ i => cases h: decide (ind < Nat.succ i) with | true => simp only [ge_iff_le, decide_eq_true_eq] at h simp only [h, List.getD_take] rw [Nat.toDigits_modulo] <;> assumption | false => simp only [decide_eq_false_iff_not, not_lt] at h rw [List.getD_eq_default, List.getD_eq_default] . simp only [List.length_reverse, gt_iff_lt, ge_iff_le] rw [Nat.toDigits_length_eq_log] . calc Nat.log b (n % b ^ Nat.succ i) + 1 ≤ Nat.succ i := by { apply Nat.succ_le_of_lt cases heq: n % b ^ Nat.succ i with | zero => simp only [Nat.zero_eq, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.log_zero_right, Nat.succ_pos'] | succ k => rw [← heq] apply Nat.log_lt_of_lt_pow . simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . apply Nat.mod_lt apply Nat.pos_pow_of_pos apply Nat.lt_trans Nat.zero_lt_one Q } _ ≤ ind := h . exact Q . simp only [List.length_take, List.length_reverse, min_le_iff, ge_iff_le, h, true_or]
b n : ℕ Q : b > 1 ind i : ℕ ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ Q : b > 1 ind i : ℕ ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [List.take, List.length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.getD_eq_default, Nat.zero_eq, pow_zero, Nat.mod_one, Nat.toDigits_zero, List.reverse_cons, List.reverse_nil, List.nil_append, List.length_singleton, List.getD_singleton_default_eq]
b n : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take Nat.zero (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.zero))) ind (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ Q : b > 1 ind : ℕ ⊢ List.getD (List.take Nat.zero (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.zero))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
cases h: decide (ind < Nat.succ i) with | true => simp only [ge_iff_le, decide_eq_true_eq] at h simp only [h, List.getD_take] rw [Nat.toDigits_modulo] <;> assumption | false => simp only [decide_eq_false_iff_not, not_lt] at h rw [List.getD_eq_default, List.getD_eq_default] . simp only [List.length_reverse, gt_iff_lt, ge_iff_le] rw [Nat.toDigits_length_eq_log] . calc Nat.log b (n % b ^ Nat.succ i) + 1 ≤ Nat.succ i := by { apply Nat.succ_le_of_lt cases heq: n % b ^ Nat.succ i with | zero => simp only [Nat.zero_eq, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.log_zero_right, Nat.succ_pos'] | succ k => rw [← heq] apply Nat.log_lt_of_lt_pow . simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . apply Nat.mod_lt apply Nat.pos_pow_of_pos apply Nat.lt_trans Nat.zero_lt_one Q } _ ≤ ind := h . exact Q . simp only [List.length_take, List.length_reverse, min_le_iff, ge_iff_le, h, true_or]
b n : ℕ Q : b > 1 ind i : ℕ ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ Q : b > 1 ind i : ℕ ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [ge_iff_le, decide_eq_true_eq] at h
case true b n : ℕ Q : b > 1 ind i : ℕ h : decide (ind < Nat.succ i) = true ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case true b n : ℕ Q : b > 1 ind i : ℕ h : decide (ind < Nat.succ i) = true ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [h, List.getD_take]
case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.reverse (Nat.toDigits b n)) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
rw [Nat.toDigits_modulo] <;> assumption
case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.reverse (Nat.toDigits b n)) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case true b n : ℕ Q : b > 1 ind i : ℕ h : ind < Nat.succ i ⊢ List.getD (List.reverse (Nat.toDigits b n)) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [decide_eq_false_iff_not, not_lt] at h
case false b n : ℕ Q : b > 1 ind i : ℕ h : decide (ind < Nat.succ i) = false ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
case false b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case false b n : ℕ Q : b > 1 ind i : ℕ h : decide (ind < Nat.succ i) = false ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
rw [List.getD_eq_default, List.getD_eq_default]
case false b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48)
case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ≤ ind case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind
Please generate a tactic in lean4 to solve the state. STATE: case false b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.getD (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ind (Char.ofNat 48) = List.getD (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ind (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
. simp only [List.length_reverse, gt_iff_lt, ge_iff_le] rw [Nat.toDigits_length_eq_log] . calc Nat.log b (n % b ^ Nat.succ i) + 1 ≤ Nat.succ i := by { apply Nat.succ_le_of_lt cases heq: n % b ^ Nat.succ i with | zero => simp only [Nat.zero_eq, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.log_zero_right, Nat.succ_pos'] | succ k => rw [← heq] apply Nat.log_lt_of_lt_pow . simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . apply Nat.mod_lt apply Nat.pos_pow_of_pos apply Nat.lt_trans Nat.zero_lt_one Q } _ ≤ ind := h . exact Q
case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ≤ ind case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind
case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind
Please generate a tactic in lean4 to solve the state. STATE: case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.reverse (Nat.toDigits b (n % b ^ Nat.succ i))) ≤ ind case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
. simp only [List.length_take, List.length_reverse, min_le_iff, ge_iff_le, h, true_or]
case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind
no goals
Please generate a tactic in lean4 to solve the state. STATE: case false.hn b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ List.length (List.take (Nat.succ i) (List.reverse (Nat.toDigits b n))) ≤ ind TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
apply Nat.succ_le_of_lt
b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ Nat.log b (n % b ^ Nat.succ i) + 1 ≤ Nat.succ i
case h b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ Nat.log b (n % b ^ Nat.succ i) + 1 ≤ Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
cases heq: n % b ^ Nat.succ i with | zero => simp only [Nat.zero_eq, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.log_zero_right, Nat.succ_pos'] | succ k => rw [← heq] apply Nat.log_lt_of_lt_pow . simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . apply Nat.mod_lt apply Nat.pos_pow_of_pos apply Nat.lt_trans Nat.zero_lt_one Q
case h b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
simp only [Nat.zero_eq, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.log_zero_right, Nat.succ_pos']
case h.zero b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind heq : n % b ^ Nat.succ i = Nat.zero ⊢ Nat.log b Nat.zero < Nat.succ i
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h.zero b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind heq : n % b ^ Nat.succ i = Nat.zero ⊢ Nat.log b Nat.zero < Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
rw [← heq]
case h.succ b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ Nat.log b (Nat.succ k) < Nat.succ i
case h.succ b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i
Please generate a tactic in lean4 to solve the state. STATE: case h.succ b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ Nat.log b (Nat.succ k) < Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
apply Nat.log_lt_of_lt_pow
case h.succ b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i
case h.succ.hy b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i ≠ 0 case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i
Please generate a tactic in lean4 to solve the state. STATE: case h.succ b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ Nat.log b (n % b ^ Nat.succ i) < Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
. simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff]
case h.succ.hy b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i ≠ 0 case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i
case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i
Please generate a tactic in lean4 to solve the state. STATE: case h.succ.hy b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i ≠ 0 case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits_tail
[720, 1]
[756, 91]
. apply Nat.mod_lt apply Nat.pos_pow_of_pos apply Nat.lt_trans Nat.zero_lt_one Q
case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h.succ.a b n : ℕ Q : b > 1 ind i : ℕ h : Nat.succ i ≤ ind k : ℕ heq : n % b ^ Nat.succ i = Nat.succ k ⊢ n % b ^ Nat.succ i < b ^ Nat.succ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
unfold toDigits toDigitsCore
b n : ℕ P : n < b ⊢ toDigits b n = [digitChar n]
b n : ℕ P : n < b ⊢ (let d := digitChar (n % b); let n' := n / b; if n' = 0 then [d] else toDigitsCore b (Nat.add n 0) n' [d]) = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b ⊢ toDigits b n = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero, add_eq, add_zero]
b n : ℕ P : n < b ⊢ (let d := digitChar (n % b); let n' := n / b; if n' = 0 then [d] else toDigitsCore b (Nat.add n 0) n' [d]) = [digitChar n]
b n : ℕ P : n < b ⊢ (if n / b = 0 then [digitChar (n % b)] else toDigitsCore b n (n / b) [digitChar (n % b)]) = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b ⊢ (let d := digitChar (n % b); let n' := n / b; if n' = 0 then [d] else toDigitsCore b (Nat.add n 0) n' [d]) = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
split
b n : ℕ P : n < b ⊢ (if n / b = 0 then [digitChar (n % b)] else toDigitsCore b n (n / b) [digitChar (n % b)]) = [digitChar n]
case inl b n : ℕ P : n < b h✝ : n / b = 0 ⊢ [digitChar (n % b)] = [digitChar n] case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b ⊢ (if n / b = 0 then [digitChar (n % b)] else toDigitsCore b n (n / b) [digitChar (n % b)]) = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
. next => have h:n % b = n := by exact mod_eq_of_lt P simp only [h]
case inl b n : ℕ P : n < b h✝ : n / b = 0 ⊢ [digitChar (n % b)] = [digitChar n] case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n]
case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: case inl b n : ℕ P : n < b h✝ : n / b = 0 ⊢ [digitChar (n % b)] = [digitChar n] case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
. next => unfold toDigitsCore simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero] split . simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mod] . split . next h _=> exfalso; apply h; exact div_eq_of_lt P . next h _=> exfalso; apply h; exact div_eq_of_lt P
case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n]
no goals
Please generate a tactic in lean4 to solve the state. STATE: case inr b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
have h:n % b = n := by exact mod_eq_of_lt P
b n : ℕ P : n < b h✝ : n / b = 0 ⊢ [digitChar (n % b)] = [digitChar n]
b n : ℕ P : n < b h✝ : n / b = 0 h : n % b = n ⊢ [digitChar (n % b)] = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : n / b = 0 ⊢ [digitChar (n % b)] = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
simp only [h]
b n : ℕ P : n < b h✝ : n / b = 0 h : n % b = n ⊢ [digitChar (n % b)] = [digitChar n]
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : n / b = 0 h : n % b = n ⊢ [digitChar (n % b)] = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
exact mod_eq_of_lt P
b n : ℕ P : n < b h✝ : n / b = 0 ⊢ n % b = n
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : n / b = 0 ⊢ n % b = n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
unfold toDigitsCore
b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n]
b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => let d := digitChar (n % b); let n' := n / b; if n' = 0 then d :: ds else toDigitsCore b fuel n' (d :: ds)) = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ toDigitsCore b n (n / b) [digitChar (n % b)] = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero]
b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => let d := digitChar (n % b); let n' := n / b; if n' = 0 then d :: ds else toDigitsCore b fuel n' (d :: ds)) = [digitChar n]
b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => if n / b = 0 then digitChar (n % b) :: ds else toDigitsCore b fuel (n / b) (digitChar (n % b) :: ds)) = [digitChar n]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => let d := digitChar (n % b); let n' := n / b; if n' = 0 then d :: ds else toDigitsCore b fuel n' (d :: ds)) = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
split
b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => if n / b = 0 then digitChar (n % b) :: ds else toDigitsCore b fuel (n / b) (digitChar (n % b) :: ds)) = [digitChar n]
case h_1 b x✝² x✝¹ : ℕ x✝ : List Char P : 0 < b h✝ : ¬0 / b = 0 ⊢ [digitChar (0 % b)] = [digitChar 0] case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)]
Please generate a tactic in lean4 to solve the state. STATE: b n : ℕ P : n < b h✝ : ¬n / b = 0 ⊢ (match n, n / b, [digitChar (n % b)] with | 0, x, ds => ds | succ fuel, n, ds => if n / b = 0 then digitChar (n % b) :: ds else toDigitsCore b fuel (n / b) (digitChar (n % b) :: ds)) = [digitChar n] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
. simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mod]
case h_1 b x✝² x✝¹ : ℕ x✝ : List Char P : 0 < b h✝ : ¬0 / b = 0 ⊢ [digitChar (0 % b)] = [digitChar 0] case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)]
case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)]
Please generate a tactic in lean4 to solve the state. STATE: case h_1 b x✝² x✝¹ : ℕ x✝ : List Char P : 0 < b h✝ : ¬0 / b = 0 ⊢ [digitChar (0 % b)] = [digitChar 0] case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
. split . next h _=> exfalso; apply h; exact div_eq_of_lt P . next h _=> exfalso; apply h; exact div_eq_of_lt P
case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)]
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h_2 b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h✝ : ¬succ fuel✝ / b = 0 ⊢ (if succ fuel✝ / b / b = 0 then [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] else toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)]) = [digitChar (succ fuel✝)] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
exfalso
b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] = [digitChar (succ fuel✝)]
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ False
Please generate a tactic in lean4 to solve the state. STATE: b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] = [digitChar (succ fuel✝)] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
apply h
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ False
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0
Please generate a tactic in lean4 to solve the state. STATE: case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ False TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
exact div_eq_of_lt P
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
exfalso
b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] = [digitChar (succ fuel✝)]
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ False
Please generate a tactic in lean4 to solve the state. STATE: b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ toDigitsCore b fuel✝ (succ fuel✝ / b / b) [digitChar (succ fuel✝ / b % b), digitChar (succ fuel✝ % b)] = [digitChar (succ fuel✝)] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
apply h
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ False
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0
Please generate a tactic in lean4 to solve the state. STATE: case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ False TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_single_digit
[759, 1]
[773, 58]
exact div_eq_of_lt P
case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h b x✝² x✝¹ : ℕ x✝ : List Char fuel✝ : ℕ P : succ fuel✝ < b h : ¬succ fuel✝ / b = 0 h✝ : ¬succ fuel✝ / b / b = 0 ⊢ succ fuel✝ / b = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
induction n using Nat.strong_induction_on with | h n ih => cases n case zero => decide case succ n=> unfold toNatΔ toNatAux simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mul, tsub_le_iff_right, zero_add] split . next heq => simp only [Nat.toDigits_ne_nil] at heq . next s hd tl heq => have h: tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) := by simp only [tsub_le_iff_right, ge_iff_le, List.lastN_eq_tail] simp only [heq, List.tail_cons] apply_fun String.toNatΔ at h rw [String.toNatΔ_inv_NattoDigits_tail] at h rw [String.toNatAux_accumulates, ← String.toNatΔ] rw [h, ih] . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_le_iff_right] apply Eq.symm rw [Nat.add_comm] apply Nat.eq_add_of_sub_eq . apply Nat.mod_le . conv => left; left; rw [← Nat.mod_add_div (Nat.succ n) (10^Nat.log 10 (Nat.succ n))] simp only [add_tsub_cancel_left, ge_iff_le, add_le_iff_nonpos_right, nonpos_iff_eq_zero, mul_eq_zero, zero_le, Nat.log_pos_iff, and_true, tsub_le_iff_right] have h₂: List.getD (Nat.toDigits 10 (Nat.succ n)) 0 '0' = hd := by unfold List.getD simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.cons.injEq, forall_true_left, and_imp, forall_apply_eq_imp_iff', forall_eq', Option.getD_some, List.get?] rw [Nat.toDigits_eq_digit] at h₂ have h₃: List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) -1 := by simp only [heq, List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero] rw [Nat.toDigits_length_eq_log] at h₃ rw [← h₂, h₃, Nat.digitChar_sub_zero_eq_self, Nat.toDigits_length_eq_log, Nat.digit, Nat.mul_comm] simp only [add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_zero, mul_eq_mul_right_iff, Nat.log_pos_iff, and_true] left apply Eq.symm (Nat.mod_eq_of_lt _) . apply (Nat.div_lt_iff_lt_mul _).2 . rw [← pow_succ] apply Nat.lt_pow_of_log_lt . simp only . simp only [lt_add_iff_pos_right] . simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, gt_iff_lt, pow_pos] . simp only . simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_zero, tsub_eq_zero_iff_le, gt_iff_lt, Nat.digit_lt_base] . simp only . simp only . apply Nat.pos_of_ne_zero intro hp apply Nat.toDigits_ne_nil (List.length_eq_zero.1 hp) . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le] calc (Nat.succ n) % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n) := by apply Nat.mod_lt; apply Nat.pos_pow_of_pos; simp only _ ≤ n + 1 := by apply Nat.pow_log_le_self; simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . simp only
n : ℕ ⊢ toNatΔ (Nat.toDigits 10 n) = n
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ⊢ toNatΔ (Nat.toDigits 10 n) = n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
cases n
case h n : ℕ ih : ∀ (m : ℕ), m < n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 n) = n
case h.zero ih : ∀ (m : ℕ), m < Nat.zero → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 Nat.zero) = Nat.zero case h.succ n✝ : ℕ ih : ∀ (m : ℕ), m < Nat.succ n✝ → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 (Nat.succ n✝)) = Nat.succ n✝
Please generate a tactic in lean4 to solve the state. STATE: case h n : ℕ ih : ∀ (m : ℕ), m < n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 n) = n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
case zero => decide
ih : ∀ (m : ℕ), m < Nat.zero → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 Nat.zero) = Nat.zero
no goals
Please generate a tactic in lean4 to solve the state. STATE: ih : ∀ (m : ℕ), m < Nat.zero → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 Nat.zero) = Nat.zero TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
case succ n=> unfold toNatΔ toNatAux simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mul, tsub_le_iff_right, zero_add] split . next heq => simp only [Nat.toDigits_ne_nil] at heq . next s hd tl heq => have h: tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) := by simp only [tsub_le_iff_right, ge_iff_le, List.lastN_eq_tail] simp only [heq, List.tail_cons] apply_fun String.toNatΔ at h rw [String.toNatΔ_inv_NattoDigits_tail] at h rw [String.toNatAux_accumulates, ← String.toNatΔ] rw [h, ih] . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_le_iff_right] apply Eq.symm rw [Nat.add_comm] apply Nat.eq_add_of_sub_eq . apply Nat.mod_le . conv => left; left; rw [← Nat.mod_add_div (Nat.succ n) (10^Nat.log 10 (Nat.succ n))] simp only [add_tsub_cancel_left, ge_iff_le, add_le_iff_nonpos_right, nonpos_iff_eq_zero, mul_eq_zero, zero_le, Nat.log_pos_iff, and_true, tsub_le_iff_right] have h₂: List.getD (Nat.toDigits 10 (Nat.succ n)) 0 '0' = hd := by unfold List.getD simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.cons.injEq, forall_true_left, and_imp, forall_apply_eq_imp_iff', forall_eq', Option.getD_some, List.get?] rw [Nat.toDigits_eq_digit] at h₂ have h₃: List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) -1 := by simp only [heq, List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero] rw [Nat.toDigits_length_eq_log] at h₃ rw [← h₂, h₃, Nat.digitChar_sub_zero_eq_self, Nat.toDigits_length_eq_log, Nat.digit, Nat.mul_comm] simp only [add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_zero, mul_eq_mul_right_iff, Nat.log_pos_iff, and_true] left apply Eq.symm (Nat.mod_eq_of_lt _) . apply (Nat.div_lt_iff_lt_mul _).2 . rw [← pow_succ] apply Nat.lt_pow_of_log_lt . simp only . simp only [lt_add_iff_pos_right] . simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, gt_iff_lt, pow_pos] . simp only . simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_zero, tsub_eq_zero_iff_le, gt_iff_lt, Nat.digit_lt_base] . simp only . simp only . apply Nat.pos_of_ne_zero intro hp apply Nat.toDigits_ne_nil (List.length_eq_zero.1 hp) . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le] calc (Nat.succ n) % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n) := by apply Nat.mod_lt; apply Nat.pos_pow_of_pos; simp only _ ≤ n + 1 := by apply Nat.pow_log_le_self; simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . simp only
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 (Nat.succ n)) = Nat.succ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 (Nat.succ n)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
decide
ih : ∀ (m : ℕ), m < Nat.zero → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 Nat.zero) = Nat.zero
no goals
Please generate a tactic in lean4 to solve the state. STATE: ih : ∀ (m : ℕ), m < Nat.zero → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 Nat.zero) = Nat.zero TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
unfold toNatΔ toNatAux
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 (Nat.succ n)) = Nat.succ n
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (0 * 10 + (Char.toNat head - Char.toNat (Char.ofNat 48)))) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ toNatΔ (Nat.toDigits 10 (Nat.succ n)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, zero_mul, tsub_le_iff_right, zero_add]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (0 * 10 + (Char.toNat head - Char.toNat (Char.ofNat 48)))) = Nat.succ n
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (Char.toNat head - Char.toNat (Char.ofNat 48))) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (0 * 10 + (Char.toNat head - Char.toNat (Char.ofNat 48)))) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
split
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (Char.toNat head - Char.toNat (Char.ofNat 48))) = Nat.succ n
case h_1 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = [] ⊢ 0 = Nat.succ n case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m ⊢ (match Nat.toDigits 10 (Nat.succ n) with | [] => 0 | head :: tail => toNatAux tail (Char.toNat head - Char.toNat (Char.ofNat 48))) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
. next heq => simp only [Nat.toDigits_ne_nil] at heq
case h_1 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = [] ⊢ 0 = Nat.succ n case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n
case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: case h_1 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = [] ⊢ 0 = Nat.succ n case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
. next s hd tl heq => have h: tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) := by simp only [tsub_le_iff_right, ge_iff_le, List.lastN_eq_tail] simp only [heq, List.tail_cons] apply_fun String.toNatΔ at h rw [String.toNatΔ_inv_NattoDigits_tail] at h rw [String.toNatAux_accumulates, ← String.toNatΔ] rw [h, ih] . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_le_iff_right] apply Eq.symm rw [Nat.add_comm] apply Nat.eq_add_of_sub_eq . apply Nat.mod_le . conv => left; left; rw [← Nat.mod_add_div (Nat.succ n) (10^Nat.log 10 (Nat.succ n))] simp only [add_tsub_cancel_left, ge_iff_le, add_le_iff_nonpos_right, nonpos_iff_eq_zero, mul_eq_zero, zero_le, Nat.log_pos_iff, and_true, tsub_le_iff_right] have h₂: List.getD (Nat.toDigits 10 (Nat.succ n)) 0 '0' = hd := by unfold List.getD simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.cons.injEq, forall_true_left, and_imp, forall_apply_eq_imp_iff', forall_eq', Option.getD_some, List.get?] rw [Nat.toDigits_eq_digit] at h₂ have h₃: List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) -1 := by simp only [heq, List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero] rw [Nat.toDigits_length_eq_log] at h₃ rw [← h₂, h₃, Nat.digitChar_sub_zero_eq_self, Nat.toDigits_length_eq_log, Nat.digit, Nat.mul_comm] simp only [add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_zero, mul_eq_mul_right_iff, Nat.log_pos_iff, and_true] left apply Eq.symm (Nat.mod_eq_of_lt _) . apply (Nat.div_lt_iff_lt_mul _).2 . rw [← pow_succ] apply Nat.lt_pow_of_log_lt . simp only . simp only [lt_add_iff_pos_right] . simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, gt_iff_lt, pow_pos] . simp only . simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_zero, tsub_eq_zero_iff_le, gt_iff_lt, Nat.digit_lt_base] . simp only . simp only . apply Nat.pos_of_ne_zero intro hp apply Nat.toDigits_ne_nil (List.length_eq_zero.1 hp) . simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le] calc (Nat.succ n) % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n) := by apply Nat.mod_lt; apply Nat.pos_pow_of_pos; simp only _ ≤ n + 1 := by apply Nat.pow_log_le_self; simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff] . simp only
case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h_2 n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char head✝ : Char tail✝ : List Char heq✝ : Nat.toDigits 10 (Nat.succ n) = head✝ :: tail✝ ⊢ toNatAux tail✝ (Char.toNat head✝ - Char.toNat (Char.ofNat 48)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [Nat.toDigits_ne_nil] at heq
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char heq : Nat.toDigits 10 (Nat.succ n) = [] ⊢ 0 = Nat.succ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s✝ : List Char heq : Nat.toDigits 10 (Nat.succ n) = [] ⊢ 0 = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
have h: tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) := by simp only [tsub_le_iff_right, ge_iff_le, List.lastN_eq_tail] simp only [heq, List.tail_cons]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
apply_fun String.toNatΔ at h
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
rw [String.toNatΔ_inv_NattoDigits_tail] at h
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
rw [String.toNatAux_accumulates, ← String.toNatΔ]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatΔ tl + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatAux tl (Char.toNat hd - Char.toNat (Char.ofNat 48)) = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
rw [h, ih]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatΔ tl + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ toNatΔ tl + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
. simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_le_iff_right] apply Eq.symm rw [Nat.add_comm] apply Nat.eq_add_of_sub_eq . apply Nat.mod_le . conv => left; left; rw [← Nat.mod_add_div (Nat.succ n) (10^Nat.log 10 (Nat.succ n))] simp only [add_tsub_cancel_left, ge_iff_le, add_le_iff_nonpos_right, nonpos_iff_eq_zero, mul_eq_zero, zero_le, Nat.log_pos_iff, and_true, tsub_le_iff_right] have h₂: List.getD (Nat.toDigits 10 (Nat.succ n)) 0 '0' = hd := by unfold List.getD simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.cons.injEq, forall_true_left, and_imp, forall_apply_eq_imp_iff', forall_eq', Option.getD_some, List.get?] rw [Nat.toDigits_eq_digit] at h₂ have h₃: List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) -1 := by simp only [heq, List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero] rw [Nat.toDigits_length_eq_log] at h₃ rw [← h₂, h₃, Nat.digitChar_sub_zero_eq_self, Nat.toDigits_length_eq_log, Nat.digit, Nat.mul_comm] simp only [add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le, tsub_zero, mul_eq_mul_right_iff, Nat.log_pos_iff, and_true] left apply Eq.symm (Nat.mod_eq_of_lt _) . apply (Nat.div_lt_iff_lt_mul _).2 . rw [← pow_succ] apply Nat.lt_pow_of_log_lt . simp only . simp only [lt_add_iff_pos_right] . simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, gt_iff_lt, pow_pos] . simp only . simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_zero, tsub_eq_zero_iff_le, gt_iff_lt, Nat.digit_lt_base] . simp only . simp only . apply Nat.pos_of_ne_zero intro hp apply Nat.toDigits_ne_nil (List.length_eq_zero.1 hp)
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) + (Char.toNat hd - Char.toNat (Char.ofNat 48)) * 10 ^ List.length tl = Nat.succ n case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
. simp only [gt_iff_lt, Nat.toDigits_length_eq_log, add_tsub_cancel_right, ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, Nat.log_eq_zero_iff, or_false, zero_le] calc (Nat.succ n) % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n) := by apply Nat.mod_lt; apply Nat.pos_pow_of_pos; simp only _ ≤ n + 1 := by apply Nat.pow_log_le_self; simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff]
case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
Please generate a tactic in lean4 to solve the state. STATE: case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) < Nat.succ n case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
. simp only
case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: case Q n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))) ⊢ 10 > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [tsub_le_iff_right, ge_iff_le, List.lastN_eq_tail]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n))
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ tl = List.tail (Nat.toDigits 10 (Nat.succ n))
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ tl = List.lastN (List.length (Nat.toDigits 10 (Nat.succ n)) - 1) (Nat.toDigits 10 (Nat.succ n)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [heq, List.tail_cons]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ tl = List.tail (Nat.toDigits 10 (Nat.succ n))
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl ⊢ tl = List.tail (Nat.toDigits 10 (Nat.succ n)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
unfold List.getD
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ List.getD (Nat.toDigits 10 (Nat.succ n)) 0 (Char.ofNat 48) = hd
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Option.getD (List.get? (Nat.toDigits 10 (Nat.succ n)) 0) (Char.ofNat 48) = hd
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ List.getD (Nat.toDigits 10 (Nat.succ n)) 0 (Char.ofNat 48) = hd TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [heq, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.cons.injEq, forall_true_left, and_imp, forall_apply_eq_imp_iff', forall_eq', Option.getD_some, List.get?]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Option.getD (List.get? (Nat.toDigits 10 (Nat.succ n)) 0) (Char.ofNat 48) = hd
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Option.getD (List.get? (Nat.toDigits 10 (Nat.succ n)) 0) (Char.ofNat 48) = hd TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [heq, List.length_cons, Nat.succ_sub_succ_eq_sub, tsub_zero, ge_iff_le, zero_le, nonpos_iff_eq_zero]
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) h₂ : Nat.digitChar (Nat.digit 10 (Nat.succ n) (List.length (Nat.toDigits 10 (Nat.succ n)) - 1 - 0)) = hd ⊢ List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) - 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) h₂ : Nat.digitChar (Nat.digit 10 (Nat.succ n) (List.length (Nat.toDigits 10 (Nat.succ n)) - 1 - 0)) = hd ⊢ List.length tl = List.length (Nat.toDigits 10 (Nat.succ n)) - 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
apply Nat.mod_lt
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n)
case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 10 ^ Nat.log 10 (Nat.succ n) > 0
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n % 10 ^ Nat.log 10 (Nat.succ n) < 10 ^ Nat.log 10 (Nat.succ n) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
apply Nat.pos_pow_of_pos
case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 10 ^ Nat.log 10 (Nat.succ n) > 0
case a.h n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 0 < 10
Please generate a tactic in lean4 to solve the state. STATE: case a n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 10 ^ Nat.log 10 (Nat.succ n) > 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only
case a.h n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 0 < 10
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a.h n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 0 < 10 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
apply Nat.pow_log_le_self
n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 10 ^ Nat.log 10 (Nat.succ n) ≤ n + 1
case hx n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n ≠ 0
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ 10 ^ Nat.log 10 (Nat.succ n) ≤ n + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toNatΔ_inv_NattoDigits
[776, 1]
[838, 22]
simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, ne_eq, Nat.succ_ne_zero, not_false_iff]
case hx n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n ≠ 0
no goals
Please generate a tactic in lean4 to solve the state. STATE: case hx n : ℕ ih : ∀ (m : ℕ), m < Nat.succ n → toNatΔ (Nat.toDigits 10 m) = m s : List Char hd : Char tl : List Char heq : Nat.toDigits 10 (Nat.succ n) = hd :: tl h : toNatΔ tl = toNatΔ (Nat.toDigits 10 (Nat.succ n % 10 ^ (List.length (Nat.toDigits 10 (Nat.succ n)) - 1))) ⊢ Nat.succ n ≠ 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toIntΔ_inv_IntreprΔ
[841, 1]
[862, 22]
unfold toIntΔ Int.reprΔ
i : ℤ ⊢ toIntΔ (Int.reprΔ i) = i
i : ℤ ⊢ (match match i with | Int.ofNat m => Nat.toDigits 10 m | Int.negSucc m => [Char.ofNat 45] ++ Nat.toDigits 10 (Nat.succ m) with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = i
Please generate a tactic in lean4 to solve the state. STATE: i : ℤ ⊢ toIntΔ (Int.reprΔ i) = i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toIntΔ_inv_IntreprΔ
[841, 1]
[862, 22]
cases i with | ofNat n => simp only [Int.ofNat_eq_coe] split case h_1 s heq => simp only [Nat.toDigits_ne_nil ] at heq case h_2 head tail heq => split case inl h => have h₂: (List.all (head::tail) Char.isDigit == true) = true := by rw [← heq] apply Nat.toDigits_digits <;> decide simp at h₂ have ⟨ h₃, _⟩ :=h₂ simp only [h] at h₃ . simp only [← heq, toNatΔ_inv_NattoDigits] | negSucc n => simp only [List.singleton_append, toNatΔ_inv_NattoDigits, Nat.cast_succ, neg_add_rev, ite_true, Int.negSucc_eq]
i : ℤ ⊢ (match match i with | Int.ofNat m => Nat.toDigits 10 m | Int.negSucc m => [Char.ofNat 45] ++ Nat.toDigits 10 (Nat.succ m) with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = i
no goals
Please generate a tactic in lean4 to solve the state. STATE: i : ℤ ⊢ (match match i with | Int.ofNat m => Nat.toDigits 10 m | Int.negSucc m => [Char.ofNat 45] ++ Nat.toDigits 10 (Nat.succ m) with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
String.toIntΔ_inv_IntreprΔ
[841, 1]
[862, 22]
simp only [Int.ofNat_eq_coe]
case ofNat n : ℕ ⊢ (match match Int.ofNat n with | Int.ofNat m => Nat.toDigits 10 m | Int.negSucc m => [Char.ofNat 45] ++ Nat.toDigits 10 (Nat.succ m) with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = Int.ofNat n
case ofNat n : ℕ ⊢ (match Nat.toDigits 10 n with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = ↑n
Please generate a tactic in lean4 to solve the state. STATE: case ofNat n : ℕ ⊢ (match match Int.ofNat n with | Int.ofNat m => Nat.toDigits 10 m | Int.negSucc m => [Char.ofNat 45] ++ Nat.toDigits 10 (Nat.succ m) with | [] => 0 | h :: tail => if h = Char.ofNat 45 then -↑(toNatΔ tail) else ↑(toNatΔ (h :: tail))) = Int.ofNat n TACTIC: