Successor and predecessor #
This file defines successor and predecessor orders. succ a, the successor of an element a : α is
the least element greater than a. pred a is the greatest element less than a. Typical examples
include ℕ, ℤ, ℕ+, Fin n, but also ENat, the lexicographic order of a successor/predecessor
order...
Typeclasses #
- SuccOrder: Order equipped with a sensible successor function.
- PredOrder: Order equipped with a sensible predecessor function.
- IsSuccArchimedean:- SuccOrderwhere- succiterated to an element gives all the greater ones.
- IsPredArchimedean:- PredOrderwhere- prediterated to an element gives all the smaller ones.
Implementation notes #
Maximal elements don't have a sensible successor. Thus the naïve typeclass
class NaiveSuccOrder (α : Type*) [Preorder α] :=
  (succ : α → α)
  (succ_le_iff : ∀ {a b}, succ a ≤ b ↔ a < b)
  (lt_succ_iff : ∀ {a b}, a < succ b ↔ a ≤ b)
can't apply to an OrderTop because plugging in a = b = ⊤ into either of succ_le_iff and
lt_succ_iff yields ⊤ < ⊤ (or more generally m < m for a maximal element m).
The solution taken here is to remove the implications ≤ → < and instead require that a < succ a
for all non maximal elements (enforced by the combination of le_succ and the contrapositive of
max_of_succ_le).
The stricter condition of every element having a sensible successor can be obtained through the
combination of SuccOrder α and NoMaxOrder α.
TODO #
Is GaloisConnection pred succ always true? If not, we should introduce
class SuccPredOrder (α : Type*) [Preorder α] extends SuccOrder α, PredOrder α :=
  (pred_succ_gc : GaloisConnection (pred : α → α) succ)
CovBy should help here.
Order equipped with a sensible successor function.
- succ : α → αSuccessor function 
- le_succ : ∀ (a : α), a ≤ SuccOrder.succ aProof of basic ordering with respect to succ
- max_of_succ_le : ∀ {a : α}, SuccOrder.succ a ≤ a → IsMax aProof of interaction between succand maximal element
- succ_le_of_lt : ∀ {a b : α}, a < b → SuccOrder.succ a ≤ b
- le_of_lt_succ : ∀ {a b : α}, a < SuccOrder.succ b → a ≤ b
Instances
Order equipped with a sensible predecessor function.
- pred : α → αPredecessor function 
- pred_le : ∀ (a : α), PredOrder.pred a ≤ aProof of basic ordering with respect to pred
- min_of_le_pred : ∀ {a : α}, a ≤ PredOrder.pred a → IsMin aProof of interaction between predand minimal element
- le_pred_of_lt : ∀ {a b : α}, a < b → a ≤ PredOrder.pred b
- le_of_pred_lt : ∀ {a b : α}, PredOrder.pred a < b → a ≤ b
Instances
A constructor for SuccOrder α usable when α has no maximal element.
Equations
- SuccOrder.ofSuccLeIffOfLeLtSucc succ hsucc_le_iff hle_of_lt_succ = { succ := succ, le_succ := ⋯, max_of_succ_le := ⋯, succ_le_of_lt := ⋯, le_of_lt_succ := ⋯ }
Instances For
A constructor for PredOrder α usable when α has no minimal element.
Equations
- PredOrder.ofLePredIffOfPredLePred pred hle_pred_iff hle_of_pred_lt = { pred := pred, pred_le := ⋯, min_of_le_pred := ⋯, le_pred_of_lt := ⋯, le_of_pred_lt := ⋯ }
Instances For
A constructor for SuccOrder α for α a linear order.
Equations
- SuccOrder.ofCore succ hn hm = { succ := succ, le_succ := ⋯, max_of_succ_le := ⋯, succ_le_of_lt := ⋯, le_of_lt_succ := ⋯ }
Instances For
A constructor for PredOrder α for α a linear order.
Equations
- PredOrder.ofCore pred hn hm = { pred := pred, pred_le := ⋯, min_of_le_pred := ⋯, le_pred_of_lt := ⋯, le_of_pred_lt := ⋯ }
Instances For
A constructor for SuccOrder α usable when α is a linear order with no maximal element.
Equations
- SuccOrder.ofSuccLeIff succ hsucc_le_iff = { succ := succ, le_succ := ⋯, max_of_succ_le := ⋯, succ_le_of_lt := ⋯, le_of_lt_succ := ⋯ }
Instances For
A constructor for PredOrder α usable when α is a linear order with no minimal element.
Equations
- PredOrder.ofLePredIff pred hle_pred_iff = { pred := pred, pred_le := ⋯, min_of_le_pred := ⋯, le_pred_of_lt := ⋯, le_of_pred_lt := ⋯ }
Instances For
Successor order #
Alias of the reverse direction of Order.lt_succ_iff_not_isMax.
Alias of the forward direction of Order.succ_le_succ_iff.
Alias of the reverse direction of Order.succ_lt_succ_iff.
Alias of the forward direction of Order.succ_lt_succ_iff.
Alias of the reverse direction of Order.succ_eq_iff_isMax.
Alias of the reverse direction of Order.succ_ne_succ_iff.
There is at most one way to define the successors in a PartialOrder.
Equations
- ⋯ = ⋯
Predecessor order #
Alias of the reverse direction of Order.pred_lt_iff_not_isMin.
Alias of the forward direction of Order.pred_le_pred_iff.
Alias of the forward direction of Order.pred_lt_pred_iff.
Alias of the reverse direction of Order.pred_lt_pred_iff.
Alias of the reverse direction of Order.pred_eq_iff_isMin.
Alias of the reverse direction of Order.pred_ne_pred_iff.
There is at most one way to define the predecessors in a PartialOrder.
Equations
- ⋯ = ⋯
Successor-predecessor orders #
WithBot, WithTop #
Adding a greatest/least element to a SuccOrder or to a PredOrder.
As far as successors and predecessors are concerned, there are four ways to add a bottom or top element to an order:
- Adding a ⊤to anOrderTop: Preservessuccandpred.
- Adding a ⊤to aNoMaxOrder: Preservessucc. Never preservespred.
- Adding a ⊥to anOrderBot: Preservessuccandpred.
- Adding a ⊥to aNoMinOrder: Preservespred. Never preservessucc. where "preserves(succ/pred)" means(Succ/Pred)Order α → (Succ/Pred)Order ((WithTop/WithBot) α).
Equations
- One or more equations did not get rendered due to their size.
Adding a ⊤ to a NoMaxOrder #
Equations
- One or more equations did not get rendered due to their size.
Equations
- ⋯ = ⋯
Equations
- One or more equations did not get rendered due to their size.
Adding a ⊥ to a NoMinOrder #
Equations
- ⋯ = ⋯
Equations
- One or more equations did not get rendered due to their size.
Archimedeanness #
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Induction principle on a type with a PredOrder for all elements below a given element m.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯