l3lab/ntp-mathlib huggingface dataset:
theorem LinearMap.exists_rightInverse_of_surjective (f : V →ₗ[K] V') (hf_surj : range f = ⊤) :
    ∃ g : V' →ₗ[K] V, f.comp g = LinearMap.id := by
  let C := Basis.ofVectorSpaceIndex K V'
  let hC := Basis.ofVectorSpace K V'
  haveI : Inhabited V := ⟨0⟩
  refine' ⟨(hC.constr ℕ : _ → _) (C.restrict (invFun f)), hC.ext fun c => _⟩
  rw [LinearMap.comp_apply, hC.constr_basis]
  

Proof state:
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v : ι → V
s t : Set V
x y z : V
f : V →ₗ[K] V'
hf_surj : range f = ⊤
C : Set V' := Basis.ofVectorSpaceIndex K V'
hC : Basis (↑(Basis.ofVectorSpaceIndex K V')) K V' := Basis.ofVectorSpace K V'
this : Inhabited V
c : ↑(Basis.ofVectorSpaceIndex K V')
⊢ f (Set.restrict C (invFun ⇑f) c) = id (hC c)

Next tactic:
simp [rightInverse_invFun (LinearMap.range_eq_top.1 hf_surj) c]
/-- Any linear map `f : p →ₗ[K] V'` defined on a subspace `p` can be extended to the whole
space. -/
theorem LinearMap.exists_extend {p : Submodule K V} (f : p →ₗ[K] V') :
    ∃ g : V →ₗ[K] V', g.comp p.subtype = f :=
  let ⟨g, hg⟩ := p.subtype.exists_leftInverse_of_injective p.ker_subtype
  ⟨f.comp g, by 

Proof state:
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v : ι → V
s t : Set V
x y z : V
p : Submodule K V
f : ↥p →ₗ[K] V'
g : V →ₗ[K] ↥p
hg : g ∘ₗ Submodule.subtype p = id
⊢ (f ∘ₗ g) ∘ₗ Submodule.subtype p = f

Next tactic:
rw [LinearMap.comp_assoc, hg, f.comp_id]
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v : ι → V
s t : Set V
x y z : V
p : Submodule K V
hp : p < ⊤
⊢ ∃ f, f ≠ 0 ∧ p ≤ ker f

Next tactic:
rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; 

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
hp : p < ⊤
v : V
hpv : v ∉ p
⊢ ∃ f, f ≠ 0 ∧ p ≤ ker f

Next tactic:
clear hp
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
⊢ ∃ f, f ≠ 0 ∧ p ≤ ker f

Next tactic:
rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  

Proof state:
case intro.intro.intro
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
f : V →ₗ[K] K
hf :
  f ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
⊢ ∃ f, f ≠ 0 ∧ p ≤ ker f

Next tactic:
refine' ⟨f, _, _⟩
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · 

Proof state:
case intro.intro.intro.refine'_1
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
f : V →ₗ[K] K
hf :
  f ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
⊢ f ≠ 0

Next tactic:
rintro rfl
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    

Proof state:
case intro.intro.intro.refine'_1
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
hf :
  0 ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
⊢ False

Next tactic:
rw [LinearMap.zero_comp] at hf
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    rw [LinearMap.zero_comp] at hf
    

Proof state:
case intro.intro.intro.refine'_1
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
hf : 0 = (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
⊢ False

Next tactic:
have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv 0 p.zero_mem 1
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    rw [LinearMap.zero_comp] at hf
    have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv 0 p.zero_mem 1
    

Proof state:
case intro.intro.intro.refine'_1
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
hf : 0 = (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
this :
  ↑(LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv)
      { val := 0 + 1 • v,
        property :=
          (_ :
            0 + 1 • v ∈
              { domain := p, toFun := 0 }.domain ⊔ (LinearPMap.mkSpanSingleton v 1 (_ : v = 0 → False)).domain) } =
    ↑{ domain := p, toFun := 0 } { val := 0, property := (_ : 0 ∈ p) } + 1 • 1
⊢ False

Next tactic:
simpa using (LinearMap.congr_fun hf _).trans this
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    rw [LinearMap.zero_comp] at hf
    have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv 0 p.zero_mem 1
    simpa using (LinearMap.congr_fun hf _).trans this
  · 

Proof state:
case intro.intro.intro.refine'_2
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x y z : V
p : Submodule K V
v : V
hpv : v ∉ p
f : V →ₗ[K] K
hf :
  f ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
⊢ p ≤ ker f

Next tactic:
refine' fun x hx => mem_ker.2 _
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    rw [LinearMap.zero_comp] at hf
    have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv 0 p.zero_mem 1
    simpa using (LinearMap.congr_fun hf _).trans this
  · refine' fun x hx => mem_ker.2 _
    

Proof state:
case intro.intro.intro.refine'_2
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x✝ y z : V
p : Submodule K V
v : V
hpv : v ∉ p
f : V →ₗ[K] K
hf :
  f ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
x : V
hx : x ∈ p
⊢ f x = 0

Next tactic:
have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv x hx 0
/-- If `p < ⊤` is a subspace of a vector space `V`, then there exists a nonzero linear map
`f : V →ₗ[K] K` such that `p ≤ ker f`. -/
theorem Submodule.exists_le_ker_of_lt_top (p : Submodule K V) (hp : p < ⊤) :
    ∃ (f : V →ₗ[K] K), f ≠ 0 ∧ p ≤ ker f := by
  rcases SetLike.exists_of_lt hp with ⟨v, -, hpv⟩; clear hp
  rcases (LinearPMap.supSpanSingleton ⟨p, 0⟩ v (1 : K) hpv).toFun.exists_extend with ⟨f, hf⟩
  refine' ⟨f, _, _⟩
  · rintro rfl
    rw [LinearMap.zero_comp] at hf
    have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv 0 p.zero_mem 1
    simpa using (LinearMap.congr_fun hf _).trans this
  · refine' fun x hx => mem_ker.2 _
    have := LinearPMap.supSpanSingleton_apply_mk ⟨p, 0⟩ v (1 : K) hpv x hx 0
    

Proof state:
case intro.intro.intro.refine'_2
ι : Type u_1
ι' : Type u_2
K : Type u_3
V : Type u_4
V' : Type u_5
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : AddCommGroup V'
inst✝¹ : Module K V
inst✝ : Module K V'
v✝ : ι → V
s t : Set V
x✝ y z : V
p : Submodule K V
v : V
hpv : v ∉ p
f : V →ₗ[K] K
hf :
  f ∘ₗ Submodule.subtype (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).domain =
    (LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv).toFun
x : V
hx : x ∈ p
this :
  ↑(LinearPMap.supSpanSingleton { domain := p, toFun := 0 } v 1 hpv)
      { val := x + 0 • v,
        property :=
          (_ :
            x + 0 • v ∈
              { domain := p, toFun := 0 }.domain ⊔ (LinearPMap.mkSpanSingleton v 1 (_ : v = 0 → False)).domain) } =
    ↑{ domain := p, toFun := 0 } { val := x, property := hx } + 0 • 1
⊢ f x = 0

Next tactic:
simpa using (LinearMap.congr_fun hf _).trans this
@[ext]
protected theorem funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction)
    (h_rel : F.onRelation = G.onRelation) : F = G := by
  

Proof state:
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
F G : L →ᴸ L'
h_fun : F.onFunction = G.onFunction
h_rel : F.onRelation = G.onRelation
⊢ F = G

Next tactic:
cases' F with Ff Fr
@[ext]
protected theorem funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction)
    (h_rel : F.onRelation = G.onRelation) : F = G := by
  cases' F with Ff Fr
  

Proof state:
case mk
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
G : L →ᴸ L'
Ff : ⦃n : ℕ⦄ → Functions L n → Functions L' n
Fr : ⦃n : ℕ⦄ → Relations L n → Relations L' n
h_fun : { onFunction := Ff, onRelation := Fr }.onFunction = G.onFunction
h_rel : { onFunction := Ff, onRelation := Fr }.onRelation = G.onRelation
⊢ { onFunction := Ff, onRelation := Fr } = G

Next tactic:
cases' G with Gf Gr
@[ext]
protected theorem funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction)
    (h_rel : F.onRelation = G.onRelation) : F = G := by
  cases' F with Ff Fr
  cases' G with Gf Gr
  

Proof state:
case mk.mk
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
Ff : ⦃n : ℕ⦄ → Functions L n → Functions L' n
Fr : ⦃n : ℕ⦄ → Relations L n → Relations L' n
Gf : ⦃n : ℕ⦄ → Functions L n → Functions L' n
Gr : ⦃n : ℕ⦄ → Relations L n → Relations L' n
h_fun : { onFunction := Ff, onRelation := Fr }.onFunction = { onFunction := Gf, onRelation := Gr }.onFunction
h_rel : { onFunction := Ff, onRelation := Fr }.onRelation = { onFunction := Gf, onRelation := Gr }.onRelation
⊢ { onFunction := Ff, onRelation := Fr } = { onFunction := Gf, onRelation := Gr }

Next tactic:
simp only [mk.injEq]
@[ext]
protected theorem funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction)
    (h_rel : F.onRelation = G.onRelation) : F = G := by
  cases' F with Ff Fr
  cases' G with Gf Gr
  simp only [mk.injEq]
  

Proof state:
case mk.mk
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
Ff : ⦃n : ℕ⦄ → Functions L n → Functions L' n
Fr : ⦃n : ℕ⦄ → Relations L n → Relations L' n
Gf : ⦃n : ℕ⦄ → Functions L n → Functions L' n
Gr : ⦃n : ℕ⦄ → Relations L n → Relations L' n
h_fun : { onFunction := Ff, onRelation := Fr }.onFunction = { onFunction := Gf, onRelation := Gr }.onFunction
h_rel : { onFunction := Ff, onRelation := Fr }.onRelation = { onFunction := Gf, onRelation := Gr }.onRelation
⊢ Ff = Gf ∧ Fr = Gr

Next tactic:
exact And.intro h_fun h_rel
@[simp]
theorem id_comp (F : L →ᴸ L') : LHom.id L' ∘ᴸ F = F := by
  

Proof state:
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
F : L →ᴸ L'
⊢ LHom.id L' ∘ᴸ F = F

Next tactic:
cases F
@[simp]
theorem id_comp (F : L →ᴸ L') : LHom.id L' ∘ᴸ F = F := by
  cases F
  

Proof state:
case mk
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
onFunction✝ : ⦃n : ℕ⦄ → Functions L n → Functions L' n
onRelation✝ : ⦃n : ℕ⦄ → Relations L n → Relations L' n
⊢ LHom.id L' ∘ᴸ { onFunction := onFunction✝, onRelation := onRelation✝ } =
    { onFunction := onFunction✝, onRelation := onRelation✝ }

Next tactic:
rfl
@[simp]
theorem comp_id (F : L →ᴸ L') : F ∘ᴸ LHom.id L = F := by
  

Proof state:
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
F : L →ᴸ L'
⊢ F ∘ᴸ LHom.id L = F

Next tactic:
cases F
@[simp]
theorem comp_id (F : L →ᴸ L') : F ∘ᴸ LHom.id L = F := by
  cases F
  

Proof state:
case mk
L : Language
L' : Language
M : Type w
inst✝ : Structure L M
ϕ : L →ᴸ L'
L'' : Language
onFunction✝ : ⦃n : ℕ⦄ → Functions L n → Functions L' n
onRelation✝ : ⦃n : ℕ⦄ → Relations L n → Relations L' n
⊢ { onFunction := onFunction✝, onRelation := onRelation✝ } ∘ᴸ LHom.id L =
    { onFunction := onFunction✝, onRelation := onRelation✝ }

Next tactic:
rfl
instance sumElim_isExpansionOn {L'' : Language} (ψ : L'' →ᴸ L') (M : Type*) [L.Structure M]
    [L'.Structure M] [L''.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumElim ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁵ : Structure L M✝
ϕ : L →ᴸ L'
L''✝ : Language
L'' : Language
ψ : L'' →ᴸ L'
M : Type u_1
inst✝⁴ : Structure L M
inst✝³ : Structure L' M
inst✝² : Structure L'' M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
f : Functions (Language.sum L L'') n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Functions L n✝), funMap (onFunction (LHom.sumElim ϕ ψ) (Sum.inl val)) x✝ = funMap (Sum.inl val) x✝

Next tactic:
simp
instance sumElim_isExpansionOn {L'' : Language} (ψ : L'' →ᴸ L') (M : Type*) [L.Structure M]
    [L'.Structure M] [L''.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumElim ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁵ : Structure L M✝
ϕ : L →ᴸ L'
L''✝ : Language
L'' : Language
ψ : L'' →ᴸ L'
M : Type u_1
inst✝⁴ : Structure L M
inst✝³ : Structure L' M
inst✝² : Structure L'' M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
f : Functions (Language.sum L L'') n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Functions L'' n✝), funMap (onFunction (LHom.sumElim ϕ ψ) (Sum.inr val)) x✝ = funMap (Sum.inr val) x✝

Next tactic:
simp
instance sumElim_isExpansionOn {L'' : Language} (ψ : L'' →ᴸ L') (M : Type*) [L.Structure M]
    [L'.Structure M] [L''.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumElim ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁵ : Structure L M✝
ϕ : L →ᴸ L'
L''✝ : Language
L'' : Language
ψ : L'' →ᴸ L'
M : Type u_1
inst✝⁴ : Structure L M
inst✝³ : Structure L' M
inst✝² : Structure L'' M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
R : Relations (Language.sum L L'') n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Relations L n✝), RelMap (onRelation (LHom.sumElim ϕ ψ) (Sum.inl val)) x✝ = RelMap (Sum.inl val) x✝

Next tactic:
simp
instance sumElim_isExpansionOn {L'' : Language} (ψ : L'' →ᴸ L') (M : Type*) [L.Structure M]
    [L'.Structure M] [L''.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumElim ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by simp) (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁵ : Structure L M✝
ϕ : L →ᴸ L'
L''✝ : Language
L'' : Language
ψ : L'' →ᴸ L'
M : Type u_1
inst✝⁴ : Structure L M
inst✝³ : Structure L' M
inst✝² : Structure L'' M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
R : Relations (Language.sum L L'') n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Relations L'' n✝), RelMap (onRelation (LHom.sumElim ϕ ψ) (Sum.inr val)) x✝ = RelMap (Sum.inr val) x✝

Next tactic:
simp
instance sumMap_isExpansionOn {L₁ L₂ : Language} (ψ : L₁ →ᴸ L₂) (M : Type*) [L.Structure M]
    [L'.Structure M] [L₁.Structure M] [L₂.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumMap ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁶ : Structure L M✝
ϕ : L →ᴸ L'
L'' : Language
L₁ : Language
L₂ : Language
ψ : L₁ →ᴸ L₂
M : Type u_1
inst✝⁵ : Structure L M
inst✝⁴ : Structure L' M
inst✝³ : Structure L₁ M
inst✝² : Structure L₂ M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
f : Functions (Language.sum L L₁) n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Functions L n✝), funMap (onFunction (sumMap ϕ ψ) (Sum.inl val)) x✝ = funMap (Sum.inl val) x✝

Next tactic:
simp
instance sumMap_isExpansionOn {L₁ L₂ : Language} (ψ : L₁ →ᴸ L₂) (M : Type*) [L.Structure M]
    [L'.Structure M] [L₁.Structure M] [L₂.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumMap ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁶ : Structure L M✝
ϕ : L →ᴸ L'
L'' : Language
L₁ : Language
L₂ : Language
ψ : L₁ →ᴸ L₂
M : Type u_1
inst✝⁵ : Structure L M
inst✝⁴ : Structure L' M
inst✝³ : Structure L₁ M
inst✝² : Structure L₂ M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
f : Functions (Language.sum L L₁) n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Functions L₁ n✝), funMap (onFunction (sumMap ϕ ψ) (Sum.inr val)) x✝ = funMap (Sum.inr val) x✝

Next tactic:
simp
instance sumMap_isExpansionOn {L₁ L₂ : Language} (ψ : L₁ →ᴸ L₂) (M : Type*) [L.Structure M]
    [L'.Structure M] [L₁.Structure M] [L₂.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumMap ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁶ : Structure L M✝
ϕ : L →ᴸ L'
L'' : Language
L₁ : Language
L₂ : Language
ψ : L₁ →ᴸ L₂
M : Type u_1
inst✝⁵ : Structure L M
inst✝⁴ : Structure L' M
inst✝³ : Structure L₁ M
inst✝² : Structure L₂ M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
R : Relations (Language.sum L L₁) n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Relations L n✝), RelMap (onRelation (sumMap ϕ ψ) (Sum.inl val)) x✝ = RelMap (Sum.inl val) x✝

Next tactic:
simp
instance sumMap_isExpansionOn {L₁ L₂ : Language} (ψ : L₁ →ᴸ L₂) (M : Type*) [L.Structure M]
    [L'.Structure M] [L₁.Structure M] [L₂.Structure M] [ϕ.IsExpansionOn M] [ψ.IsExpansionOn M] :
    (ϕ.sumMap ψ).IsExpansionOn M :=
  ⟨fun f _ => Sum.casesOn f (by simp) (by simp), fun R _ => Sum.casesOn R (by simp) (by 

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁶ : Structure L M✝
ϕ : L →ᴸ L'
L'' : Language
L₁ : Language
L₂ : Language
ψ : L₁ →ᴸ L₂
M : Type u_1
inst✝⁵ : Structure L M
inst✝⁴ : Structure L' M
inst✝³ : Structure L₁ M
inst✝² : Structure L₂ M
inst✝¹ : IsExpansionOn ϕ M
inst✝ : IsExpansionOn ψ M
n✝ : ℕ
R : Relations (Language.sum L L₁) n✝
x✝ : Fin n✝ → M
⊢ ∀ (val : Relations L₁ n✝), RelMap (onRelation (sumMap ϕ ψ) (Sum.inr val)) x✝ = RelMap (Sum.inr val) x✝

Next tactic:
simp
theorem Injective.isExpansionOn_default {ϕ : L →ᴸ L'}
    [∀ (n) (f : L'.Functions n), Decidable (f ∈ Set.range fun f : L.Functions n => ϕ.onFunction f)]
    [∀ (n) (r : L'.Relations n), Decidable (r ∈ Set.range fun r : L.Relations n => ϕ.onRelation r)]
    (h : ϕ.Injective) (M : Type*) [Inhabited M] [L.Structure M] :
    @IsExpansionOn L L' ϕ M _ (ϕ.defaultExpansion M) := by
  

Proof state:
L : Language
L' : Language
M✝ : Type w
inst✝⁴ : Structure L M✝
ϕ✝ : L →ᴸ L'
L'' : Language
ϕ : L →ᴸ L'
inst✝³ : (n : ℕ) → (f : Functions L' n) → Decidable (f ∈ Set.range fun f => LHom.onFunction ϕ f)
inst✝² : (n : ℕ) → (r : Relations L' n) → Decidable (r ∈ Set.range fun r => LHom.onRelation ϕ r)
h : LHom.Injective ϕ
M : Type u_1
inst✝¹ : Inhabited M
inst✝ : Structure L M
⊢ IsExpansionOn ϕ M

Next tactic:
letI := ϕ.defaultExpansion M