Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 599240f

Browse files
committed
refactor(order/bounds): general cleanup (#14127)
Apart from golfing, this PR does the following: Add the following theorems (which are immediate from the non-self counterparts): - `monotone_on.mem_upper_bounds_image_self` - `monotone_on.mem_lower_bounds_image_self` - `antitone_on.mem_upper_bounds_image_self` - `antitone_on.mem_lower_bounds_image_self` Remove the following theorems (as they're just `mem_X_bounds_image` under unnecessarily stronger assumptions): - `monotone_on.is_lub_image_le` - `monotone_on.le_is_glb_image` - `antitone_on.is_lub_image_le` - `antitone_on.le_is_glb_image` - `monotone.is_lub_image_le` - `monotone.le_is_glb_image` - `antitone.is_lub_image_le` - `antitone.le_is_glb_image` Remove a redundant argument `s ⊆ t` from the following (the old theorems follow immediately from the new ones and `monotone_on.mono`): - `monotone_on.map_is_greatest` - `monotone_on.map_is_least` - `antitone_on.map_is_greatest` - `antitone_on.map_is_least`
1 parent bb90598 commit 599240f

File tree

2 files changed

+62
-93
lines changed

2 files changed

+62
-93
lines changed

src/order/bounds.lean

Lines changed: 60 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,7 @@ lemma is_lub.union [semilattice_sup γ] {a b : γ} {s t : set γ}
310310
(hs : is_lub s a) (ht : is_lub t b) :
311311
is_lub (s ∪ t) (a ⊔ b) :=
312312
⟨λ c h, h.cases_on (λ h, le_sup_of_le_left $ hs.left h) (λ h, le_sup_of_le_right $ ht.left h),
313-
assume c hc, sup_le
314-
(hs.right $ assume d hd, hc $ or.inl hd) (ht.right $ assume d hd, hc $ or.inr hd)⟩
313+
λ c hc, sup_le (hs.right $ λ d hd, hc $ or.inl hd) (ht.right $ λ d hd, hc $ or.inr hd)⟩
315314

316315
/-- If `a` is the greatest lower bound of `s` and `b` is the greatest lower bound of `t`,
317316
then `a ⊓ b` is the greatest lower bound of `s ∪ t`. -/
@@ -622,9 +621,7 @@ lemma is_lub_empty [preorder γ] [order_bot γ] : is_lub ∅ (⊥:γ) := @is_glb
622621

623622
lemma is_lub.nonempty [no_min_order α] (hs : is_lub s a) : s.nonempty :=
624623
let ⟨a', ha'⟩ := exists_lt a in
625-
ne_empty_iff_nonempty.1 $ assume h,
626-
have a ≤ a', from hs.right $ by simp only [h, upper_bounds_empty],
627-
not_le_of_lt ha' this
624+
ne_empty_iff_nonempty.1 $ λ h, not_le_of_lt ha' $ hs.right $ by simp only [h, upper_bounds_empty]
628625

629626
lemma is_glb.nonempty [no_max_order α] (hs : is_glb s a) : s.nonempty := hs.dual.nonempty
630627

@@ -682,11 +679,11 @@ by rw [insert_eq, lower_bounds_union, lower_bounds_singleton]
682679

683680
/-- When there is a global maximum, every set is bounded above. -/
684681
@[simp] protected lemma order_top.bdd_above [preorder γ] [order_top γ] (s : set γ) : bdd_above s :=
685-
⟨⊤, assume a ha, order_top.le_top a⟩
682+
⟨⊤, λ a ha, order_top.le_top a⟩
686683

687684
/-- When there is a global minimum, every set is bounded below. -/
688685
@[simp] protected lemma order_bot.bdd_below [preorder γ] [order_bot γ] (s : set γ) : bdd_below s :=
689-
⟨⊥, assume a ha, order_bot.bot_le a⟩
686+
⟨⊥, λ a ha, order_bot.bot_le a⟩
690687

691688
/-!
692689
#### Pair
@@ -750,13 +747,13 @@ lemma is_least.unique (Ha : is_least s a) (Hb : is_least s b) : a = b :=
750747
le_antisymm (Ha.right Hb.left) (Hb.right Ha.left)
751748

752749
lemma is_least.is_least_iff_eq (Ha : is_least s a) : is_least s b ↔ a = b :=
753-
iff.intro Ha.unique (assume h, h ▸ Ha)
750+
iff.intro Ha.unique (λ h, h ▸ Ha)
754751

755752
lemma is_greatest.unique (Ha : is_greatest s a) (Hb : is_greatest s b) : a = b :=
756753
le_antisymm (Hb.right Ha.left) (Ha.right Hb.left)
757754

758755
lemma is_greatest.is_greatest_iff_eq (Ha : is_greatest s a) : is_greatest s b ↔ a = b :=
759-
iff.intro Ha.unique (assume h, h ▸ Ha)
756+
iff.intro Ha.unique (λ h, h ▸ Ha)
760757

761758
lemma is_lub.unique (Ha : is_lub s a) (Hb : is_lub s b) : a = b :=
762759
Ha.unique Hb
@@ -839,17 +836,23 @@ namespace monotone_on
839836

840837
variables [preorder α] [preorder β] {f : α → β} {s t : set α}
841838
(Hf : monotone_on f t) {a : α} (Hst : s ⊆ t)
842-
include Hf Hst
839+
include Hf
843840

844841
lemma mem_upper_bounds_image (Has : a ∈ upper_bounds s) (Hat : a ∈ t) :
845842
f a ∈ upper_bounds (f '' s) :=
846-
ball_image_of_ball (assume x H, Hf (Hst H) Hat (Has H))
843+
ball_image_of_ball (λ x H, Hf (Hst H) Hat (Has H))
844+
845+
lemma mem_upper_bounds_image_self : a ∈ upper_bounds t → a ∈ t → f a ∈ upper_bounds (f '' t) :=
846+
Hf.mem_upper_bounds_image subset_rfl
847847

848848
lemma mem_lower_bounds_image (Has : a ∈ lower_bounds s) (Hat : a ∈ t) :
849849
f a ∈ lower_bounds (f '' s) :=
850-
ball_image_of_ball (assume x H, Hf Hat (Hst H) (Has H))
850+
ball_image_of_ball (λ x H, Hf Hat (Hst H) (Has H))
851+
852+
lemma mem_lower_bounds_image_self : a ∈ lower_bounds t → a ∈ t → f a ∈ lower_bounds (f '' t) :=
853+
Hf.mem_lower_bounds_image subset_rfl
851854

852-
lemma image_upper_bounds_subset_upper_bounds_image :
855+
lemma image_upper_bounds_subset_upper_bounds_image (Hst : s ⊆ t) :
853856
f '' (upper_bounds s ∩ t) ⊆ upper_bounds (f '' s) :=
854857
by { rintro _ ⟨a, ha, rfl⟩, exact Hf.mem_upper_bounds_image Hst ha.1 ha.2 }
855858

@@ -868,36 +871,32 @@ lemma map_bdd_below : (lower_bounds s ∩ t).nonempty → bdd_below (f '' s) :=
868871
λ ⟨C, hs, ht⟩, ⟨f C, Hf.mem_lower_bounds_image Hst hs ht⟩
869872

870873
/-- A monotone map sends a least element of a set to a least element of its image. -/
871-
lemma map_is_least (Ha : is_least s a) : is_least (f '' s) (f a) :=
872-
⟨mem_image_of_mem _ Ha.1, Hf.mem_lower_bounds_image Hst Ha.2 (Hst Ha.1)
874+
lemma map_is_least (Ha : is_least t a) : is_least (f '' t) (f a) :=
875+
⟨mem_image_of_mem _ Ha.1, Hf.mem_lower_bounds_image_self Ha.2 Ha.1
873876

874877
/-- A monotone map sends a greatest element of a set to a greatest element of its image. -/
875-
lemma map_is_greatest (Ha : is_greatest s a) : is_greatest (f '' s) (f a) :=
876-
⟨mem_image_of_mem _ Ha.1, Hf.mem_upper_bounds_image Hst Ha.2 (Hst Ha.1)⟩
877-
878-
lemma is_lub_image_le (Ha : is_lub s a) (Hat : a ∈ t) {b : β} (Hb : is_lub (f '' s) b) :
879-
b ≤ f a :=
880-
Hb.2 (Hf.mem_upper_bounds_image Hst Ha.1 Hat)
881-
882-
lemma le_is_glb_image (Ha : is_glb s a) (Hat : a ∈ t) {b : β} (Hb : is_glb (f '' s) b) :
883-
f a ≤ b :=
884-
Hb.2 (Hf.mem_lower_bounds_image Hst Ha.1 Hat)
878+
lemma map_is_greatest (Ha : is_greatest t a) : is_greatest (f '' t) (f a) :=
879+
⟨mem_image_of_mem _ Ha.1, Hf.mem_upper_bounds_image_self Ha.2 Ha.1
885880

886881
end monotone_on
887882

888883
namespace antitone_on
889884

890885
variables [preorder α] [preorder β] {f : α → β} {s t : set α}
891886
(Hf : antitone_on f t) {a : α} (Hst : s ⊆ t)
892-
include Hf Hst
887+
include Hf
893888

894-
lemma mem_upper_bounds_image (Has : a ∈ lower_bounds s) (Hat : a ∈ t) :
895-
f a ∈ upper_bounds (f '' s) :=
896-
Hf.dual_right.mem_lower_bounds_image Hst Has Hat
889+
lemma mem_upper_bounds_image (Has : a ∈ lower_bounds s) : a ∈ t → f a ∈ upper_bounds (f '' s) :=
890+
Hf.dual_right.mem_lower_bounds_image Hst Has
897891

898-
lemma mem_lower_bounds_image (Has : a ∈ upper_bounds s) (Hat : a ∈ t) :
899-
f a ∈ lower_bounds (f '' s) :=
900-
Hf.dual_right.mem_upper_bounds_image Hst Has Hat
892+
lemma mem_upper_bounds_image_self : a ∈ lower_bounds t → a ∈ t → f a ∈ upper_bounds (f '' t) :=
893+
Hf.dual_right.mem_lower_bounds_image_self
894+
895+
lemma mem_lower_bounds_image : a ∈ upper_bounds s → a ∈ t → f a ∈ lower_bounds (f '' s) :=
896+
Hf.dual_right.mem_upper_bounds_image Hst
897+
898+
lemma mem_lower_bounds_image_self : a ∈ upper_bounds t → a ∈ t → f a ∈ lower_bounds (f '' t) :=
899+
Hf.dual_right.mem_upper_bounds_image_self
901900

902901
lemma image_lower_bounds_subset_upper_bounds_image :
903902
f '' (lower_bounds s ∩ t) ⊆ upper_bounds (f '' s) :=
@@ -916,51 +915,39 @@ lemma map_bdd_below : (lower_bounds s ∩ t).nonempty → bdd_above (f '' s) :=
916915
Hf.dual_right.map_bdd_below Hst
917916

918917
/-- An antitone map sends a greatest element of a set to a least element of its image. -/
919-
lemma map_is_greatest (Ha : is_greatest s a) : is_least (f '' s) (f a) :=
920-
Hf.dual_right.map_is_greatest Hst Ha
918+
lemma map_is_greatest : is_greatest t a → is_least (f '' t) (f a) :=
919+
Hf.dual_right.map_is_greatest
921920

922921
/-- An antitone map sends a least element of a set to a greatest element of its image. -/
923-
lemma map_is_least (Ha : is_least s a) : is_greatest (f '' s) (f a) :=
924-
Hf.dual_right.map_is_least Hst Ha
925-
926-
lemma is_lub_image_le (Ha : is_glb s a) (Hat : a ∈ t) {b : β} (Hb : is_lub (f '' s) b) : b ≤ f a :=
927-
Hf.dual_left.is_lub_image_le Hst Ha Hat Hb
928-
929-
lemma le_is_glb_image (Ha : is_lub s a) (Hat : a ∈ t) {b : β} (Hb : is_glb (f '' s) b) : f a ≤ b :=
930-
Hf.dual_left.le_is_glb_image Hst Ha Hat Hb
922+
lemma map_is_least : is_least t a → is_greatest (f '' t) (f a) :=
923+
Hf.dual_right.map_is_least
931924

932925
end antitone_on
933926

934927
namespace monotone
935928

936929
variables [preorder α] [preorder β] {f : α → β} (Hf : monotone f) {a : α} {s : set α}
930+
include Hf
937931

938-
lemma mem_upper_bounds_image (Ha : a ∈ upper_bounds s) :
939-
f a ∈ upper_bounds (f '' s) :=
940-
ball_image_of_ball (assume x H, Hf (Ha ‹x ∈ s›))
932+
lemma mem_upper_bounds_image (Ha : a ∈ upper_bounds s) : f a ∈ upper_bounds (f '' s) :=
933+
ball_image_of_ball (λ x H, Hf (Ha H))
941934

942-
lemma mem_lower_bounds_image (Ha : a ∈ lower_bounds s) :
943-
f a ∈ lower_bounds (f '' s) :=
944-
ball_image_of_ball (assume x H, Hf (Ha ‹x ∈ s›))
935+
lemma mem_lower_bounds_image (Ha : a ∈ lower_bounds s) : f a ∈ lower_bounds (f '' s) :=
936+
ball_image_of_ball (λ x H, Hf (Ha H))
945937

946-
lemma image_upper_bounds_subset_upper_bounds_image (hf : monotone f) :
947-
f '' upper_bounds s ⊆ upper_bounds (f '' s) :=
948-
begin
949-
rintro _ ⟨a, ha, rfl⟩,
950-
exact hf.mem_upper_bounds_image ha,
951-
end
938+
lemma image_upper_bounds_subset_upper_bounds_image : f '' upper_bounds s ⊆ upper_bounds (f '' s) :=
939+
by { rintro _ ⟨a, ha, rfl⟩, exact Hf.mem_upper_bounds_image ha }
952940

953-
lemma image_lower_bounds_subset_lower_bounds_image (hf : monotone f) :
954-
f '' lower_bounds s ⊆ lower_bounds (f '' s) :=
955-
hf.dual.image_upper_bounds_subset_upper_bounds_image
941+
lemma image_lower_bounds_subset_lower_bounds_image : f '' lower_bounds s ⊆ lower_bounds (f '' s) :=
942+
Hf.dual.image_upper_bounds_subset_upper_bounds_image
956943

957944
/-- The image under a monotone function of a set which is bounded above is bounded above. -/
958-
lemma map_bdd_above (hf : monotone f) : bdd_above s → bdd_above (f '' s)
959-
| ⟨C, hC⟩ := ⟨f C, hf.mem_upper_bounds_image hC⟩
945+
lemma map_bdd_above : bdd_above s → bdd_above (f '' s)
946+
| ⟨C, hC⟩ := ⟨f C, Hf.mem_upper_bounds_image hC⟩
960947

961948
/-- The image under a monotone function of a set which is bounded below is bounded below. -/
962-
lemma map_bdd_below (hf : monotone f) : bdd_below s → bdd_below (f '' s)
963-
| ⟨C, hC⟩ := ⟨f C, hf.mem_lower_bounds_image hC⟩
949+
lemma map_bdd_below : bdd_below s → bdd_below (f '' s)
950+
| ⟨C, hC⟩ := ⟨f C, Hf.mem_lower_bounds_image hC⟩
964951

965952
/-- A monotone map sends a least element of a set to a least element of its image. -/
966953
lemma map_is_least (Ha : is_least s a) : is_least (f '' s) (f a) :=
@@ -970,56 +957,38 @@ lemma map_is_least (Ha : is_least s a) : is_least (f '' s) (f a) :=
970957
lemma map_is_greatest (Ha : is_greatest s a) : is_greatest (f '' s) (f a) :=
971958
⟨mem_image_of_mem _ Ha.1, Hf.mem_upper_bounds_image Ha.2
972959

973-
lemma is_lub_image_le (Ha : is_lub s a) {b : β} (Hb : is_lub (f '' s) b) :
974-
b ≤ f a :=
975-
Hb.2 (Hf.mem_upper_bounds_image Ha.1)
976-
977-
lemma le_is_glb_image (Ha : is_glb s a) {b : β} (Hb : is_glb (f '' s) b) :
978-
f a ≤ b :=
979-
Hb.2 (Hf.mem_lower_bounds_image Ha.1)
980-
981960
end monotone
982961

983962
namespace antitone
984963
variables [preorder α] [preorder β] {f : α → β} (hf : antitone f) {a : α} {s : set α}
985964

986-
lemma mem_upper_bounds_image (ha : a ∈ lower_bounds s) :
987-
f a ∈ upper_bounds (f '' s) :=
988-
hf.dual_right.mem_lower_bounds_image ha
965+
lemma mem_upper_bounds_image : a ∈ lower_bounds s → f a ∈ upper_bounds (f '' s) :=
966+
hf.dual_right.mem_lower_bounds_image
989967

990-
lemma mem_lower_bounds_image (ha : a ∈ upper_bounds s) :
991-
f a ∈ lower_bounds (f '' s) :=
992-
hf.dual_right.mem_upper_bounds_image ha
968+
lemma mem_lower_bounds_image : a ∈ upper_bounds s → f a ∈ lower_bounds (f '' s) :=
969+
hf.dual_right.mem_upper_bounds_image
993970

994-
lemma image_lower_bounds_subset_upper_bounds_image (hf : antitone f) :
995-
f '' lower_bounds s ⊆ upper_bounds (f '' s) :=
971+
lemma image_lower_bounds_subset_upper_bounds_image : f '' lower_bounds s ⊆ upper_bounds (f '' s) :=
996972
hf.dual_right.image_lower_bounds_subset_lower_bounds_image
997973

998-
lemma image_upper_bounds_subset_lower_bounds_image (hf : antitone f) :
999-
f '' upper_bounds s ⊆ lower_bounds (f '' s) :=
974+
lemma image_upper_bounds_subset_lower_bounds_image : f '' upper_bounds s ⊆ lower_bounds (f '' s) :=
1000975
hf.dual_right.image_upper_bounds_subset_upper_bounds_image
1001976

1002977
/-- The image under an antitone function of a set which is bounded above is bounded below. -/
1003-
lemma map_bdd_above (hf : antitone f) : bdd_above s → bdd_below (f '' s) :=
978+
lemma map_bdd_above : bdd_above s → bdd_below (f '' s) :=
1004979
hf.dual_right.map_bdd_above
1005980

1006981
/-- The image under an antitone function of a set which is bounded below is bounded above. -/
1007-
lemma map_bdd_below (hf : antitone f) : bdd_below s → bdd_above (f '' s) :=
982+
lemma map_bdd_below : bdd_below s → bdd_above (f '' s) :=
1008983
hf.dual_right.map_bdd_below
1009984

1010985
/-- An antitone map sends a greatest element of a set to a least element of its image. -/
1011-
lemma map_is_greatest (ha : is_greatest s a) : is_least (f '' s) (f a) :=
1012-
hf.dual_right.map_is_greatest ha
986+
lemma map_is_greatest : is_greatest s a is_least (f '' s) (f a) :=
987+
hf.dual_right.map_is_greatest
1013988

1014989
/-- An antitone map sends a least element of a set to a greatest element of its image. -/
1015-
lemma map_is_least (ha : is_least s a) : is_greatest (f '' s) (f a) :=
1016-
hf.dual_right.map_is_least ha
1017-
1018-
lemma is_lub_image_le (ha : is_glb s a) {b : β} (hb : is_lub (f '' s) b) : b ≤ f a :=
1019-
hf.dual_left.is_lub_image_le ha hb
1020-
1021-
lemma le_is_glb_image (ha : is_lub s a) {b : β} (hb : is_glb (f '' s) b) : f a ≤ b :=
1022-
hf.dual_left.le_is_glb_image ha hb
990+
lemma map_is_least : is_least s a → is_greatest (f '' s) (f a) :=
991+
hf.dual_right.map_is_least
1023992

1024993
end antitone
1025994

src/order/galois_connection.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ def lift_complete_lattice [complete_lattice α] (gi : galois_insertion l u) : co
522522
{ Sup := λ s, l (Sup (u '' s)),
523523
Sup_le := λ s, (gi.is_lub_of_u_image (is_lub_Sup _)).2,
524524
le_Sup := λ s, (gi.is_lub_of_u_image (is_lub_Sup _)).1,
525-
Inf := λ s, gi.choice (Inf (u '' s)) $ gi.gc.monotone_u.le_is_glb_image
526-
(gi.is_glb_of_u_image $ is_glb_Inf _) (is_glb_Inf _),
525+
Inf := λ s, gi.choice (Inf (u '' s)) $ (is_glb_Inf _).2 $ gi.gc.monotone_u.mem_lower_bounds_image
526+
(gi.is_glb_of_u_image $ is_glb_Inf _).1,
527527
Inf_le := λ s, by { rw gi.choice_eq, exact (gi.is_glb_of_u_image (is_glb_Inf _)).1 },
528528
le_Inf := λ s, by { rw gi.choice_eq, exact (gi.is_glb_of_u_image (is_glb_Inf _)).2 },
529529
.. gi.lift_bounded_order,

0 commit comments

Comments
 (0)