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
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. exact h
case a b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ n / b < n case accum b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ List Char case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ ?accum = [] ++ ?accum
case accum b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ List Char case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ ?accum = [] ++ ?accum
Please generate a tactic in lean4 to solve the state. STATE: case a b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ n / b < n case accum b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ List Char case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ ?accum = [] ++ ?accum TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. exact []
case accum b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ List Char case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ ?accum = [] ++ ?accum
case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ []
Please generate a tactic in lean4 to solve the state. STATE: case accum b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ List Char case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ ?accum = [] ++ ?accum TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. calc l β‰₯ n := by exact le_of_lt_succ R _ > n/b := h
case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ []
case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ []
Please generate a tactic in lean4 to solve the state. STATE: case R b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l > n / b case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. simp
case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ []
no goals
Please generate a tactic in lean4 to solve the state. STATE: case heq b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ [] = [] ++ [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
apply Nat.div_lt_self
b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ n / b < n
case hLtN b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 0 < n case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b
Please generate a tactic in lean4 to solve the state. STATE: b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ n / b < n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. apply Nat.pos_of_ne_zero intro h simp only [h, Nat.zero_div, not_true] at heq
case hLtN b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 0 < n case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b
case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b
Please generate a tactic in lean4 to solve the state. STATE: case hLtN b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 0 < n case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
. apply P
case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b
no goals
Please generate a tactic in lean4 to solve the state. STATE: case hLtK b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 ⊒ 1 < b TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigitsCore_length_eq_log
[330, 1]
[372, 15]
exact le_of_lt_succ R
b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l β‰₯ n
no goals
Please generate a tactic in lean4 to solve the state. STATE: b : β„• P : b > 1 accum : List Char heq✝ : accum = [] ++ accum n w y : β„• p : List Char l : β„• ih : βˆ€ (m : β„•), m < n β†’ βˆ€ {accum : List Char} (fuel : β„•), fuel > m β†’ accum = [] ++ accum β†’ List.length (toDigitsCore b fuel m []) = log b m + 1 R : succ l > n heq : Β¬n / b = 0 h : n / b < n ⊒ l β‰₯ n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_length_eq_log
[374, 1]
[379, 27]
unfold Nat.toDigits
b n : β„• P : b > 1 ⊒ List.length (toDigits b n) = log b n + 1
b n : β„• P : b > 1 ⊒ List.length (toDigitsCore b (n + 1) n []) = log b n + 1
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 ⊒ List.length (toDigits b n) = log b n + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_length_eq_log
[374, 1]
[379, 27]
rw [Nat.toDigitsCore_length_eq_log]
b n : β„• P : b > 1 ⊒ List.length (toDigitsCore b (n + 1) n []) = log b n + 1
b n : β„• P : b > 1 ⊒ log b n + 1 + List.length [] = log b n + 1 case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 ⊒ List.length (toDigitsCore b (n + 1) n []) = log b n + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_length_eq_log
[374, 1]
[379, 27]
. simp only [List.length_nil, add_zero]
b n : β„• P : b > 1 ⊒ log b n + 1 + List.length [] = log b n + 1 case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n
case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 ⊒ log b n + 1 + List.length [] = log b n + 1 case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_length_eq_log
[374, 1]
[379, 27]
. exact P
case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n
case R b n : β„• P : b > 1 ⊒ n + 1 > n
Please generate a tactic in lean4 to solve the state. STATE: case P b n : β„• P : b > 1 ⊒ b > 1 case R b n : β„• P : b > 1 ⊒ n + 1 > n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_length_eq_log
[374, 1]
[379, 27]
. apply Nat.lt_succ_self
case R b n : β„• P : b > 1 ⊒ n + 1 > n
no goals
Please generate a tactic in lean4 to solve the state. STATE: case R b n : β„• P : b > 1 ⊒ n + 1 > n TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
intro i h
b n : β„• P : b > 1 ⊒ βˆ€ (i : β„•), i < List.length (toDigits b n) β†’ List.getD (toDigits b n) i (Char.ofNat 48) = digitChar (digit b n (List.length (toDigits b n) - 1 - i))
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = digitChar (digit b n (List.length (toDigits b n) - 1 - i))
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 ⊒ βˆ€ (i : β„•), i < List.length (toDigits b n) β†’ List.getD (toDigits b n) i (Char.ofNat 48) = digitChar (digit b n (List.length (toDigits b n) - 1 - i)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
rw [← Nat.toDigits_eq_digit_rev b n P (List.length (Nat.toDigits b n) - 1 - i)]
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = digitChar (digit b n (List.length (toDigits b n) - 1 - i))
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = List.getD (List.reverse (toDigits b n)) (List.length (toDigits b n) - 1 - i) (Char.ofNat 48)
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = digitChar (digit b n (List.length (toDigits b n) - 1 - i)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
rw [ List.getD, List.getD, List.get?_reverse]
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = List.getD (List.reverse (toDigits b n)) (List.length (toDigits b n) - 1 - i) (Char.ofNat 48)
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ Option.getD (List.get? (toDigits b n) i) (Char.ofNat 48) = Option.getD (List.get? (toDigits b n) (List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i))) (Char.ofNat 48) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.getD (toDigits b n) i (Char.ofNat 48) = List.getD (List.reverse (toDigits b n)) (List.length (toDigits b n) - 1 - i) (Char.ofNat 48) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
congr
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ Option.getD (List.get? (toDigits b n) i) (Char.ofNat 48) = Option.getD (List.get? (toDigits b n) (List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i))) (Char.ofNat 48) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
case e_a.e_a b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ i = List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ Option.getD (List.get? (toDigits b n) i) (Char.ofNat 48) = Option.getD (List.get? (toDigits b n) (List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i))) (Char.ofNat 48) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
. have hβ‚‚: List.length (toDigits b n) - 1 β‰₯ (List.length (toDigits b n) - 1 - i) := by simp have h₃: List.length (toDigits b n) β‰₯ 1 := by calc List.length (toDigits b n) > i := h _ β‰₯ 0 := by simp only [ge_iff_le, _root_.zero_le] have hβ‚„: i ≀ List.length (toDigits b n) - 1 := by apply Nat.le_pred_of_lt; exact h zify [hβ‚‚, h₃, hβ‚„] apply Int.eq_of_sub_eq_zero ring_nf
case e_a.e_a b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ i = List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
Please generate a tactic in lean4 to solve the state. STATE: case e_a.e_a b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ i = List.length (toDigits b n) - 1 - (List.length (toDigits b n) - 1 - i) case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
. rw [Nat.sub_sub] apply Nat.sub_lt_self . simp only [add_pos_iff, true_or] . rw [Nat.add_comm] apply Nat.lt_iff_add_one_le.1 h
case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 - i < List.length (toDigits b n) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
simp
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) ⊒ List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
calc List.length (toDigits b n) > i := h _ β‰₯ 0 := by simp only [ge_iff_le, _root_.zero_le]
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i ⊒ List.length (toDigits b n) β‰₯ 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i ⊒ List.length (toDigits b n) β‰₯ 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
simp only [ge_iff_le, _root_.zero_le]
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i ⊒ i β‰₯ 0
no goals
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i ⊒ i β‰₯ 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
apply Nat.le_pred_of_lt
b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i h₃ : List.length (toDigits b n) β‰₯ 1 ⊒ i ≀ List.length (toDigits b n) - 1
case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i h₃ : List.length (toDigits b n) β‰₯ 1 ⊒ i < List.length (toDigits b n)
Please generate a tactic in lean4 to solve the state. STATE: b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i h₃ : List.length (toDigits b n) β‰₯ 1 ⊒ i ≀ List.length (toDigits b n) - 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.toDigits_eq_digit
[382, 1]
[400, 38]
exact h
case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i h₃ : List.length (toDigits b n) β‰₯ 1 ⊒ i < List.length (toDigits b n)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h b n : β„• P : b > 1 i : β„• h : i < List.length (toDigits b n) hβ‚‚ : List.length (toDigits b n) - 1 β‰₯ List.length (toDigits b n) - 1 - i h₃ : List.length (toDigits b n) β‰₯ 1 ⊒ i < List.length (toDigits b n) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
unfold digit
b n i : β„• P : b > 1 Q : i > log b n ⊒ digit b n i = 0
b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i % b = 0
Please generate a tactic in lean4 to solve the state. STATE: b n i : β„• P : b > 1 Q : i > log b n ⊒ digit b n i = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
convert Nat.zero_mod b
b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i % b = 0
case e_a.e_a b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i = 0
Please generate a tactic in lean4 to solve the state. STATE: b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i % b = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
apply Nat.div_eq_of_lt
case e_a.e_a b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i = 0
case e_a.e_a.hβ‚€ b n i : β„• P : b > 1 Q : i > log b n ⊒ n < b ^ i
Please generate a tactic in lean4 to solve the state. STATE: case e_a.e_a b n i : β„• P : b > 1 Q : i > log b n ⊒ n / b ^ i = 0 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
apply Nat.lt_pow_of_log_lt
case e_a.e_a.hβ‚€ b n i : β„• P : b > 1 Q : i > log b n ⊒ n < b ^ i
case e_a.e_a.hβ‚€.hb b n i : β„• P : b > 1 Q : i > log b n ⊒ 1 < b case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i
Please generate a tactic in lean4 to solve the state. STATE: case e_a.e_a.hβ‚€ b n i : β„• P : b > 1 Q : i > log b n ⊒ n < b ^ i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
. exact P
case e_a.e_a.hβ‚€.hb b n i : β„• P : b > 1 Q : i > log b n ⊒ 1 < b case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i
case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i
Please generate a tactic in lean4 to solve the state. STATE: case e_a.e_a.hβ‚€.hb b n i : β„• P : b > 1 Q : i > log b n ⊒ 1 < b case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
Nat.digit_gt_log_eq_zero
[402, 1]
[408, 12]
. exact Q
case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i
no goals
Please generate a tactic in lean4 to solve the state. STATE: case e_a.e_a.hβ‚€.a b n i : β„• P : b > 1 Q : i > log b n ⊒ log b n < i TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_zero
[413, 1]
[415, 7]
unfold List.lastN
α : Type u_1 l : List α ⊒ lastN 0 l = []
α : Type u_1 l : List α ⊒ drop (length l - 0) l = []
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊒ lastN 0 l = [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_zero
[413, 1]
[415, 7]
simp
α : Type u_1 l : List α ⊒ drop (length l - 0) l = []
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊒ drop (length l - 0) l = [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length_eq_self
[418, 1]
[420, 7]
unfold List.lastN
α : Type u_1 l : List α ⊒ lastN (length l) l = l
α : Type u_1 l : List α ⊒ drop (length l - length l) l = l
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊒ lastN (length l) l = l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length_eq_self
[418, 1]
[420, 7]
simp
α : Type u_1 l : List α ⊒ drop (length l - length l) l = l
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊒ drop (length l - length l) l = l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
unfold lastN
Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length (lastN i l) = min i (length l)
Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length (drop (length l - i) l) = min i (length l)
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length (lastN i l) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
simp only [ge_iff_le, length_drop]
Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length (drop (length l - i) l) = min i (length l)
Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length l - (length l - i) = min i (length l)
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length (drop (length l - i) l) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
cases h: decide (i ≀ length l) with | true => simp at h rw [Nat.sub_sub_self h, Nat.min_eq_left h] | false => simp at h have hβ‚‚: length l ≀ i := Nat.le_of_lt h simp [hβ‚‚]
Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length l - (length l - i) = min i (length l)
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± i : β„• ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
simp at h
case true Ξ± : Type u_1 l : List Ξ± i : β„• h : decide (i ≀ length l) = true ⊒ length l - (length l - i) = min i (length l)
case true Ξ± : Type u_1 l : List Ξ± i : β„• h : i ≀ length l ⊒ length l - (length l - i) = min i (length l)
Please generate a tactic in lean4 to solve the state. STATE: case true Ξ± : Type u_1 l : List Ξ± i : β„• h : decide (i ≀ length l) = true ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
rw [Nat.sub_sub_self h, Nat.min_eq_left h]
case true Ξ± : Type u_1 l : List Ξ± i : β„• h : i ≀ length l ⊒ length l - (length l - i) = min i (length l)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case true Ξ± : Type u_1 l : List Ξ± i : β„• h : i ≀ length l ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
simp at h
case false Ξ± : Type u_1 l : List Ξ± i : β„• h : decide (i ≀ length l) = false ⊒ length l - (length l - i) = min i (length l)
case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i ⊒ length l - (length l - i) = min i (length l)
Please generate a tactic in lean4 to solve the state. STATE: case false Ξ± : Type u_1 l : List Ξ± i : β„• h : decide (i ≀ length l) = false ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
have hβ‚‚: length l ≀ i := Nat.le_of_lt h
case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i ⊒ length l - (length l - i) = min i (length l)
case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i hβ‚‚ : length l ≀ i ⊒ length l - (length l - i) = min i (length l)
Please generate a tactic in lean4 to solve the state. STATE: case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_length
[422, 1]
[433, 14]
simp [hβ‚‚]
case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i hβ‚‚ : length l ≀ i ⊒ length l - (length l - i) = min i (length l)
no goals
Please generate a tactic in lean4 to solve the state. STATE: case false Ξ± : Type u_1 l : List Ξ± i : β„• h : length l < i hβ‚‚ : length l ≀ i ⊒ length l - (length l - i) = min i (length l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
unfold lastN
Ξ± : Type u_1 head : Ξ± tail : List Ξ± i : β„• ⊒ lastN i (head :: tail) = if length (head :: tail) > i then lastN i tail else head :: tail
Ξ± : Type u_1 head : Ξ± tail : List Ξ± i : β„• ⊒ drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± i : β„• ⊒ lastN i (head :: tail) = if length (head :: tail) > i then lastN i tail else head :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
induction tail with | nil => split case inl heq => simp_all case inr heq => simp only [length_singleton, gt_iff_lt, Nat.lt_one_iff, ← ne_eq] at heq simp only [length_singleton, ge_iff_le, Nat.sub_eq_zero_of_le (Nat.succ_le_of_lt (Nat.pos_of_ne_zero heq)), drop] | cons mid tail _ih=> split case inl heq => simp [Nat.succ_eq_one_add] rw [Nat.add_sub_assoc, ←Nat.succ_eq_one_add, drop._eq_3] simp_all only [Nat.le_of_lt_succ, length_cons, Nat.succ_eq_one_add, ge_iff_le, gt_iff_lt] case inr heq => simp only [length_cons, gt_iff_lt, not_lt] at heq simp only [length_cons, ge_iff_le, Nat.sub_eq_zero_of_le heq, drop]
Ξ± : Type u_1 head : Ξ± tail : List Ξ± i : β„• ⊒ drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± i : β„• ⊒ drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
split
case nil Ξ± : Type u_1 head : Ξ± i : β„• ⊒ drop (length [head] - i) [head] = if length [head] > i then drop (length [] - i) [] else [head]
case nil.inl Ξ± : Type u_1 head : Ξ± i : β„• h✝ : length [head] > i ⊒ drop (length [head] - i) [head] = drop (length [] - i) [] case nil.inr Ξ± : Type u_1 head : Ξ± i : β„• h✝ : Β¬length [head] > i ⊒ drop (length [head] - i) [head] = [head]
Please generate a tactic in lean4 to solve the state. STATE: case nil Ξ± : Type u_1 head : Ξ± i : β„• ⊒ drop (length [head] - i) [head] = if length [head] > i then drop (length [] - i) [] else [head] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
case inl heq => simp_all
Ξ± : Type u_1 head : Ξ± i : β„• heq : length [head] > i ⊒ drop (length [head] - i) [head] = drop (length [] - i) []
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• heq : length [head] > i ⊒ drop (length [head] - i) [head] = drop (length [] - i) [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
case inr heq => simp only [length_singleton, gt_iff_lt, Nat.lt_one_iff, ← ne_eq] at heq simp only [length_singleton, ge_iff_le, Nat.sub_eq_zero_of_le (Nat.succ_le_of_lt (Nat.pos_of_ne_zero heq)), drop]
Ξ± : Type u_1 head : Ξ± i : β„• heq : Β¬length [head] > i ⊒ drop (length [head] - i) [head] = [head]
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• heq : Β¬length [head] > i ⊒ drop (length [head] - i) [head] = [head] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp_all
Ξ± : Type u_1 head : Ξ± i : β„• heq : length [head] > i ⊒ drop (length [head] - i) [head] = drop (length [] - i) []
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• heq : length [head] > i ⊒ drop (length [head] - i) [head] = drop (length [] - i) [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp only [length_singleton, gt_iff_lt, Nat.lt_one_iff, ← ne_eq] at heq
Ξ± : Type u_1 head : Ξ± i : β„• heq : Β¬length [head] > i ⊒ drop (length [head] - i) [head] = [head]
Ξ± : Type u_1 head : Ξ± i : β„• heq : i β‰  0 ⊒ drop (length [head] - i) [head] = [head]
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• heq : Β¬length [head] > i ⊒ drop (length [head] - i) [head] = [head] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp only [length_singleton, ge_iff_le, Nat.sub_eq_zero_of_le (Nat.succ_le_of_lt (Nat.pos_of_ne_zero heq)), drop]
Ξ± : Type u_1 head : Ξ± i : β„• heq : i β‰  0 ⊒ drop (length [head] - i) [head] = [head]
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• heq : i β‰  0 ⊒ drop (length [head] - i) [head] = [head] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
split
case cons Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = if length (head :: mid :: tail) > i then drop (length (mid :: tail) - i) (mid :: tail) else head :: mid :: tail
case cons.inl Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail h✝ : length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = drop (length (mid :: tail) - i) (mid :: tail) case cons.inr Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail h✝ : Β¬length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail
Please generate a tactic in lean4 to solve the state. STATE: case cons Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = if length (head :: mid :: tail) > i then drop (length (mid :: tail) - i) (mid :: tail) else head :: mid :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
case inl heq => simp [Nat.succ_eq_one_add] rw [Nat.add_sub_assoc, ←Nat.succ_eq_one_add, drop._eq_3] simp_all only [Nat.le_of_lt_succ, length_cons, Nat.succ_eq_one_add, ge_iff_le, gt_iff_lt]
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = drop (length (mid :: tail) - i) (mid :: tail)
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = drop (length (mid :: tail) - i) (mid :: tail) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
case inr heq => simp only [length_cons, gt_iff_lt, not_lt] at heq simp only [length_cons, ge_iff_le, Nat.sub_eq_zero_of_le heq, drop]
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Β¬length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Β¬length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp [Nat.succ_eq_one_add]
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = drop (length (mid :: tail) - i) (mid :: tail)
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (1 + (1 + length tail) - i) (head :: mid :: tail) = drop (1 + length tail - i) (mid :: tail)
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = drop (length (mid :: tail) - i) (mid :: tail) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
rw [Nat.add_sub_assoc, ←Nat.succ_eq_one_add, drop._eq_3]
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (1 + (1 + length tail) - i) (head :: mid :: tail) = drop (1 + length tail - i) (mid :: tail)
case h Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ i ≀ 1 + length tail
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ drop (1 + (1 + length tail) - i) (head :: mid :: tail) = drop (1 + length tail - i) (mid :: tail) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp_all only [Nat.le_of_lt_succ, length_cons, Nat.succ_eq_one_add, ge_iff_le, gt_iff_lt]
case h Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ i ≀ 1 + length tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : length (head :: mid :: tail) > i ⊒ i ≀ 1 + length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp only [length_cons, gt_iff_lt, not_lt] at heq
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Β¬length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Nat.succ (Nat.succ (length tail)) ≀ i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Β¬length (head :: mid :: tail) > i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_cons
[435, 1]
[452, 74]
simp only [length_cons, ge_iff_le, Nat.sub_eq_zero_of_le heq, drop]
Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Nat.succ (Nat.succ (length tail)) ≀ i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± i : β„• mid : Ξ± tail : List Ξ± _ih : drop (length (head :: tail) - i) (head :: tail) = if length (head :: tail) > i then drop (length tail - i) tail else head :: tail heq : Nat.succ (Nat.succ (length tail)) ≀ i ⊒ drop (length (head :: mid :: tail) - i) (head :: mid :: tail) = head :: mid :: tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_ge_length
[455, 1]
[458, 11]
unfold List.lastN
Ξ± : Type u_1 n : β„• l : List Ξ± h : n β‰₯ length l ⊒ lastN n l = l
Ξ± : Type u_1 n : β„• l : List Ξ± h : n β‰₯ length l ⊒ drop (length l - n) l = l
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± h : n β‰₯ length l ⊒ lastN n l = l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_ge_length
[455, 1]
[458, 11]
simp [h]
Ξ± : Type u_1 n : β„• l : List Ξ± h : n β‰₯ length l ⊒ drop (length l - n) l = l
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± h : n β‰₯ length l ⊒ drop (length l - n) l = l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
induction l with | nil => simp only [length_nil, ge_iff_le, lastN_ge_length, getLast?_nil, Option.to_list_none] | cons head tail ih=> rw [lastN_cons] simp only [length_cons, gt_iff_lt, ge_iff_le] split case inl heq => have hne: tail β‰  [] := by apply List.ne_nil_of_length_pos apply Nat.succ_lt_succ_iff.1 heq rw [getLast?_cons, ih, getLast?_eq_getLast _ hne, List.getLastD] split . contradiction . simp case inr heq => simp at heq have hnil: tail = [] := List.eq_nil_of_length_eq_zero (Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ heq)) subst tail simp only [getLast?_singleton, Option.to_list_some]
α : Type u_1 l : List α ⊒ lastN 1 l = Option.toList (getLast? l)
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α ⊒ lastN 1 l = Option.toList (getLast? l) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
simp only [length_nil, ge_iff_le, lastN_ge_length, getLast?_nil, Option.to_list_none]
case nil α : Type u_1 ⊒ lastN 1 [] = Option.toList (getLast? [])
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil α : Type u_1 ⊒ lastN 1 [] = Option.toList (getLast? []) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
rw [lastN_cons]
case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ lastN 1 (head :: tail) = Option.toList (getLast? (head :: tail))
case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if length (head :: tail) > 1 then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ lastN 1 (head :: tail) = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
simp only [length_cons, gt_iff_lt, ge_iff_le]
case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if length (head :: tail) > 1 then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail))
case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if 1 < Nat.succ (length tail) then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if length (head :: tail) > 1 then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
split
case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if 1 < Nat.succ (length tail) then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail))
case cons.inl α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) h✝ : 1 < Nat.succ (length tail) ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail)) case cons.inr α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) h✝ : ¬1 < Nat.succ (length tail) ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) ⊒ (if 1 < Nat.succ (length tail) then lastN 1 tail else head :: tail) = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
case inl heq => have hne: tail β‰  [] := by apply List.ne_nil_of_length_pos apply Nat.succ_lt_succ_iff.1 heq rw [getLast?_cons, ih, getLast?_eq_getLast _ hne, List.getLastD] split . contradiction . simp
α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail))
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
case inr heq => simp at heq have hnil: tail = [] := List.eq_nil_of_length_eq_zero (Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ heq)) subst tail simp only [getLast?_singleton, Option.to_list_some]
α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : ¬1 < Nat.succ (length tail) ⊒ head :: tail = Option.toList (getLast? (head :: tail))
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : ¬1 < Nat.succ (length tail) ⊒ head :: tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
have hne: tail β‰  [] := by apply List.ne_nil_of_length_pos apply Nat.succ_lt_succ_iff.1 heq
α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail))
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
rw [getLast?_cons, ih, getLast?_eq_getLast _ hne, List.getLastD]
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail))
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ Option.toList (some (getLast tail hne)) = Option.toList (some (match tail, head with | [], aβ‚€ => aβ‚€ | a :: as, x => getLast (a :: as) (_ : a :: as = [] β†’ List.noConfusionType False (a :: as) [])))
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ lastN 1 tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
split
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ Option.toList (some (getLast tail hne)) = Option.toList (some (match tail, head with | [], aβ‚€ => aβ‚€ | a :: as, x => getLast (a :: as) (_ : a :: as = [] β†’ List.noConfusionType False (a :: as) [])))
case h_1 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : 1 < Nat.succ (length []) hne : [] β‰  [] ⊒ Option.toList (some (getLast [] hne)) = Option.toList (some head) case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) [])))
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) hne : tail β‰  [] ⊒ Option.toList (some (getLast tail hne)) = Option.toList (some (match tail, head with | [], aβ‚€ => aβ‚€ | a :: as, x => getLast (a :: as) (_ : a :: as = [] β†’ List.noConfusionType False (a :: as) []))) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
. contradiction
case h_1 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : 1 < Nat.succ (length []) hne : [] β‰  [] ⊒ Option.toList (some (getLast [] hne)) = Option.toList (some head) case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) [])))
case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) [])))
Please generate a tactic in lean4 to solve the state. STATE: case h_1 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : 1 < Nat.succ (length []) hne : [] β‰  [] ⊒ Option.toList (some (getLast [] hne)) = Option.toList (some head) case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) []))) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
. simp
case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) [])))
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h_2 Ξ± : Type u_1 head : Ξ± x✝¹ : List Ξ± x✝ a✝ : Ξ± tail✝ : List Ξ± ih : lastN 1 (a✝ :: tail✝) = Option.toList (getLast? (a✝ :: tail✝)) heq : 1 < Nat.succ (length (a✝ :: tail✝)) hne : a✝ :: tail✝ β‰  [] ⊒ Option.toList (some (getLast (a✝ :: tail✝) hne)) = Option.toList (some (getLast (a✝ :: tail✝) (_ : a✝ :: tail✝ = [] β†’ List.noConfusionType False (a✝ :: tail✝) []))) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
apply List.ne_nil_of_length_pos
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ tail β‰  []
case a α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ 0 < length tail
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ tail β‰  [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
apply Nat.succ_lt_succ_iff.1 heq
case a α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ 0 < length tail
no goals
Please generate a tactic in lean4 to solve the state. STATE: case a α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : 1 < Nat.succ (length tail) ⊒ 0 < length tail TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
simp at heq
α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : ¬1 < Nat.succ (length tail) ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 head : α tail : List α ih : lastN 1 tail = Option.toList (getLast? tail) heq : ¬1 < Nat.succ (length tail) ⊒ head :: tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
have hnil: tail = [] := List.eq_nil_of_length_eq_zero (Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ heq))
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 hnil : tail = [] ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 ⊒ head :: tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
subst tail
Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 hnil : tail = [] ⊒ head :: tail = Option.toList (getLast? (head :: tail))
Ξ± : Type u_1 head : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : Nat.succ (length []) ≀ 1 ⊒ [head] = Option.toList (getLast? [head])
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± tail : List Ξ± ih : lastN 1 tail = Option.toList (getLast? tail) heq : Nat.succ (length tail) ≀ 1 hnil : tail = [] ⊒ head :: tail = Option.toList (getLast? (head :: tail)) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_one_eq_getLast
[460, 1]
[479, 58]
simp only [getLast?_singleton, Option.to_list_some]
Ξ± : Type u_1 head : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : Nat.succ (length []) ≀ 1 ⊒ [head] = Option.toList (getLast? [head])
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 head : Ξ± ih : lastN 1 [] = Option.toList (getLast? []) heq : Nat.succ (length []) ≀ 1 ⊒ [head] = Option.toList (getLast? [head]) TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
have hβ‚‚:= congr_arg Option.isSome h
Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a ⊒ l β‰  []
Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ l β‰  []
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a ⊒ l β‰  [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
simp at hβ‚‚
Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ l β‰  []
Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ l β‰  []
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ l β‰  [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
simp [hβ‚‚]
Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ l β‰  []
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type ?u.93833 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ l β‰  [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
have hβ‚‚:= congr_arg Option.isSome h
α : Type u_1 l : List α a : α h : getLast? l = some a ⊒ getLast l (_ : ¬l = []) = a
Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ getLast l (_ : Β¬l = []) = a
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α a : α h : getLast? l = some a ⊒ getLast l (_ : ¬l = []) = a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
simp only [Option.isSome_some, getLast?_isSome, ne_eq] at hβ‚‚
Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ getLast l (_ : Β¬l = []) = a
Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ getLast l (_ : Β¬l = []) = a
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Option.isSome (getLast? l) = Option.isSome (some a) ⊒ getLast l (_ : Β¬l = []) = a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
rw [ List.getLast?_eq_getLast l hβ‚‚] at h
Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ getLast l (_ : Β¬l = []) = a
Ξ± : Type u_1 l : List Ξ± a : Ξ± h✝ : getLast? l = some a hβ‚‚ : Β¬l = [] h : some (getLast l hβ‚‚) = some a ⊒ getLast l (_ : Β¬l = []) = a
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± a : Ξ± h : getLast? l = some a hβ‚‚ : Β¬l = [] ⊒ getLast l (_ : Β¬l = []) = a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLast?_some
[481, 1]
[486, 36]
simp_all only [Option.some.injEq]
Ξ± : Type u_1 l : List Ξ± a : Ξ± h✝ : getLast? l = some a hβ‚‚ : Β¬l = [] h : some (getLast l hβ‚‚) = some a ⊒ getLast l (_ : Β¬l = []) = a
no goals
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 l : List Ξ± a : Ξ± h✝ : getLast? l = some a hβ‚‚ : Β¬l = [] h : some (getLast l hβ‚‚) = some a ⊒ getLast l (_ : Β¬l = []) = a TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLastD_ne_nil
[488, 1]
[492, 54]
cases l with | nil => contradiction | cons hd tl => rw [List.getLastD_cons, List.getLast_eq_getLastD]
α✝ : Type u_1 l : List α✝ a : α✝ h : l β‰  [] ⊒ getLastD l a = getLast l h
no goals
Please generate a tactic in lean4 to solve the state. STATE: α✝ : Type u_1 l : List α✝ a : α✝ h : l β‰  [] ⊒ getLastD l a = getLast l h TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLastD_ne_nil
[488, 1]
[492, 54]
contradiction
case nil α✝ : Type u_1 a : α✝ h : [] β‰  [] ⊒ getLastD [] a = getLast [] h
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil α✝ : Type u_1 a : α✝ h : [] β‰  [] ⊒ getLastD [] a = getLast [] h TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.getLastD_ne_nil
[488, 1]
[492, 54]
rw [List.getLastD_cons, List.getLast_eq_getLastD]
case cons α✝ : Type u_1 a hd : α✝ tl : List α✝ h : hd :: tl β‰  [] ⊒ getLastD (hd :: tl) a = getLast (hd :: tl) h
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons α✝ : Type u_1 a hd : α✝ tl : List α✝ h : hd :: tl β‰  [] ⊒ getLastD (hd :: tl) a = getLast (hd :: tl) h TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.get_zero_cons_tail
[494, 1]
[498, 39]
cases l with | nil => simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, length_nil, lt_self_iff_false] at h | cons => simp only [get, tail_cons]
α : Type u_1 l : List α h : 0 < length l ⊒ get l { val := 0, isLt := h } :: tail l = l
no goals
Please generate a tactic in lean4 to solve the state. STATE: α : Type u_1 l : List α h : 0 < length l ⊒ get l { val := 0, isLt := h } :: tail l = l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.get_zero_cons_tail
[494, 1]
[498, 39]
simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, length_nil, lt_self_iff_false] at h
case nil α : Type u_1 h : 0 < length [] ⊒ get [] { val := 0, isLt := h } :: tail [] = []
no goals
Please generate a tactic in lean4 to solve the state. STATE: case nil α : Type u_1 h : 0 < length [] ⊒ get [] { val := 0, isLt := h } :: tail [] = [] TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.get_zero_cons_tail
[494, 1]
[498, 39]
simp only [get, tail_cons]
case cons α : Type u_1 head✝ : α tail✝ : List α h : 0 < length (head✝ :: tail✝) ⊒ get (head✝ :: tail✝) { val := 0, isLt := h } :: tail (head✝ :: tail✝) = head✝ :: tail✝
no goals
Please generate a tactic in lean4 to solve the state. STATE: case cons α : Type u_1 head✝ : α tail✝ : List α h : 0 < length (head✝ :: tail✝) ⊒ get (head✝ :: tail✝) { val := 0, isLt := h } :: tail (head✝ :: tail✝) = head✝ :: tail✝ TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
unfold lastN
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: lastN n l = lastN (n + 1) l
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: lastN n l = lastN (n + 1) l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
have h: length l - (n + 1) < length l := by apply Nat.sub_lt_self . simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, add_pos_iff, or_true] . simp only [Nat.succ_eq_add_one, P, Nat.succ_le_of_lt]
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
conv => right rw [List.drop_eq_get_cons (h:=h)]
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = get l { val := length l - (n + 1), isLt := h } :: drop (length l - (n + 1) + 1) l
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = drop (length l - (n + 1)) l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
congr 2
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = get l { val := length l - (n + 1), isLt := h } :: drop (length l - (n + 1) + 1) l
case e_head.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } = { val := length l - (n + 1), isLt := h } case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ get l { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } :: drop (length l - n) l = get l { val := length l - (n + 1), isLt := h } :: drop (length l - (n + 1) + 1) l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
. congr 1 rw [Nat.sub_sub, Nat.add_comm]
case e_head.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } = { val := length l - (n + 1), isLt := h } case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1
case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1
Please generate a tactic in lean4 to solve the state. STATE: case e_head.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ { val := length l - 1 - n, isLt := (_ : length l - 1 - n < length l) } = { val := length l - (n + 1), isLt := h } case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
. rw [← Nat.sub_sub, Nat.sub_add_cancel] apply Nat.le_of_add_le_add_right (b:=n) rw [Nat.sub_add_cancel] . rw [Nat.add_comm, ← Nat.succ_eq_add_one] apply Nat.succ_le_of_lt P . simp only [P, Nat.le_of_lt]
case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1
no goals
Please generate a tactic in lean4 to solve the state. STATE: case e_tail.e_a Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l h : length l - (n + 1) < length l ⊒ length l - n = length l - (n + 1) + 1 TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
apply Nat.sub_lt_self
Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ length l - (n + 1) < length l
case hβ‚€ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ 0 < n + 1 case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l
Please generate a tactic in lean4 to solve the state. STATE: Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ length l - (n + 1) < length l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
. simp only [zero_le, ge_iff_le, nonpos_iff_eq_zero, add_pos_iff, or_true]
case hβ‚€ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ 0 < n + 1 case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l
case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l
Please generate a tactic in lean4 to solve the state. STATE: case hβ‚€ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ 0 < n + 1 case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l TACTIC:
https://github.com/jeremysalwen/advent_of_lean_2022.git
96035d07c4f9f133fe79fe02cdf5792b597881c0
One.lean
List.lastN_eq_cons_lastN
[501, 1]
[521, 34]
. simp only [Nat.succ_eq_add_one, P, Nat.succ_le_of_lt]
case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l
no goals
Please generate a tactic in lean4 to solve the state. STATE: case h₁ Ξ± : Type u_1 n : β„• l : List Ξ± P : n < length l ⊒ n + 1 ≀ length l TACTIC: