Skip to content

Commit

Permalink
chore(Order/RelIso): golf, fix NS (#7114)
Browse files Browse the repository at this point in the history
* Rename `Surjective.wellFounded_iff` to
  `Function.Surjective.wellFounded_iff`.
* Golf the proof.
  • Loading branch information
urkud committed Sep 12, 2023
1 parent bf815bd commit 198327e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
14 changes: 4 additions & 10 deletions Mathlib/Order/RelIso/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,14 @@ theorem RelHom.injective_of_increasing [IsTrichotomous α r] [IsIrrefl β s] (f
_root_.injective_of_increasing r s f f.map_rel
#align rel_hom.injective_of_increasing RelHom.injective_of_increasing

-- TODO: define a `RelIffClass` so we don't have to do all the `convert` trickery?
theorem Surjective.wellFounded_iff {f : α → β} (hf : Surjective f)
theorem Function.Surjective.wellFounded_iff {f : α → β} (hf : Surjective f)
(o : ∀ {a b}, r a b ↔ s (f a) (f b)) :
WellFounded r ↔ WellFounded s :=
Iff.intro
(by
refine RelHomClass.wellFounded (RelHom.mk ?_ ?_ : s →r r)
· exact Classical.choose hf.hasRightInverse
intro a b h
apply o.2
convert h
iterate 2 apply Classical.choose_spec hf.hasRightInverse)
(RelHomClass.wellFounded (⟨surjInv hf,
fun h => by simpa only [o, surjInv_eq hf] using h⟩ : s →r r))
(RelHomClass.wellFounded (⟨f, o.1⟩ : r →r s))
#align surjective.well_founded_iff Surjective.wellFounded_iff
#align surjective.well_founded_iff Function.Surjective.wellFounded_iff

/-- A relation embedding with respect to a given pair of relations `r` and `s`
is an embedding `f : α ↪ β` such that `r a b ↔ s (f a) (f b)`. -/
Expand Down
12 changes: 3 additions & 9 deletions Mathlib/RingTheory/UniqueFactorizationDomain.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,14 @@ variable [CommMonoidWithZero α]

open Associates Nat

theorem of_wfDvdMonoid_associates (h : WfDvdMonoid (Associates α)) : WfDvdMonoid α :=
by
refine' (Surjective.wellFounded_iff mk_surjective _).2 wellFounded_dvdNotUnit
intros
rw [mk_dvdNotUnit_mk_iff]⟩
theorem of_wfDvdMonoid_associates (_ : WfDvdMonoid (Associates α)) : WfDvdMonoid α :=
⟨(mk_surjective.wellFounded_iff mk_dvdNotUnit_mk_iff.symm).2 wellFounded_dvdNotUnit⟩
#align wf_dvd_monoid.of_wf_dvd_monoid_associates WfDvdMonoid.of_wfDvdMonoid_associates

variable [WfDvdMonoid α]

instance wfDvdMonoid_associates : WfDvdMonoid (Associates α) :=
by
refine' (Surjective.wellFounded_iff mk_surjective _).1 wellFounded_dvdNotUnit
intros
rw [mk_dvdNotUnit_mk_iff]⟩
⟨(mk_surjective.wellFounded_iff mk_dvdNotUnit_mk_iff.symm).1 wellFounded_dvdNotUnit⟩
#align wf_dvd_monoid.wf_dvd_monoid_associates WfDvdMonoid.wfDvdMonoid_associates

theorem wellFounded_associates : WellFounded ((· < ·) : Associates α → Associates α → Prop) :=
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Topology/NoetherianSpace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ theorem noetherianSpace_TFAE :
∀ s : Set α, IsCompact s,
∀ s : Opens α, IsCompact (s : Set α)] := by
tfae_have 12
· refine' (noetherianSpace_iff α).trans (Surjective.wellFounded_iff Opens.compl_bijective.2 _)
· refine' (noetherianSpace_iff α).trans (Opens.compl_bijective.2.wellFounded_iff _)
exact (@OrderIso.compl (Set α)).lt_iff_lt.symm
tfae_have 14
· exact noetherianSpace_iff_opens α
Expand Down

0 comments on commit 198327e

Please sign in to comment.