-- Mathlib/.lake/packages/lean4/src/lean/Init/Data/Array/Lemmas.lean
theorem getElem_extract_loop_ge (as bs : Array α) (size start : Nat) (hge : i ≥ bs.size)
    (h : i < (extract.loop as size start bs).size)
    (h' := getElem_extract_loop_ge_aux as bs size start hge h) :
    (extract.loop as size start bs)[i] = as[start + i - bs.size]

Proof state:
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this✝ : start < as.size
this : i < (extract.loop as size (start + 1) (bs.push as[start])).size
⊢ (extract.loop as (size + 1) start bs)[i] = (extract.loop as size (start + 1) (bs.push as[start]))[i]

Tactic:
congr 1

Result:
case e_xs
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this✝ : start < as.size
this : i < (extract.loop as size (start + 1) (bs.push as[start])).size
⊢ extract.loop as (size + 1) start bs = extract.loop as size (start + 1) (bs.push as[start])

Proof state:
case zero
α : Type u_1
i : Nat
as bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as 0 start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
⊢ (extract.loop as 0 start bs)[i] = as[start + i - bs.size]

Tactic:
rw [size_extract_loop, Nat.zero_min, Nat.add_zero] at h

Result:
case zero
α : Type u_1
i : Nat
as bs : Array α
start : Nat
hge : i ≥ bs.size
h✝ : i < (extract.loop as 0 start bs).size
h : i < bs.size
h' : optParam (start + i - bs.size < as.size) ⋯
⊢ (extract.loop as 0 start bs)[i] = as[start + i - bs.size]

Proof state:
case zero
α : Type u_1
i : Nat
as bs : Array α
start : Nat
hge : i ≥ bs.size
h✝ : i < (extract.loop as 0 start bs).size
h : i < bs.size
h' : optParam (start + i - bs.size < as.size) ⋯
⊢ (extract.loop as 0 start bs)[i] = as[start + i - bs.size]

Tactic:
omega

Result:
no goals

Proof state:
case succ
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this✝ : start < as.size
this : i < (extract.loop as size (start + 1) (bs.push as[start])).size
heq : (extract.loop as (size + 1) start bs)[i] = (extract.loop as size (start + 1) (bs.push as[start]))[i]
⊢ (extract.loop as (size + 1) start bs)[i] = as[start + i - bs.size]

Tactic:
rw [heq]

Result:
case succ
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this✝ : start < as.size
this : i < (extract.loop as size (start + 1) (bs.push as[start])).size
heq : (extract.loop as (size + 1) start bs)[i] = (extract.loop as size (start + 1) (bs.push as[start]))[i]
⊢ (extract.loop as size (start + 1) (bs.push as[start]))[i] = as[start + i - bs.size]

Proof state:
case succ
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this : start < as.size
⊢ (extract.loop as (size + 1) start bs)[i] = as[start + i - bs.size]

Tactic:
have : i < (extract.loop as size (start+1) (bs.push as[start])).size := by
  rwa [← extract_loop_succ]

Result:
case succ
α : Type u_1
i : Nat
as : Array α
size : Nat
ih :
  ∀ (bs : Array α) (start : Nat) (hge : i ≥ bs.size) (h : i < (extract.loop as size start bs).size)
    (h' : optParam (start + i - bs.size < as.size) ⋯), (extract.loop as size start bs)[i] = as[start + i - bs.size]
bs : Array α
start : Nat
hge : i ≥ bs.size
h : i < (extract.loop as (size + 1) start bs).size
h' : optParam (start + i - bs.size < as.size) ⋯
this✝ : start < as.size
this : i < (extract.loop as size (start + 1) (bs.push as[start])).size
⊢ (extract.loop as (size + 1) start bs)[i] = as[start + i - bs.size]

Proof state:
case refl
α : Type u_1
as : Array α
size : Nat
bs : Array α
start : Nat
this✝ : start < as.size
ih :
  ∀ (bs_1 : Array α) (start : Nat) (hge : bs.size ≥ bs_1.size) (h : bs.size < (extract.loop as size start bs_1).size)
    (h' : optParam (start + bs.size - bs_1.size < as.size) ⋯),
    (extract.loop as size start bs_1)[bs.size] = as[start + bs.size - bs_1.size]
hge : bs.size ≥ bs.size
h✝ : bs.size < (extract.loop as (size + 1) start bs).size
h' : optParam (start + bs.size - bs.size < as.size) ⋯
this : bs.size < (extract.loop as size (start + 1) (bs.push as[start])).size
heq : (extract.loop as (size + 1) start bs)[bs.size] = (extract.loop as size (start + 1) (bs.push as[start]))[bs.size]
h₁ : bs.size < (bs.push as[start]).size
h₂ : bs.size < (extract.loop as size (start + 1) (bs.push as[start])).size
h : (extract.loop as size (start + 1) (bs.push as[start]))[bs.size] = as[start]
⊢ (extract.loop as size (start + 1) (bs.push as[start]))[bs.size] = as[start + bs.size - bs.size]

Tactic:
rw [h]

Result:
case refl
α : Type u_1
as : Array α
size : Nat
bs : Array α
start : Nat
this✝ : start < as.size
ih :
  ∀ (bs_1 : Array α) (start : Nat) (hge : bs.size ≥ bs_1.size) (h : bs.size < (extract.loop as size start bs_1).size)
    (h' : optParam (start + bs.size - bs_1.size < as.size) ⋯),
    (extract.loop as size start bs_1)[bs.size] = as[start + bs.size - bs_1.size]
hge : bs.size ≥ bs.size
h✝ : bs.size < (extract.loop as (size + 1) start bs).size
h' : optParam (start + bs.size - bs.size < as.size) ⋯
this : bs.size < (extract.loop as size (start + 1) (bs.push as[start])).size
heq : (extract.loop as (size + 1) start bs)[bs.size] = (extract.loop as size (start + 1) (bs.push as[start]))[bs.size]
h₁ : bs.size < (bs.push as[start]).size
h₂ : bs.size < (extract.loop as size (start + 1) (bs.push as[start])).size
h : (extract.loop as size (start + 1) (bs.push as[start]))[bs.size] = as[start]
⊢ as[start] = as[start + bs.size - bs.size]