Theorem: List.map_get_sublist
File: .lake/packages/batteries/Batteries/Data/List/Pairwise.lean

tactic: suffices ∀ n l', l' = l.drop n → (∀ i ∈ is, n ≤ i) → map (get l) is <+ l'
  from this 0 l (by simp) (by simp)
state_before: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
⊢ map l.get is <+ l
state_after: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
⊢ ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ is → n ≤ ↑i) → map l.get is <+ l'

tactic: intro n l' hl' his
state_before: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
⊢ ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ is → n ≤ ↑i) → map l.get is <+ l'
state_after: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ is → n ≤ ↑i
⊢ map l.get is <+ l'

tactic: induction is generalizing n l' with
| nil => simp
| cons hd tl IH =>
  simp; cases hl'
  have := IH h.of_cons (hd+1) _ rfl (pairwise_cons.mp h).1
  specialize his hd (.head _)
  have := (drop_eq_getElem_cons ..).symm ▸ this.cons₂ (get l hd)
  have := Sublist.append (nil_sublist (take hd l |>.drop n)) this
  rwa [nil_append, ← (drop_append_of_le_length ?_), take_append_drop] at this
  simp [Nat.min_eq_left (Nat.le_of_lt hd.isLt), his]
state_before: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ is → n ≤ ↑i
⊢ map l.get is <+ l'
state_after: no goals

tactic: simp
state_before: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
this : ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ is → n ≤ ↑i) → map l.get is <+ l'
⊢ l = drop 0 l
state_after: no goals

tactic: simp
state_before: α : Type u_1
l : List α
is : List (Fin l.length)
h : Pairwise (fun x x_1 => ↑x < ↑x_1) is
this : ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ is → n ≤ ↑i) → map l.get is <+ l'
⊢ ∀ (i : Fin l.length), i ∈ is → 0 ≤ ↑i
state_after: no goals

tactic: simp
state_before: case nil
α : Type u_1
l : List α
h : Pairwise (fun x x_1 => ↑x < ↑x_1) []
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ [] → n ≤ ↑i
⊢ map l.get [] <+ l'
state_after: no goals

tactic: simp
state_before: case cons
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
⊢ map l.get (hd :: tl) <+ l'
state_after: case cons
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
⊢ l[↑hd] :: map l.get tl <+ l'

tactic: cases hl'
state_before: case cons
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
l' : List α
hl' : l' = drop n l
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
⊢ l[↑hd] :: map l.get tl <+ l'
state_after: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
⊢ l[↑hd] :: map l.get tl <+ drop n l

tactic: have := IH h.of_cons (hd+1) _ rfl (pairwise_cons.mp h).1
state_before: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
⊢ l[↑hd] :: map l.get tl <+ drop n l
state_after: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
this : map l.get tl <+ drop (↑hd + 1) l
⊢ l[↑hd] :: map l.get tl <+ drop n l

tactic: specialize his hd (.head _)
state_before: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
his : ∀ (i : Fin l.length), i ∈ hd :: tl → n ≤ ↑i
this : map l.get tl <+ drop (↑hd + 1) l
⊢ l[↑hd] :: map l.get tl <+ drop n l
state_after: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
⊢ l[↑hd] :: map l.get tl <+ drop n l

tactic: have := (drop_eq_getElem_cons ..).symm ▸ this.cons₂ (get l hd)
state_before: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
⊢ l[↑hd] :: map l.get tl <+ drop n l
state_after: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this : l.get hd :: map l.get tl <+ drop (↑hd) l
⊢ l[↑hd] :: map l.get tl <+ drop n l

tactic: have := Sublist.append (nil_sublist (take hd l |>.drop n)) this
state_before: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this : l.get hd :: map l.get tl <+ drop (↑hd) l
⊢ l[↑hd] :: map l.get tl <+ drop n l
state_after: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝¹ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this✝ : l.get hd :: map l.get tl <+ drop (↑hd) l
this : [] ++ l.get hd :: map l.get tl <+ drop n (take (↑hd) l) ++ drop (↑hd) l
⊢ l[↑hd] :: map l.get tl <+ drop n l

tactic: rwa [nil_append, ← (drop_append_of_le_length ?_), take_append_drop] at this
state_before: case cons.refl
α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝¹ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this✝ : l.get hd :: map l.get tl <+ drop (↑hd) l
this : [] ++ l.get hd :: map l.get tl <+ drop n (take (↑hd) l) ++ drop (↑hd) l
⊢ l[↑hd] :: map l.get tl <+ drop n l
state_after: α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝¹ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this✝ : l.get hd :: map l.get tl <+ drop (↑hd) l
this : l.get hd :: map l.get tl <+ drop n (take (↑hd) l) ++ drop (↑hd) l
⊢ n ≤ (take (↑hd) l).length

tactic: simp [Nat.min_eq_left (Nat.le_of_lt hd.isLt), his]
state_before: α : Type u_1
l : List α
hd : Fin l.length
tl : List (Fin l.length)
IH :
  Pairwise (fun x x_1 => ↑x < ↑x_1) tl →
    ∀ (n : Nat) (l' : List α), l' = drop n l → (∀ (i : Fin l.length), i ∈ tl → n ≤ ↑i) → map l.get tl <+ l'
h : Pairwise (fun x x_1 => ↑x < ↑x_1) (hd :: tl)
n : Nat
this✝¹ : map l.get tl <+ drop (↑hd + 1) l
his : n ≤ ↑hd
this✝ : l.get hd :: map l.get tl <+ drop (↑hd) l
this : l.get hd :: map l.get tl <+ drop n (take (↑hd) l) ++ drop (↑hd) l
⊢ n ≤ (take (↑hd) l).length
state_after: no goals