Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(data/finset): not_mem theorems #44

Closed
wants to merge 1 commit into from

Conversation

spl
Copy link
Collaborator

@spl spl commented Feb 8, 2018

These are some theorems I've been using that involve not being a member () of a finset.

variables {s s₁ s₂ : finset α} [decidable_eq α] {a b : α}

theorem ne_of_mem_of_not_mem (h_mem : a ∈ s) (h_not_mem : b ∉ s) : a ≠ b :=
ne_of_mem_erase (@@eq.substr _ (erase_insert h_not_mem) h_mem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know, this can be proved for literally anything that has a has_mem, it has nothing to do with finsets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. For whatever reason that didn't occur to me before.

theorem ne_of_mem_of_not_mem {A S : Type} [has_mem A S] {a b : A} {s : S} (h_mem : a ∈ s) (h_not_mem : b ∉ s) : a ≠ b :=
λ p : a = b, by subst p; contradiction

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it, does this not already exist somewhere?

theorem ne_of_p_of_not_p {A : Type} {a b : A} (P : A → Prop) (pa : P a) (npb : ¬ P b) : a ≠ b :=
λ h, by subst h; contradiction

theorem ne_of_mem_of_not_mem {A S : Type} [has_mem A S] {a b : A} {s : S} : a ∈ s → b ∉ s → a ≠ b :=
ne_of_p_of_not_p (λ a : A, a ∈ s)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know how you'd like the PR changed. I can add the above two theorems, though they would not naturally go into data/finset.lean.

digama0 added a commit that referenced this pull request Feb 9, 2018
@digama0
Copy link
Member

digama0 commented Feb 9, 2018

Added in 6ef721e

@digama0 digama0 closed this Feb 9, 2018
@spl spl deleted the finset_not_mem branch February 12, 2018 12:13
johoelzl pushed a commit to johoelzl/mathlib that referenced this pull request Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants