L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode (List.bind l fun φ => listEncode φ.snd)).fst = headI l

case h
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
⊢ ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
⊢ (listDecode (List.bind l fun φ => listEncode φ.snd)).fst = headI l
suffices h : ∀ (φ : Σn, L.BoundedFormula α n) (l),
    (listDecode (listEncode φ.2 ++ l)).1 = φ ∧ (listDecode (listEncode φ.2 ++ l)).2.1 = l
case nil
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode (List.bind [] fun φ => listEncode φ.snd)).fst = headI []

case cons
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
φ : (n : ℕ) × BoundedFormula L α n
l : List ((n : ℕ) × BoundedFormula L α n)
tail_ih✝ : (listDecode (List.bind l fun φ => listEncode φ.snd)).fst = headI l
⊢ (listDecode (List.bind (φ :: l) fun φ => listEncode φ.snd)).fst = headI (φ :: l)
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode (List.bind l fun φ => listEncode φ.snd)).fst = headI l
induction' l with φ l _
case nil
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode []).fst = headI []
case nil
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode (List.bind [] fun φ => listEncode φ.snd)).fst = headI []
rw [List.nil_bind]
no goals
case nil
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
⊢ (listDecode []).fst = headI []
simp [listDecode]
no goals
case cons
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
h :
  ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
φ : (n : ℕ) × BoundedFormula L α n
l : List ((n : ℕ) × BoundedFormula L α n)
tail_ih✝ : (listDecode (List.bind l fun φ => listEncode φ.snd)).fst = headI l
⊢ (listDecode (List.bind (φ :: l) fun φ => listEncode φ.snd)).fst = headI (φ :: l)
rw [cons_bind, (h φ _).1, headI_cons]
case h.mk
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
n : ℕ
φ : BoundedFormula L α n
⊢ ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n, snd := φ }.snd ++ l)).fst = { fst := n, snd := φ } ∧
      ↑(listDecode (listEncode { fst := n, snd := φ }.snd ++ l)).snd = l
case h
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
⊢ ∀ (φ : (n : ℕ) × BoundedFormula L α n) (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode φ.snd ++ l)).fst = φ ∧ ↑(listDecode (listEncode φ.snd ++ l)).snd = l
rintro ⟨n, φ⟩
case h.mk.falsum
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := falsum }.snd ++ l)).fst = { fst := n✝, snd := falsum } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := falsum }.snd ++ l)).snd = l

case h.mk.equal
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := equal t₁✝ t₂✝ }.snd ++ l)).fst = { fst := n✝, snd := equal t₁✝ t₂✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := equal t₁✝ t₂✝ }.snd ++ l)).snd = l

case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := φ_n, snd := rel φ_R ts }.snd ++ l)).fst = { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(listDecode (listEncode { fst := φ_n, snd := rel φ_R ts }.snd ++ l)).snd = l

case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := f₁✝ ⟹ f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ ⟹ f₂✝ }.snd ++ l)).snd = l

case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := ∀'f✝ }.snd ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := ∀'f✝ }.snd ++ l)).snd = l
case h.mk
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l : List ((n : ℕ) × BoundedFormula L α n)
n : ℕ
φ : BoundedFormula L α n
⊢ ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n, snd := φ }.snd ++ l)).fst = { fst := n, snd := φ } ∧
      ↑(listDecode (listEncode { fst := n, snd := φ }.snd ++ l)).snd = l
induction' φ with _ _ _ _ φ_n φ_l φ_R ts _ _ _ ih1 ih2 _ _ ih <;> intro l
case h.mk.falsum
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ({ fst := { fst := n✝, snd := falsum }.fst, snd := falsum },
          { val := l,
            property :=
              (_ :
                SizeOf.sizeOf l ≤
                  max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr ({ fst := n✝, snd := falsum }.fst + 2)) :: l))) }).fst =
      { fst := n✝, snd := falsum } ∧
    ↑({ fst := { fst := n✝, snd := falsum }.fst, snd := falsum },
            { val := l,
              property :=
                (_ :
                  SizeOf.sizeOf l ≤
                    max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr ({ fst := n✝, snd := falsum }.fst + 2)) :: l))) }).snd =
      l
case h.mk.falsum
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := falsum }.snd ++ l)).fst = { fst := n✝, snd := falsum } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := falsum }.snd ++ l)).snd = l
rw [listEncode, singleton_append, listDecode]
no goals
case h.mk.falsum
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ({ fst := { fst := n✝, snd := falsum }.fst, snd := falsum },
          { val := l,
            property :=
              (_ :
                SizeOf.sizeOf l ≤
                  max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr ({ fst := n✝, snd := falsum }.fst + 2)) :: l))) }).fst =
      { fst := n✝, snd := falsum } ∧
    ↑({ fst := { fst := n✝, snd := falsum }.fst, snd := falsum },
            { val := l,
              property :=
                (_ :
                  SizeOf.sizeOf l ≤
                    max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr ({ fst := n✝, snd := falsum }.fst + 2)) :: l))) }).snd =
      l
simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
case h.mk.equal
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ({ fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst,
            snd :=
              equal t₁✝
                (Eq.mp
                  (_ :
                    Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst) =
                      Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst))
                  t₂✝) },
          { val := [] ++ l,
            property :=
              (_ :
                SizeOf.sizeOf ([] ++ l) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₁✝ } ::
                        Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₂✝ } :: ([] ++ l)))) }).fst =
      { fst := n✝, snd := equal t₁✝ t₂✝ } ∧
    ↑({ fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst,
              snd :=
                equal t₁✝
                  (Eq.mp
                    (_ :
                      Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst) =
                        Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst))
                    t₂✝) },
            { val := [] ++ l,
              property :=
                (_ :
                  SizeOf.sizeOf ([] ++ l) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₁✝ } ::
                          Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₂✝ } ::
                            ([] ++ l)))) }).snd =
      l

case h.mk.equal.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ { fst := n✝, snd := equal t₁✝ t₂✝ }.fst = { fst := n✝, snd := equal t₁✝ t₂✝ }.fst
case h.mk.equal
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := equal t₁✝ t₂✝ }.snd ++ l)).fst = { fst := n✝, snd := equal t₁✝ t₂✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := equal t₁✝ t₂✝ }.snd ++ l)).snd = l
rw [listEncode, cons_append, cons_append, listDecode, dif_pos]
no goals
case h.mk.equal
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ({ fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst,
            snd :=
              equal t₁✝
                (Eq.mp
                  (_ :
                    Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst) =
                      Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst))
                  t₂✝) },
          { val := [] ++ l,
            property :=
              (_ :
                SizeOf.sizeOf ([] ++ l) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₁✝ } ::
                        Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₂✝ } :: ([] ++ l)))) }).fst =
      { fst := n✝, snd := equal t₁✝ t₂✝ } ∧
    ↑({ fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst,
              snd :=
                equal t₁✝
                  (Eq.mp
                    (_ :
                      Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst) =
                        Term L (α ⊕ Fin { fst := n✝, snd := equal t₁✝ t₂✝ }.fst))
                    t₂✝) },
            { val := [] ++ l,
              property :=
                (_ :
                  SizeOf.sizeOf ([] ++ l) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₁✝ } ::
                          Sum.inl { fst := { fst := n✝, snd := equal t₁✝ t₂✝ }.fst, snd := t₂✝ } ::
                            ([] ++ l)))) }).snd =
      l
simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append]
no goals
case h.mk.equal.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ { fst := n✝, snd := equal t₁✝ t₂✝ }.fst = { fst := n✝, snd := equal t₁✝ t₂✝ }.fst
simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (if h :
              ∀ (i : Fin φ_l),
                Option.isSome
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i)) =
                  true then
            if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h :
                ∀ (i : Fin φ_l),
                  Option.isSome
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i)) =
                    true then
              if h' :
                  ∀ (i : Fin φ_l),
                    (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).fst =
                      { fst := φ_n, snd := rel φ_R ts }.fst then
                { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                  snd :=
                    rel φ_R fun i =>
                      Eq.mp
                        (_ :
                          Term L
                              (α ⊕
                                Fin
                                  (Option.get
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i))
                                      (_ :
                                        Option.isSome
                                            (Option.join
                                              (get?
                                                (List.map Sum.getLeft
                                                  (List.map
                                                      (fun i =>
                                                        Sum.inl
                                                          { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                      (finRange φ_l) ++
                                                    l))
                                                ↑i)) =
                                          true)).fst) =
                            Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                        (Option.get
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i))
                            (_ :
                              Option.isSome
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i)) =
                                true)).snd }
              else default
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := φ_n, snd := rel φ_R ts }.snd ++ l)).fst = { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(listDecode (listEncode { fst := φ_n, snd := rel φ_R ts }.snd ++ l)).snd = l
rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode]
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (if h' :
              ∀ (i : Fin φ_l),
                (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).fst =
                  { fst := φ_n, snd := rel φ_R ts }.fst then
            { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd }
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l

case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    Option.isSome
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i)) =
      true
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (if h :
              ∀ (i : Fin φ_l),
                Option.isSome
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i)) =
                  true then
            if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h :
                ∀ (i : Fin φ_l),
                  Option.isSome
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i)) =
                    true then
              if h' :
                  ∀ (i : Fin φ_l),
                    (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).fst =
                      { fst := φ_n, snd := rel φ_R ts }.fst then
                { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                  snd :=
                    rel φ_R fun i =>
                      Eq.mp
                        (_ :
                          Term L
                              (α ⊕
                                Fin
                                  (Option.get
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i))
                                      (_ :
                                        Option.isSome
                                            (Option.join
                                              (get?
                                                (List.map Sum.getLeft
                                                  (List.map
                                                      (fun i =>
                                                        Sum.inl
                                                          { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                      (finRange φ_l) ++
                                                    l))
                                                ↑i)) =
                                          true)).fst) =
                            Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                        (Option.get
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i))
                            (_ :
                              Option.isSome
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i)) =
                                true)).snd }
              else default
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
rw [dif_pos]
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    Option.isSome
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i)) =
      true

case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (if h' :
              ∀ (i : Fin φ_l),
                (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).fst =
                  { fst := φ_n, snd := rel φ_R ts }.fst then
            { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd }
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (if h' :
              ∀ (i : Fin φ_l),
                (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).fst =
                  { fst := φ_n, snd := rel φ_R ts }.fst then
            { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd }
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l

case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    Option.isSome
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i)) =
      true
swap
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
            snd :=
              rel φ_R fun i =>
                Eq.mp
                  (_ :
                    Term L
                        (α ⊕
                          Fin
                            (Option.get
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i))
                                (_ :
                                  Option.isSome
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i)) =
                                    true)).fst) =
                      Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                  (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).snd },
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd },
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l

case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    (Option.get
          (Option.join
            (get?
              (List.map Sum.getLeft
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l))
                    ↑i)) =
              true)).fst =
      { fst := φ_n, snd := rel φ_R ts }.fst
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (if h' :
              ∀ (i : Fin φ_l),
                (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).fst =
                  { fst := φ_n, snd := rel φ_R ts }.fst then
            { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd }
          else default,
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑(if h' :
                ∀ (i : Fin φ_l),
                  (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst =
                    { fst := φ_n, snd := rel φ_R ts }.fst then
              { fst := { fst := φ_n, snd := rel φ_R ts }.fst,
                snd :=
                  rel φ_R fun i =>
                    Eq.mp
                      (_ :
                        Term L
                            (α ⊕
                              Fin
                                (Option.get
                                    (Option.join
                                      (get?
                                        (List.map Sum.getLeft
                                          (List.map
                                              (fun i =>
                                                Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                              (finRange φ_l) ++
                                            l))
                                        ↑i))
                                    (_ :
                                      Option.isSome
                                          (Option.join
                                            (get?
                                              (List.map Sum.getLeft
                                                (List.map
                                                    (fun i =>
                                                      Sum.inl
                                                        { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                    (finRange φ_l) ++
                                                  l))
                                              ↑i)) =
                                        true)).fst) =
                          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                      (Option.get
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i))
                          (_ :
                            Option.isSome
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i)) =
                              true)).snd }
            else default,
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
rw [dif_pos]
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    (Option.get
          (Option.join
            (get?
              (List.map Sum.getLeft
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l))
                    ↑i)) =
              true)).fst =
      { fst := φ_n, snd := rel φ_R ts }.fst

case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
            snd :=
              rel φ_R fun i =>
                Eq.mp
                  (_ :
                    Term L
                        (α ⊕
                          Fin
                            (Option.get
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i))
                                (_ :
                                  Option.isSome
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i)) =
                                    true)).fst) =
                      Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                  (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).snd },
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd },
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
            snd :=
              rel φ_R fun i =>
                Eq.mp
                  (_ :
                    Term L
                        (α ⊕
                          Fin
                            (Option.get
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i))
                                (_ :
                                  Option.isSome
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i)) =
                                    true)).fst) =
                      Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                  (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).snd },
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd },
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l

case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    (Option.get
          (Option.join
            (get?
              (List.map Sum.getLeft
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l))
                    ↑i)) =
              true)).fst =
      { fst := φ_n, snd := rel φ_R ts }.fst
swap
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (fun i =>
        Eq.mp
          (_ :
            Term L
                (α ⊕
                  Fin
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst) =
              Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
          (Option.get
              (Option.join
                (get?
                  (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                  ↑i))
              (_ :
                Option.isSome
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                        ↑i)) =
                  true)).snd) =
      ts ∧
    drop φ_l (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l) = l
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
            snd :=
              rel φ_R fun i =>
                Eq.mp
                  (_ :
                    Term L
                        (α ⊕
                          Fin
                            (Option.get
                                (Option.join
                                  (get?
                                    (List.map Sum.getLeft
                                      (List.map
                                          (fun i =>
                                            Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                          (finRange φ_l) ++
                                        l))
                                    ↑i))
                                (_ :
                                  Option.isSome
                                      (Option.join
                                        (get?
                                          (List.map Sum.getLeft
                                            (List.map
                                                (fun i =>
                                                  Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                (finRange φ_l) ++
                                              l))
                                          ↑i)) =
                                    true)).fst) =
                      Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                  (Option.get
                      (Option.join
                        (get?
                          (List.map Sum.getLeft
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l))
                          ↑i))
                      (_ :
                        Option.isSome
                            (Option.join
                              (get?
                                (List.map Sum.getLeft
                                  (List.map
                                      (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                      (finRange φ_l) ++
                                    l))
                                ↑i)) =
                          true)).snd },
          {
            val :=
              drop φ_l
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l),
            property :=
              (_ :
                SizeOf.sizeOf
                    (drop φ_l
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l)) ≤
                  max 1
                    (SizeOf.sizeOf
                      (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                        Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l)))) }).fst =
      { fst := φ_n, snd := rel φ_R ts } ∧
    ↑({ fst := { fst := φ_n, snd := rel φ_R ts }.fst,
              snd :=
                rel φ_R fun i =>
                  Eq.mp
                    (_ :
                      Term L
                          (α ⊕
                            Fin
                              (Option.get
                                  (Option.join
                                    (get?
                                      (List.map Sum.getLeft
                                        (List.map
                                            (fun i =>
                                              Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                            (finRange φ_l) ++
                                          l))
                                      ↑i))
                                  (_ :
                                    Option.isSome
                                        (Option.join
                                          (get?
                                            (List.map Sum.getLeft
                                              (List.map
                                                  (fun i =>
                                                    Sum.inl
                                                      { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                                  (finRange φ_l) ++
                                                l))
                                            ↑i)) =
                                      true)).fst) =
                        Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).snd },
            {
              val :=
                drop φ_l
                  (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                      (finRange φ_l) ++
                    l),
              property :=
                (_ :
                  SizeOf.sizeOf
                      (drop φ_l
                        (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                            (finRange φ_l) ++
                          l)) ≤
                    max 1
                      (SizeOf.sizeOf
                        (Sum.inr (Sum.inl { fst := φ_l, snd := φ_R }) ::
                          Sum.inr (Sum.inr { fst := φ_n, snd := rel φ_R ts }.fst) ::
                            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                (finRange φ_l) ++
                              l)))) }).snd =
      l
simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and]
case h.mk.rel.refine'_1
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
⊢ Eq.mp
      (_ :
        Term L
            (α ⊕
              Fin
                (Option.get
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i))
                    (_ :
                      Option.isSome
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i)) =
                        true)).fst) =
          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
      (Option.get
          (Option.join
            (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                    ↑i)) =
              true)).snd =
    ts i

case h.mk.rel.refine'_2
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ drop φ_l (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l) = l
case h.mk.rel
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ (fun i =>
        Eq.mp
          (_ :
            Term L
                (α ⊕
                  Fin
                    (Option.get
                        (Option.join
                          (get?
                            (List.map Sum.getLeft
                              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                  (finRange φ_l) ++
                                l))
                            ↑i))
                        (_ :
                          Option.isSome
                              (Option.join
                                (get?
                                  (List.map Sum.getLeft
                                    (List.map
                                        (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                        (finRange φ_l) ++
                                      l))
                                  ↑i)) =
                            true)).fst) =
              Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
          (Option.get
              (Option.join
                (get?
                  (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                  ↑i))
              (_ :
                Option.isSome
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                        ↑i)) =
                  true)).snd) =
      ts ∧
    drop φ_l (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l) = l
refine' ⟨funext fun i => _, _⟩
case h.mk.rel.refine'_2
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ length (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l)) ≤ φ_l
case h.mk.rel.refine'_2
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ drop φ_l (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l) = l
rw [List.drop_append_eq_append_drop, length_map, length_finRange, Nat.sub_self, drop,
  drop_eq_nil_of_le, nil_append]
no goals
case h.mk.rel.refine'_2
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ length (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l)) ≤ φ_l
rw [length_map, length_finRange]
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ Option.join
      (get?
        (List.map Sum.getLeft
          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
            l))
        ↑i) =
    some { fst := φ_n, snd := ts i }
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
intro i
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ ∃ h,
    List.get
        (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ List.map Sum.getLeft l)
        { val := ↑i,
          isLt :=
            (_ :
              ↑i <
                length
                  (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++
                    List.map Sum.getLeft l)) } =
      some { fst := φ_n, snd := ts i }
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ Option.join
      (get?
        (List.map Sum.getLeft
          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
            l))
        ↑i) =
    some { fst := φ_n, snd := ts i }
simp only [Option.join, map_append, map_map, Option.bind_eq_some, id.def, exists_eq_right,
  get?_eq_some, length_append, length_map, length_finRange]
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ List.get
      (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ List.map Sum.getLeft l)
      { val := ↑i,
        isLt :=
          (_ :
            ↑i <
              length
                (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++
                  List.map Sum.getLeft l)) } =
    some { fst := φ_n, snd := ts i }
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ ∃ h,
    List.get
        (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ List.map Sum.getLeft l)
        { val := ↑i,
          isLt :=
            (_ :
              ↑i <
                length
                  (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++
                    List.map Sum.getLeft l)) } =
      some { fst := φ_n, snd := ts i }
refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i })
      (List.get (finRange φ_l)
        { val := ↑{ val := ↑i, isLt := ?h }, isLt := (_ : ↑{ val := ↑i, isLt := ?h } < length (finRange φ_l)) }) =
    some { fst := φ_n, snd := ts i }

case h
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ ↑i < length (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l))

case h
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ ↑i < length (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l))
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ List.get
      (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ List.map Sum.getLeft l)
      { val := ↑i,
        isLt :=
          (_ :
            ↑i <
              length
                (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++
                  List.map Sum.getLeft l)) } =
    some { fst := φ_n, snd := ts i }
rw [get_append, get_map]
no goals
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i })
      (List.get (finRange φ_l)
        { val := ↑{ val := ↑i, isLt := ?h }, isLt := (_ : ↑{ val := ↑i, isLt := ?h } < length (finRange φ_l)) }) =
    some { fst := φ_n, snd := ts i }
simp only [Sum.getLeft, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true,
  heq_iff_eq, and_self_iff]
no goals
case h
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
i : Fin φ_l
⊢ ↑i < length (List.map (Sum.getLeft ∘ fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l))
simp only [length_map, length_finRange, is_lt]
no goals
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    Option.isSome
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i)) =
      true
exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
⊢ (Option.get
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft
                    (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                        (finRange φ_l) ++
                      l))
                  ↑i)) =
            true)).fst =
    { fst := φ_n, snd := rel φ_R ts }.fst
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
⊢ ∀ (i : Fin φ_l),
    (Option.get
          (Option.join
            (get?
              (List.map Sum.getLeft
                (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                    (finRange φ_l) ++
                  l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft
                      (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                          (finRange φ_l) ++
                        l))
                    ↑i)) =
              true)).fst =
      { fst := φ_n, snd := rel φ_R ts }.fst
intro i
case h.mk.rel.hc.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ (Option.get
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft
                    (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                        (finRange φ_l) ++
                      l))
                  ↑i)) =
            true)).fst =
    { fst := φ_n, snd := rel φ_R ts }.fst
case h.mk.rel.hc
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
⊢ (Option.get
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft
                    (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                        (finRange φ_l) ++
                      l))
                  ↑i)) =
            true)).fst =
    { fst := φ_n, snd := rel φ_R ts }.fst
obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
no goals
case h.mk.rel.hc.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ (Option.get
        (Option.join
          (get?
            (List.map Sum.getLeft
              (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                  (finRange φ_l) ++
                l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft
                    (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                        (finRange φ_l) ++
                      l))
                  ↑i)) =
            true)).fst =
    { fst := φ_n, snd := rel φ_R ts }.fst
rw [h2]
case h.mk.rel.refine'_1.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ Eq.mp
      (_ :
        Term L
            (α ⊕
              Fin
                (Option.get
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i))
                    (_ :
                      Option.isSome
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i)) =
                        true)).fst) =
          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
      (Option.get
          (Option.join
            (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                    ↑i)) =
              true)).snd =
    ts i
case h.mk.rel.refine'_1
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
⊢ Eq.mp
      (_ :
        Term L
            (α ⊕
              Fin
                (Option.get
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i))
                    (_ :
                      Option.isSome
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i)) =
                        true)).fst) =
          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
      (Option.get
          (Option.join
            (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                    ↑i)) =
              true)).snd =
    ts i
obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
case h.mk.rel.refine'_1.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ HEq
    (Option.get
        (Option.join
          (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                  ↑i)) =
            true)).snd
    (ts i)
case h.mk.rel.refine'_1.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ Eq.mp
      (_ :
        Term L
            (α ⊕
              Fin
                (Option.get
                    (Option.join
                      (get?
                        (List.map Sum.getLeft
                          (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                              (finRange φ_l) ++
                            l))
                        ↑i))
                    (_ :
                      Option.isSome
                          (Option.join
                            (get?
                              (List.map Sum.getLeft
                                (List.map
                                    (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i })
                                    (finRange φ_l) ++
                                  l))
                              ↑i)) =
                        true)).fst) =
          Term L (α ⊕ Fin { fst := φ_n, snd := rel φ_R ts }.fst))
      (Option.get
          (Option.join
            (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
              ↑i))
          (_ :
            Option.isSome
                (Option.join
                  (get?
                    (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                    ↑i)) =
              true)).snd =
    ts i
rw [eq_mp_eq_cast, cast_eq_iff_heq]
no goals
case h.mk.rel.refine'_1.intro
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n φ_n φ_l : ℕ
φ_R : Relations L φ_l
ts : Fin φ_l → Term L (α ⊕ Fin φ_n)
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
h :
  ∀ (i : Fin φ_l),
    Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i) =
      some { fst := φ_n, snd := ts i }
i : Fin φ_l
h1 :
  Option.isSome
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i)) =
    true
h2 :
  Option.get
      (Option.join
        (get?
          (List.map Sum.getLeft
            (List.map (fun i => Sum.inl { fst := { fst := φ_n, snd := rel φ_R ts }.fst, snd := ts i }) (finRange φ_l) ++
              l))
          ↑i))
      h1 =
    { fst := φ_n, snd := ts i }
⊢ HEq
    (Option.get
        (Option.join
          (get? (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
            ↑i))
        (_ :
          Option.isSome
              (Option.join
                (get?
                  (List.map Sum.getLeft (List.map (fun i => Sum.inl { fst := φ_n, snd := ts i }) (finRange φ_l) ++ l))
                  ↑i)) =
            true)).snd
    (ts i)
exact (Sigma.ext_iff.1 ((Sigma.eta (Option.get _ h1)).trans h2)).2
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ((fun this =>
            (sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
                (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst,
              { val := ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd,
                property :=
                  (_ :
                    SizeOf.sizeOf ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd ≤
                      max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 0) :: (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))))) }))
          (_ :
            SizeOf.sizeOf ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd <
              1 + (1 + 1) + SizeOf.sizeOf (listEncode f₁✝ ++ (listEncode f₂✝ ++ l)))).fst =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑((fun this =>
              (sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
                  (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst,
                { val := ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd,
                  property :=
                    (_ :
                      SizeOf.sizeOf ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd ≤
                        max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 0) :: (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))))) }))
            (_ :
              SizeOf.sizeOf ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd <
                1 + (1 + 1) + SizeOf.sizeOf (listEncode f₁✝ ++ (listEncode f₂✝ ++ l)))).snd =
      l
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := f₁✝ ⟹ f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ ⟹ f₂✝ }.snd ++ l)).snd = l
rw [listEncode, List.append_assoc, cons_append, listDecode]
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
        (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd = l
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₁✝ }.snd ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧
      ↑(listDecode (listEncode { fst := n✝, snd := f₂✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ ((fun this =>
            (sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
                (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst,
              { val := ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd,
                property :=
                  (_ :
                    SizeOf.sizeOf ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd ≤
                      max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 0) :: (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))))) }))
          (_ :
            SizeOf.sizeOf ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd <
              1 + (1 + 1) + SizeOf.sizeOf (listEncode f₁✝ ++ (listEncode f₂✝ ++ l)))).fst =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑((fun this =>
              (sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
                  (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst,
                { val := ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd,
                  property :=
                    (_ :
                      SizeOf.sizeOf ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd ≤
                        max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 0) :: (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))))) }))
            (_ :
              SizeOf.sizeOf ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd <
                1 + (1 + 1) + SizeOf.sizeOf (listEncode f₁✝ ++ (listEncode f₂✝ ++ l)))).snd =
      l
simp only [] at *
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (match { fst := n✝, snd := f₁✝ }, { fst := n✝, snd := f₂✝ } with
      | { fst := m, snd := φ }, { fst := n, snd := ψ } =>
        if h : m = n then { fst := m, snd := φ ⟹ Eq.mp (_ : BoundedFormula L α n = BoundedFormula L α m) ψ }
        else default) =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    l = l
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaImp (listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).fst
        (listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).fst =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    ↑(listDecode ↑(listDecode (listEncode f₁✝ ++ (listEncode f₂✝ ++ l))).snd).snd = l
rw [(ih1 _).1, (ih1 _).2, (ih2 _).1, (ih2 _).2, sigmaImp]
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ { fst := n✝, snd := f₁✝ ⟹ Eq.mp (_ : BoundedFormula L α n✝ = BoundedFormula L α n✝) f₂✝ } =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    True
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (match { fst := n✝, snd := f₁✝ }, { fst := n✝, snd := f₂✝ } with
      | { fst := m, snd := φ }, { fst := n, snd := ψ } =>
        if h : m = n then { fst := m, snd := φ ⟹ Eq.mp (_ : BoundedFormula L α n = BoundedFormula L α m) ψ }
        else default) =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    l = l
simp only [dite_true]
no goals
case h.mk.imp
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₁✝ ++ l)).fst = { fst := n✝, snd := f₁✝ } ∧ ↑(listDecode (listEncode f₁✝ ++ l)).snd = l
ih2 :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f₂✝ ++ l)).fst = { fst := n✝, snd := f₂✝ } ∧ ↑(listDecode (listEncode f₂✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ { fst := n✝, snd := f₁✝ ⟹ Eq.mp (_ : BoundedFormula L α n✝ = BoundedFormula L α n✝) f₂✝ } =
      { fst := n✝, snd := f₁✝ ⟹ f₂✝ } ∧
    True
exact ⟨rfl, trivial⟩
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (sigmaAll (listDecode (listEncode f✝ ++ l)).fst,
          { val := ↑(listDecode (listEncode f✝ ++ l)).snd,
            property :=
              (_ :
                SizeOf.sizeOf ↑(listDecode (listEncode f✝ ++ l)).snd ≤
                  max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 1) :: (listEncode f✝ ++ l)))) }).fst =
      { fst := n✝, snd := ∀'f✝ } ∧
    ↑(sigmaAll (listDecode (listEncode f✝ ++ l)).fst,
            { val := ↑(listDecode (listEncode f✝ ++ l)).snd,
              property :=
                (_ :
                  SizeOf.sizeOf ↑(listDecode (listEncode f✝ ++ l)).snd ≤
                    max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 1) :: (listEncode f✝ ++ l)))) }).snd =
      l
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (listDecode (listEncode { fst := n✝, snd := ∀'f✝ }.snd ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode { fst := n✝, snd := ∀'f✝ }.snd ++ l)).snd = l
rw [listEncode, cons_append, listDecode]
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaAll (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode f✝ ++ l)).snd = l
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (sigmaAll (listDecode (listEncode f✝ ++ l)).fst,
          { val := ↑(listDecode (listEncode f✝ ++ l)).snd,
            property :=
              (_ :
                SizeOf.sizeOf ↑(listDecode (listEncode f✝ ++ l)).snd ≤
                  max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 1) :: (listEncode f✝ ++ l)))) }).fst =
      { fst := n✝, snd := ∀'f✝ } ∧
    ↑(sigmaAll (listDecode (listEncode f✝ ++ l)).fst,
            { val := ↑(listDecode (listEncode f✝ ++ l)).snd,
              property :=
                (_ :
                  SizeOf.sizeOf ↑(listDecode (listEncode f✝ ++ l)).snd ≤
                    max 1 (SizeOf.sizeOf (Sum.inr (Sum.inr 1) :: (listEncode f✝ ++ l)))) }).snd =
      l
simp only
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧ ↑(listDecode (listEncode f✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaAll (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode f✝ ++ l)).snd = l
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧
      ↑(listDecode (listEncode { fst := n✝ + 1, snd := f✝ }.snd ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaAll (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode f✝ ++ l)).snd = l
simp only [] at *
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧ ↑(listDecode (listEncode f✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (match { fst := n✝ + 1, snd := f✝ } with
      | { fst := Nat.succ n, snd := φ } => { fst := n, snd := ∀'φ }
      | x => default) =
      { fst := n✝, snd := ∀'f✝ } ∧
    l = l
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧ ↑(listDecode (listEncode f✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ sigmaAll (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝, snd := ∀'f✝ } ∧
    ↑(listDecode (listEncode f✝ ++ l)).snd = l
rw [(ih _).1, (ih _).2, sigmaAll]
no goals
case h.mk.all
L : Language
M : Type w
N : Type ?u.139469
P : Type ?u.139472
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
l✝ : List ((n : ℕ) × BoundedFormula L α n)
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)),
    (listDecode (listEncode f✝ ++ l)).fst = { fst := n✝ + 1, snd := f✝ } ∧ ↑(listDecode (listEncode f✝ ++ l)).snd = l
l : List ((k : ℕ) × Term L (α ⊕ Fin k) ⊕ (n : ℕ) × Relations L n ⊕ ℕ)
⊢ (match { fst := n✝ + 1, snd := f✝ } with
      | { fst := Nat.succ n, snd := φ } => { fst := n, snd := ∀'φ }
      | x => default) =
      { fst := n✝, snd := ∀'f✝ } ∧
    l = l
exact ⟨rfl, rfl⟩