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
List.drop_cons
[524, 1]
[525, 81]
simp only [drop, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.add_eq, add_zero]
α : Type u_1 n : ℕ head : α tail : List α ⊢ drop (n + 1) (head :: tail) = drop n tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 n : ℕ head : α tail : List α ⊢ drop (n + 1) (head :: tail) = drop n tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
unfold List.lastN
α : Type u_1 n : ℕ l : List α ⊢ lastN n l = reverse (take n (reverse l))
α : Type u_1 n : ℕ l : List α ⊢ drop (length l - n) l = reverse (take n (reverse l))
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 n : ℕ l : List α ⊢ lastN n l = reverse (take n (reverse l)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
induction l generalizing n with | nil => simp only [length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.zero_sub, tsub_eq_zero_of_le, drop_nil, reverse_nil, take_nil] | cons head tail ih => simp only [length_cons, tsub_le_iff_right, ge_iff_le, reverse_cons, length_reverse] cases h: decide (n ≤ length tail) with | false => simp only [decide_eq_false_iff_not, not_le] at h rw [Nat.succ_eq_add_one, Nat.add_comm] rw [List.take_length_le, List.reverse_append, List.reverse_reverse] simp only [tsub_le_iff_right, ge_iff_le, reverse_cons, reverse_nil, nil_append, singleton_append] have heq : 1 + length tail - n = 0 := by simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le] rw [Nat.add_comm] apply Nat.le_of_lt_succ rw [Nat.succ_eq_add_one] simp only [add_lt_add_iff_right, h] rw [heq] simp only [drop] rw [List.length_append, List.length_reverse] simp only [length_singleton] exact h | true => simp only [decide_eq_true_eq] at h rw [Nat.succ_eq_add_one, Nat.add_comm, Nat.add_sub_assoc, Nat.add_comm, List.drop_cons, ih] congr 1 rw [List.take_append_of_le_length] . simp only [length_reverse]; apply h . apply h
α : Type u_1 n : ℕ l : List α ⊢ drop (length l - n) l = reverse (take n (reverse l))
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 n : ℕ l : List α ⊢ drop (length l - n) l = reverse (take n (reverse l)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.zero_sub, tsub_eq_zero_of_le, drop_nil, reverse_nil, take_nil]
case nil α : Type u_1 n : ℕ ⊢ drop (length [] - n) [] = reverse (take n (reverse []))
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil α : Type u_1 n : ℕ ⊢ drop (length [] - n) [] = reverse (take n (reverse [])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [length_cons, tsub_le_iff_right, ge_iff_le, reverse_cons, length_reverse]
case cons α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ ⊢ drop (length (head :: tail) - n) (head :: tail) = reverse (take n (reverse (head :: tail)))
case cons α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ ⊢ drop (length (head :: tail) - n) (head :: tail) = reverse (take n (reverse (head :: tail))) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
cases h: decide (n ≤ length tail) with | false => simp only [decide_eq_false_iff_not, not_le] at h rw [Nat.succ_eq_add_one, Nat.add_comm] rw [List.take_length_le, List.reverse_append, List.reverse_reverse] simp only [tsub_le_iff_right, ge_iff_le, reverse_cons, reverse_nil, nil_append, singleton_append] have heq : 1 + length tail - n = 0 := by simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le] rw [Nat.add_comm] apply Nat.le_of_lt_succ rw [Nat.succ_eq_add_one] simp only [add_lt_add_iff_right, h] rw [heq] simp only [drop] rw [List.length_append, List.length_reverse] simp only [length_singleton] exact h | true => simp only [decide_eq_true_eq] at h rw [Nat.succ_eq_add_one, Nat.add_comm, Nat.add_sub_assoc, Nat.add_comm, List.drop_cons, ih] congr 1 rw [List.take_append_of_le_length] . simp only [length_reverse]; apply h . apply h
case cons α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [decide_eq_false_iff_not, not_le] at h
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : decide (n ≤ length tail) = false ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : decide (n ≤ length tail) = false ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [Nat.succ_eq_add_one, Nat.add_comm]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [List.take_length_le, List.reverse_append, List.reverse_reverse]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse [head] ++ tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [tsub_le_iff_right, ge_iff_le, reverse_cons, reverse_nil, nil_append, singleton_append]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse [head] ++ tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = reverse [head] ++ tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
have heq : 1 + length tail - n = 0 := by simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le] rw [Nat.add_comm] apply Nat.le_of_lt_succ rw [Nat.succ_eq_add_one] simp only [add_lt_add_iff_right, h]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [heq]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop 0 (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop (1 + length tail - n) (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [drop]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop 0 (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n heq : 1 + length tail - n = 0 ⊢ drop 0 (head :: tail) = head :: tail case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [List.length_append, List.length_reverse]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + length [head] ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length (reverse tail ++ [head]) ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [length_singleton]
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + length [head] ≤ n
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + length [head] ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
exact h
case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons.false α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le]
α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ 1 + length tail - n = 0
α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ 1 + length tail ≤ n
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ 1 + length tail - n = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [Nat.add_comm]
α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ 1 + length tail ≤ n
α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ 1 + length tail ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
apply Nat.le_of_lt_succ
α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n
case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < Nat.succ n
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [Nat.succ_eq_add_one]
case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < Nat.succ n
case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < n + 1
Please generate a tactic in lean4 to solve the state. STATE: case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < Nat.succ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [add_lt_add_iff_right, h]
case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < n + 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : length tail < n ⊢ length tail + 1 < n + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
simp only [decide_eq_true_eq] at h
case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : decide (n ≤ length tail) = true ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
Please generate a tactic in lean4 to solve the state. STATE: case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : decide (n ≤ length tail) = true ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [Nat.succ_eq_add_one, Nat.add_comm, Nat.add_sub_assoc, Nat.add_comm, List.drop_cons, ih]
case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head]))
case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ reverse (take n (reverse tail)) = reverse (take n (reverse tail ++ [head])) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
Please generate a tactic in lean4 to solve the state. STATE: case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ drop (Nat.succ (length tail) - n) (head :: tail) = reverse (take n (reverse tail ++ [head])) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
congr 1
case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ reverse (take n (reverse tail)) = reverse (take n (reverse tail ++ [head])) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ take n (reverse tail) = take n (reverse tail ++ [head]) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
Please generate a tactic in lean4 to solve the state. STATE: case cons.true α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ reverse (take n (reverse tail)) = reverse (take n (reverse tail ++ [head])) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
rw [List.take_append_of_le_length]
case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ take n (reverse tail) = take n (reverse tail ++ [head]) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length (reverse tail) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
Please generate a tactic in lean4 to solve the state. STATE: case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ take n (reverse tail) = take n (reverse tail ++ [head]) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
. simp only [length_reverse]; apply h
case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length (reverse tail) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
Please generate a tactic in lean4 to solve the state. STATE: case cons.true.e_as α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length (reverse tail) case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_reverse_take
[527, 1]
[557, 16]
. apply h
case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons.true.h α : Type u_1 head : α tail : List α ih : ∀ (n : ℕ), drop (length tail - n) tail = reverse (take n (reverse tail)) n : ℕ h : n ≤ length tail ⊢ n ≤ length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digitChar_sub_zero_eq_self
[560, 1]
[562, 9]
revert n
n : ℕ P : n < 10 ⊢ Char.toNat (digitChar n) - Char.toNat (Char.ofNat 48) = n
⊢ ∀ (n : ℕ), n < 10 → Char.toNat (digitChar n) - Char.toNat (Char.ofNat 48) = n
Please generate a tactic in lean4 to solve the state. STATE: n : ℕ P : n < 10 ⊢ Char.toNat (digitChar n) - Char.toNat (Char.ofNat 48) = n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digitChar_sub_zero_eq_self
[560, 1]
[562, 9]
decide
⊢ ∀ (n : ℕ), n < 10 → Char.toNat (digitChar n) - Char.toNat (Char.ofNat 48) = n
no goals
Please generate a tactic in lean4 to solve the state. STATE: ⊢ ∀ (n : ℕ), n < 10 → Char.toNat (digitChar n) - Char.toNat (Char.ofNat 48) = n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.sub_self_sub_eq_min
[563, 1]
[566, 54]
conv => left; right; rw [Nat.sub_eq_sub_min]
n k : ℕ ⊢ n - (n - k) = Nat.min n k
n k : ℕ ⊢ n - (n - min n k) = Nat.min n k
Please generate a tactic in lean4 to solve the state. STATE: n k : ℕ ⊢ n - (n - k) = Nat.min n k TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.sub_self_sub_eq_min
[563, 1]
[566, 54]
rw [Nat.sub_sub_self]
n k : ℕ ⊢ n - (n - min n k) = Nat.min n k
n k : ℕ ⊢ min n k ≤ n
Please generate a tactic in lean4 to solve the state. STATE: n k : ℕ ⊢ n - (n - min n k) = Nat.min n k TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.sub_self_sub_eq_min
[563, 1]
[566, 54]
simp only [min_le_iff, ge_iff_le, le_refl, true_or]
n k : ℕ ⊢ min n k ≤ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: n k : ℕ ⊢ min n k ≤ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
unfold List.lastN
α : Type u_1 l : List α ⊢ lastN (length l - 1) l = tail l
α : Type u_1 l : List α ⊢ drop (length l - (length l - 1)) l = tail l
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊢ lastN (length l - 1) l = tail l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
rw [Nat.sub_self_sub_eq_min]
α : Type u_1 l : List α ⊢ drop (length l - (length l - 1)) l = tail l
α : Type u_1 l : List α ⊢ drop (Nat.min (length l) 1) l = tail l
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊢ drop (length l - (length l - 1)) l = tail l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
cases l with | nil => simp only [drop, tail_nil] | cons hd tl => have h: Nat.succ (List.length tl) ≥ 1 := by apply Nat.succ_le_succ apply Nat.zero_le simp only [length_cons, Nat.min_eq_right h, ge_iff_le, drop, tail_cons]
α : Type u_1 l : List α ⊢ drop (Nat.min (length l) 1) l = tail l
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊢ drop (Nat.min (length l) 1) l = tail l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
simp only [drop, tail_nil]
case nil α : Type u_1 ⊢ drop (Nat.min (length []) 1) [] = tail []
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil α : Type u_1 ⊢ drop (Nat.min (length []) 1) [] = tail [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
have h: Nat.succ (List.length tl) ≥ 1 := by apply Nat.succ_le_succ apply Nat.zero_le
case cons α : Type u_1 hd : α tl : List α ⊢ drop (Nat.min (length (hd :: tl)) 1) (hd :: tl) = tail (hd :: tl)
case cons α : Type u_1 hd : α tl : List α h : Nat.succ (length tl) ≥ 1 ⊢ drop (Nat.min (length (hd :: tl)) 1) (hd :: tl) = tail (hd :: tl)
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 hd : α tl : List α ⊢ drop (Nat.min (length (hd :: tl)) 1) (hd :: tl) = tail (hd :: tl) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
simp only [length_cons, Nat.min_eq_right h, ge_iff_le, drop, tail_cons]
case cons α : Type u_1 hd : α tl : List α h : Nat.succ (length tl) ≥ 1 ⊢ drop (Nat.min (length (hd :: tl)) 1) (hd :: tl) = tail (hd :: tl)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 hd : α tl : List α h : Nat.succ (length tl) ≥ 1 ⊢ drop (Nat.min (length (hd :: tl)) 1) (hd :: tl) = tail (hd :: tl) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
apply Nat.succ_le_succ
α : Type u_1 hd : α tl : List α ⊢ Nat.succ (length tl) ≥ 1
case a α : Type u_1 hd : α tl : List α ⊢ 0 ≤ length tl
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 hd : α tl : List α ⊢ Nat.succ (length tl) ≥ 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_tail
[570, 1]
[579, 76]
apply Nat.zero_le
case a α : Type u_1 hd : α tl : List α ⊢ 0 ≤ length tl
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a α : Type u_1 hd : α tl : List α ⊢ 0 ≤ length tl TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_zero
[583, 1]
[586, 111]
unfold toDigits toDigitsCore
b : ℕ ⊢ toDigits b 0 = [Char.ofNat 48]
b : ℕ ⊢ (let d := digitChar (0 % b); let n' := 0 / b; if n' = 0 then [d] else toDigitsCore b 0 n' [d]) = [Char.ofNat 48]
Please generate a tactic in lean4 to solve the state. STATE: b : ℕ ⊢ toDigits b 0 = [Char.ofNat 48] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_zero
[583, 1]
[586, 111]
simp only [_root_.zero_le, ge_iff_le, nonpos_iff_eq_zero, Nat.zero_div, zero_mod, ite_true, List.cons.injEq]
b : ℕ ⊢ (let d := digitChar (0 % b); let n' := 0 / b; if n' = 0 then [d] else toDigitsCore b 0 n' [d]) = [Char.ofNat 48]
no goals
Please generate a tactic in lean4 to solve the state. STATE: b : ℕ ⊢ (let d := digitChar (0 % b); let n' := 0 / b; if n' = 0 then [d] else toDigitsCore b 0 n' [d]) = [Char.ofNat 48] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
rw [Nat.toDigits_eq_digit_rev, Nat.toDigits_eq_digit_rev]
b n p i : ℕ P : i < p Q : b > 1 ⊢ List.getD (List.reverse (toDigits b (n % b ^ p))) i (Char.ofNat 48) = List.getD (List.reverse (toDigits b n)) i (Char.ofNat 48)
b n p i : ℕ P : i < p Q : b > 1 ⊢ digitChar (digit b (n % b ^ p) i) = digitChar (digit b n i) case P b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1 case P b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1
Please generate a tactic in lean4 to solve the state. STATE: b n p i : ℕ P : i < p Q : b > 1 ⊢ List.getD (List.reverse (toDigits b (n % b ^ p))) i (Char.ofNat 48) = List.getD (List.reverse (toDigits b n)) i (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
case P => exact Q
b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
congr 1
b n p i : ℕ P : i < p Q : b > 1 ⊢ digitChar (digit b (n % b ^ p) i) = digitChar (digit b n i)
case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ digit b (n % b ^ p) i = digit b n i
Please generate a tactic in lean4 to solve the state. STATE: b n p i : ℕ P : i < p Q : b > 1 ⊢ digitChar (digit b (n % b ^ p) i) = digitChar (digit b n i) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
unfold digit
case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ digit b (n % b ^ p) i = digit b n i
case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b
Please generate a tactic in lean4 to solve the state. STATE: case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ digit b (n % b ^ p) i = digit b n i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
have hpeq := Nat.sub_add_cancel (le_of_lt P)
case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b
case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b
Please generate a tactic in lean4 to solve the state. STATE: case e_n b n p i : ℕ P : i < p Q : b > 1 ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
conv => left; left; left; rw [← hpeq, pow_add]
case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b
case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % (b ^ (p - i) * b ^ i) / b ^ i % b = n / b ^ i % b
Please generate a tactic in lean4 to solve the state. STATE: case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % b ^ p / b ^ i % b = n / b ^ i % b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
rw [Nat.mod_mul_left_div_self, Nat.mod_mod_of_dvd]
case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % (b ^ (p - i) * b ^ i) / b ^ i % b = n / b ^ i % b
case e_n.h b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b ^ (p - i)
Please generate a tactic in lean4 to solve the state. STATE: case e_n b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ n % (b ^ (p - i) * b ^ i) / b ^ i % b = n / b ^ i % b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
apply dvd_pow
case e_n.h b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b ^ (p - i)
case e_n.h.hxy b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0
Please generate a tactic in lean4 to solve the state. STATE: case e_n.h b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b ^ (p - i) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
. apply dvd_refl
case e_n.h.hxy b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0
case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0
Please generate a tactic in lean4 to solve the state. STATE: case e_n.h.hxy b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ b ∣ b case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
. simp only [min_le_iff, ge_iff_le, tsub_le_iff_right, le_min_iff, _root_.zero_le, nonpos_iff_eq_zero, ne_eq, tsub_eq_zero_iff_le, not_and, not_le, P, implies_true]
case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0
no goals
Please generate a tactic in lean4 to solve the state. STATE: case e_n.h.x b n p i : ℕ P : i < p Q : b > 1 hpeq : p - i + i = p ⊢ p - i ≠ 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_modulo
[588, 1]
[602, 61]
exact Q
b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n p i : ℕ P : i < p Q : b > 1 ⊢ b > 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
apply List.ext
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d ⊢ a = b
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d ⊢ ∀ (n : ℕ), get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d ⊢ a = b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
intro n
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d ⊢ ∀ (n : ℕ), get? a n = get? b n
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d ⊢ ∀ (n : ℕ), get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
have h:= Q n
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ ⊢ get? a n = get? b n
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : getD a n d = getD b n d ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
unfold getD at h
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : getD a n d = getD b n d ⊢ get? a n = get? b n
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : getD a n d = getD b n d ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
cases hlt: decide (n < List.length a) with | true => simp only [decide_eq_true_eq] at hlt have hltb: n < length b := by rw [← P]; exact hlt simp_all only [zero_le, ge_iff_le, nonpos_iff_eq_zero, hltb, get?_eq_get, Option.getD_some, gt_iff_lt, P] | false => simp only [decide_eq_false_iff_not, not_lt] at hlt have hltb: n ≥ length b := by rw [← P]; exact hlt simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, hltb]
case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d ⊢ get? a n = get? b n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
simp only [decide_eq_true_eq] at hlt
case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : decide (n < length a) = true ⊢ get? a n = get? b n
case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : decide (n < length a) = true ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
have hltb: n < length b := by rw [← P]; exact hlt
case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ get? a n = get? b n
case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a hltb : n < length b ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
simp_all only [zero_le, ge_iff_le, nonpos_iff_eq_zero, hltb, get?_eq_get, Option.getD_some, gt_iff_lt, P]
case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a hltb : n < length b ⊢ get? a n = get? b n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a.true α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a hltb : n < length b ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
rw [← P]
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ n < length b
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ n < length a
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ n < length b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
exact hlt
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ n < length a
no goals
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : n < length a ⊢ n < length a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
simp only [decide_eq_false_iff_not, not_lt] at hlt
case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : decide (n < length a) = false ⊢ get? a n = get? b n
case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : decide (n < length a) = false ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
have hltb: n ≥ length b := by rw [← P]; exact hlt
case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ get? a n = get? b n
case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n hltb : n ≥ length b ⊢ get? a n = get? b n
Please generate a tactic in lean4 to solve the state. STATE: case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, hltb]
case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n hltb : n ≥ length b ⊢ get? a n = get? b n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a.false α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n hltb : n ≥ length b ⊢ get? a n = get? b n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
rw [← P]
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ n ≥ length b
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ n ≥ length a
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ n ≥ length b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_ext
[604, 1]
[617, 88]
exact hlt
α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ n ≥ length a
no goals
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 a b : List α✝ d : α✝ P : length a = length b Q : ∀ (i : ℕ), getD a i d = getD b i d n : ℕ h : Option.getD (get? a n) d = Option.getD (get? b n) d hlt : length a ≤ n ⊢ n ≥ length a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_reverse
[619, 1]
[624, 12]
unfold List.getD
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ getD (reverse l) i d = l[length l - 1 - i]
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (get? (reverse l) i) d = l[length l - 1 - i]
Please generate a tactic in lean4 to solve the state. STATE: i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ getD (reverse l) i d = l[length l - 1 - i] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_reverse
[619, 1]
[624, 12]
rw [List.get?_reverse, List.get?_eq_get]
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (get? (reverse l) i) d = l[length l - 1 - i]
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (some (get l { val := length l - 1 - i, isLt := ?m.112638 })) d = l[length l - 1 - i] i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
Please generate a tactic in lean4 to solve the state. STATE: i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (get? (reverse l) i) d = l[length l - 1 - i] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_reverse
[619, 1]
[624, 12]
simp only [tsub_le_iff_right, ge_iff_le, Option.getD_some, getElem_eq_get]
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (some (get l { val := length l - 1 - i, isLt := ?m.112638 })) d = l[length l - 1 - i] i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
Please generate a tactic in lean4 to solve the state. STATE: i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ Option.getD (some (get l { val := length l - 1 - i, isLt := ?m.112638 })) d = l[length l - 1 - i] i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_reverse
[619, 1]
[624, 12]
. exact Nat.sub_one_sub_lt P
i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
Please generate a tactic in lean4 to solve the state. STATE: i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ length l - 1 - i < length l case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getD_reverse
[619, 1]
[624, 12]
. exact P
case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h i : ℕ α✝ : Type u_1 l : List α✝ d : α✝ P : i < length l ⊢ i < length l 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]
induction b with | nil => simp only [List.length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.length_eq_zero] at Q simp only [Q] | cons hd tl ih => cases heq: decide (List.length a = List.length (hd::tl)) case true => simp only [decide_eq_true_eq] at heq have h: a = (hd::tl) := by apply List.getD_ext heq (d:='0') intro n cases hlt: decide (n < List.length a) with | true => simp only [decide_eq_true_eq] at hlt have hblt: n < List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [gt_iff_lt, hlt, List.getD_eq_get, List.getElem_eq_get, hblt] have Q:= P (List.length a -1 - n) conv at Q => right; rw [heq] rw [ List.getD_reverse (Nat.sub_one_sub_lt hlt), List.getD_reverse (Nat.sub_one_sub_lt hblt)] at Q simp only [tsub_le_iff_right, ge_iff_le, Nat.sub_sub_self (Nat.le_pred_of_lt hlt), List.getElem_eq_get, Nat.sub_sub_self (Nat.le_pred_of_lt hblt)] at Q apply Q | false => simp only [decide_eq_false_iff_not, not_lt] at hlt have hblt: n ≥ List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [List.getD_eq_get?, zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, Option.getD_none, hblt] simp only [h] case false => simp only [decide_eq_false_iff_not] at heq have R := P (List.length tl) rw [List.getD_eq_default] at R . 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] . 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
a b : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse b) i (Char.ofNat 48) Q : List.length a ≤ List.length b ⊢ 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) Q : 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_aux
[627, 1]
[689, 41]
simp only [List.length_nil, zero_le, ge_iff_le, nonpos_iff_eq_zero, List.length_eq_zero] at Q
case nil a : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse []) i (Char.ofNat 48) Q : List.length a ≤ List.length [] ⊢ toNatΔ a = toNatΔ []
case nil a : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse []) i (Char.ofNat 48) Q : a = [] ⊢ toNatΔ a = toNatΔ []
Please generate a tactic in lean4 to solve the state. STATE: case nil a : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse []) i (Char.ofNat 48) Q : List.length a ≤ List.length [] ⊢ toNatΔ a = toNatΔ [] 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 [Q]
case nil a : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse []) i (Char.ofNat 48) Q : a = [] ⊢ toNatΔ a = toNatΔ []
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil a : List Char P : ∀ (i : ℕ), List.getD (List.reverse a) i (Char.ofNat 48) = List.getD (List.reverse []) i (Char.ofNat 48) Q : a = [] ⊢ toNatΔ a = toNatΔ [] 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]
cases heq: decide (List.length a = List.length (hd::tl))
case cons 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) ⊢ toNatΔ a = toNatΔ (hd :: tl)
case cons.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 : decide (List.length a = List.length (hd :: tl)) = false ⊢ toNatΔ a = toNatΔ (hd :: tl) case cons.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 : decide (List.length a = List.length (hd :: tl)) = true ⊢ toNatΔ a = toNatΔ (hd :: tl)
Please generate a tactic in lean4 to solve the state. STATE: case cons 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) ⊢ 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]
case true => simp only [decide_eq_true_eq] at heq have h: a = (hd::tl) := by apply List.getD_ext heq (d:='0') intro n cases hlt: decide (n < List.length a) with | true => simp only [decide_eq_true_eq] at hlt have hblt: n < List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [gt_iff_lt, hlt, List.getD_eq_get, List.getElem_eq_get, hblt] have Q:= P (List.length a -1 - n) conv at Q => right; rw [heq] rw [ List.getD_reverse (Nat.sub_one_sub_lt hlt), List.getD_reverse (Nat.sub_one_sub_lt hblt)] at Q simp only [tsub_le_iff_right, ge_iff_le, Nat.sub_sub_self (Nat.le_pred_of_lt hlt), List.getElem_eq_get, Nat.sub_sub_self (Nat.le_pred_of_lt hblt)] at Q apply Q | false => simp only [decide_eq_false_iff_not, not_lt] at hlt have hblt: n ≥ List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [List.getD_eq_get?, zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, Option.getD_none, hblt] simp only [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 : decide (List.length a = List.length (hd :: tl)) = true ⊢ toNatΔ a = toNatΔ (hd :: tl)
no goals
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 : decide (List.length a = List.length (hd :: tl)) = true ⊢ 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]
case false => simp only [decide_eq_false_iff_not] at heq have R := P (List.length tl) rw [List.getD_eq_default] at R . 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] . 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
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 : decide (List.length a = List.length (hd :: tl)) = false ⊢ toNatΔ a = toNatΔ (hd :: tl)
no goals
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 : decide (List.length a = List.length (hd :: tl)) = false ⊢ 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]
simp only [decide_eq_true_eq] at heq
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 : decide (List.length a = List.length (hd :: tl)) = true ⊢ 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) ⊢ toNatΔ a = toNatΔ (hd :: 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 : decide (List.length a = List.length (hd :: tl)) = true ⊢ 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]
have h: a = (hd::tl) := by apply List.getD_ext heq (d:='0') intro n cases hlt: decide (n < List.length a) with | true => simp only [decide_eq_true_eq] at hlt have hblt: n < List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [gt_iff_lt, hlt, List.getD_eq_get, List.getElem_eq_get, hblt] have Q:= P (List.length a -1 - n) conv at Q => right; rw [heq] rw [ List.getD_reverse (Nat.sub_one_sub_lt hlt), List.getD_reverse (Nat.sub_one_sub_lt hblt)] at Q simp only [tsub_le_iff_right, ge_iff_le, Nat.sub_sub_self (Nat.le_pred_of_lt hlt), List.getElem_eq_get, Nat.sub_sub_self (Nat.le_pred_of_lt hblt)] at Q apply Q | false => simp only [decide_eq_false_iff_not, not_lt] at hlt have hblt: n ≥ List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [List.getD_eq_get?, zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, Option.getD_none, hblt]
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) ⊢ 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) h : a = hd :: tl ⊢ toNatΔ a = toNatΔ (hd :: 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) ⊢ 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]
simp only [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) h : a = hd :: tl ⊢ toNatΔ a = toNatΔ (hd :: tl)
no goals
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) h : a = hd :: tl ⊢ 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]
apply List.getD_ext heq (d:='0')
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) ⊢ a = 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) ⊢ ∀ (i : ℕ), List.getD a i (Char.ofNat 48) = List.getD (hd :: tl) i (Char.ofNat 48)
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) ⊢ a = 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]
intro n
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) ⊢ ∀ (i : ℕ), List.getD a i (Char.ofNat 48) = List.getD (hd :: tl) i (Char.ofNat 48)
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) n : ℕ ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
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) ⊢ ∀ (i : ℕ), List.getD a i (Char.ofNat 48) = List.getD (hd :: 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]
cases hlt: decide (n < List.length a) with | true => simp only [decide_eq_true_eq] at hlt have hblt: n < List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [gt_iff_lt, hlt, List.getD_eq_get, List.getElem_eq_get, hblt] have Q:= P (List.length a -1 - n) conv at Q => right; rw [heq] rw [ List.getD_reverse (Nat.sub_one_sub_lt hlt), List.getD_reverse (Nat.sub_one_sub_lt hblt)] at Q simp only [tsub_le_iff_right, ge_iff_le, Nat.sub_sub_self (Nat.le_pred_of_lt hlt), List.getElem_eq_get, Nat.sub_sub_self (Nat.le_pred_of_lt hblt)] at Q apply Q | false => simp only [decide_eq_false_iff_not, not_lt] at hlt have hblt: n ≥ List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq] simp only [List.getD_eq_get?, zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, Option.getD_none, hblt]
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) n : ℕ ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
no goals
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) n : ℕ ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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 [decide_eq_true_eq] at hlt
case 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) n : ℕ hlt : decide (n < List.length a) = true ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
case 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) n : ℕ hlt : n < List.length a ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : decide (n < List.length a) = true ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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]
have hblt: n < List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq]
case 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) n : ℕ hlt : n < List.length a ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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 [gt_iff_lt, hlt, List.getD_eq_get, List.getElem_eq_get, hblt]
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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]
have Q:= P (List.length a -1 - n)
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length a - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) } 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]
conv at Q => right; rw [heq]
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length a - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length (hd :: tl) - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length a - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) } 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 (Nat.sub_one_sub_lt hlt), List.getD_reverse (Nat.sub_one_sub_lt hblt)] at Q
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length (hd :: tl) - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : a[List.length a - 1 - (List.length a - 1 - n)] = (hd :: tl)[List.length (hd :: tl) - 1 - (List.length (hd :: tl) - 1 - n)] ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.getD (List.reverse a) (List.length a - 1 - n) (Char.ofNat 48) = List.getD (List.reverse (hd :: tl)) (List.length (hd :: tl) - 1 - n) (Char.ofNat 48) ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) } 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 [tsub_le_iff_right, ge_iff_le, Nat.sub_sub_self (Nat.le_pred_of_lt hlt), List.getElem_eq_get, Nat.sub_sub_self (Nat.le_pred_of_lt hblt)] at Q
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : a[List.length a - 1 - (List.length a - 1 - n)] = (hd :: tl)[List.length (hd :: tl) - 1 - (List.length (hd :: tl) - 1 - n)] ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.get a { val := n, isLt := (_ : (fun as i => i < List.length as) a n) } = List.get (hd :: tl) { val := n, isLt := (_ : (fun as i => i < List.length as) (hd :: tl) n) } ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : a[List.length a - 1 - (List.length a - 1 - n)] = (hd :: tl)[List.length (hd :: tl) - 1 - (List.length (hd :: tl) - 1 - n)] ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) } 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]
apply Q
case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.get a { val := n, isLt := (_ : (fun as i => i < List.length as) a n) } = List.get (hd :: tl) { val := n, isLt := (_ : (fun as i => i < List.length as) (hd :: tl) n) } ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) }
no goals
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : n < List.length a hblt : n < List.length (hd :: tl) Q : List.get a { val := n, isLt := (_ : (fun as i => i < List.length as) a n) } = List.get (hd :: tl) { val := n, isLt := (_ : (fun as i => i < List.length as) (hd :: tl) n) } ⊢ List.get a { val := n, isLt := (_ : List.length a > n) } = List.get (hd :: tl) { val := n, isLt := (_ : List.length (hd :: tl) > n) } 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_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq]
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) n : ℕ hlt : n < List.length a ⊢ n < List.length (hd :: tl)
no goals
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) n : ℕ hlt : n < List.length a ⊢ n < List.length (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]
simp only [decide_eq_false_iff_not, not_lt] at hlt
case 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) n : ℕ hlt : decide (n < List.length a) = false ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
case 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) n : ℕ hlt : List.length a ≤ n ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : decide (n < List.length a) = false ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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]
have hblt: n ≥ List.length (hd::tl) := by simp_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq]
case 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) n : ℕ hlt : List.length a ≤ n ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
case 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) n : ℕ hlt : List.length a ≤ n hblt : n ≥ List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : List.length a ≤ n ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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.getD_eq_get?, zero_le, ge_iff_le, nonpos_iff_eq_zero, hlt, List.get?_eq_none.2, Option.getD_none, hblt]
case 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) n : ℕ hlt : List.length a ≤ n hblt : n ≥ List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (Char.ofNat 48)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case 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) n : ℕ hlt : List.length a ≤ n hblt : n ≥ List.length (hd :: tl) ⊢ List.getD a n (Char.ofNat 48) = List.getD (hd :: tl) n (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_all only [tsub_le_iff_right, ge_iff_le, zero_le, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, heq]
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) n : ℕ hlt : List.length a ≤ n ⊢ n ≥ List.length (hd :: tl)
no goals
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) n : ℕ hlt : List.length a ≤ n ⊢ n ≥ List.length (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]
simp only [decide_eq_false_iff_not] at heq
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 : decide (List.length a = List.length (hd :: tl)) = false ⊢ 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) ⊢ toNatΔ a = toNatΔ (hd :: 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 : decide (List.length a = List.length (hd :: tl)) = false ⊢ 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]
have R := P (List.length 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) ⊢ 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 : 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)
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) ⊢ toNatΔ a = toNatΔ (hd :: tl) TACTIC: