no goals
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize φ (↑f ∘ v) (↑f ∘ xs) ↔ BoundedFormula.Realize φ v xs
classical
  rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq]
  have h :=
    f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _))
      (Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm)
  simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h
  rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm,
    Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _), Equiv.symm_comp_self,
    Function.comp.right_id, Function.comp.assoc, Sum.elim_comp_inl,
    Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h
  refine' h.trans _
  erw [Function.comp.assoc _ _ (Fintype.equivFin _), Equiv.symm_comp_self, Function.comp.right_id,
    Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs,
    ← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl,
    BoundedFormula.realize_restrictFreeVar Set.Subset.rfl]
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize φ (↑f ∘ v) (↑f ∘ xs) ↔ BoundedFormula.Realize φ v xs
rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq]
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  Formula.Realize
      (Formula.relabel (↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)))
        (BoundedFormula.toFormula (BoundedFormula.restrictFreeVar φ id)))
      (↑f ∘
        Sum.elim (v ∘ Subtype.val) xs ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ↔
    Formula.Realize
      (Formula.relabel (↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)))
        (BoundedFormula.toFormula (BoundedFormula.restrictFreeVar φ id)))
      (Sum.elim (v ∘ Subtype.val) xs ∘ ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
have h :=
  f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _))
    (Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm)
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((↑f ∘
            Sum.elim (v ∘ Subtype.val) xs ∘
              ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((↑f ∘
            Sum.elim (v ∘ Subtype.val) xs ∘
              ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  Formula.Realize
      (Formula.relabel (↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)))
        (BoundedFormula.toFormula (BoundedFormula.restrictFreeVar φ id)))
      (↑f ∘
        Sum.elim (v ∘ Subtype.val) xs ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ↔
    Formula.Realize
      (Formula.relabel (↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)))
        (BoundedFormula.toFormula (BoundedFormula.restrictFreeVar φ id)))
      (Sum.elim (v ∘ Subtype.val) xs ∘ ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((↑f ∘
            Sum.elim (v ∘ Subtype.val) xs ∘
              ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((↑f ∘
            Sum.elim (v ∘ Subtype.val) xs ∘
              ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm,
  Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _), Equiv.symm_comp_self,
  Function.comp.right_id, Function.comp.assoc, Sum.elim_comp_inl,
  Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr) =
    BoundedFormula.Realize φ v xs
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize φ v xs
refine' h.trans _
no goals
L : Language
M : Type u_3
N : Type u_4
P : Type ?u.10715
Q : Type ?u.10718
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
inst✝ : Structure L Q
f : M ↪ₑ[L] N
α : Type u_5
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
h :
  BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id) ((↑f ∘ v) ∘ Subtype.val) (↑f ∘ xs) =
    BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr)
⊢ BoundedFormula.Realize (BoundedFormula.restrictFreeVar φ id)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inl)
      (((Sum.elim (v ∘ Subtype.val) xs ∘
            ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n)).symm) ∘
          ↑(Fintype.equivFin ({ x // x ∈ BoundedFormula.freeVarFinset φ } ⊕ Fin n))) ∘
        Sum.inr) =
    BoundedFormula.Realize φ v xs
erw [Function.comp.assoc _ _ (Fintype.equivFin _), Equiv.symm_comp_self, Function.comp.right_id,
  Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs,
  ← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl,
  BoundedFormula.realize_restrictFreeVar Set.Subset.rfl]