Skip to content

Commit

Permalink
feat(linear_algebra/affine_space/affine_subspace): prove that a set w…
Browse files Browse the repository at this point in the history
…hose affine span is top cannot be empty. (#9113)



The lemma `finset.card_sdiff_add_card` is unrelated but I've been meaning to add it
and now seemed like a good time since I'm touching `data/finset/basic.lean` anyway.
  • Loading branch information
ocfnash committed Sep 22, 2021
1 parent f59dbf2 commit b77aa3a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/data/finset/basic.lean
Expand Up @@ -313,6 +313,8 @@ protected def nonempty (s : finset α) : Prop := ∃ x:α, x ∈ s

@[simp, norm_cast] lemma coe_nonempty {s : finset α} : (s:set α).nonempty ↔ s.nonempty := iff.rfl

@[simp] lemma nonempty_coe_sort (s : finset α) : nonempty ↥s ↔ s.nonempty := nonempty_subtype

alias coe_nonempty ↔ _ finset.nonempty.to_set

lemma nonempty.bex {s : finset α} (h : s.nonempty) : ∃ x:α, x ∈ s := h
Expand Down Expand Up @@ -2862,6 +2864,9 @@ theorem card_sdiff {s t : finset α} (h : s ⊆ t) : card (t \ s) = card t - car
suffices card (t \ s) = card ((t \ s) ∪ s) - card s, by rwa sdiff_union_of_subset h at this,
by rw [card_disjoint_union sdiff_disjoint, nat.add_sub_cancel]

lemma card_sdiff_add_card {s t : finset α} : (s \ t).card + t.card = (s ∪ t).card :=
by rw [← card_disjoint_union sdiff_disjoint, sdiff_union_self_eq_union]

lemma disjoint_filter {s : finset α} {p q : α → Prop} [decidable_pred p] [decidable_pred q] :
disjoint (s.filter p) (s.filter q) ↔ (∀ x ∈ s, p x → ¬ q x) :=
by split; simp [disjoint_left] {contextual := tt}
Expand Down
2 changes: 2 additions & 0 deletions src/data/set/basic.lean
Expand Up @@ -291,6 +291,8 @@ in theorem assumptions instead of `∃ x, x ∈ s` or `s ≠ ∅` as it gives ac
to the dot notation. -/
protected def nonempty (s : set α) : Prop := ∃ x, x ∈ s

@[simp] lemma nonempty_coe_sort (s : set α) : nonempty ↥s ↔ s.nonempty := nonempty_subtype

lemma nonempty_def : s.nonempty ↔ ∃ x, x ∈ s := iff.rfl

lemma nonempty_of_mem {x} (h : x ∈ s) : s.nonempty := ⟨x, h⟩
Expand Down
19 changes: 19 additions & 0 deletions src/linear_algebra/affine_space/affine_subspace.lean
Expand Up @@ -351,6 +351,10 @@ begin
exact h
end

@[simp] lemma ext_iff (s₁ s₂ : affine_subspace k P) :
(s₁ : set P) = s₂ ↔ s₁ = s₂ :=
⟨ext, by tidy⟩

/-- Two affine subspaces with the same direction and nonempty
intersection are equal. -/
lemma ext_of_direction_eq {s1 s2 : affine_subspace k P} (hd : s1.direction = s2.direction)
Expand Down Expand Up @@ -667,6 +671,21 @@ end
@[simp] lemma bot_coe : ((⊥ : affine_subspace k P) : set P) = ∅ :=
rfl

lemma bot_ne_top : (⊥ : affine_subspace k P) ≠ ⊤ :=
begin
intros contra,
rw [← ext_iff, bot_coe, top_coe] at contra,
exact set.empty_ne_univ contra,
end

lemma nonempty_of_affine_span_eq_top {s : set P} (h : affine_span k s = ⊤) : s.nonempty :=
begin
rw ← set.ne_empty_iff_nonempty,
rintros rfl,
rw affine_subspace.span_empty at h,
exact bot_ne_top k V P h,
end

variables {P}

/-- No points are in `⊥`. -/
Expand Down

0 comments on commit b77aa3a

Please sign in to comment.