Skip to content

Commit

Permalink
feat(logic/nontrivial): function.injective.exists_ne (#3983)
Browse files Browse the repository at this point in the history
Add a lemma that an injective function from a nontrivial type has an
argument at which it does not take a given value.
  • Loading branch information
jsm28 committed Aug 30, 2020
1 parent 942c779 commit 1073204
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/logic/nontrivial.lean
Expand Up @@ -118,3 +118,14 @@ begin
have : x' ≠ y', by { contrapose! h, rw [← hx', ← hy', h] },
exact ⟨⟨x', y', this⟩⟩
end

/-- An injective function from a nontrivial type has an argument at
which it does not take a given value. -/
protected lemma function.injective.exists_ne [nontrivial α] {f : α → β}
(hf : function.injective f) (y : β) : ∃ x, f x ≠ y :=
begin
rcases exists_pair_ne α with ⟨x₁, x₂, hx⟩,
by_cases h : f x₂ = y,
{ exact ⟨x₁, (hf.ne_iff' h).2 hx⟩ },
{ exact ⟨x₂, h⟩ }
end

0 comments on commit 1073204

Please sign in to comment.