Skip to content

Commit

Permalink
feat(data/set/function): add lemmas about set.restrict (#15605)
Browse files Browse the repository at this point in the history
From the sphere eversion project.

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
  • Loading branch information
urkud and fpvandoorn committed Jul 22, 2022
1 parent 8ad82e4 commit 6b93ea7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/data/set/function.lean
Expand Up @@ -48,6 +48,14 @@ lemma restrict_eq (f : α → β) (s : set α) : s.restrict f = f ∘ coe := rfl

@[simp] lemma restrict_apply (f : α → β) (s : set α) (x : s) : s.restrict f x = f x := rfl

lemma restrict_eq_iff {f : Π a, π a} {s : set α} {g : Π a : s, π a} :
restrict s f = g ↔ ∀ a (ha : a ∈ s), f a = g ⟨a, ha⟩ :=
funext_iff.trans subtype.forall

lemma eq_restrict_iff {s : set α} {f : Π a : s, π a} {g : Π a, π a} :
f = restrict s g ↔ ∀ a (ha : a ∈ s), f ⟨a, ha⟩ = g a :=
funext_iff.trans subtype.forall

@[simp] lemma range_restrict (f : α → β) (s : set α) : set.range (s.restrict f) = f '' s :=
(range_comp _ _).trans $ congr_arg (('') f) subtype.range_coe

Expand Down Expand Up @@ -134,6 +142,9 @@ def eq_on (f₁ f₂ : α → β) (s : set α) : Prop :=

@[simp] lemma eq_on_empty (f₁ f₂ : α → β) : eq_on f₁ f₂ ∅ := λ x, false.elim

@[simp] lemma restrict_eq_restrict_iff : restrict s f₁ = restrict s f₂ ↔ eq_on f₁ f₂ s :=
restrict_eq_iff

@[symm] lemma eq_on.symm (h : eq_on f₁ f₂ s) : eq_on f₂ f₁ s :=
λ x hx, (h hx).symm

Expand Down

0 comments on commit 6b93ea7

Please sign in to comment.