@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Sébastien Gouëzel
5
5
-/
6
6
import data.nat.enat
7
+ import data.set.intervals.ord_connected
7
8
8
9
/-!
9
10
# Theory of conditionally complete lattices.
@@ -607,6 +608,30 @@ instance (α : Type*) [conditionally_complete_linear_order α] :
607
608
608
609
end order_dual
609
610
611
+ namespace monotone
612
+ variables [preorder α] [conditionally_complete_lattice β] {f : α → β} (h_mono : monotone f)
613
+
614
+ /-! A monotone function into a conditionally complete lattice preserves the ordering properties of
615
+ `Sup` and `Inf`. -/
616
+
617
+ lemma le_cSup_image {s : set α} {c : α} (hcs : c ∈ s) (h_bdd : bdd_above s) :
618
+ f c ≤ Sup (f '' s) :=
619
+ le_cSup (map_bdd_above h_mono h_bdd) (mem_image_of_mem f hcs)
620
+
621
+ lemma cSup_image_le {s : set α} (hs : s.nonempty) {B : α} (hB: B ∈ upper_bounds s) :
622
+ Sup (f '' s) ≤ f B :=
623
+ cSup_le (nonempty.image f hs) (h_mono.mem_upper_bounds_image hB)
624
+
625
+ lemma cInf_image_le {s : set α} {c : α} (hcs : c ∈ s) (h_bdd : bdd_below s) :
626
+ Inf (f '' s) ≤ f c :=
627
+ @le_cSup_image (order_dual α) (order_dual β) _ _ _ (λ x y hxy, h_mono hxy) _ _ hcs h_bdd
628
+
629
+ lemma le_cInf_image {s : set α} (hs : s.nonempty) {B : α} (hB: B ∈ lower_bounds s) :
630
+ f B ≤ Inf (f '' s) :=
631
+ @cSup_image_le (order_dual α) (order_dual β) _ _ _ (λ x y hxy, h_mono hxy) _ hs _ hB
632
+
633
+ end monotone
634
+
610
635
section with_top_bot
611
636
612
637
/-!
@@ -692,3 +717,141 @@ noncomputable instance with_top.with_bot.complete_lattice {α : Type*}
692
717
..with_top.with_bot.bounded_lattice }
693
718
694
719
end with_top_bot
720
+
721
+ section subtype
722
+ variables (s : set α)
723
+
724
+ /-! ### Subtypes of conditionally complete linear orders
725
+
726
+ In this section we give conditions on a subset of a conditionally complete linear order, to ensure
727
+ that the subtype is itself conditionally complete.
728
+
729
+ We check that an `ord_connected` set satisfies these conditions.
730
+
731
+ TODO There are several possible variants; the `conditionally_complete_linear_order` could be changed
732
+ to `conditionally_complete_linear_order_bot` or `complete_linear_order`.
733
+ -/
734
+
735
+ open_locale classical
736
+
737
+ section has_Sup
738
+ variables [has_Sup α]
739
+
740
+ /-- `has_Sup` structure on a nonempty subset `s` of an object with `has_Sup`. This definition is
741
+ non-canonical (it uses `default s`); it should be used only as here, as an auxiliary instance in the
742
+ construction of the `conditionally_complete_linear_order` structure. -/
743
+ noncomputable def subset_has_Sup [inhabited s] : has_Sup s := {Sup := λ t,
744
+ if ht : Sup (coe '' t : set α) ∈ s then ⟨Sup (coe '' t : set α), ht⟩ else default s}
745
+
746
+ local attribute [instance] subset_has_Sup
747
+
748
+ @[simp] lemma subset_Sup_def [inhabited s] :
749
+ @Sup s _ = λ t,
750
+ if ht : Sup (coe '' t : set α) ∈ s then ⟨Sup (coe '' t : set α), ht⟩ else default s :=
751
+ rfl
752
+
753
+ lemma subset_Sup_of_within [inhabited s] {t : set s} (h : Sup (coe '' t : set α) ∈ s) :
754
+ Sup (coe '' t : set α) = (@Sup s _ t : α) :=
755
+ by simp [dif_pos h]
756
+
757
+ end has_Sup
758
+
759
+ section has_Inf
760
+ variables [has_Inf α]
761
+
762
+ /-- `has_Inf` structure on a nonempty subset `s` of an object with `has_Inf`. This definition is
763
+ non-canonical (it uses `default s`); it should be used only as here, as an auxiliary instance in the
764
+ construction of the `conditionally_complete_linear_order` structure. -/
765
+ noncomputable def subset_has_Inf [inhabited s] : has_Inf s := {Inf := λ t,
766
+ if ht : Inf (coe '' t : set α) ∈ s then ⟨Inf (coe '' t : set α), ht⟩ else default s}
767
+
768
+ local attribute [instance] subset_has_Inf
769
+
770
+ @[simp] lemma subset_Inf_def [inhabited s] :
771
+ @Inf s _ = λ t,
772
+ if ht : Inf (coe '' t : set α) ∈ s then ⟨Inf (coe '' t : set α), ht⟩ else default s :=
773
+ rfl
774
+
775
+ lemma subset_Inf_of_within [inhabited s] {t : set s} (h : Inf (coe '' t : set α) ∈ s) :
776
+ Inf (coe '' t : set α) = (@Inf s _ t : α) :=
777
+ by simp [dif_pos h]
778
+
779
+ end has_Inf
780
+
781
+ variables [conditionally_complete_linear_order α]
782
+
783
+ local attribute [instance] subset_has_Sup
784
+ local attribute [instance] subset_has_Inf
785
+
786
+ /-- For a nonempty subset of a conditionally complete linear order to be a conditionally complete
787
+ linear order, it suffices that it contain the `Sup` of all its nonempty bounded-above subsets, and
788
+ the `Inf` of all its nonempty bounded-below subsets. -/
789
+ noncomputable def subset_conditionally_complete_linear_order [inhabited s]
790
+ (h_Sup : ∀ {t : set s} (ht : t.nonempty) (h_bdd : bdd_above t), Sup (coe '' t : set α) ∈ s)
791
+ (h_Inf : ∀ {t : set s} (ht : t.nonempty) (h_bdd : bdd_below t), Inf (coe '' t : set α) ∈ s) :
792
+ conditionally_complete_linear_order s :=
793
+ { le_cSup := begin
794
+ rintros t c h_bdd hct,
795
+ -- The following would be a more natural way to finish, but gives a "deep recursion" error:
796
+ -- simpa [subset_Sup_of_within (h_Sup t)] using (strict_mono_coe s).monotone.le_cSup_image hct h_bdd,
797
+ have := (strict_mono_coe s).monotone.le_cSup_image hct h_bdd,
798
+ rwa subset_Sup_of_within s (h_Sup ⟨c, hct⟩ h_bdd) at this ,
799
+ end ,
800
+ cSup_le := begin
801
+ rintros t B ht hB,
802
+ have := (strict_mono_coe s).monotone.cSup_image_le ht hB,
803
+ rwa subset_Sup_of_within s (h_Sup ht ⟨B, hB⟩) at this ,
804
+ end ,
805
+ le_cInf := begin
806
+ intros t B ht hB,
807
+ have := (strict_mono_coe s).monotone.le_cInf_image ht hB,
808
+ rwa subset_Inf_of_within s (h_Inf ht ⟨B, hB⟩) at this ,
809
+ end ,
810
+ cInf_le := begin
811
+ rintros t c h_bdd hct,
812
+ have := (strict_mono_coe s).monotone.cInf_image_le hct h_bdd,
813
+ rwa subset_Inf_of_within s (h_Inf ⟨c, hct⟩ h_bdd) at this ,
814
+ end ,
815
+ ..subset_has_Sup s,
816
+ ..subset_has_Inf s,
817
+ ..distrib_lattice.to_lattice s,
818
+ ..classical.DLO s }
819
+
820
+ section ord_connected
821
+
822
+ /-- The `Sup` function on a nonempty `ord_connected` set `s` in a conditionally complete linear
823
+ order takes values within `s`, for all nonempty bounded-above subsets of `s`. -/
824
+ lemma Sup_within_of_ord_connected
825
+ {s : set α} [hs : ord_connected s] ⦃t : set s⦄ (ht : t.nonempty) (h_bdd : bdd_above t) :
826
+ Sup (coe '' t : set α) ∈ s :=
827
+ begin
828
+ obtain ⟨c, hct⟩ : ∃ c, c ∈ t := ht,
829
+ obtain ⟨B, hB⟩ : ∃ B, B ∈ upper_bounds t := h_bdd,
830
+ refine hs c.2 B.2 ⟨_, _⟩,
831
+ { exact (strict_mono_coe s).monotone.le_cSup_image hct ⟨B, hB⟩ },
832
+ { exact (strict_mono_coe s).monotone.cSup_image_le ⟨c, hct⟩ hB },
833
+ end
834
+
835
+ /-- The `Inf` function on a nonempty `ord_connected` set `s` in a conditionally complete linear
836
+ order takes values within `s`, for all nonempty bounded-below subsets of `s`. -/
837
+ lemma Inf_within_of_ord_connected
838
+ {s : set α} [hs : ord_connected s] ⦃t : set s⦄ (ht : t.nonempty) (h_bdd : bdd_below t) :
839
+ Inf (coe '' t : set α) ∈ s :=
840
+ begin
841
+ obtain ⟨c, hct⟩ : ∃ c, c ∈ t := ht,
842
+ obtain ⟨B, hB⟩ : ∃ B, B ∈ lower_bounds t := h_bdd,
843
+ refine hs B.2 c.2 ⟨_, _⟩,
844
+ { exact (strict_mono_coe s).monotone.le_cInf_image ⟨c, hct⟩ hB },
845
+ { exact (strict_mono_coe s).monotone.cInf_image_le hct ⟨B, hB⟩ },
846
+ end
847
+
848
+ /-- A nonempty `ord_connected` set in a conditionally complete linear order is naturally a
849
+ conditionally complete linear order. -/
850
+ noncomputable instance ord_connected_subset_conditionally_complete_linear_order
851
+ [inhabited s] [ord_connected s] :
852
+ conditionally_complete_linear_order s :=
853
+ subset_conditionally_complete_linear_order s Sup_within_of_ord_connected Inf_within_of_ord_connected
854
+
855
+ end ord_connected
856
+
857
+ end subtype
0 commit comments