l3lab/ntp-mathlib huggingface dataset:
theorem toLin_restrict_range_dualCoannihilator_eq_orthogonal (B : BilinForm K V)
    (W : Subspace K V) : (B.toLin.domRestrict W).range.dualCoannihilator = B.orthogonal W := by
  ext x; constructor <;> rw [mem_orthogonal_iff] <;> intro hx
  · intro y hy
    rw [Submodule.mem_dualCoannihilator] at hx
    refine' hx (B.toLin.domRestrict W ⟨y, hy⟩) ⟨⟨y, hy⟩, rfl⟩
  · 

Proof state:
case h.mpr
R : Type u_1
M : Type u_2
inst✝²⁰ : Semiring R
inst✝¹⁹ : AddCommMonoid M
inst✝¹⁸ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁷ : Ring R₁
inst✝¹⁶ : AddCommGroup M₁
inst✝¹⁵ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁴ : CommSemiring R₂
inst✝¹³ : AddCommMonoid M₂
inst✝¹² : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹¹ : CommRing R₃
inst✝¹⁰ : AddCommGroup M₃
inst✝⁹ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁸ : Field K
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁵ : AddCommMonoid M₂'✝
inst✝⁴ : AddCommMonoid M₂''
inst✝³ : Module R₂ M₂'✝
inst✝² : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝¹ : AddCommMonoid M₂'
inst✝ : Module R₂ M₂'
B : BilinForm K V
W : Subspace K V
x : V
hx : ∀ n ∈ W, IsOrtho B n x
⊢ x ∈ Submodule.dualCoannihilator (LinearMap.range (LinearMap.domRestrict (toLin B) W))

Next tactic:
rw [Submodule.mem_dualCoannihilator]
theorem toLin_restrict_range_dualCoannihilator_eq_orthogonal (B : BilinForm K V)
    (W : Subspace K V) : (B.toLin.domRestrict W).range.dualCoannihilator = B.orthogonal W := by
  ext x; constructor <;> rw [mem_orthogonal_iff] <;> intro hx
  · intro y hy
    rw [Submodule.mem_dualCoannihilator] at hx
    refine' hx (B.toLin.domRestrict W ⟨y, hy⟩) ⟨⟨y, hy⟩, rfl⟩
  · rw [Submodule.mem_dualCoannihilator]
    

Proof state:
case h.mpr
R : Type u_1
M : Type u_2
inst✝²⁰ : Semiring R
inst✝¹⁹ : AddCommMonoid M
inst✝¹⁸ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁷ : Ring R₁
inst✝¹⁶ : AddCommGroup M₁
inst✝¹⁵ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁴ : CommSemiring R₂
inst✝¹³ : AddCommMonoid M₂
inst✝¹² : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹¹ : CommRing R₃
inst✝¹⁰ : AddCommGroup M₃
inst✝⁹ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁸ : Field K
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁵ : AddCommMonoid M₂'✝
inst✝⁴ : AddCommMonoid M₂''
inst✝³ : Module R₂ M₂'✝
inst✝² : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝¹ : AddCommMonoid M₂'
inst✝ : Module R₂ M₂'
B : BilinForm K V
W : Subspace K V
x : V
hx : ∀ n ∈ W, IsOrtho B n x
⊢ ∀ φ ∈ LinearMap.range (LinearMap.domRestrict (toLin B) W), φ x = 0

Next tactic:
rintro _ ⟨⟨w, hw⟩, rfl⟩
theorem toLin_restrict_range_dualCoannihilator_eq_orthogonal (B : BilinForm K V)
    (W : Subspace K V) : (B.toLin.domRestrict W).range.dualCoannihilator = B.orthogonal W := by
  ext x; constructor <;> rw [mem_orthogonal_iff] <;> intro hx
  · intro y hy
    rw [Submodule.mem_dualCoannihilator] at hx
    refine' hx (B.toLin.domRestrict W ⟨y, hy⟩) ⟨⟨y, hy⟩, rfl⟩
  · rw [Submodule.mem_dualCoannihilator]
    rintro _ ⟨⟨w, hw⟩, rfl⟩
    

Proof state:
case h.mpr.intro.mk
R : Type u_1
M : Type u_2
inst✝²⁰ : Semiring R
inst✝¹⁹ : AddCommMonoid M
inst✝¹⁸ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁷ : Ring R₁
inst✝¹⁶ : AddCommGroup M₁
inst✝¹⁵ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁴ : CommSemiring R₂
inst✝¹³ : AddCommMonoid M₂
inst✝¹² : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹¹ : CommRing R₃
inst✝¹⁰ : AddCommGroup M₃
inst✝⁹ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁸ : Field K
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁵ : AddCommMonoid M₂'✝
inst✝⁴ : AddCommMonoid M₂''
inst✝³ : Module R₂ M₂'✝
inst✝² : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝¹ : AddCommMonoid M₂'
inst✝ : Module R₂ M₂'
B : BilinForm K V
W : Subspace K V
x : V
hx : ∀ n ∈ W, IsOrtho B n x
w : V
hw : w ∈ W
⊢ ((LinearMap.domRestrict (toLin B) W) { val := w, property := hw }) x = 0

Next tactic:
exact hx w hw
theorem finrank_add_finrank_orthogonal {B : BilinForm K V} {W : Subspace K V} (b₁ : B.IsRefl) :
    finrank K W + finrank K (B.orthogonal W) =
      finrank K V + finrank K (W ⊓ B.orthogonal ⊤ : Subspace K V) := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
⊢ finrank K ↥W + finrank K ↥(orthogonal B W) = finrank K V + finrank K ↥(W ⊓ orthogonal B ⊤)

Next tactic:
rw [← toLin_restrict_ker_eq_inf_orthogonal _ _ b₁, ←
    toLin_restrict_range_dualCoannihilator_eq_orthogonal _ _, finrank_map_subtype_eq]
theorem finrank_add_finrank_orthogonal {B : BilinForm K V} {W : Subspace K V} (b₁ : B.IsRefl) :
    finrank K W + finrank K (B.orthogonal W) =
      finrank K V + finrank K (W ⊓ B.orthogonal ⊤ : Subspace K V) := by
  rw [← toLin_restrict_ker_eq_inf_orthogonal _ _ b₁, ←
    toLin_restrict_range_dualCoannihilator_eq_orthogonal _ _, finrank_map_subtype_eq]
  

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
⊢ finrank K ↥W + finrank K ↥(dualCoannihilator (LinearMap.range (LinearMap.domRestrict (toLin B) W))) =
    finrank K V + finrank K ↥(LinearMap.ker (LinearMap.domRestrict (toLin B) W))

Next tactic:
conv_rhs =>
    rw [← @Subspace.finrank_add_finrank_dualCoannihilator_eq K V _ _ _ _
        (LinearMap.range (B.toLin.domRestrict W)),
      add_comm, ← add_assoc, add_comm (finrank K (LinearMap.ker (B.toLin.domRestrict W))),
      LinearMap.finrank_range_add_finrank_ker]
theorem finrank_add_finrank_orthogonal {B : BilinForm K V} {W : Subspace K V} (b₁ : B.IsRefl) :
    finrank K W + finrank K (B.orthogonal W) =
      finrank K V + finrank K (W ⊓ B.orthogonal ⊤ : Subspace K V) := by
  rw [← toLin_restrict_ker_eq_inf_orthogonal _ _ b₁, ←
    toLin_restrict_range_dualCoannihilator_eq_orthogonal _ _, finrank_map_subtype_eq]
  conv_rhs =>
    

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
| finrank K V + finrank K ↥(LinearMap.ker (LinearMap.domRestrict (toLin B) W))

Next tactic:
rw [← @Subspace.finrank_add_finrank_dualCoannihilator_eq K V _ _ _ _
        (LinearMap.range (B.toLin.domRestrict W)),
      add_comm, ← add_assoc, add_comm (finrank K (LinearMap.ker (B.toLin.domRestrict W))),
      LinearMap.finrank_range_add_finrank_ker]
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
⊢ IsCompl W (orthogonal B W)

Next tactic:
have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    rintro ⟨n, hn⟩
    rw [restrict_apply, coe_mk, coe_mk, b₁]
    exact hx₂ n hn
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
⊢ W ⊓ orthogonal B W = ⊥

Next tactic:
rw [eq_bot_iff]
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
⊢ W ⊓ orthogonal B W ≤ ⊥

Next tactic:
intro x hx
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
x : V
hx : x ∈ W ⊓ orthogonal B W
⊢ x ∈ ⊥

Next tactic:
obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    

Proof state:
case intro
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
x : V
hx : x ∈ W ⊓ orthogonal B W
hx₁ : x ∈ W
hx₂ : x ∈ orthogonal B W
⊢ x ∈ ⊥

Next tactic:
refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    

Proof state:
case intro
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
x : V
hx : x ∈ W ⊓ orthogonal B W
hx₁ : x ∈ W
hx₂ : x ∈ orthogonal B W
⊢ ∀ (n : ↥W), bilin (restrict B W) { val := x, property := hx₁ } n = 0

Next tactic:
rintro ⟨n, hn⟩
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    rintro ⟨n, hn⟩
    

Proof state:
case intro.mk
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
x : V
hx : x ∈ W ⊓ orthogonal B W
hx₁ : x ∈ W
hx₂ : x ∈ orthogonal B W
n : V
hn : n ∈ W
⊢ bilin (restrict B W) { val := x, property := hx₁ } { val := n, property := hn } = 0

Next tactic:
rw [restrict_apply, coe_mk, coe_mk, b₁]
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    rintro ⟨n, hn⟩
    rw [restrict_apply, coe_mk, coe_mk, b₁]
    

Proof state:
case intro.mk.a
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
x : V
hx : x ∈ W ⊓ orthogonal B W
hx₁ : x ∈ W
hx₂ : x ∈ orthogonal B W
n : V
hn : n ∈ W
⊢ bilin B n x = 0

Next tactic:
exact hx₂ n hn
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    rintro ⟨n, hn⟩
    rw [restrict_apply, coe_mk, coe_mk, b₁]
    exact hx₂ n hn
  

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
this : W ⊓ orthogonal B W = ⊥
⊢ IsCompl W (orthogonal B W)

Next tactic:
refine' IsCompl.of_eq this (eq_top_of_finrank_eq <| (finrank_le _).antisymm _)
/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem restrict_nondegenerate_of_isCompl_orthogonal {B : BilinForm K V} {W : Subspace K V}
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W) := by
  have : W ⊓ B.orthogonal W = ⊥ := by
    rw [eq_bot_iff]
    intro x hx
    obtain ⟨hx₁, hx₂⟩ := mem_inf.1 hx
    refine' Subtype.mk_eq_mk.1 (b₂ ⟨x, hx₁⟩ _)
    rintro ⟨n, hn⟩
    rw [restrict_apply, coe_mk, coe_mk, b₁]
    exact hx₂ n hn
  refine' IsCompl.of_eq this (eq_top_of_finrank_eq <| (finrank_le _).antisymm _)
  

Proof state:
R : Type u_1
M : Type u_2
inst✝²¹ : Semiring R
inst✝²⁰ : AddCommMonoid M
inst✝¹⁹ : Module R M
R₁ : Type u_3
M₁ : Type u_4
inst✝¹⁸ : Ring R₁
inst✝¹⁷ : AddCommGroup M₁
inst✝¹⁶ : Module R₁ M₁
R₂ : Type u_5
M₂ : Type u_6
inst✝¹⁵ : CommSemiring R₂
inst✝¹⁴ : AddCommMonoid M₂
inst✝¹³ : Module R₂ M₂
R₃ : Type u_7
M₃ : Type u_8
inst✝¹² : CommRing R₃
inst✝¹¹ : AddCommGroup M₃
inst✝¹⁰ : Module R₃ M₃
V : Type u_9
K : Type u_10
inst✝⁹ : Field K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
M₂'✝ : Type u_11
M₂'' : Type u_12
inst✝⁶ : AddCommMonoid M₂'✝
inst✝⁵ : AddCommMonoid M₂''
inst✝⁴ : Module R₂ M₂'✝
inst✝³ : Module R₂ M₂''
B✝ : BilinForm R M
B₁ : BilinForm R₁ M₁
B₂ : BilinForm R₂ M₂
M₂' : Type u_13
inst✝² : AddCommMonoid M₂'
inst✝¹ : Module R₂ M₂'
inst✝ : FiniteDimensional K V
B : BilinForm K V
W : Subspace K V
b₁ : IsRefl B
b₂ : Nondegenerate (restrict B W)
this : W ⊓ orthogonal B W = ⊥
⊢ finrank K V ≤ finrank K ↥(W ⊔ orthogonal B W)

Next tactic:
conv_rhs => rw [← add_zero (finrank K _)]