Theorem: List.sublist_iff_exists_orderEmbedding_get?_eq
File: Mathlib/Data/List/NodupEquivFin.lean

tactic: constructor
state_before: α : Type u_1
l l' : List α
⊢ l <+ l' ↔ ∃ f, ∀ (ix : ℕ), get? l ix = get? l' (↑f ix)

tactic: intro H
state_before: case mp
α : Type u_1
l l' : List α
⊢ l <+ l' → ∃ f, ∀ (ix : ℕ), get? l ix = get? l' (↑f ix)

tactic: induction' H with xs ys y _H IH xs ys x _H IH
state_before: case mp
α : Type u_1
l l' : List α
H : l <+ l'
⊢ ∃ f, ∀ (ix : ℕ), get? l ix = get? l' (↑f ix)

tactic: simp
state_before: case mp.slnil
α : Type u_1
l l' : List α
⊢ ∃ f, ∀ (ix : ℕ), get? [] ix = get? [] (↑f ix)

tactic: obtain ⟨f, hf⟩ := IH
state_before: case mp.cons
α : Type u_1
l l' xs ys : List α
y : α
_H : xs <+ ys
IH : ∃ f, ∀ (ix : ℕ), get? xs ix = get? ys (↑f ix)
⊢ ∃ f, ∀ (ix : ℕ), get? xs ix = get? (y :: ys) (↑f ix)

tactic: simpa using hf
state_before: case mp.cons.intro
α : Type u_1
l l' xs ys : List α
y : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (↑f ix)
⊢ ∀ (ix : ℕ),
    get? xs ix =
      get? (y :: ys)
        (↑(RelEmbedding.trans f (OrderEmbedding.ofStrictMono (fun x => x + 1) (_ : ∀ (x a : ℕ), x < a → x + 1 < a + 1)))
          ix)

tactic: simp
state_before: α : Type u_1
l l' xs ys : List α
y : α
_H : xs <+ ys
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? xs ix = get? ys (↑f ix)
x✝ : ℕ
⊢ ∀ ⦃b : ℕ⦄, x✝ < b → (fun x => x + 1) x✝ < (fun x => x + 1) b

tactic: obtain ⟨f, hf⟩ := IH
state_before: 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)

tactic: refine'
  ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) _, _⟩
state_before: 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)

tactic: rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
state_before: 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

tactic: rintro ⟨_ | i⟩
state_before: 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)

tactic: simp
state_before: 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)

tactic: simpa using hf _
state_before: 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✝))

tactic: rintro ⟨f, hf⟩
state_before: case mpr
α : Type u_1
l l' : List α
⊢ (∃ f, ∀ (ix : ℕ), get? l ix = get? l' (↑f ix)) → l <+ l'

tactic: exact sublist_of_orderEmbedding_get?_eq f hf
state_before: case mpr.intro
α : Type u_1
l l' : List α
f : ℕ ↪o ℕ
hf : ∀ (ix : ℕ), get? l ix = get? l' (↑f ix)
⊢ l <+ l'