l3lab/ntp-mathlib huggingface dataset:
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
n✝ : ℕ
F : Functions L n✝
x : Fin n✝ → G i
⊢ Function.Embedding.toFun
      { toFun := fun a => ⟦Structure.Sigma.mk f i a⟧,
        inj' :=
          (_ :
            ∀ (x y : G i), (fun a => ⟦Structure.Sigma.mk f i a⟧) x = (fun a => ⟦Structure.Sigma.mk f i a⟧) y → x = y) }
      (funMap F x) =
    funMap F
      ({ toFun := fun a => ⟦Structure.Sigma.mk f i a⟧,
            inj' :=
              (_ :
                ∀ (x y : G i),
                  (fun a => ⟦Structure.Sigma.mk f i a⟧) x = (fun a => ⟦Structure.Sigma.mk f i a⟧) y → x = y) }.toFun ∘
        x)

Next tactic:
simp only
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    simp only
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
n✝ : ℕ
F : Functions L n✝
x : Fin n✝ → G i
⊢ ⟦Structure.Sigma.mk f i (funMap F x)⟧ = funMap F ((fun a => ⟦Structure.Sigma.mk f i a⟧) ∘ x)

Next tactic:
rw [← funMap_quotient_mk'_sigma_mk']
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    simp only
    rw [← funMap_quotient_mk'_sigma_mk']
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
n✝ : ℕ
F : Functions L n✝
x : Fin n✝ → G i
⊢ (funMap F fun a => ⟦Structure.Sigma.mk f i (x a)⟧) = funMap F ((fun a => ⟦Structure.Sigma.mk f i a⟧) ∘ x)

Next tactic:
rfl
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    simp only
    rw [← funMap_quotient_mk'_sigma_mk']
    rfl
  map_rel' := by
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
⊢ ∀ {n : ℕ} (r : Relations L n) (x : Fin n → G i),
    RelMap r
        ({ toFun := fun a => ⟦Structure.Sigma.mk f i a⟧,
              inj' :=
                (_ :
                  ∀ (x y : G i),
                    (fun a => ⟦Structure.Sigma.mk f i a⟧) x = (fun a => ⟦Structure.Sigma.mk f i a⟧) y → x = y) }.toFun ∘
          x) ↔
      RelMap r x

Next tactic:
intro n R x
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    simp only
    rw [← funMap_quotient_mk'_sigma_mk']
    rfl
  map_rel' := by
    intro n R x
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
n : ℕ
R : Relations L n
x : Fin n → G i
⊢ RelMap R
      ({ toFun := fun a => ⟦Structure.Sigma.mk f i a⟧,
            inj' :=
              (_ :
                ∀ (x y : G i),
                  (fun a => ⟦Structure.Sigma.mk f i a⟧) x = (fun a => ⟦Structure.Sigma.mk f i a⟧) y → x = y) }.toFun ∘
        x) ↔
    RelMap R x

Next tactic:
change RelMap R (fun a => (⟦.mk f i (x a)⟧ : DirectLimit G f)) ↔ _
/-- The canonical map from a component to the direct limit. -/
def of (i : ι) : G i ↪[L] DirectLimit G f where
  toFun := fun a => ⟦.mk f i a⟧
  inj' x y h := by
    rw [Quotient.eq] at h
    obtain ⟨j, h1, _, h3⟩ := h
    exact (f i j h1).injective h3
  map_fun' F x := by
    simp only
    rw [← funMap_quotient_mk'_sigma_mk']
    rfl
  map_rel' := by
    intro n R x
    change RelMap R (fun a => (⟦.mk f i (x a)⟧ : DirectLimit G f)) ↔ _
    

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i : ι
n : ℕ
R : Relations L n
x : Fin n → G i
⊢ (RelMap R fun a => ⟦Structure.Sigma.mk f i (x a)⟧) ↔ RelMap R x

Next tactic:
simp only [relMap_quotient_mk'_sigma_mk']
theorem of_f {i j : ι} {hij : i ≤ j} {x : G i} : of L ι G f j (f i j hij x) = of L ι G f i x := by
  

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i j : ι
hij : i ≤ j
x : G i
⊢ (of L ι G f j) ((f i j hij) x) = (of L ι G f i) x

Next tactic:
rw [of_apply, of_apply, Quotient.eq]
theorem of_f {i j : ι} {hij : i ≤ j} {x : G i} : of L ι G f j (f i j hij x) = of L ι G f i x := by
  rw [of_apply, of_apply, Quotient.eq]
  

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i j : ι
hij : i ≤ j
x : G i
⊢ Structure.Sigma.mk f j ((f i j hij) x) ≈ Structure.Sigma.mk f i x

Next tactic:
refine' Setoid.symm ⟨j, hij, refl j, _⟩
theorem of_f {i j : ι} {hij : i ≤ j} {x : G i} : of L ι G f j (f i j hij x) = of L ι G f i x := by
  rw [of_apply, of_apply, Quotient.eq]
  refine' Setoid.symm ⟨j, hij, refl j, _⟩
  

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
i j : ι
hij : i ≤ j
x : G i
⊢ (f i j hij) x = (f j j (_ : j ≤ j)) ((f i j hij) x)

Next tactic:
simp only [DirectedSystem.map_self]
/-- Every element of the direct limit corresponds to some element in
some component of the directed system. -/
theorem exists_of (z : DirectLimit G f) : ∃ i x, of L ι G f i x = z :=
  ⟨z.out.1, z.out.2, by 

Proof state:
L : Language
ι : Type v
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝² : IsDirected ι fun x x_1 => x ≤ x_1
inst✝¹ : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝ : Nonempty ι
z : DirectLimit G f
⊢ (of L ι G f (Quotient.out z).fst) (Quotient.out z).snd = z

Next tactic:
simp
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      

Proof state:
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : Σˣ f
xy : x ≈ y
⊢ (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y

Next tactic:
simp only
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      

Proof state:
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : Σˣ f
xy : x ≈ y
⊢ (g x.fst) x.snd = (g y.fst) y.snd

Next tactic:
obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : Σˣ f
xy : x ≈ y
i : ι
hx : x.fst ≤ i
hy : y.fst ≤ i
⊢ (g x.fst) x.snd = (g y.fst) y.snd

Next tactic:
rw [← Hg x.1 i hx, ← Hg y.1 i hy]
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : Σˣ f
xy : x ≈ y
i : ι
hx : x.fst ≤ i
hy : y.fst ≤ i
⊢ (g i) ((f x.fst i hx) x.snd) = (g i) ((f y.fst i hy) y.snd)

Next tactic:
exact congr_arg _ ((equiv_iff ..).1 xy)
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    

Proof state:
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : DirectLimit G f
xy :
  Quotient.lift (fun x => (g x.fst) x.snd)
      (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) x =
    Quotient.lift (fun x => (g x.fst) x.snd)
      (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) y
⊢ x = y

Next tactic:
rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    

Proof state:
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : DirectLimit G f
xy : (g (Quotient.out x).fst) (Quotient.out x).snd = (g (Quotient.out y).fst) (Quotient.out y).snd
⊢ x = y

Next tactic:
obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
    

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : DirectLimit G f
xy : (g (Quotient.out x).fst) (Quotient.out x).snd = (g (Quotient.out y).fst) (Quotient.out y).snd
i : ι
hx : (Quotient.out x).fst ≤ i
hy : (Quotient.out y).fst ≤ i
⊢ x = y

Next tactic:
rw [← Hg x.out.1 i hx, ← Hg y.out.1 i hy] at xy
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
    rw [← Hg x.out.1 i hx, ← Hg y.out.1 i hy] at xy
    

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : DirectLimit G f
i : ι
hx : (Quotient.out x).fst ≤ i
hy : (Quotient.out y).fst ≤ i
xy :
  (g i) ((f (Quotient.out x).fst i hx) (Quotient.out x).snd) =
    (g i) ((f (Quotient.out y).fst i hy) (Quotient.out y).snd)
⊢ x = y

Next tactic:
rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.eq, equiv_iff G f hx hy]
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
    rw [← Hg x.out.1 i hx, ← Hg y.out.1 i hy] at xy
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.eq, equiv_iff G f hx hy]
    

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
x y : DirectLimit G f
i : ι
hx : (Quotient.out x).fst ≤ i
hy : (Quotient.out y).fst ≤ i
xy :
  (g i) ((f (Quotient.out x).fst i hx) (Quotient.out x).snd) =
    (g i) ((f (Quotient.out y).fst i hy) (Quotient.out y).snd)
⊢ (f (Quotient.out x).fst i hx) (Quotient.out x).snd = (f (Quotient.out y).fst i hy) (Quotient.out y).snd

Next tactic:
exact (g i).injective xy
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
    rw [← Hg x.out.1 i hx, ← Hg y.out.1 i hy] at xy
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.eq, equiv_iff G f hx hy]
    exact (g i).injective xy
  map_fun' F x := by
    

Proof state:
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
n✝ : ℕ
F : Functions L n✝
x : Fin n✝ → DirectLimit G f
⊢ Function.Embedding.toFun
      {
        toFun :=
          Quotient.lift (fun x => (g x.fst) x.snd)
            (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y),
        inj' :=
          (_ :
            ∀ (x y : DirectLimit G f),
              Quotient.lift (fun x => (g x.fst) x.snd)
                    (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) x =
                  Quotient.lift (fun x => (g x.fst) x.snd)
                    (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) y →
                x = y) }
      (funMap F x) =
    funMap F
      ({
            toFun :=
              Quotient.lift (fun x => (g x.fst) x.snd)
                (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y),
            inj' :=
              (_ :
                ∀ (x y : DirectLimit G f),
                  Quotient.lift (fun x => (g x.fst) x.snd)
                        (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) x =
                      Quotient.lift (fun x => (g x.fst) x.snd)
                        (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) y →
                    x = y) }.toFun ∘
        x)

Next tactic:
obtain ⟨i, y, rfl⟩ := exists_quotient_mk'_sigma_mk'_eq G f x
/-- The universal property of the direct limit: maps from the components to another module
that respect the directed system structure (i.e. make some diagram commute) give rise
to a unique map out of the direct limit. -/
def lift : DirectLimit G f ↪[L] P where
  toFun :=
    Quotient.lift (fun x : Σˣ f => (g x.1) x.2) fun x y xy => by
      simp only
      obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.1 y.1
      rw [← Hg x.1 i hx, ← Hg y.1 i hy]
      exact congr_arg _ ((equiv_iff ..).1 xy)
  inj' x y xy := by
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy
    obtain ⟨i, hx, hy⟩ := directed_of (· ≤ ·) x.out.1 y.out.1
    rw [← Hg x.out.1 i hx, ← Hg y.out.1 i hy] at xy
    rw [← Quotient.out_eq x, ← Quotient.out_eq y, Quotient.eq, equiv_iff G f hx hy]
    exact (g i).injective xy
  map_fun' F x := by
    obtain ⟨i, y, rfl⟩ := exists_quotient_mk'_sigma_mk'_eq G f x
    

Proof state:
case intro.intro
L : Language
ι : Type v
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → Structure L (G i)
f : (i j : ι) → i ≤ j → G i ↪[L] G j
inst✝³ : IsDirected ι fun x x_1 => x ≤ x_1
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
P : Type u₁
inst✝ : Structure L P
g : (i : ι) → G i ↪[L] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
n✝ : ℕ
F : Functions L n✝
i : ι
y : Fin n✝ → G i
⊢ Function.Embedding.toFun
      {
        toFun :=
          Quotient.lift (fun x => (g x.fst) x.snd)
            (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y),
        inj' :=
          (_ :
            ∀ (x y : DirectLimit G f),
              Quotient.lift (fun x => (g x.fst) x.snd)
                    (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) x =
                  Quotient.lift (fun x => (g x.fst) x.snd)
                    (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) y →
                x = y) }
      (funMap F fun a => ⟦Structure.Sigma.mk f i (y a)⟧) =
    funMap F
      ({
            toFun :=
              Quotient.lift (fun x => (g x.fst) x.snd)
                (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y),
            inj' :=
              (_ :
                ∀ (x y : DirectLimit G f),
                  Quotient.lift (fun x => (g x.fst) x.snd)
                        (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) x =
                      Quotient.lift (fun x => (g x.fst) x.snd)
                        (_ : ∀ (x y : Σˣ f), x ≈ y → (fun x => (g x.fst) x.snd) x = (fun x => (g x.fst) x.snd) y) y →
                    x = y) }.toFun ∘
        fun a => ⟦Structure.Sigma.mk f i (y a)⟧)

Next tactic:
change _ = funMap F (Quotient.lift _ _ ∘ Quotient.mk _ ∘ Structure.Sigma.mk f i ∘ y)