l3lab/ntp-mathlib huggingface dataset:
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    

Proof state:
case inr.refine'_1.intro.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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
x y : ↥(sSup (domain '' c))
p : E →ₗ.[R] F
hpc : p ∈ c
hpx : ↑↑(P x) ≤ p
hpy : ↑↑(P y) ≤ p
⊢ f (x + y) = f x + f y

Next tactic:
set x' := inclusion hpx.1 ⟨x, (P x).2⟩
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    

Proof state:
case inr.refine'_1.intro.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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
x y : ↥(sSup (domain '' c))
p : E →ₗ.[R] F
hpc : p ∈ c
hpx : ↑↑(P x) ≤ p
hpy : ↑↑(P y) ≤ p
x' : ↥p.domain := (inclusion (_ : (↑↑(P x)).domain ≤ p.domain)) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
⊢ f (x + y) = f x + f y

Next tactic:
set y' := inclusion hpy.1 ⟨y, (P y).2⟩
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    set y' := inclusion hpy.1 ⟨y, (P y).2⟩
    

Proof state:
case inr.refine'_1.intro.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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
x y : ↥(sSup (domain '' c))
p : E →ₗ.[R] F
hpc : p ∈ c
hpx : ↑↑(P x) ≤ p
hpy : ↑↑(P y) ≤ p
x' : ↥p.domain := (inclusion (_ : (↑↑(P x)).domain ≤ p.domain)) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
y' : ↥p.domain := (inclusion (_ : (↑↑(P y)).domain ≤ p.domain)) { val := ↑y, property := (_ : ↑y ∈ (↑↑(P y)).domain) }
⊢ f (x + y) = f x + f y

Next tactic:
rw [f_eq ⟨p, hpc⟩ x x' rfl, f_eq ⟨p, hpc⟩ y y' rfl, f_eq ⟨p, hpc⟩ (x + y) (x' + y') rfl,
      map_add]
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    set y' := inclusion hpy.1 ⟨y, (P y).2⟩
    rw [f_eq ⟨p, hpc⟩ x x' rfl, f_eq ⟨p, hpc⟩ y y' rfl, f_eq ⟨p, hpc⟩ (x + y) (x' + y') rfl,
      map_add]
  · 

Proof state:
case inr.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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
⊢ ∀ (r : R) (x : ↥(sSup (domain '' c))),
    AddHom.toFun { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c))), f (x + y) = f x + f y) } (r • x) =
      (RingHom.id R) r •
        AddHom.toFun { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c))), f (x + y) = f x + f y) } x

Next tactic:
intro c x
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    set y' := inclusion hpy.1 ⟨y, (P y).2⟩
    rw [f_eq ⟨p, hpc⟩ x x' rfl, f_eq ⟨p, hpc⟩ y y' rfl, f_eq ⟨p, hpc⟩ (x + y) (x' + y') rfl,
      map_add]
  · intro c x
    -- Porting note: `simp [..]` to `simp only [..]`, or timeouts.
    

Proof state:
case inr.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
c✝ : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c✝
cne : Set.Nonempty c✝
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c✝)
P : (x : ↥(sSup (domain '' c✝))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c✝)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c✝) (x : ↥(sSup (domain '' c✝))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
c : R
x : ↥(sSup (domain '' c✝))
⊢ AddHom.toFun { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c✝))), f (x + y) = f x + f y) } (c • x) =
    (RingHom.id R) c •
      AddHom.toFun { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c✝))), f (x + y) = f x + f y) } x

Next tactic:
simp only [f_eq (P x).1 (c • x) (c • ⟨x, (P x).2⟩) rfl, ← map_smul, RingHom.id_apply]
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    set y' := inclusion hpy.1 ⟨y, (P y).2⟩
    rw [f_eq ⟨p, hpc⟩ x x' rfl, f_eq ⟨p, hpc⟩ y y' rfl, f_eq ⟨p, hpc⟩ (x + y) (x' + y') rfl,
      map_add]
  · intro c x
    -- Porting note: `simp [..]` to `simp only [..]`, or timeouts.
    simp only [f_eq (P x).1 (c • x) (c • ⟨x, (P x).2⟩) rfl, ← map_smul, RingHom.id_apply]
  · 

Proof state:
case inr.refine'_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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
⊢ { domain := sSup (domain '' c),
      toFun :=
        { toAddHom := { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c))), f (x + y) = f x + f y) },
          map_smul' :=
            (_ :
              ∀ (c_1 : R) (x : ↥(sSup (domain '' c))),
                f (c_1 • x) = c_1 • ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }) } } ∈
    upperBounds c

Next tactic:
intro p hpc
private theorem sSup_aux (c : Set (E →ₗ.[R] F)) (hc : DirectedOn (· ≤ ·) c) :
    ∃ f : ↥(sSup (domain '' c)) →ₗ[R] F, (⟨_, f⟩ : E →ₗ.[R] F) ∈ upperBounds c := by
  rcases c.eq_empty_or_nonempty with ceq | cne
  · subst c
    simp
  have hdir : DirectedOn (· ≤ ·) (domain '' c) :=
    directedOn_image.2 (hc.mono @(domain_mono.monotone))
  have P : ∀ x : ↥(sSup (domain '' c)), { p : c // (x : E) ∈ p.val.domain } := by
    rintro x
    apply Classical.indefiniteDescription
    have := (mem_sSup_of_directed (cne.image _) hdir).1 x.2
    -- Porting note: + `← bex_def`
    rwa [Set.bex_image_iff, ← bex_def, SetCoe.exists'] at this
  set f : ↥(sSup (domain '' c)) → F := fun x => (P x).val.val ⟨x, (P x).property⟩
  have f_eq : ∀ (p : c) (x : ↥(sSup (domain '' c))) (y : p.1.1) (_hxy : (x : E) = y),
      f x = p.1 y := by
    intro p x y hxy
    rcases hc (P x).1.1 (P x).1.2 p.1 p.2 with ⟨q, _hqc, hxq, hpq⟩
    -- Porting note: `refine' ..; exacts [inclusion hpq.1 y, hxy, rfl]`
    --               → `refine' .. <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy`
    refine' (hxq.2 _).trans (hpq.2 _).symm <;> [skip; exact inclusion hpq.1 y; rfl]; exact hxy
  refine' ⟨{ toFun := f.. }, _⟩
  · intro x y
    rcases hc (P x).1.1 (P x).1.2 (P y).1.1 (P y).1.2 with ⟨p, hpc, hpx, hpy⟩
    set x' := inclusion hpx.1 ⟨x, (P x).2⟩
    set y' := inclusion hpy.1 ⟨y, (P y).2⟩
    rw [f_eq ⟨p, hpc⟩ x x' rfl, f_eq ⟨p, hpc⟩ y y' rfl, f_eq ⟨p, hpc⟩ (x + y) (x' + y') rfl,
      map_add]
  · intro c x
    -- Porting note: `simp [..]` to `simp only [..]`, or timeouts.
    simp only [f_eq (P x).1 (c • x) (c • ⟨x, (P x).2⟩) rfl, ← map_smul, RingHom.id_apply]
  · intro p hpc
    

Proof state:
case inr.refine'_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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
cne : Set.Nonempty c
hdir : DirectedOn (fun x x_1 => x ≤ x_1) (domain '' c)
P : (x : ↥(sSup (domain '' c))) → { p // ↑x ∈ (↑p).domain }
f : ↥(sSup (domain '' c)) → F := fun x => ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }
f_eq : ∀ (p : ↑c) (x : ↥(sSup (domain '' c))) (y : ↥(↑p).domain), ↑x = ↑y → f x = ↑↑p y
p : E →ₗ.[R] F
hpc : p ∈ c
⊢ p ≤
    { domain := sSup (domain '' c),
      toFun :=
        { toAddHom := { toFun := f, map_add' := (_ : ∀ (x y : ↥(sSup (domain '' c))), f (x + y) = f x + f y) },
          map_smul' :=
            (_ :
              ∀ (c_1 : R) (x : ↥(sSup (domain '' c))),
                f (c_1 • x) = c_1 • ↑↑↑(P x) { val := ↑x, property := (_ : ↑x ∈ (↑↑(P x)).domain) }) } }

Next tactic:
refine' ⟨le_sSup <| Set.mem_image_of_mem domain hpc, fun x y hxy => Eq.symm _⟩
protected theorem sSup_apply {c : Set (E →ₗ.[R] F)} (hc : DirectedOn (· ≤ ·) c) {l : E →ₗ.[R] F}
    (hl : l ∈ c) (x : l.domain) :
    (LinearPMap.sSup c hc) ⟨x, (LinearPMap.le_sSup hc hl).1 x.2⟩ = l x := 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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
l : E →ₗ.[R] F
hl : l ∈ c
x : ↥l.domain
⊢ ↑(LinearPMap.sSup c hc) { val := ↑x, property := (_ : ↑x ∈ (LinearPMap.sSup c hc).domain) } = ↑l x

Next tactic:
symm
protected theorem sSup_apply {c : Set (E →ₗ.[R] F)} (hc : DirectedOn (· ≤ ·) c) {l : E →ₗ.[R] F}
    (hl : l ∈ c) (x : l.domain) :
    (LinearPMap.sSup c hc) ⟨x, (LinearPMap.le_sSup hc hl).1 x.2⟩ = l x := by
  symm
  

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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
l : E →ₗ.[R] F
hl : l ∈ c
x : ↥l.domain
⊢ ↑l x = ↑(LinearPMap.sSup c hc) { val := ↑x, property := (_ : ↑x ∈ (LinearPMap.sSup c hc).domain) }

Next tactic:
apply (Classical.choose_spec (sSup_aux c hc) hl).2
protected theorem sSup_apply {c : Set (E →ₗ.[R] F)} (hc : DirectedOn (· ≤ ·) c) {l : E →ₗ.[R] F}
    (hl : l ∈ c) (x : l.domain) :
    (LinearPMap.sSup c hc) ⟨x, (LinearPMap.le_sSup hc hl).1 x.2⟩ = l x := by
  symm
  apply (Classical.choose_spec (sSup_aux c hc) hl).2
  

Proof state:
case _h
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
c : Set (E →ₗ.[R] F)
hc : DirectedOn (fun x x_1 => x ≤ x_1) c
l : E →ₗ.[R] F
hl : l ∈ c
x : ↥l.domain
⊢ ↑x = ↑{ val := ↑x, property := (_ : ↑x ∈ (LinearPMap.sSup c hc).domain) }

Next tactic:
rfl
/-- Restrict a partially defined linear map to a submodule of `E` contained in `f.domain`. -/
def domRestrict (f : E →ₗ.[R] F) (S : Submodule R E) : E →ₗ.[R] F :=
  ⟨S ⊓ f.domain, f.toFun.comp (Submodule.inclusion (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 : E →ₗ.[R] F
S : Submodule R E
⊢ S ⊓ f.domain ≤ f.domain

Next tactic:
simp
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f 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
f : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
⊢ ↑(domRestrict f S) x = ↑f y

Next tactic:
have : Submodule.inclusion (by simp) x = y := by
    ext
    simp [h]
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f y := by
  have : Submodule.inclusion (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 : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
⊢ S ⊓ f.domain ≤ f.domain

Next tactic:
simp
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f y := by
  have : Submodule.inclusion (by simp) x = 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
f : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
⊢ (Submodule.inclusion (_ : S ⊓ f.domain ≤ f.domain)) x = y

Next tactic:
ext
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f y := by
  have : Submodule.inclusion (by simp) x = y := by
    ext
    

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
f : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
⊢ ↑((Submodule.inclusion (_ : S ⊓ f.domain ≤ f.domain)) x) = ↑y

Next tactic:
simp [h]
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f y := by
  have : Submodule.inclusion (by simp) x = y := by
    ext
    simp [h]
  

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 : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
this : (Submodule.inclusion (_ : S ⊓ f.domain ≤ f.domain)) x = y
⊢ ↑(domRestrict f S) x = ↑f y

Next tactic:
rw [← this]
theorem domRestrict_apply {f : E →ₗ.[R] F} {S : Submodule R E} ⦃x : ↥(S ⊓ f.domain)⦄ ⦃y : f.domain⦄
    (h : (x : E) = y) : f.domRestrict S x = f y := by
  have : Submodule.inclusion (by simp) x = y := by
    ext
    simp [h]
  rw [← this]
  

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 : E →ₗ.[R] F
S : Submodule R E
x : ↥(S ⊓ f.domain)
y : ↥f.domain
h : ↑x = ↑y
this : (Submodule.inclusion (_ : S ⊓ f.domain ≤ f.domain)) x = y
⊢ ↑(domRestrict f S) x = ↑f ((Submodule.inclusion (_ : S ⊓ f.domain ≤ f.domain)) x)

Next tactic:
exact LinearPMap.mk_apply _ _ _
theorem domRestrict_le {f : E →ₗ.[R] F} {S : Submodule R E} : f.domRestrict S ≤ f :=
  ⟨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 : E →ₗ.[R] F
S : Submodule R E
⊢ (domRestrict f S).domain ≤ f.domain

Next tactic:
simp
theorem mem_graph_iff' (f : E →ₗ.[R] F) {x : E × F} : x ∈ f.graph ↔ ∃ y : f.domain, (↑y, f y) = x :=
  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 : E →ₗ.[R] F
x : E × F
⊢ x ∈ graph f ↔ ∃ y, (↑y, ↑f y) = x

Next tactic:
simp [graph]