l3lab/ntp-mathlib huggingface dataset:
/-- The unique `LinearPMap` on `R ∙ x` that sends `x` to `y`. This version works for modules
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
    E →ₗ.[R] F where
  domain := R ∙ x
  toFun :=
    have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
      intro c₁ c₂ h
      rw [← sub_eq_zero, ← sub_smul] at h ⊢
      exact H _ h
    { toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
      -- Porting note: `dsimp only []` are required.
      -- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
      map_add' := fun y z => by
        dsimp only []
        rw [← add_smul]
        apply H
        simp only [add_smul, sub_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        apply coe_add
      map_smul' := fun c z => 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
x : E
y : F
H✝ : ∀ (c : R), c • x = 0 → c • y = 0
H : ∀ (c₁ c₂ : R), c₁ • x = c₂ • x → c₁ • y = c₂ • y
c : R
z : ↥(span R {x})
⊢ AddHom.toFun
      { toFun := fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y,
        map_add' :=
          (_ :
            ∀ (y_1 z : ↥(span R {x})),
              (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) (y_1 + z) =
                (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) y_1 +
                  (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) z) }
      (c • z) =
    (RingHom.id R) c •
      AddHom.toFun
        { toFun := fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y,
          map_add' :=
            (_ :
              ∀ (y_1 z : ↥(span R {x})),
                (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) (y_1 + z) =
                  (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) y_1 +
                    (fun z => Classical.choose (_ : ∃ a, a • x = ↑z) • y) z) }
        z

Next tactic:
dsimp only []
/-- The unique `LinearPMap` on `R ∙ x` that sends `x` to `y`. This version works for modules
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
    E →ₗ.[R] F where
  domain := R ∙ x
  toFun :=
    have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
      intro c₁ c₂ h
      rw [← sub_eq_zero, ← sub_smul] at h ⊢
      exact H _ h
    { toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
      -- Porting note: `dsimp only []` are required.
      -- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
      map_add' := fun y z => by
        dsimp only []
        rw [← add_smul]
        apply H
        simp only [add_smul, sub_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        apply coe_add
      map_smul' := fun c z => by
        dsimp only []
        

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
x : E
y : F
H✝ : ∀ (c : R), c • x = 0 → c • y = 0
H : ∀ (c₁ c₂ : R), c₁ • x = c₂ • x → c₁ • y = c₂ • y
c : R
z : ↥(span R {x})
⊢ Classical.choose (_ : ∃ a, a • x = ↑(c • z)) • y = (RingHom.id R) c • Classical.choose (_ : ∃ a, a • x = ↑z) • y

Next tactic:
rw [smul_smul]
/-- The unique `LinearPMap` on `R ∙ x` that sends `x` to `y`. This version works for modules
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
    E →ₗ.[R] F where
  domain := R ∙ x
  toFun :=
    have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
      intro c₁ c₂ h
      rw [← sub_eq_zero, ← sub_smul] at h ⊢
      exact H _ h
    { toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
      -- Porting note: `dsimp only []` are required.
      -- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
      map_add' := fun y z => by
        dsimp only []
        rw [← add_smul]
        apply H
        simp only [add_smul, sub_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        apply coe_add
      map_smul' := fun c z => by
        dsimp only []
        rw [smul_smul]
        

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
x : E
y : F
H✝ : ∀ (c : R), c • x = 0 → c • y = 0
H : ∀ (c₁ c₂ : R), c₁ • x = c₂ • x → c₁ • y = c₂ • y
c : R
z : ↥(span R {x})
⊢ Classical.choose (_ : ∃ a, a • x = ↑(c • z)) • y = ((RingHom.id R) c * Classical.choose (_ : ∃ a, a • x = ↑z)) • y

Next tactic:
apply H
/-- The unique `LinearPMap` on `R ∙ x` that sends `x` to `y`. This version works for modules
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
    E →ₗ.[R] F where
  domain := R ∙ x
  toFun :=
    have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
      intro c₁ c₂ h
      rw [← sub_eq_zero, ← sub_smul] at h ⊢
      exact H _ h
    { toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
      -- Porting note: `dsimp only []` are required.
      -- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
      map_add' := fun y z => by
        dsimp only []
        rw [← add_smul]
        apply H
        simp only [add_smul, sub_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        apply coe_add
      map_smul' := fun c z => by
        dsimp only []
        rw [smul_smul]
        apply H
        

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
x : E
y : F
H✝ : ∀ (c : R), c • x = 0 → c • y = 0
H : ∀ (c₁ c₂ : R), c₁ • x = c₂ • x → c₁ • y = c₂ • y
c : R
z : ↥(span R {x})
⊢ Classical.choose (_ : ∃ a, a • x = ↑(c • z)) • x = ((RingHom.id R) c * Classical.choose (_ : ∃ a, a • x = ↑z)) • x

Next tactic:
simp only [mul_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
/-- The unique `LinearPMap` on `R ∙ x` that sends `x` to `y`. This version works for modules
over rings, and requires a proof of `∀ c, c • x = 0 → c • y = 0`. -/
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
    E →ₗ.[R] F where
  domain := R ∙ x
  toFun :=
    have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
      intro c₁ c₂ h
      rw [← sub_eq_zero, ← sub_smul] at h ⊢
      exact H _ h
    { toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
      -- Porting note: `dsimp only []` are required.
      -- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
      map_add' := fun y z => by
        dsimp only []
        rw [← add_smul]
        apply H
        simp only [add_smul, sub_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        apply coe_add
      map_smul' := fun c z => by
        dsimp only []
        rw [smul_smul]
        apply H
        simp only [mul_smul,
          fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
        

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
x : E
y : F
H✝ : ∀ (c : R), c • x = 0 → c • y = 0
H : ∀ (c₁ c₂ : R), c₁ • x = c₂ • x → c₁ • y = c₂ • y
c : R
z : ↥(span R {x})
⊢ ↑(c • z) = (RingHom.id R) c • ↑z

Next tactic:
apply coe_smul
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
    mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := 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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
c : R
h : c • x ∈ (mkSpanSingleton' x y H).domain
⊢ ↑(mkSpanSingleton' x y H) { val := c • x, property := h } = c • y

Next tactic:
dsimp [mkSpanSingleton']
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
    mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by
  dsimp [mkSpanSingleton']
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
c : R
h : c • x ∈ (mkSpanSingleton' x y H).domain
⊢ Classical.choose (_ : ∃ a, a • x = c • x) • y = c • y

Next tactic:
rw [← sub_eq_zero, ← sub_smul]
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
    mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by
  dsimp [mkSpanSingleton']
  rw [← sub_eq_zero, ← sub_smul]
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
c : R
h : c • x ∈ (mkSpanSingleton' x y H).domain
⊢ (Classical.choose (_ : ∃ a, a • x = c • x) - c) • y = 0

Next tactic:
apply H
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
    mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by
  dsimp [mkSpanSingleton']
  rw [← sub_eq_zero, ← sub_smul]
  apply H
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
c : R
h : c • x ∈ (mkSpanSingleton' x y H).domain
⊢ (Classical.choose (_ : ∃ a, a • x = c • x) - c) • x = 0

Next tactic:
simp only [sub_smul, one_smul, sub_eq_zero]
@[simp]
theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
    mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by
  dsimp [mkSpanSingleton']
  rw [← sub_eq_zero, ← sub_smul]
  apply H
  simp only [sub_smul, one_smul, sub_eq_zero]
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
c : R
h : c • x ∈ (mkSpanSingleton' x y H).domain
⊢ Classical.choose (_ : ∃ a, a • x = c • x) • x = c • x

Next tactic:
apply Classical.choose_spec (mem_span_singleton.1 h)
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
⊢ ↑(mkSpanSingleton' x y H) { val := x, property := h } = y

Next tactic:
have := by refine mkSpanSingleton'_apply x y H 1 ?_; rwa [one_smul]
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  have := 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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
⊢ ?m.87409

Next tactic:
refine mkSpanSingleton'_apply x y H 1 ?_
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  have := by refine mkSpanSingleton'_apply x y H 1 ?_; 

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
⊢ 1 • x ∈ (mkSpanSingleton' x y H).domain

Next tactic:
rwa [one_smul]
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  have := by refine mkSpanSingleton'_apply x y H 1 ?_; rwa [one_smul]
  

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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
this : ↑(mkSpanSingleton' x y H) { val := 1 • x, property := (_ : 1 • x ∈ (mkSpanSingleton' x y H).domain) } = 1 • y
⊢ ↑(mkSpanSingleton' x y H) { val := x, property := h } = y

Next tactic:
convert this
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  have := by refine mkSpanSingleton'_apply x y H 1 ?_; rwa [one_smul]
  convert this <;> 

Proof state:
case h.e'_2.h.e'_10.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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
this : ↑(mkSpanSingleton' x y H) { val := 1 • x, property := (_ : 1 • x ∈ (mkSpanSingleton' x y H).domain) } = 1 • y
⊢ x = 1 • x

Next tactic:
rw [one_smul]
@[simp]
theorem mkSpanSingleton'_apply_self (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (h) :
    mkSpanSingleton' x y H ⟨x, h⟩ = y := by
  -- Porting note: A placeholder should be specified before `convert`.
  have := by refine mkSpanSingleton'_apply x y H 1 ?_; rwa [one_smul]
  convert this <;> 

Proof state:
case 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
x : E
y : F
H : ∀ (c : R), c • x = 0 → c • y = 0
h : x ∈ (mkSpanSingleton' x y H).domain
this : ↑(mkSpanSingleton' x y H) { val := 1 • x, property := (_ : 1 • x ∈ (mkSpanSingleton' x y H).domain) } = 1 • y
⊢ y = 1 • y

Next tactic:
rw [one_smul]
/-- The unique `LinearPMap` on `span R {x}` that sends a non-zero vector `x` to `y`.
This version works for modules over division rings. -/
@[reducible]
noncomputable def mkSpanSingleton {K E F : Type*} [DivisionRing K] [AddCommGroup E] [Module K E]
    [AddCommGroup F] [Module K F] (x : E) (y : F) (hx : x ≠ 0) : E →ₗ.[K] F :=
  mkSpanSingleton' x y fun c hc =>
    (smul_eq_zero.1 hc).elim (fun hc => 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
K : Type u_5
E : Type u_6
F : Type u_7
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup E
inst✝² : Module K E
inst✝¹ : AddCommGroup F
inst✝ : Module K F
x : E
y : F
hx : x ≠ 0
c : K
hc✝ : c • x = 0
hc : c = 0
⊢ c • y = 0

Next tactic:
rw [hc, zero_smul]
/-- Given two partial linear maps `f`, `g`, the set of points `x` such that
both `f` and `g` are defined at `x` and `f x = g x` form a submodule. -/
def eqLocus (f g : E →ₗ.[R] F) : Submodule R E where
  carrier := { x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), f ⟨x, hf⟩ = g ⟨x, hg⟩ }
  zero_mem' := ⟨zero_mem _, zero_mem _, f.map_zero.trans g.map_zero.symm⟩
  add_mem' := fun {x y} ⟨hfx, hgx, hx⟩ ⟨hfy, hgy, hy⟩ =>
    ⟨add_mem hfx hfy, add_mem hgx hgy, 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
f g : E →ₗ.[R] F
x y : E
x✝¹ :
  x ∈ {x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), ↑f { val := x, property := hf } = ↑g { val := x, property := hg }}
x✝ :
  y ∈ {x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), ↑f { val := x, property := hf } = ↑g { val := x, property := hg }}
hfx : x ∈ f.domain
hgx : x ∈ g.domain
hx : ↑f { val := x, property := hfx } = ↑g { val := x, property := hgx }
hfy : y ∈ f.domain
hgy : y ∈ g.domain
hy : ↑f { val := y, property := hfy } = ↑g { val := y, property := hgy }
⊢ ↑f { val := x + y, property := (_ : x + y ∈ f.domain) } = ↑g { val := x + y, property := (_ : x + y ∈ g.domain) }

Next tactic:
erw [f.map_add ⟨x, hfx⟩ ⟨y, hfy⟩, g.map_add ⟨x, hgx⟩ ⟨y, hgy⟩, hx, hy]
/-- Given two partial linear maps `f`, `g`, the set of points `x` such that
both `f` and `g` are defined at `x` and `f x = g x` form a submodule. -/
def eqLocus (f g : E →ₗ.[R] F) : Submodule R E where
  carrier := { x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), f ⟨x, hf⟩ = g ⟨x, hg⟩ }
  zero_mem' := ⟨zero_mem _, zero_mem _, f.map_zero.trans g.map_zero.symm⟩
  add_mem' := fun {x y} ⟨hfx, hgx, hx⟩ ⟨hfy, hgy, hy⟩ =>
    ⟨add_mem hfx hfy, add_mem hgx hgy, by
      erw [f.map_add ⟨x, hfx⟩ ⟨y, hfy⟩, g.map_add ⟨x, hgx⟩ ⟨y, hgy⟩, hx, hy]⟩
  -- Porting note: `by rintro` is required, or error of a free variable happens.
  smul_mem' := by
    rintro c x ⟨hfx, hgx, hx⟩
    

Proof state:
case intro.intro
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
f g : E →ₗ.[R] F
c : R
x : E
hfx : x ∈ f.domain
hgx : x ∈ g.domain
hx : ↑f { val := x, property := hfx } = ↑g { val := x, property := hgx }
⊢ c • x ∈
    {
          toAddSubsemigroup :=
            {
              carrier :=
                {x |
                  ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain),
                    ↑f { val := x, property := hf } = ↑g { val := x, property := hg }},
              add_mem' :=
                (_ :
                  ∀ {x y : E},
                    x ∈
                        {x |
                          ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain),
                            ↑f { val := x, property := hf } = ↑g { val := x, property := hg }} →
                      y ∈
                          {x |
                            ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain),
                              ↑f { val := x, property := hf } = ↑g { val := x, property := hg }} →
                        x + y ∈
                          {x |
                            ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain),
                              ↑f { val := x, property := hf } = ↑g { val := x, property := hg }}) },
          zero_mem' :=
            (_ :
              ∃ (hf : 0 ∈ f.domain) (hg : 0 ∈ g.domain),
                ↑f { val := 0, property := hf } = ↑g { val := 0, property := hg }) }.toAddSubsemigroup.carrier

Next tactic:
exact
      ⟨smul_mem _ c hfx, smul_mem _ c hgx,
        by erw [f.map_smul c ⟨x, hfx⟩, g.map_smul c ⟨x, hgx⟩, hx]⟩
/-- Given two partial linear maps `f`, `g`, the set of points `x` such that
both `f` and `g` are defined at `x` and `f x = g x` form a submodule. -/
def eqLocus (f g : E →ₗ.[R] F) : Submodule R E where
  carrier := { x | ∃ (hf : x ∈ f.domain) (hg : x ∈ g.domain), f ⟨x, hf⟩ = g ⟨x, hg⟩ }
  zero_mem' := ⟨zero_mem _, zero_mem _, f.map_zero.trans g.map_zero.symm⟩
  add_mem' := fun {x y} ⟨hfx, hgx, hx⟩ ⟨hfy, hgy, hy⟩ =>
    ⟨add_mem hfx hfy, add_mem hgx hgy, by
      erw [f.map_add ⟨x, hfx⟩ ⟨y, hfy⟩, g.map_add ⟨x, hgx⟩ ⟨y, hgy⟩, hx, hy]⟩
  -- Porting note: `by rintro` is required, or error of a free variable happens.
  smul_mem' := by
    rintro c x ⟨hfx, hgx, hx⟩
    exact
      ⟨smul_mem _ c hfx, smul_mem _ c hgx,
        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
f g : E →ₗ.[R] F
c : R
x : E
hfx : x ∈ f.domain
hgx : x ∈ g.domain
hx : ↑f { val := x, property := hfx } = ↑g { val := x, property := hgx }
⊢ ↑f { val := c • x, property := (_ : c • x ∈ f.domain) } = ↑g { val := c • x, property := (_ : c • x ∈ g.domain) }

Next tactic:
erw [f.map_smul c ⟨x, hfx⟩, g.map_smul c ⟨x, hgx⟩, hx]
instance semilatticeInf : SemilatticeInf (E →ₗ.[R] F) where
  le := (· ≤ ·)
  le_refl f := ⟨le_refl f.domain, fun x y h => Subtype.eq h ▸ rfl⟩
  le_trans := fun f g h ⟨fg_le, fg_eq⟩ ⟨gh_le, gh_eq⟩ =>
    ⟨le_trans fg_le gh_le, fun x z hxz =>
      have hxy : (x : E) = inclusion fg_le x := rfl
      (fg_eq hxy).trans (gh_eq <| hxy.symm.trans hxz)⟩
  le_antisymm f g fg gf := eq_of_le_of_domain_eq fg (le_antisymm fg.1 gf.1)
  inf := (· ⊓ ·)
  -- Porting note: `by rintro` is required, or error of a metavariable happens.
  le_inf := 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
⊢ ∀ (a b c : E →ₗ.[R] F), a ≤ b → a ≤ c → a ≤ b ⊓ c

Next tactic:
rintro f g h ⟨fg_le, fg_eq⟩ ⟨fh_le, fh_eq⟩
instance semilatticeInf : SemilatticeInf (E →ₗ.[R] F) where
  le := (· ≤ ·)
  le_refl f := ⟨le_refl f.domain, fun x y h => Subtype.eq h ▸ rfl⟩
  le_trans := fun f g h ⟨fg_le, fg_eq⟩ ⟨gh_le, gh_eq⟩ =>
    ⟨le_trans fg_le gh_le, fun x z hxz =>
      have hxy : (x : E) = inclusion fg_le x := rfl
      (fg_eq hxy).trans (gh_eq <| hxy.symm.trans hxz)⟩
  le_antisymm f g fg gf := eq_of_le_of_domain_eq fg (le_antisymm fg.1 gf.1)
  inf := (· ⊓ ·)
  -- Porting note: `by rintro` is required, or error of a metavariable happens.
  le_inf := by
    rintro f g h ⟨fg_le, fg_eq⟩ ⟨fh_le, fh_eq⟩
    

Proof state:
case intro.intro
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
f g h : E →ₗ.[R] F
fg_le : f.domain ≤ g.domain
fg_eq : ∀ ⦃x : ↥f.domain⦄ ⦃y : ↥g.domain⦄, ↑x = ↑y → ↑f x = ↑g y
fh_le : f.domain ≤ h.domain
fh_eq : ∀ ⦃x : ↥f.domain⦄ ⦃y : ↥h.domain⦄, ↑x = ↑y → ↑f x = ↑h y
⊢ f ≤ g ⊓ h

Next tactic:
exact ⟨fun x hx =>
      ⟨fg_le hx, fh_le hx, by
        -- Porting note: `[exact ⟨x, hx⟩, rfl, rfl]` → `[skip, exact ⟨x, hx⟩, skip] <;> rfl`
        refine' (fg_eq _).symm.trans (fh_eq _) <;> [skip; exact ⟨x, hx⟩; skip] <;> rfl⟩,
      fun x ⟨y, yg, hy⟩ h => by
        apply fg_eq
        exact h⟩