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:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.