l3lab/ntp-mathlib huggingface dataset:
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    

Proof state:
case e_a.f.refine'_2
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
⊢ ker (coprod db eb) ≤ LinearMap.range (LinearMap.prod cd (-ce))

Next tactic:
rintro ⟨d, e⟩
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    

Proof state:
case e_a.f.refine'_2.mk
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
⊢ (d, e) ∈ ker (coprod db eb) → (d, e) ∈ LinearMap.range (LinearMap.prod cd (-ce))

Next tactic:
have h := eq₂ d (-e)
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    have h := eq₂ d (-e)
    

Proof state:
case e_a.f.refine'_2.mk
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
h : db d = eb (-e) → ∃ c, cd c = d ∧ ce c = -e
⊢ (d, e) ∈ ker (coprod db eb) → (d, e) ∈ LinearMap.range (LinearMap.prod cd (-ce))

Next tactic:
simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe,
      Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    have h := eq₂ d (-e)
    simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe,
      Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢
    

Proof state:
case e_a.f.refine'_2.mk
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
h : db d = -eb e → ∃ c, cd c = d ∧ ce c = -e
⊢ db d = -eb e → ∃ y, cd y = d ∧ -ce y = e

Next tactic:
intro hde
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    have h := eq₂ d (-e)
    simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe,
      Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢
    intro hde
    

Proof state:
case e_a.f.refine'_2.mk
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde✝ : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
h : db d = -eb e → ∃ c, cd c = d ∧ ce c = -e
hde : db d = -eb e
⊢ ∃ y, cd y = d ∧ -ce y = e

Next tactic:
rcases h hde with ⟨c, h₁, h₂⟩
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    have h := eq₂ d (-e)
    simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe,
      Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢
    intro hde
    rcases h hde with ⟨c, h₁, h₂⟩
    

Proof state:
case e_a.f.refine'_2.mk.intro.intro
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde✝ : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
h : db d = -eb e → ∃ c, cd c = d ∧ ce c = -e
hde : db d = -eb e
c : V₁
h₁ : cd c = d
h₂ : ce c = -e
⊢ ∃ y, cd y = d ∧ -ce y = e

Next tactic:
refine' ⟨c, h₁, _⟩
/-- This is mostly an auxiliary lemma for `Submodule.rank_sup_add_rank_inf_eq`. -/
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂)
    (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥)
    (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) :
    Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
  have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff]
  conv =>
    rhs
    rw [← rank_prod', rank_eq_of_surjective _ hf]
  congr 1
  apply LinearEquiv.rank_eq
  let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout
    refine' LinearMap.codRestrict _ (prod cd (-ce)) _
    · intro c
      simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply,
        neg_neg, map_neg, neg_apply]
      exact LinearMap.ext_iff.1 eq c
  refine' LinearEquiv.ofBijective L ⟨_, _⟩
  · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq]
  · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top,
      range_subtype]
    rintro ⟨d, e⟩
    have h := eq₂ d (-e)
    simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe,
      Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢
    intro hde
    rcases h hde with ⟨c, h₁, h₂⟩
    refine' ⟨c, h₁, _⟩
    

Proof state:
case e_a.f.refine'_2.mk.intro.intro
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
db : V₂ →ₗ[K] V
eb : V₃ →ₗ[K] V
cd : V₁ →ₗ[K] V₂
ce : V₁ →ₗ[K] V₃
hde✝ : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb
hgd : ker cd = ⊥
eq : db ∘ₗ cd = eb ∘ₗ ce
eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e → ∃ c, cd c = d ∧ ce c = e
hf : Surjective ⇑(coprod db eb)
L : V₁ →ₗ[K] ↥(ker (coprod db eb)) :=
  LinearMap.codRestrict (ker (coprod db eb)) (LinearMap.prod cd (-ce))
    (_ : ∀ (c : V₁), (LinearMap.prod cd (-ce)) c ∈ ker (coprod db eb))
d : V₂
e : V₃
h : db d = -eb e → ∃ c, cd c = d ∧ ce c = -e
hde : db d = -eb e
c : V₁
h₁ : cd c = d
h₂ : ce c = -e
⊢ -ce c = e

Next tactic:
rw [h₂, _root_.neg_neg]
theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule K V) :
    Module.rank K (s ⊔ t : Submodule K V) + Module.rank K (s ⊓ t : Submodule K V) =
    Module.rank K s + Module.rank K t :=
  rank_add_rank_split
    (inclusion le_sup_left) (inclusion le_sup_right)
    (inclusion inf_le_left) (inclusion inf_le_right)
    (by
      

Proof state:
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
s t : Submodule K V
⊢ ⊤ ≤ LinearMap.range (inclusion (_ : s ≤ s ⊔ t)) ⊔ LinearMap.range (inclusion (_ : t ≤ s ⊔ t))

Next tactic:
rw [← map_le_map_iff' (ker_subtype <| s ⊔ t), Submodule.map_sup, Submodule.map_top, ←
        LinearMap.range_comp, ← LinearMap.range_comp, subtype_comp_inclusion,
        subtype_comp_inclusion, range_subtype, range_subtype, range_subtype]
theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule K V) :
    Module.rank K (s ⊔ t : Submodule K V) + Module.rank K (s ⊓ t : Submodule K V) =
    Module.rank K s + Module.rank K t :=
  rank_add_rank_split
    (inclusion le_sup_left) (inclusion le_sup_right)
    (inclusion inf_le_left) (inclusion inf_le_right)
    (by
      rw [← map_le_map_iff' (ker_subtype <| s ⊔ t), Submodule.map_sup, Submodule.map_top, ←
        LinearMap.range_comp, ← LinearMap.range_comp, subtype_comp_inclusion,
        subtype_comp_inclusion, range_subtype, range_subtype, range_subtype])
    (ker_inclusion _ _ _) (by 

Proof state:
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
s t : Submodule K V
⊢ inclusion (_ : s ≤ s ⊔ t) ∘ₗ inclusion (_ : s ⊓ t ≤ s) = inclusion (_ : t ≤ s ⊔ t) ∘ₗ inclusion (_ : s ⊓ t ≤ t)

Next tactic:
ext ⟨x, hx⟩
theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule K V) :
    Module.rank K (s ⊔ t : Submodule K V) + Module.rank K (s ⊓ t : Submodule K V) =
    Module.rank K s + Module.rank K t :=
  rank_add_rank_split
    (inclusion le_sup_left) (inclusion le_sup_right)
    (inclusion inf_le_left) (inclusion inf_le_right)
    (by
      rw [← map_le_map_iff' (ker_subtype <| s ⊔ t), Submodule.map_sup, Submodule.map_top, ←
        LinearMap.range_comp, ← LinearMap.range_comp, subtype_comp_inclusion,
        subtype_comp_inclusion, range_subtype, range_subtype, range_subtype])
    (ker_inclusion _ _ _) (by ext ⟨x, hx⟩; 

Proof state:
case h.mk.a
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
s t : Submodule K V
x : V
hx : x ∈ s ⊓ t
⊢ ↑((inclusion (_ : s ≤ s ⊔ t) ∘ₗ inclusion (_ : s ⊓ t ≤ s)) { val := x, property := hx }) =
    ↑((inclusion (_ : t ≤ s ⊔ t) ∘ₗ inclusion (_ : s ⊓ t ≤ t)) { val := x, property := hx })

Next tactic:
rfl
theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule K V) :
    Module.rank K (s ⊔ t : Submodule K V) + Module.rank K (s ⊓ t : Submodule K V) =
    Module.rank K s + Module.rank K t :=
  rank_add_rank_split
    (inclusion le_sup_left) (inclusion le_sup_right)
    (inclusion inf_le_left) (inclusion inf_le_right)
    (by
      rw [← map_le_map_iff' (ker_subtype <| s ⊔ t), Submodule.map_sup, Submodule.map_top, ←
        LinearMap.range_comp, ← LinearMap.range_comp, subtype_comp_inclusion,
        subtype_comp_inclusion, range_subtype, range_subtype, range_subtype])
    (ker_inclusion _ _ _) (by ext ⟨x, hx⟩; rfl)
    (by
      

Proof state:
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
s t : Submodule K V
⊢ ∀ (d : ↥s) (e : ↥t),
    (inclusion (_ : s ≤ s ⊔ t)) d = (inclusion (_ : t ≤ s ⊔ t)) e →
      ∃ c, (inclusion (_ : s ⊓ t ≤ s)) c = d ∧ (inclusion (_ : s ⊓ t ≤ t)) c = e

Next tactic:
rintro ⟨b₁, hb₁⟩ ⟨b₂, hb₂⟩ eq
theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule K V) :
    Module.rank K (s ⊔ t : Submodule K V) + Module.rank K (s ⊓ t : Submodule K V) =
    Module.rank K s + Module.rank K t :=
  rank_add_rank_split
    (inclusion le_sup_left) (inclusion le_sup_right)
    (inclusion inf_le_left) (inclusion inf_le_right)
    (by
      rw [← map_le_map_iff' (ker_subtype <| s ⊔ t), Submodule.map_sup, Submodule.map_top, ←
        LinearMap.range_comp, ← LinearMap.range_comp, subtype_comp_inclusion,
        subtype_comp_inclusion, range_subtype, range_subtype, range_subtype])
    (ker_inclusion _ _ _) (by ext ⟨x, hx⟩; rfl)
    (by
      rintro ⟨b₁, hb₁⟩ ⟨b₂, hb₂⟩ eq
      

Proof state:
case mk.mk
K R : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
inst✝¹³ : DivisionRing K
inst✝¹² : Ring R
inst✝¹¹ : StrongRankCondition R
inst✝¹⁰ : AddCommGroup V
inst✝⁹ : Module K V
inst✝⁸ : Module R V
inst✝⁷ : AddCommGroup V'
inst✝⁶ : Module K V'
inst✝⁵ : AddCommGroup V₁
inst✝⁴ : Module K V₁
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : AddCommGroup V₃
inst✝ : Module K V₃
s t : Submodule K V
b₁ : V
hb₁ : b₁ ∈ s
b₂ : V
hb₂ : b₂ ∈ t
eq :
  (inclusion (_ : s ≤ s ⊔ t)) { val := b₁, property := hb₁ } =
    (inclusion (_ : t ≤ s ⊔ t)) { val := b₂, property := hb₂ }
⊢ ∃ c,
    (inclusion (_ : s ⊓ t ≤ s)) c = { val := b₁, property := hb₁ } ∧
      (inclusion (_ : s ⊓ t ≤ t)) c = { val := b₂, property := hb₂ }

Next tactic:
obtain rfl : b₁ = b₂ := congr_arg Subtype.val eq