topology.algebra.order.upper_lowerMathlib.Topology.Algebra.Order.UpperLower

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(last sync)

feat(measure_theory/order/upper_lower): Order-connected sets in ℝⁿ are measurable (#16976)

Prove that the frontier of an order-connected set in ℝⁿ (with the -metric, but it doesn't actually matter) has measure zero.

As a corollary, antichains in ℝⁿ have measure zero.

Co-authored-by: @JasonKYi

Diff
@@ -5,6 +5,7 @@ Authors: Yaël Dillies
 -/
 import algebra.order.upper_lower
 import topology.algebra.group.basic
+import topology.order.basic
 
 /-!
 # Topological facts about upper/lower/order-connected sets
@@ -46,7 +47,33 @@ instance ordered_comm_group.to_has_upper_lower_closure [ordered_comm_group α]
   is_open_upper_closure := λ s hs, by { rw [←mul_one s, ←mul_upper_closure], exact hs.mul_right },
   is_open_lower_closure := λ s hs, by { rw [←mul_one s, ←mul_lower_closure], exact hs.mul_right } }
 
-variables [preorder α] [has_upper_lower_closure α] {s : set α}
+variables [preorder α]
+
+section order_closed_topology
+variables [order_closed_topology α] {s : set α}
+
+@[simp] lemma upper_bounds_closure (s : set α) :
+  upper_bounds (closure s : set α) = upper_bounds s :=
+ext $ λ a, by simp_rw [mem_upper_bounds_iff_subset_Iic, is_closed_Iic.closure_subset_iff]
+
+@[simp] lemma lower_bounds_closure (s : set α) :
+  lower_bounds (closure s : set α) = lower_bounds s :=
+ext $ λ a, by simp_rw [mem_lower_bounds_iff_subset_Ici, is_closed_Ici.closure_subset_iff]
+
+@[simp] lemma bdd_above_closure : bdd_above (closure s) ↔ bdd_above s :=
+by simp_rw [bdd_above, upper_bounds_closure]
+
+@[simp] lemma bdd_below_closure : bdd_below (closure s) ↔ bdd_below s :=
+by simp_rw [bdd_below, lower_bounds_closure]
+
+alias bdd_above_closure ↔ bdd_above.of_closure bdd_above.closure
+alias bdd_below_closure ↔ bdd_below.of_closure bdd_below.closure
+
+attribute [protected] bdd_above.closure bdd_below.closure
+
+end order_closed_topology
+
+variables [has_upper_lower_closure α] {s : set α}
 
 protected lemma is_upper_set.closure : is_upper_set s → is_upper_set (closure s) :=
 has_upper_lower_closure.is_upper_set_closure _

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(order/upper_lower/basic): Linear order (#19068)

Upper/lower sets on a linear order themselves form a linear order.

Diff
@@ -85,7 +85,7 @@ protected lemma is_upper_set.interior (h : is_upper_set s) : is_upper_set (inter
 by { rw [←is_lower_set_compl, ←closure_compl], exact h.compl.closure }
 
 protected lemma is_lower_set.interior (h : is_lower_set s) : is_lower_set (interior s) :=
-h.of_dual.interior
+h.to_dual.interior
 
 protected lemma set.ord_connected.interior (h : s.ord_connected) : (interior s).ord_connected :=
 begin

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(analysis/normed/order/upper_lower): Thickening an upper set (#17257)

Results about upper sets in normed ordered groups.

Diff
@@ -16,11 +16,10 @@ The topological closure and interior of an upper/lower/order-connected set is an
 upper/lower/order-connected set (with the notable exception of the closure of an order-connected
 set).
 
-## Notes
+## Implementation notes
 
-The lemmas don't mention additive/multiplicative operations. As a result, we decide to prime the
-multiplicative lemma names to indicate that there is probably a common generalisation to each pair
-of additive/multiplicative lemma.
+The same lemmas are true in the additive/multiplicative worlds. To avoid code duplication, we
+provide `has_upper_lower_closure`, an ad hoc axiomatisation of the properties we need.
 -/
 
 open function set

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -52,10 +52,10 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
     where
   isUpperSet_closure s h x y hxy hx :=
     closure_mono (h.smul_subset <| one_le_div'.2 hxy) <| by rw [closure_smul];
-      exact ⟨x, hx, div_mul_cancel' _ _⟩
+      exact ⟨x, hx, div_mul_cancel _ _⟩
   isLowerSet_closure s h x y hxy hx :=
     closure_mono (h.smul_subset <| div_le_one'.2 hxy) <| by rw [closure_smul];
-      exact ⟨x, hx, div_mul_cancel' _ _⟩
+      exact ⟨x, hx, div_mul_cancel _ _⟩
   isOpen_upperClosure s hs := by rw [← mul_one s, ← mul_upperClosure]; exact hs.mul_right
   isOpen_lowerClosure s hs := by rw [← mul_one s, ← mul_lowerClosure]; exact hs.mul_right
 #align ordered_comm_group.to_has_upper_lower_closure OrderedCommGroup.to_hasUpperLowerClosure
Diff
@@ -68,25 +68,33 @@ section OrderClosedTopology
 
 variable [OrderClosedTopology α] {s : Set α}
 
+#print upperBounds_closure /-
 @[simp]
 theorem upperBounds_closure (s : Set α) : upperBounds (closure s : Set α) = upperBounds s :=
   ext fun a => by simp_rw [mem_upperBounds_iff_subset_Iic, is_closed_Iic.closure_subset_iff]
 #align upper_bounds_closure upperBounds_closure
+-/
 
+#print lowerBounds_closure /-
 @[simp]
 theorem lowerBounds_closure (s : Set α) : lowerBounds (closure s : Set α) = lowerBounds s :=
   ext fun a => by simp_rw [mem_lowerBounds_iff_subset_Ici, is_closed_Ici.closure_subset_iff]
 #align lower_bounds_closure lowerBounds_closure
+-/
 
+#print bddAbove_closure /-
 @[simp]
 theorem bddAbove_closure : BddAbove (closure s) ↔ BddAbove s := by
   simp_rw [BddAbove, upperBounds_closure]
 #align bdd_above_closure bddAbove_closure
+-/
 
+#print bddBelow_closure /-
 @[simp]
 theorem bddBelow_closure : BddBelow (closure s) ↔ BddBelow s := by
   simp_rw [BddBelow, lowerBounds_closure]
 #align bdd_below_closure bddBelow_closure
+-/
 
 alias ⟨BddAbove.of_closure, BddAbove.closure⟩ := bddAbove_closure
 #align bdd_above.of_closure BddAbove.of_closure
Diff
@@ -5,8 +5,9 @@ Authors: Yaël Dillies
 -/
 import Algebra.Order.UpperLower
 import Topology.Algebra.Group.Basic
+import Topology.Order.Basic
 
-#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
 
 /-!
 # Topological facts about upper/lower/order-connected sets
@@ -61,7 +62,45 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
 #align ordered_add_comm_group.to_has_upper_lower_closure OrderedAddCommGroup.to_hasUpperLowerClosure
 -/
 
-variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
+variable [Preorder α]
+
+section OrderClosedTopology
+
+variable [OrderClosedTopology α] {s : Set α}
+
+@[simp]
+theorem upperBounds_closure (s : Set α) : upperBounds (closure s : Set α) = upperBounds s :=
+  ext fun a => by simp_rw [mem_upperBounds_iff_subset_Iic, is_closed_Iic.closure_subset_iff]
+#align upper_bounds_closure upperBounds_closure
+
+@[simp]
+theorem lowerBounds_closure (s : Set α) : lowerBounds (closure s : Set α) = lowerBounds s :=
+  ext fun a => by simp_rw [mem_lowerBounds_iff_subset_Ici, is_closed_Ici.closure_subset_iff]
+#align lower_bounds_closure lowerBounds_closure
+
+@[simp]
+theorem bddAbove_closure : BddAbove (closure s) ↔ BddAbove s := by
+  simp_rw [BddAbove, upperBounds_closure]
+#align bdd_above_closure bddAbove_closure
+
+@[simp]
+theorem bddBelow_closure : BddBelow (closure s) ↔ BddBelow s := by
+  simp_rw [BddBelow, lowerBounds_closure]
+#align bdd_below_closure bddBelow_closure
+
+alias ⟨BddAbove.of_closure, BddAbove.closure⟩ := bddAbove_closure
+#align bdd_above.of_closure BddAbove.of_closure
+#align bdd_above.closure BddAbove.closure
+
+alias ⟨BddBelow.of_closure, BddBelow.closure⟩ := bddBelow_closure
+#align bdd_below.of_closure BddBelow.of_closure
+#align bdd_below.closure BddBelow.closure
+
+attribute [protected] BddAbove.closure BddBelow.closure
+
+end OrderClosedTopology
+
+variable [HasUpperLowerClosure α] {s : Set α}
 
 #print IsUpperSet.closure /-
 protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) :=
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
-import Mathbin.Algebra.Order.UpperLower
-import Mathbin.Topology.Algebra.Group.Basic
+import Algebra.Order.UpperLower
+import Topology.Algebra.Group.Basic
 
 #align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
 
Diff
@@ -6,7 +6,7 @@ Authors: Yaël Dillies
 import Mathbin.Algebra.Order.UpperLower
 import Mathbin.Topology.Algebra.Group.Basic
 
-#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"992efbda6f85a5c9074375d3c7cb9764c64d8f72"
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
 
 /-!
 # Topological facts about upper/lower/order-connected sets
@@ -116,7 +116,7 @@ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior
 
 #print IsLowerSet.interior /-
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
-  h.ofDual.interior
+  h.toDual.interior
 #align is_lower_set.interior IsLowerSet.interior
 -/
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module topology.algebra.order.upper_lower
-! leanprover-community/mathlib commit 992efbda6f85a5c9074375d3c7cb9764c64d8f72
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.Order.UpperLower
 import Mathbin.Topology.Algebra.Group.Basic
 
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"992efbda6f85a5c9074375d3c7cb9764c64d8f72"
+
 /-!
 # Topological facts about upper/lower/order-connected sets
 
Diff
@@ -46,6 +46,7 @@ class HasUpperLowerClosure (α : Type _) [TopologicalSpace α] [Preorder α] : P
 
 variable {α : Type _} [TopologicalSpace α]
 
+#print OrderedCommGroup.to_hasUpperLowerClosure /-
 -- See note [lower instance priority]
 @[to_additive]
 instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedCommGroup α]
@@ -61,6 +62,7 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
   isOpen_lowerClosure s hs := by rw [← mul_one s, ← mul_lowerClosure]; exact hs.mul_right
 #align ordered_comm_group.to_has_upper_lower_closure OrderedCommGroup.to_hasUpperLowerClosure
 #align ordered_add_comm_group.to_has_upper_lower_closure OrderedAddCommGroup.to_hasUpperLowerClosure
+-/
 
 variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
 
Diff
@@ -30,7 +30,7 @@ provide `has_upper_lower_closure`, an ad hoc axiomatisation of the properties we
 
 open Function Set
 
-open Pointwise
+open scoped Pointwise
 
 #print HasUpperLowerClosure /-
 /-- Ad hoc class stating that the closure of an upper set is an upper set. This is used to state
@@ -64,13 +64,17 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
 
 variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
 
+#print IsUpperSet.closure /-
 protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) :=
   HasUpperLowerClosure.isUpperSet_closure _
 #align is_upper_set.closure IsUpperSet.closure
+-/
 
+#print IsLowerSet.closure /-
 protected theorem IsLowerSet.closure : IsLowerSet s → IsLowerSet (closure s) :=
   HasUpperLowerClosure.isLowerSet_closure _
 #align is_lower_set.closure IsLowerSet.closure
+-/
 
 #print IsOpen.upperClosure /-
 protected theorem IsOpen.upperClosure : IsOpen s → IsOpen (upperClosure s : Set α) :=
@@ -91,6 +95,7 @@ instance : HasUpperLowerClosure αᵒᵈ
   isOpen_upperClosure := @IsOpen.lowerClosure α _ _ _
   isOpen_lowerClosure := @IsOpen.upperClosure α _ _ _
 
+#print IsUpperSet.interior /-
 /-
 Note: `s.ord_connected` does not imply `(closure s).ord_connected`, as we can see by taking
 `s := Ioo 0 1 × Ioo 1 2 ∪ Ioo 2 3 × Ioo 0 1` because then
@@ -108,10 +113,13 @@ oooooxx
 protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior s) := by
   rw [← isLowerSet_compl, ← closure_compl]; exact h.compl.closure
 #align is_upper_set.interior IsUpperSet.interior
+-/
 
+#print IsLowerSet.interior /-
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
   h.ofDual.interior
 #align is_lower_set.interior IsLowerSet.interior
+-/
 
 #print Set.OrdConnected.interior /-
 protected theorem Set.OrdConnected.interior (h : s.OrdConnected) : (interior s).OrdConnected :=
Diff
@@ -46,12 +46,6 @@ class HasUpperLowerClosure (α : Type _) [TopologicalSpace α] [Preorder α] : P
 
 variable {α : Type _} [TopologicalSpace α]
 
-/- warning: ordered_comm_group.to_has_upper_lower_closure -> OrderedCommGroup.to_hasUpperLowerClosure is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : OrderedCommGroup.{u1} α] [_inst_3 : ContinuousConstSMul.{u1, u1} α α _inst_1 (Mul.toSMul.{u1} α (MulOneClass.toHasMul.{u1} α (Monoid.toMulOneClass.{u1} α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2)))))))], HasUpperLowerClosure.{u1} α _inst_1 (PartialOrder.toPreorder.{u1} α (OrderedCommGroup.toPartialOrder.{u1} α _inst_2))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : OrderedCommGroup.{u1} α] [_inst_3 : ContinuousConstSMul.{u1, u1} α α _inst_1 (MulAction.toSMul.{u1, u1} α α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2)))) (Monoid.toMulAction.{u1} α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2))))))], HasUpperLowerClosure.{u1} α _inst_1 (PartialOrder.toPreorder.{u1} α (OrderedCommGroup.toPartialOrder.{u1} α _inst_2))
-Case conversion may be inaccurate. Consider using '#align ordered_comm_group.to_has_upper_lower_closure OrderedCommGroup.to_hasUpperLowerClosureₓ'. -/
 -- See note [lower instance priority]
 @[to_additive]
 instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedCommGroup α]
@@ -70,22 +64,10 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
 
 variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
 
-/- warning: is_upper_set.closure -> IsUpperSet.closure is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
-Case conversion may be inaccurate. Consider using '#align is_upper_set.closure IsUpperSet.closureₓ'. -/
 protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) :=
   HasUpperLowerClosure.isUpperSet_closure _
 #align is_upper_set.closure IsUpperSet.closure
 
-/- warning: is_lower_set.closure -> IsLowerSet.closure is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
-Case conversion may be inaccurate. Consider using '#align is_lower_set.closure IsLowerSet.closureₓ'. -/
 protected theorem IsLowerSet.closure : IsLowerSet s → IsLowerSet (closure s) :=
   HasUpperLowerClosure.isLowerSet_closure _
 #align is_lower_set.closure IsLowerSet.closure
@@ -109,12 +91,6 @@ instance : HasUpperLowerClosure αᵒᵈ
   isOpen_upperClosure := @IsOpen.lowerClosure α _ _ _
   isOpen_lowerClosure := @IsOpen.upperClosure α _ _ _
 
-/- warning: is_upper_set.interior -> IsUpperSet.interior is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
-Case conversion may be inaccurate. Consider using '#align is_upper_set.interior IsUpperSet.interiorₓ'. -/
 /-
 Note: `s.ord_connected` does not imply `(closure s).ord_connected`, as we can see by taking
 `s := Ioo 0 1 × Ioo 1 2 ∪ Ioo 2 3 × Ioo 0 1` because then
@@ -133,12 +109,6 @@ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior
   rw [← isLowerSet_compl, ← closure_compl]; exact h.compl.closure
 #align is_upper_set.interior IsUpperSet.interior
 
-/- warning: is_lower_set.interior -> IsLowerSet.interior is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
-Case conversion may be inaccurate. Consider using '#align is_lower_set.interior IsLowerSet.interiorₓ'. -/
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
   h.ofDual.interior
 #align is_lower_set.interior IsLowerSet.interior
Diff
@@ -58,21 +58,13 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
     [ContinuousConstSMul α α] : HasUpperLowerClosure α
     where
   isUpperSet_closure s h x y hxy hx :=
-    closure_mono (h.smul_subset <| one_le_div'.2 hxy) <|
-      by
-      rw [closure_smul]
+    closure_mono (h.smul_subset <| one_le_div'.2 hxy) <| by rw [closure_smul];
       exact ⟨x, hx, div_mul_cancel' _ _⟩
   isLowerSet_closure s h x y hxy hx :=
-    closure_mono (h.smul_subset <| div_le_one'.2 hxy) <|
-      by
-      rw [closure_smul]
+    closure_mono (h.smul_subset <| div_le_one'.2 hxy) <| by rw [closure_smul];
       exact ⟨x, hx, div_mul_cancel' _ _⟩
-  isOpen_upperClosure s hs := by
-    rw [← mul_one s, ← mul_upperClosure]
-    exact hs.mul_right
-  isOpen_lowerClosure s hs := by
-    rw [← mul_one s, ← mul_lowerClosure]
-    exact hs.mul_right
+  isOpen_upperClosure s hs := by rw [← mul_one s, ← mul_upperClosure]; exact hs.mul_right
+  isOpen_lowerClosure s hs := by rw [← mul_one s, ← mul_lowerClosure]; exact hs.mul_right
 #align ordered_comm_group.to_has_upper_lower_closure OrderedCommGroup.to_hasUpperLowerClosure
 #align ordered_add_comm_group.to_has_upper_lower_closure OrderedAddCommGroup.to_hasUpperLowerClosure
 
@@ -137,10 +129,8 @@ oooooxx
 oooooxx
 ```
 -/
-protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior s) :=
-  by
-  rw [← isLowerSet_compl, ← closure_compl]
-  exact h.compl.closure
+protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior s) := by
+  rw [← isLowerSet_compl, ← closure_compl]; exact h.compl.closure
 #align is_upper_set.interior IsUpperSet.interior
 
 /- warning: is_lower_set.interior -> IsLowerSet.interior is a dubious translation:
Diff
@@ -78,17 +78,25 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
 
 variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
 
-#print IsUpperSet.closure /-
+/- warning: is_upper_set.closure -> IsUpperSet.closure is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
+Case conversion may be inaccurate. Consider using '#align is_upper_set.closure IsUpperSet.closureₓ'. -/
 protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) :=
   HasUpperLowerClosure.isUpperSet_closure _
 #align is_upper_set.closure IsUpperSet.closure
--/
 
-#print IsLowerSet.closure /-
+/- warning: is_lower_set.closure -> IsLowerSet.closure is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (closure.{u1} α _inst_1 s))
+Case conversion may be inaccurate. Consider using '#align is_lower_set.closure IsLowerSet.closureₓ'. -/
 protected theorem IsLowerSet.closure : IsLowerSet s → IsLowerSet (closure s) :=
   HasUpperLowerClosure.isLowerSet_closure _
 #align is_lower_set.closure IsLowerSet.closure
--/
 
 #print IsOpen.upperClosure /-
 protected theorem IsOpen.upperClosure : IsOpen s → IsOpen (upperClosure s : Set α) :=
@@ -109,7 +117,12 @@ instance : HasUpperLowerClosure αᵒᵈ
   isOpen_upperClosure := @IsOpen.lowerClosure α _ _ _
   isOpen_lowerClosure := @IsOpen.upperClosure α _ _ _
 
-#print IsUpperSet.interior /-
+/- warning: is_upper_set.interior -> IsUpperSet.interior is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsUpperSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
+Case conversion may be inaccurate. Consider using '#align is_upper_set.interior IsUpperSet.interiorₓ'. -/
 /-
 Note: `s.ord_connected` does not imply `(closure s).ord_connected`, as we can see by taking
 `s := Ioo 0 1 × Ioo 1 2 ∪ Ioo 2 3 × Ioo 0 1` because then
@@ -129,13 +142,16 @@ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior
   rw [← isLowerSet_compl, ← closure_compl]
   exact h.compl.closure
 #align is_upper_set.interior IsUpperSet.interior
--/
 
-#print IsLowerSet.interior /-
+/- warning: is_lower_set.interior -> IsLowerSet.interior is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toHasLe.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : Preorder.{u1} α] [_inst_3 : HasUpperLowerClosure.{u1} α _inst_1 _inst_2] {s : Set.{u1} α}, (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) s) -> (IsLowerSet.{u1} α (Preorder.toLE.{u1} α _inst_2) (interior.{u1} α _inst_1 s))
+Case conversion may be inaccurate. Consider using '#align is_lower_set.interior IsLowerSet.interiorₓ'. -/
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
   h.ofDual.interior
 #align is_lower_set.interior IsLowerSet.interior
--/
 
 #print Set.OrdConnected.interior /-
 protected theorem Set.OrdConnected.interior (h : s.OrdConnected) : (interior s).OrdConnected :=
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 
 ! This file was ported from Lean 3 source module topology.algebra.order.upper_lower
-! leanprover-community/mathlib commit f47581155c818e6361af4e4fda60d27d020c226b
+! leanprover-community/mathlib commit 992efbda6f85a5c9074375d3c7cb9764c64d8f72
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -21,11 +21,10 @@ The topological closure and interior of an upper/lower/order-connected set is an
 upper/lower/order-connected set (with the notable exception of the closure of an order-connected
 set).
 
-## Notes
+## Implementation notes
 
-The lemmas don't mention additive/multiplicative operations. As a result, we decide to prime the
-multiplicative lemma names to indicate that there is probably a common generalisation to each pair
-of additive/multiplicative lemma.
+The same lemmas are true in the additive/multiplicative worlds. To avoid code duplication, we
+provide `has_upper_lower_closure`, an ad hoc axiomatisation of the properties we need.
 -/
 
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 
 ! This file was ported from Lean 3 source module topology.algebra.order.upper_lower
-! leanprover-community/mathlib commit 4330aae21f538b862f8aead371cfb6ee556398f1
+! leanprover-community/mathlib commit f47581155c818e6361af4e4fda60d27d020c226b
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Topology.Algebra.Group.Basic
 /-!
 # Topological facts about upper/lower/order-connected sets
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 The topological closure and interior of an upper/lower/order-connected set is an
 upper/lower/order-connected set (with the notable exception of the closure of an order-connected
 set).
Diff
@@ -30,6 +30,7 @@ open Function Set
 
 open Pointwise
 
+#print HasUpperLowerClosure /-
 /-- Ad hoc class stating that the closure of an upper set is an upper set. This is used to state
 lemmas that do not mention algebraic operations for both the additive and multiplicative versions
 simultaneously. If you find a satisfying replacement for this typeclass, please remove it! -/
@@ -39,9 +40,16 @@ class HasUpperLowerClosure (α : Type _) [TopologicalSpace α] [Preorder α] : P
   isOpen_upperClosure : ∀ s : Set α, IsOpen s → IsOpen (upperClosure s : Set α)
   isOpen_lowerClosure : ∀ s : Set α, IsOpen s → IsOpen (lowerClosure s : Set α)
 #align has_upper_lower_closure HasUpperLowerClosure
+-/
 
 variable {α : Type _} [TopologicalSpace α]
 
+/- warning: ordered_comm_group.to_has_upper_lower_closure -> OrderedCommGroup.to_hasUpperLowerClosure is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : OrderedCommGroup.{u1} α] [_inst_3 : ContinuousConstSMul.{u1, u1} α α _inst_1 (Mul.toSMul.{u1} α (MulOneClass.toHasMul.{u1} α (Monoid.toMulOneClass.{u1} α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2)))))))], HasUpperLowerClosure.{u1} α _inst_1 (PartialOrder.toPreorder.{u1} α (OrderedCommGroup.toPartialOrder.{u1} α _inst_2))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : TopologicalSpace.{u1} α] [_inst_2 : OrderedCommGroup.{u1} α] [_inst_3 : ContinuousConstSMul.{u1, u1} α α _inst_1 (MulAction.toSMul.{u1, u1} α α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2)))) (Monoid.toMulAction.{u1} α (DivInvMonoid.toMonoid.{u1} α (Group.toDivInvMonoid.{u1} α (CommGroup.toGroup.{u1} α (OrderedCommGroup.toCommGroup.{u1} α _inst_2))))))], HasUpperLowerClosure.{u1} α _inst_1 (PartialOrder.toPreorder.{u1} α (OrderedCommGroup.toPartialOrder.{u1} α _inst_2))
+Case conversion may be inaccurate. Consider using '#align ordered_comm_group.to_has_upper_lower_closure OrderedCommGroup.to_hasUpperLowerClosureₓ'. -/
 -- See note [lower instance priority]
 @[to_additive]
 instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedCommGroup α]
@@ -68,21 +76,29 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
 
 variable [Preorder α] [HasUpperLowerClosure α] {s : Set α}
 
+#print IsUpperSet.closure /-
 protected theorem IsUpperSet.closure : IsUpperSet s → IsUpperSet (closure s) :=
   HasUpperLowerClosure.isUpperSet_closure _
 #align is_upper_set.closure IsUpperSet.closure
+-/
 
+#print IsLowerSet.closure /-
 protected theorem IsLowerSet.closure : IsLowerSet s → IsLowerSet (closure s) :=
   HasUpperLowerClosure.isLowerSet_closure _
 #align is_lower_set.closure IsLowerSet.closure
+-/
 
+#print IsOpen.upperClosure /-
 protected theorem IsOpen.upperClosure : IsOpen s → IsOpen (upperClosure s : Set α) :=
   HasUpperLowerClosure.isOpen_upperClosure _
 #align is_open.upper_closure IsOpen.upperClosure
+-/
 
+#print IsOpen.lowerClosure /-
 protected theorem IsOpen.lowerClosure : IsOpen s → IsOpen (lowerClosure s : Set α) :=
   HasUpperLowerClosure.isOpen_lowerClosure _
 #align is_open.lower_closure IsOpen.lowerClosure
+-/
 
 instance : HasUpperLowerClosure αᵒᵈ
     where
@@ -91,6 +107,7 @@ instance : HasUpperLowerClosure αᵒᵈ
   isOpen_upperClosure := @IsOpen.lowerClosure α _ _ _
   isOpen_lowerClosure := @IsOpen.upperClosure α _ _ _
 
+#print IsUpperSet.interior /-
 /-
 Note: `s.ord_connected` does not imply `(closure s).ord_connected`, as we can see by taking
 `s := Ioo 0 1 × Ioo 1 2 ∪ Ioo 2 3 × Ioo 0 1` because then
@@ -110,15 +127,20 @@ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior
   rw [← isLowerSet_compl, ← closure_compl]
   exact h.compl.closure
 #align is_upper_set.interior IsUpperSet.interior
+-/
 
+#print IsLowerSet.interior /-
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
   h.ofDual.interior
 #align is_lower_set.interior IsLowerSet.interior
+-/
 
+#print Set.OrdConnected.interior /-
 protected theorem Set.OrdConnected.interior (h : s.OrdConnected) : (interior s).OrdConnected :=
   by
   rw [← h.upper_closure_inter_lower_closure, interior_inter]
   exact
     (upperClosure s).upper.interior.OrdConnected.inter (lowerClosure s).lower.interior.OrdConnected
 #align set.ord_connected.interior Set.OrdConnected.interior
+-/
 

Changes in mathlib4

mathlib3
mathlib4
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -45,11 +45,11 @@ instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedComm
   isUpperSet_closure s h x y hxy hx :=
     closure_mono (h.smul_subset <| one_le_div'.2 hxy) <| by
       rw [closure_smul]
-      exact ⟨x, hx, div_mul_cancel' _ _⟩
+      exact ⟨x, hx, div_mul_cancel _ _⟩
   isLowerSet_closure s h x y hxy hx :=
     closure_mono (h.smul_subset <| div_le_one'.2 hxy) <| by
       rw [closure_smul]
-      exact ⟨x, hx, div_mul_cancel' _ _⟩
+      exact ⟨x, hx, div_mul_cancel _ _⟩
   isOpen_upperClosure s hs := by
     rw [← mul_one s, ← mul_upperClosure]
     exact hs.mul_right
feat(Topology/Order): assorted lemmas (#10556)
  • Add upperBounds_closure, lowerBounds_closure, bddAbove_closure, bddBelow_closure.
  • Add IsAntichain.interior_eq_empty.
  • Generalize nhds_left'_le_nhds_ne and nhds_right'_le_nhds_ne to a Preorder.

Partly forward-ports https://github.com/leanprover-community/mathlib/pull/16976

Diff
@@ -6,7 +6,7 @@ Authors: Yaël Dillies
 import Mathlib.Algebra.Order.UpperLower
 import Mathlib.Topology.Algebra.Group.Basic
 
-#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
 
 /-!
 # Topological facts about upper/lower/order-connected sets
feat: Linear order on upper/lower sets (#6816)

Match https://github.com/leanprover-community/mathlib/pull/19068

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -6,7 +6,7 @@ Authors: Yaël Dillies
 import Mathlib.Algebra.Order.UpperLower
 import Mathlib.Topology.Algebra.Group.Basic
 
-#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"992efbda6f85a5c9074375d3c7cb9764c64d8f72"
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
 
 /-!
 # Topological facts about upper/lower/order-connected sets
@@ -104,7 +104,7 @@ protected theorem IsUpperSet.interior (h : IsUpperSet s) : IsUpperSet (interior
 #align is_upper_set.interior IsUpperSet.interior
 
 protected theorem IsLowerSet.interior (h : IsLowerSet s) : IsLowerSet (interior s) :=
-  h.ofDual.interior
+  h.toDual.interior
 #align is_lower_set.interior IsLowerSet.interior
 
 protected theorem Set.OrdConnected.interior (h : s.OrdConnected) : (interior s).OrdConnected := by
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -29,14 +29,14 @@ open Pointwise
 /-- Ad hoc class stating that the closure of an upper set is an upper set. This is used to state
 lemmas that do not mention algebraic operations for both the additive and multiplicative versions
 simultaneously. If you find a satisfying replacement for this typeclass, please remove it! -/
-class HasUpperLowerClosure (α : Type _) [TopologicalSpace α] [Preorder α] : Prop where
+class HasUpperLowerClosure (α : Type*) [TopologicalSpace α] [Preorder α] : Prop where
   isUpperSet_closure : ∀ s : Set α, IsUpperSet s → IsUpperSet (closure s)
   isLowerSet_closure : ∀ s : Set α, IsLowerSet s → IsLowerSet (closure s)
   isOpen_upperClosure : ∀ s : Set α, IsOpen s → IsOpen (upperClosure s : Set α)
   isOpen_lowerClosure : ∀ s : Set α, IsOpen s → IsOpen (lowerClosure s : Set α)
 #align has_upper_lower_closure HasUpperLowerClosure
 
-variable {α : Type _} [TopologicalSpace α]
+variable {α : Type*} [TopologicalSpace α]
 
 -- See note [lower instance priority]
 @[to_additive]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module topology.algebra.order.upper_lower
-! leanprover-community/mathlib commit 992efbda6f85a5c9074375d3c7cb9764c64d8f72
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.Order.UpperLower
 import Mathlib.Topology.Algebra.Group.Basic
 
+#align_import topology.algebra.order.upper_lower from "leanprover-community/mathlib"@"992efbda6f85a5c9074375d3c7cb9764c64d8f72"
+
 /-!
 # Topological facts about upper/lower/order-connected sets
 
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -44,16 +44,13 @@ variable {α : Type _} [TopologicalSpace α]
 -- See note [lower instance priority]
 @[to_additive]
 instance (priority := 100) OrderedCommGroup.to_hasUpperLowerClosure [OrderedCommGroup α]
-    [ContinuousConstSMul α α] : HasUpperLowerClosure α
-    where
+    [ContinuousConstSMul α α] : HasUpperLowerClosure α where
   isUpperSet_closure s h x y hxy hx :=
-    closure_mono (h.smul_subset <| one_le_div'.2 hxy) <|
-      by
+    closure_mono (h.smul_subset <| one_le_div'.2 hxy) <| by
       rw [closure_smul]
       exact ⟨x, hx, div_mul_cancel' _ _⟩
   isLowerSet_closure s h x y hxy hx :=
-    closure_mono (h.smul_subset <| div_le_one'.2 hxy) <|
-      by
+    closure_mono (h.smul_subset <| div_le_one'.2 hxy) <| by
       rw [closure_smul]
       exact ⟨x, hx, div_mul_cancel' _ _⟩
   isOpen_upperClosure s hs := by
chore: Fix Topology.Algebra.Order.UpperLower docstring (#2896)

Match https://github.com/leanprover-community/mathlib/pull/17257

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 
 ! This file was ported from Lean 3 source module topology.algebra.order.upper_lower
-! leanprover-community/mathlib commit 4330aae21f538b862f8aead371cfb6ee556398f1
+! leanprover-community/mathlib commit 992efbda6f85a5c9074375d3c7cb9764c64d8f72
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -18,11 +18,10 @@ The topological closure and interior of an upper/lower/order-connected set is an
 upper/lower/order-connected set (with the notable exception of the closure of an order-connected
 set).
 
-## Notes
+## Implementation notes
 
-The lemmas don't mention additive/multiplicative operations. As a result, we decide to prime the
-multiplicative lemma names to indicate that there is probably a common generalisation to each pair
-of additive/multiplicative lemma.
+The same lemmas are true in the additive/multiplicative worlds. To avoid code duplication, we
+provide `HasUpperLowerClosure`, an ad hoc axiomatisation of the properties we need.
 -/
 
 
feat: port Topology.Algebra.Order.UpperLower (#2503)

Co-authored-by: Moritz Firsching <firsching@google.com>

Dependencies 9 + 397

398 files ported (97.8%)
173849 lines ported (97.2%)
Show graph

The unported dependencies are