l3lab/ntp-mathlib huggingface dataset:
theorem eq_of_eq_graph {f g : E →ₗ.[R] F} (h : f.graph = g.graph) : f = g := by
  -- Porting note: `ext` → `refine ext ..`
  refine ext (Submodule.ext fun x => ?_) (fun x y h' => ?_)
  

Proof state:
case refine_1
R : Type u_1
inst✝⁹ : Ring R
E : Type u_2
inst✝⁸ : AddCommGroup E
inst✝⁷ : Module R E
F : Type u_3
inst✝⁶ : AddCommGroup F
inst✝⁵ : Module R F
G : Type u_4
inst✝⁴ : AddCommGroup G
inst✝³ : Module R G
M : Type u_5
inst✝² : Monoid M
inst✝¹ : DistribMulAction M F
inst✝ : SMulCommClass R M F
y : M
f g : E →ₗ.[R] F
h : graph f = graph g
x : E
⊢ x ∈ f.domain ↔ x ∈ g.domain
case refine_2
R : Type u_1
inst✝⁹ : Ring R
E : Type u_2
inst✝⁸ : AddCommGroup E
inst✝⁷ : Module R E
F : Type u_3
inst✝⁶ : AddCommGroup F
inst✝⁵ : Module R F
G : Type u_4
inst✝⁴ : AddCommGroup G
inst✝³ : Module R G
M : Type u_5
inst✝² : Monoid M
inst✝¹ : DistribMulAction M F
inst✝ : SMulCommClass R M F
y✝ : M
f g : E →ₗ.[R] F
h : graph f = graph g
x : ↥f.domain
y : ↥g.domain
h' : ↑x = ↑y
⊢ ↑f x = ↑g y

Next tactic:
exact mem_domain_iff_of_eq_graph h
theorem eq_of_eq_graph {f g : E →ₗ.[R] F} (h : f.graph = g.graph) : f = g := by
  -- Porting note: `ext` → `refine ext ..`
  refine ext (Submodule.ext fun x => ?_) (fun x y h' => ?_)
  exact mem_domain_iff_of_eq_graph h
  

Proof state:
case refine_2
R : Type u_1
inst✝⁹ : Ring R
E : Type u_2
inst✝⁸ : AddCommGroup E
inst✝⁷ : Module R E
F : Type u_3
inst✝⁶ : AddCommGroup F
inst✝⁵ : Module R F
G : Type u_4
inst✝⁴ : AddCommGroup G
inst✝³ : Module R G
M : Type u_5
inst✝² : Monoid M
inst✝¹ : DistribMulAction M F
inst✝ : SMulCommClass R M F
y✝ : M
f g : E →ₗ.[R] F
h : graph f = graph g
x : ↥f.domain
y : ↥g.domain
h' : ↑x = ↑y
⊢ ↑f x = ↑g y

Next tactic:
exact (le_of_le_graph h.le).2 h'
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
⊢ ∃! b, (a, b) ∈ g

Next tactic:
refine' exists_unique_of_exists_of_unique _ _
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · 

Proof state:
case refine'_1
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
⊢ ∃ x, (a, x) ∈ g

Next tactic:
convert ha
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    

Proof state:
case a
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
⊢ (∃ x, (a, x) ∈ g) ↔ a ∈ map (LinearMap.fst R E F) g

Next tactic:
simp
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  

Proof state:
case refine'_2
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
⊢ ∀ (y₁ y₂ : F), (a, y₁) ∈ g → (a, y₂) ∈ g → y₁ = y₂

Next tactic:
intro y₁ y₂ hy₁ hy₂
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  intro y₁ y₂ hy₁ hy₂
  

Proof state:
case refine'_2
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
y₁ y₂ : F
hy₁ : (a, y₁) ∈ g
hy₂ : (a, y₂) ∈ g
⊢ y₁ = y₂

Next tactic:
have hy : ((0 : E), y₁ - y₂) ∈ g := by
    convert g.sub_mem hy₁ hy₂
    exact (sub_self _).symm
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  intro y₁ y₂ hy₁ hy₂
  have hy : ((0 : E), y₁ - y₂) ∈ g := by
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
y₁ y₂ : F
hy₁ : (a, y₁) ∈ g
hy₂ : (a, y₂) ∈ g
⊢ (0, y₁ - y₂) ∈ g

Next tactic:
convert g.sub_mem hy₁ hy₂
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  intro y₁ y₂ hy₁ hy₂
  have hy : ((0 : E), y₁ - y₂) ∈ g := by
    convert g.sub_mem hy₁ hy₂
    

Proof state:
case h.e'_4.h.e'_3
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
y₁ y₂ : F
hy₁ : (a, y₁) ∈ g
hy₂ : (a, y₂) ∈ g
⊢ 0 = ((a, y₁) - (a, y₂)).1

Next tactic:
exact (sub_self _).symm
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  intro y₁ y₂ hy₁ hy₂
  have hy : ((0 : E), y₁ - y₂) ∈ g := by
    convert g.sub_mem hy₁ hy₂
    exact (sub_self _).symm
  

Proof state:
case refine'_2
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
y₁ y₂ : F
hy₁ : (a, y₁) ∈ g
hy₂ : (a, y₂) ∈ g
hy : (0, y₁ - y₂) ∈ g
⊢ y₁ = y₂

Next tactic:
exact sub_eq_zero.mp (hg hy (by simp))
theorem existsUnique_from_graph {g : Submodule R (E × F)}
    (hg : ∀ {x : E × F} (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) {a : E}
    (ha : a ∈ g.map (LinearMap.fst R E F)) : ∃! b : F, (a, b) ∈ g := by
  refine' exists_unique_of_exists_of_unique _ _
  · convert ha
    simp
  intro y₁ y₂ hy₁ hy₂
  have hy : ((0 : E), y₁ - y₂) ∈ g := by
    convert g.sub_mem hy₁ hy₂
    exact (sub_self _).symm
  exact sub_eq_zero.mp (hg hy (by 

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ {x : E × F}, x ∈ g → x.1 = 0 → x.2 = 0
a : E
ha : a ∈ map (LinearMap.fst R E F) g
y₁ y₂ : F
hy₁ : (a, y₁) ∈ g
hy₂ : (a, y₂) ∈ g
hy : (0, y₁ - y₂) ∈ g
⊢ (0, y₁ - y₂).1 = 0

Next tactic:
simp
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
v w : ↥(map (LinearMap.fst R E F) g)
⊢ (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
      (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w

Next tactic:
have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
v w : ↥(map (LinearMap.fst R E F) g)
hadd : ↑v + ↑w ∈ map (LinearMap.fst R E F) g
⊢ (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
      (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w

Next tactic:
have hvw := valFromGraph_mem hg hadd
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
v w : ↥(map (LinearMap.fst R E F) g)
hadd : ↑v + ↑w ∈ map (LinearMap.fst R E F) g
hvw : (↑v + ↑w, valFromGraph hg hadd) ∈ g
⊢ (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
      (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w

Next tactic:
have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
v w : ↥(map (LinearMap.fst R E F) g)
hadd : ↑v + ↑w ∈ map (LinearMap.fst R E F) g
hvw : (↑v + ↑w, valFromGraph hg hadd) ∈ g
hvw' :
  (↑v, valFromGraph hg (_ : ↑v ∈ map (LinearMap.fst R E F) g)) +
      (↑w, valFromGraph hg (_ : ↑w ∈ map (LinearMap.fst R E F) g)) ∈
    g
⊢ (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
      (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w

Next tactic:
rw [Prod.mk_add_mk] at hvw'
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    rw [Prod.mk_add_mk] at hvw'
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
v w : ↥(map (LinearMap.fst R E F) g)
hadd : ↑v + ↑w ∈ map (LinearMap.fst R E F) g
hvw : (↑v + ↑w, valFromGraph hg hadd) ∈ g
hvw' :
  (↑v + ↑w,
      valFromGraph hg (_ : ↑v ∈ map (LinearMap.fst R E F) g) + valFromGraph hg (_ : ↑w ∈ map (LinearMap.fst R E F) g)) ∈
    g
⊢ (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
      (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w

Next tactic:
exact (existsUnique_from_graph @hg hadd).unique hvw hvw'
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    rw [Prod.mk_add_mk] at hvw'
    exact (existsUnique_from_graph @hg hadd).unique hvw hvw'
  map_smul' := fun a v => by
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
a : R
v : ↥(map (LinearMap.fst R E F) g)
⊢ AddHom.toFun
      { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
        map_add' :=
          (_ :
            ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
              (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
      (a • v) =
    (RingHom.id R) a •
      AddHom.toFun
        { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
          map_add' :=
            (_ :
              ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
        v

Next tactic:
have hsmul := (g.map (LinearMap.fst R E F)).smul_mem a v.2
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    rw [Prod.mk_add_mk] at hvw'
    exact (existsUnique_from_graph @hg hadd).unique hvw hvw'
  map_smul' := fun a v => by
    have hsmul := (g.map (LinearMap.fst R E F)).smul_mem a v.2
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
a : R
v : ↥(map (LinearMap.fst R E F) g)
hsmul : a • ↑v ∈ map (LinearMap.fst R E F) g
⊢ AddHom.toFun
      { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
        map_add' :=
          (_ :
            ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
              (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
      (a • v) =
    (RingHom.id R) a •
      AddHom.toFun
        { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
          map_add' :=
            (_ :
              ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
        v

Next tactic:
have hav := valFromGraph_mem hg hsmul
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    rw [Prod.mk_add_mk] at hvw'
    exact (existsUnique_from_graph @hg hadd).unique hvw hvw'
  map_smul' := fun a v => by
    have hsmul := (g.map (LinearMap.fst R E F)).smul_mem a v.2
    have hav := valFromGraph_mem hg hsmul
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
a : R
v : ↥(map (LinearMap.fst R E F) g)
hsmul : a • ↑v ∈ map (LinearMap.fst R E F) g
hav : (a • ↑v, valFromGraph hg hsmul) ∈ g
⊢ AddHom.toFun
      { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
        map_add' :=
          (_ :
            ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
              (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
      (a • v) =
    (RingHom.id R) a •
      AddHom.toFun
        { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
          map_add' :=
            (_ :
              ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
        v

Next tactic:
have hav' := g.smul_mem a (valFromGraph_mem hg v.2)
/-- Define a `LinearMap` from its graph.

Helper definition for `LinearPMap`. -/
noncomputable def toLinearPMapAux (g : Submodule R (E × F))
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0) :
    g.map (LinearMap.fst R E F) →ₗ[R] F where
  toFun := fun x => valFromGraph hg x.2
  map_add' := fun v w => by
    have hadd := (g.map (LinearMap.fst R E F)).add_mem v.2 w.2
    have hvw := valFromGraph_mem hg hadd
    have hvw' := g.add_mem (valFromGraph_mem hg v.2) (valFromGraph_mem hg w.2)
    rw [Prod.mk_add_mk] at hvw'
    exact (existsUnique_from_graph @hg hadd).unique hvw hvw'
  map_smul' := fun a v => by
    have hsmul := (g.map (LinearMap.fst R E F)).smul_mem a v.2
    have hav := valFromGraph_mem hg hsmul
    have hav' := g.smul_mem a (valFromGraph_mem hg v.2)
    

Proof state:
R : Type u_1
inst✝⁶ : Ring R
E : Type u_2
inst✝⁵ : AddCommGroup E
inst✝⁴ : Module R E
F : Type u_3
inst✝³ : AddCommGroup F
inst✝² : Module R F
G : Type u_4
inst✝¹ : AddCommGroup G
inst✝ : Module R G
g : Submodule R (E × F)
hg : ∀ x ∈ g, x.1 = 0 → x.2 = 0
a : R
v : ↥(map (LinearMap.fst R E F) g)
hsmul : a • ↑v ∈ map (LinearMap.fst R E F) g
hav : (a • ↑v, valFromGraph hg hsmul) ∈ g
hav' : a • (↑v, valFromGraph hg (_ : ↑v ∈ map (LinearMap.fst R E F) g)) ∈ g
⊢ AddHom.toFun
      { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
        map_add' :=
          (_ :
            ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
              (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
      (a • v) =
    (RingHom.id R) a •
      AddHom.toFun
        { toFun := fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g),
          map_add' :=
            (_ :
              ∀ (v w : ↥(map (LinearMap.fst R E F) g)),
                (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) (v + w) =
                  (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) v +
                    (fun x => valFromGraph hg (_ : ↑x ∈ map (LinearMap.fst R E F) g)) w) }
        v

Next tactic:
rw [Prod.smul_mk] at hav'