l3lab/ntp-mathlib huggingface dataset:
/-- 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 _)
  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
b₂ : Nondegenerate (restrict B W)
this : W ⊓ orthogonal B W = ⊥
| finrank K ↥(W ⊔ orthogonal B W)

Next tactic:
rw [← add_zero (finrank K _)]
/-- 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 _)
  conv_rhs => rw [← add_zero (finrank K _)]
  

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) + 0

Next tactic:
rw [← finrank_bot K V, ← this, finrank_sup_add_finrank_inf_eq,
    finrank_add_finrank_orthogonal 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₁]
    exact hx₂ n hn
  refine' IsCompl.of_eq this (eq_top_of_finrank_eq <| (finrank_le _).antisymm _)
  conv_rhs => rw [← add_zero (finrank K _)]
  rw [← finrank_bot K V, ← this, finrank_sup_add_finrank_inf_eq,
    finrank_add_finrank_orthogonal b₁]
  

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 V + finrank K ↥(W ⊓ orthogonal B ⊤)

Next tactic:
exact le_self_add
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := 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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
⊢ Nondegenerate (restrict B (orthogonal B (Submodule.span K {x})))

Next tactic:
refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  

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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
hm : ∀ (n : ↥(orthogonal B (Submodule.span K {x}))), bilin (restrict B (orthogonal B (Submodule.span K {x}))) m n = 0
n : V
⊢ bilin B (↑m) n = 0

Next tactic:
have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  

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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
hm : ∀ (n : ↥(orthogonal B (Submodule.span K {x}))), bilin (restrict B (orthogonal B (Submodule.span K {x}))) m n = 0
n : V
this : n ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
⊢ bilin B (↑m) n = 0

Next tactic:
rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
  

Proof state:
case intro.intro.intro.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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
hm : ∀ (n : ↥(orthogonal B (Submodule.span K {x}))), bilin (restrict B (orthogonal B (Submodule.span K {x}))) m n = 0
y : V
hy : y ∈ Submodule.span K {x}
z : V
hz : z ∈ orthogonal B (Submodule.span K {x})
this : y + z ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
⊢ bilin B (↑m) (y + z) = 0

Next tactic:
specialize hm ⟨z, hz⟩
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
  specialize hm ⟨z, hz⟩
  

Proof state:
case intro.intro.intro.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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
y : V
hy : y ∈ Submodule.span K {x}
z : V
hz : z ∈ orthogonal B (Submodule.span K {x})
this : y + z ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
hm : bilin (restrict B (orthogonal B (Submodule.span K {x}))) m { val := z, property := hz } = 0
⊢ bilin B (↑m) (y + z) = 0

Next tactic:
rw [restrict] at hm
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
  specialize hm ⟨z, hz⟩
  rw [restrict] at hm
  

Proof state:
case intro.intro.intro.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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
y : V
hy : y ∈ Submodule.span K {x}
z : V
hz : z ∈ orthogonal B (Submodule.span K {x})
this : y + z ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
hm :
  bilin
      { bilin := fun a b => bilin B ↑a ↑b,
        bilin_add_left :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1 + ↑x_2) ↑x_3 = bilin B ↑x_1 ↑x_3 + bilin B ↑x_2 ↑x_3),
        bilin_smul_left :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (x_1 • ↑x_2) ↑x_3 = x_1 * bilin B ↑x_2 ↑x_3),
        bilin_add_right :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1) (↑x_2 + ↑x_3) = bilin B ↑x_1 ↑x_2 + bilin B ↑x_1 ↑x_3),
        bilin_smul_right :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_2) (x_1 • ↑x_3) = x_1 * bilin B ↑x_2 ↑x_3) }
      m { val := z, property := hz } =
    0
⊢ bilin B (↑m) (y + z) = 0

Next tactic:
erw [add_right, show B m.1 y = 0 by rw [b₂]; exact m.2 y hy, hm, add_zero]
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
  specialize hm ⟨z, hz⟩
  rw [restrict] at hm
  erw [add_right, show B m.1 y = 0 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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
y : V
hy : y ∈ Submodule.span K {x}
z : V
hz : z ∈ orthogonal B (Submodule.span K {x})
this : y + z ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
hm :
  bilin
      { bilin := fun a b => bilin B ↑a ↑b,
        bilin_add_left :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1 + ↑x_2) ↑x_3 = bilin B ↑x_1 ↑x_3 + bilin B ↑x_2 ↑x_3),
        bilin_smul_left :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (x_1 • ↑x_2) ↑x_3 = x_1 * bilin B ↑x_2 ↑x_3),
        bilin_add_right :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1) (↑x_2 + ↑x_3) = bilin B ↑x_1 ↑x_2 + bilin B ↑x_1 ↑x_3),
        bilin_smul_right :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_2) (x_1 • ↑x_3) = x_1 * bilin B ↑x_2 ↑x_3) }
      m { val := z, property := hz } =
    0
⊢ bilin B (↑m) y = 0

Next tactic:
rw [b₂]
/-- The restriction of a reflexive, non-degenerate bilinear form on the orthogonal complement of
the span of a singleton is also non-degenerate. -/
theorem restrictOrthogonalSpanSingletonNondegenerate (B : BilinForm K V) (b₁ : B.Nondegenerate)
    (b₂ : B.IsRefl) {x : V} (hx : ¬B.IsOrtho x x) :
    Nondegenerate <| B.restrict <| B.orthogonal (K ∙ x) := by
  refine' fun m hm => Submodule.coe_eq_zero.1 (b₁ m.1 fun n => _)
  have : n ∈ (K ∙ x) ⊔ B.orthogonal (K ∙ x) :=
    (span_singleton_sup_orthogonal_eq_top hx).symm ▸ Submodule.mem_top
  rcases Submodule.mem_sup.1 this with ⟨y, hy, z, hz, rfl⟩
  specialize hm ⟨z, hz⟩
  rw [restrict] at hm
  erw [add_right, show B m.1 y = 0 by rw [b₂]; 

Proof state:
case 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₂'
B : BilinForm K V
b₁ : Nondegenerate B
b₂ : IsRefl B
x : V
hx : ¬IsOrtho B x x
m : ↥(orthogonal B (Submodule.span K {x}))
y : V
hy : y ∈ Submodule.span K {x}
z : V
hz : z ∈ orthogonal B (Submodule.span K {x})
this : y + z ∈ Submodule.span K {x} ⊔ orthogonal B (Submodule.span K {x})
hm :
  bilin
      { bilin := fun a b => bilin B ↑a ↑b,
        bilin_add_left :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1 + ↑x_2) ↑x_3 = bilin B ↑x_1 ↑x_3 + bilin B ↑x_2 ↑x_3),
        bilin_smul_left :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (x_1 • ↑x_2) ↑x_3 = x_1 * bilin B ↑x_2 ↑x_3),
        bilin_add_right :=
          (_ :
            ∀ (x_1 x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_1) (↑x_2 + ↑x_3) = bilin B ↑x_1 ↑x_2 + bilin B ↑x_1 ↑x_3),
        bilin_smul_right :=
          (_ :
            ∀ (x_1 : K) (x_2 x_3 : ↥(orthogonal B (Submodule.span K {x}))),
              bilin B (↑x_2) (x_1 • ↑x_3) = x_1 * bilin B ↑x_2 ↑x_3) }
      m { val := z, property := hz } =
    0
⊢ bilin B y ↑m = 0

Next tactic:
exact m.2 y hy
/-- Kernel with image `(κ a).withDensity (f a)` if `Function.uncurry f` is measurable, and
with image 0 otherwise. If `Function.uncurry f` is measurable, it satisfies
`∫⁻ b, g b ∂(withDensity κ f hf a) = ∫⁻ b, f a b * g b ∂(κ a)`. -/
noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
    kernel α β :=
  @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf =>
    (⟨fun a => (κ a).withDensity (f a),
      by
        

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ✝ : ↥(kernel α β)
f✝ : α → β → ℝ≥0∞
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
f : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
⊢ (fun a => Measure.withDensity (κ a) (f a)) ∈ kernel α β

Next tactic:
refine' Measure.measurable_of_measurable_coe _ fun s hs => _
/-- Kernel with image `(κ a).withDensity (f a)` if `Function.uncurry f` is measurable, and
with image 0 otherwise. If `Function.uncurry f` is measurable, it satisfies
`∫⁻ b, g b ∂(withDensity κ f hf a) = ∫⁻ b, f a b * g b ∂(κ a)`. -/
noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
    kernel α β :=
  @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf =>
    (⟨fun a => (κ a).withDensity (f a),
      by
        refine' Measure.measurable_of_measurable_coe _ fun s hs => _
        

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ✝ : ↥(kernel α β)
f✝ : α → β → ℝ≥0∞
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
f : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
s : Set β
hs : MeasurableSet s
⊢ Measurable fun b => ↑↑(Measure.withDensity (κ b) (f b)) s

Next tactic:
simp_rw [withDensity_apply _ hs]
/-- Kernel with image `(κ a).withDensity (f a)` if `Function.uncurry f` is measurable, and
with image 0 otherwise. If `Function.uncurry f` is measurable, it satisfies
`∫⁻ b, g b ∂(withDensity κ f hf a) = ∫⁻ b, f a b * g b ∂(κ a)`. -/
noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
    kernel α β :=
  @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf =>
    (⟨fun a => (κ a).withDensity (f a),
      by
        refine' Measure.measurable_of_measurable_coe _ fun s hs => _
        simp_rw [withDensity_apply _ hs]
        

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
κ✝ : ↥(kernel α β)
f✝ : α → β → ℝ≥0∞
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
f : α → β → ℝ≥0∞
hf : Measurable (Function.uncurry f)
s : Set β
hs : MeasurableSet s
⊢ Measurable fun b => ∫⁻ (a : β) in s, f b a ∂κ b

Next tactic:
exact hf.set_lintegral_kernel_prod_right hs