Circular order hierarchy #
This file defines circular preorders, circular partial orders and circular orders.
Hierarchy #
- A ternary "betweenness" relation
btw : α → α → α → Propforms acircular_orderif it is- reflexive:
btw a a a - cyclic:
btw a b c → btw b c a - antisymmetric:
btw a b c → btw c b a → a = b ∨ b = c ∨ c = a - total:
btw a b c ∨ btw c b aalong with a strict betweenness relationsbtw : α → α → α → Propwhich respectssbtw a b c ↔ btw a b c ∧ ¬ btw c b a, analogously to how<and≤are related, and is - transitive:
sbtw a b c → sbtw b d c → sbtw a d c.
- reflexive:
- A
circular_partial_orderdrops totality. - A
circular_preorderfurther drops antisymmetry.
The intuition is that a circular order is a circle and btw a b c means that going around
clockwise from a you reach b before c (b is between a and c is meaningless on an
unoriented circle). A circular partial order is several, potentially intersecting, circles. A
circular preorder is like a circular partial order, but several points can coexist.
Note that the relations between circular_preorder, circular_partial_order and circular_order
are subtler than between preorder, partial_order, linear_order. In particular, one cannot
simply extend the btw of a circular_partial_order to make it a circular_order.
One can translate from usual orders to circular ones by "closing the necklace at infinity". See
has_le.to_has_btw and has_lt.to_has_sbtw. Going the other way involves "cutting the necklace" or
"rolling the necklace open".
Examples #
Some concrete circular orders one encounters in the wild are zmod n for 0 < n, circle,
real.angle...
Main definitions #
Notes #
There's an unsolved diamond on order_dual α here. The instances has_le α → has_btw αᵒᵈ and
has_lt α → has_sbtw αᵒᵈ can each be inferred in two ways:
has_le α→has_btw α→has_btw αᵒᵈvshas_le α→has_le αᵒᵈ→has_btw αᵒᵈhas_lt α→has_sbtw α→has_sbtw αᵒᵈvshas_lt α→has_lt αᵒᵈ→has_sbtw αᵒᵈThe fields are propeq, but not defeq. It is temporarily fixed by turning the circularizing instances into definitions.
TODO #
Antisymmetry is quite weak in the sense that there's no way to discriminate which two points are
equal. This prevents defining closed-open intervals cIco and cIoc in the neat =-less way. We
currently haven't defined them at all.
What is the correct generality of "rolling the necklace" open? At least, this works for α × β and
β × α where α is a circular order and β is a linear order.
What's next is to define circular groups and provide instances for zmod n, the usual circle group
circle, real.angle, and roots_of_unity M. What conditions do we need on M for this last one
to work?
We should have circular order homomorphisms. The typical example is
days_to_month : days_of_the_year →c months_of_the_year which relates the circular order of days
and the circular order of months. Is α →c β a good notation?
References #
Tags #
circular order, cyclic order, circularly ordered set, cyclically ordered set
- btw : α → α → α → Prop
Syntax typeclass for a betweenness relation.
Instances of this typeclass
Instances of other typeclasses for has_btw
- has_btw.has_sizeof_inst
- sbtw : α → α → α → Prop
Syntax typeclass for a strict betweenness relation.
Instances of this typeclass
Instances of other typeclasses for has_sbtw
- has_sbtw.has_sizeof_inst
- to_has_btw : has_btw α
- to_has_sbtw : has_sbtw α
- btw_refl : ∀ (a : α), has_btw.btw a a a
- btw_cyclic_left : ∀ {a b c : α}, has_btw.btw a b c → has_btw.btw b c a
- sbtw_iff_btw_not_btw : ∀ {a b c : α}, has_sbtw.sbtw a b c ↔ has_btw.btw a b c ∧ ¬has_btw.btw c b a . "order_laws_tac"
- sbtw_trans_left : ∀ {a b c d : α}, has_sbtw.sbtw a b c → has_sbtw.sbtw b d c → has_sbtw.sbtw a d c
A circular preorder is the analogue of a preorder where you can loop around. ≤ and < are
replaced by ternary relations btw and sbtw. btw is reflexive and cyclic. sbtw is transitive.
Instances of this typeclass
Instances of other typeclasses for circular_preorder
- circular_preorder.has_sizeof_inst
- to_circular_preorder : circular_preorder α
- btw_antisymm : ∀ {a b c : α}, has_btw.btw a b c → has_btw.btw c b a → a = b ∨ b = c ∨ c = a
A circular partial order is the analogue of a partial order where you can loop around. ≤ and
< are replaced by ternary relations btw and sbtw. btw is reflexive, cyclic and
antisymmetric. sbtw is transitive.
Instances of this typeclass
Instances of other typeclasses for circular_partial_order
- circular_partial_order.has_sizeof_inst
- to_circular_partial_order : circular_partial_order α
- btw_total : ∀ (a b c : α), has_btw.btw a b c ∨ has_btw.btw c b a
A circular order is the analogue of a linear order where you can loop around. ≤ and < are
replaced by ternary relations btw and sbtw. btw is reflexive, cyclic, antisymmetric and total.
sbtw is transitive.
Instances of this typeclass
Instances of other typeclasses for circular_order
- circular_order.has_sizeof_inst
Circular preorders #
Alias of btw_cyclic_right.
The order of the ↔ has been chosen so that rw btw_cyclic cycles to the right while
rw ←btw_cyclic cycles to the left (thus following the prepended arrow).
Alias of btw_of_sbtw.
Alias of not_btw_of_sbtw.
Alias of not_sbtw_of_btw.
Alias of sbtw_of_btw_not_btw.
Alias of sbtw_cyclic_left.
Alias of sbtw_cyclic_right.
The order of the ↔ has been chosen so that rw sbtw_cyclic cycles to the right while
rw ←sbtw_cyclic cycles to the left (thus following the prepended arrow).
Alias of sbtw_trans_right.
Alias of sbtw_asymm.
Circular partial orders #
Circular orders #
Circular intervals #
Closed-closed circular interval
Equations
- set.cIcc a b = {x : α | has_btw.btw a x b}
Open-open circular interval
Equations
- set.cIoo a b = {x : α | has_sbtw.sbtw a x b}
Circularizing instances #
The circular preorder obtained from "looping around" a preorder. See note [reducible non-instances].
Equations
The circular partial order obtained from "looping around" a partial order. See note [reducible non-instances].
Equations
- partial_order.to_circular_partial_order α = {to_circular_preorder := {to_has_btw := circular_preorder.to_has_btw (preorder.to_circular_preorder α), to_has_sbtw := circular_preorder.to_has_sbtw (preorder.to_circular_preorder α), btw_refl := _, btw_cyclic_left := _, sbtw_iff_btw_not_btw := _, sbtw_trans_left := _}, btw_antisymm := _}
The circular order obtained from "looping around" a linear order. See note [reducible non-instances].
Dual constructions #
Equations
- order_dual.has_btw α = {btw := λ (a b c : α), has_btw.btw c b a}
Equations
- order_dual.has_sbtw α = {sbtw := λ (a b c : α), has_sbtw.sbtw c b a}
Equations
- order_dual.circular_preorder α = {to_has_btw := {btw := has_btw.btw (order_dual.has_btw α)}, to_has_sbtw := {sbtw := has_sbtw.sbtw (order_dual.has_sbtw α)}, btw_refl := _, btw_cyclic_left := _, sbtw_iff_btw_not_btw := _, sbtw_trans_left := _}
Equations
- order_dual.circular_partial_order α = {to_circular_preorder := {to_has_btw := circular_preorder.to_has_btw (order_dual.circular_preorder α), to_has_sbtw := circular_preorder.to_has_sbtw (order_dual.circular_preorder α), btw_refl := _, btw_cyclic_left := _, sbtw_iff_btw_not_btw := _, sbtw_trans_left := _}, btw_antisymm := _}