l3lab/ntp-mathlib huggingface dataset:
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · 

Proof state:
case mp.cons₂
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
IH : ∃ f, ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ ∃ f, ∀ (ix : ℕ), get? (x :: xs) ix = get? (x :: ys) (f ix)

Next tactic:
obtain ⟨f, hf⟩ := IH
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      

Proof state:
case mp.cons₂.intro
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ ∃ f, ∀ (ix : ℕ), get? (x :: xs) ix = get? (x :: ys) (f ix)

Next tactic:
refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · 

Proof state:
case mp.cons₂.intro.refine'_1
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ ∀ (a b : ℕ),
    (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) a ≤
        (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) b ↔
      a ≤ b

Next tactic:
rintro ⟨_ | a⟩ ⟨_ | b⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> 

Proof state:
case mp.cons₂.intro.refine'_1.zero.zero
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) Nat.zero ≤
      (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) Nat.zero ↔
    Nat.zero ≤ Nat.zero

Next tactic:
simp [Nat.succ_le_succ_iff]
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> 

Proof state:
case mp.cons₂.intro.refine'_1.zero.succ
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
n✝ : ℕ
⊢ (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) Nat.zero ≤
      (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) (Nat.succ n✝) ↔
    Nat.zero ≤ Nat.succ n✝

Next tactic:
simp [Nat.succ_le_succ_iff]
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> 

Proof state:
case mp.cons₂.intro.refine'_1.succ.zero
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
n✝ : ℕ
⊢ (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) (Nat.succ n✝) ≤
      (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) Nat.zero ↔
    Nat.succ n✝ ≤ Nat.zero

Next tactic:
simp [Nat.succ_le_succ_iff]
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> 

Proof state:
case mp.cons₂.intro.refine'_1.succ.succ
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
n✝¹ n✝ : ℕ
⊢ (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) (Nat.succ n✝¹) ≤
      (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) (Nat.succ n✝) ↔
    Nat.succ n✝¹ ≤ Nat.succ n✝

Next tactic:
simp [Nat.succ_le_succ_iff]
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
      · 

Proof state:
case mp.cons₂.intro.refine'_2
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ ∀ (ix : ℕ),
    get? (x :: xs) ix =
      get? (x :: ys)
        ((OrderEmbedding.ofMapLEIff (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix)))
            (_ :
              ∀ (a b : ℕ),
                (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) a ≤
                    (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) b ↔
                  a ≤ b))
          ix)

Next tactic:
rintro ⟨_ | i⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
      · rintro ⟨_ | i⟩
        · 

Proof state:
case mp.cons₂.intro.refine'_2.zero
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
⊢ get? (x :: xs) Nat.zero =
    get? (x :: ys)
      ((OrderEmbedding.ofMapLEIff (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix)))
          (_ :
            ∀ (a b : ℕ),
              (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) a ≤
                  (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) b ↔
                a ≤ b))
        Nat.zero)

Next tactic:
simp
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
      · rintro ⟨_ | i⟩
        · simp
        · 

Proof state:
case mp.cons₂.intro.refine'_2.succ
α : Type u_1
l l' xs ys : List α
x : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (f ix)
n✝ : ℕ
⊢ get? (x :: xs) (Nat.succ n✝) =
    get? (x :: ys)
      ((OrderEmbedding.ofMapLEIff (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix)))
          (_ :
            ∀ (a b : ℕ),
              (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) a ≤
                  (fun ix => if ix = 0 then 0 else Nat.succ (f (Nat.pred ix))) b ↔
                a ≤ b))
        (Nat.succ n✝))

Next tactic:
simpa using hf _
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
      · rintro ⟨_ | i⟩
        · simp
        · simpa using hf _
  · 

Proof state:
case mpr
α : Type u_1
l l' : List α
⊢ (∃ f, ∀ (ix : ℕ), get? l ix = get? l' (f ix)) → l <+ l'

Next tactic:
rintro ⟨f, hf⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `ℕ` into `ℕ` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
    l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
  constructor
  · intro H
    induction' H with xs ys y _H IH xs ys x _H IH
    · simp
    · obtain ⟨f, hf⟩ := IH
      refine' ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), _⟩
      simpa using hf
    · obtain ⟨f, hf⟩ := IH
      refine'
        ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
      · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
      · rintro ⟨_ | i⟩
        · simp
        · simpa using hf _
  · rintro ⟨f, hf⟩
    

Proof state:
case mpr.intro
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
⊢ l <+ l'

Next tactic:
exact sublist_of_orderEmbedding_get?_eq f hf
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  

Proof state:
α : Type u_1
l l' : List α
⊢ l <+ l' ↔ ∃ f, ∀ (ix : Fin (length l)), get l ix = get l' (f ix)

Next tactic:
rw [sublist_iff_exists_orderEmbedding_get?_eq]
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  

Proof state:
α : Type u_1
l l' : List α
⊢ (∃ f, ∀ (ix : ℕ), get? l ix = get? l' (f ix)) ↔ ∃ f, ∀ (ix : Fin (length l)), get l ix = get l' (f ix)

Next tactic:
constructor
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · 

Proof state:
case mp
α : Type u_1
l l' : List α
⊢ (∃ f, ∀ (ix : ℕ), get? l ix = get? l' (f ix)) → ∃ f, ∀ (ix : Fin (length l)), get l ix = get l' (f ix)

Next tactic:
rintro ⟨f, hf⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    

Proof state:
case mp.intro
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
⊢ ∃ f, ∀ (ix : Fin (length l)), get l ix = get l' (f ix)

Next tactic:
have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      obtain ⟨h, -⟩ := hf
      exact h
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      

Proof state:
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
⊢ ∀ {i : ℕ}, i < length l → f i < length l'

Next tactic:
intro i hi
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      

Proof state:
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
i : ℕ
hi : i < length l
⊢ f i < length l'

Next tactic:
specialize hf i
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      

Proof state:
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
i : ℕ
hi : i < length l
hf : get? l i = get? l' (f i)
⊢ f i < length l'

Next tactic:
rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      

Proof state:
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
i : ℕ
hi : i < length l
hf : ∃ (h : f i < length l'), get l' { val := f i, isLt := h } = get l { val := i, isLt := hi }
⊢ f i < length l'

Next tactic:
obtain ⟨h, -⟩ := hf
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      obtain ⟨h, -⟩ := hf
      

Proof state:
case intro
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
i : ℕ
hi : i < length l
h : f i < length l'
⊢ f i < length l'

Next tactic:
exact h
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      obtain ⟨h, -⟩ := hf
      exact h
    

Proof state:
case mp.intro
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
h : ∀ {i : ℕ}, i < length l → f i < length l'
⊢ ∃ f, ∀ (ix : Fin (length l)), get l ix = get l' (f ix)

Next tactic:
refine' ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) _, _⟩
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      obtain ⟨h, -⟩ := hf
      exact h
    refine' ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) _, _⟩
    · 

Proof state:
case mp.intro.refine'_1
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
h : ∀ {i : ℕ}, i < length l → f i < length l'
⊢ ∀ (a b : Fin (length l)),
    (fun ix => { val := f ↑ix, isLt := (_ : f ↑ix < length l') }) a ≤
        (fun ix => { val := f ↑ix, isLt := (_ : f ↑ix < length l') }) b ↔
      a ≤ b

Next tactic:
simp
/-- A `l : List α` is `Sublist l l'` for `l' : List α` iff
there is `f`, an order-preserving embedding of `Fin l.length` into `Fin l'.length` such that
any element of `l` found at index `ix` can be found at index `f ix` in `l'`.
-/
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} :
    l <+ l' ↔
      ∃ f : Fin l.length ↪o Fin l'.length,
        ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
  rw [sublist_iff_exists_orderEmbedding_get?_eq]
  constructor
  · rintro ⟨f, hf⟩
    have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by
      intro i hi
      specialize hf i
      rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf
      obtain ⟨h, -⟩ := hf
      exact h
    refine' ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) _, _⟩
    · simp
    · 

Proof state:
case mp.intro.refine'_2
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (f ix)
h : ∀ {i : ℕ}, i < length l → f i < length l'
⊢ ∀ (ix : Fin (length l)),
    get l ix =
      get l'
        ((OrderEmbedding.ofMapLEIff (fun ix => { val := f ↑ix, isLt := (_ : f ↑ix < length l') })
            (_ :
              ∀ (a a_1 : Fin (length l)),
                { val := f ↑a, isLt := (_ : f ↑a < length l') } ≤ { val := f ↑a_1, isLt := (_ : f ↑a_1 < length l') } ↔
                  a ≤ a_1))
          ix)

Next tactic:
intro i