Documentation

ToCslib.Order.LeanOrder

Core's order hierarchy from Mathlib's #

Core's weakest-precondition stack states assertions over Lean.Order.CompleteLattice, a lattice class whose order is a bare relation ⊑ and whose suprema are indexed by predicates, while Mathlib's program-logic carriers (Prop, ℝ≥0∞, function lattices) come with Mathlib's CompleteLattice. The pinned Mathlib has no bridge between the two hierarchies; this file supplies it. The instances are low priority so that core's own instances on Prop and on function types win where both apply; they agree with these definitionally on the order relation, and Lean.Order.CompleteLattice carries no further data, so the two routes to a lattice structure on the same type are propositionally interchangeable.

The file also reverses core's order on Mathlib's OrderDual: ⊑ on αᵒᵈ is ⊑ on α read backwards, and the supremum of a predicate is its infimum in α. On a Mathlib lattice this agrees, at instance transparency, with the bridge of Mathlib's own dual order.

On a bridged carrier, core's lattice operations are Mathlib's. The transfer lemmas of the namespace LeanOrder (LeanOrder.top_eq_top, LeanOrder.meet_eq_inf, …) rewrite each into Mathlib's spelling, and simp uses them.

@[instance_reducible, instance 100]

Mathlib's ≤ as core's ⊑.

Equations
@[simp]
theorem Lean.Order.rel_eq_le {α : Type u} [_root_.PartialOrder α] (x y : α) :

The relation underlying the bridged order is Mathlib's ≤.

@[instance_reducible, instance 100]

Mathlib's complete lattice as core's, with sSup of the set a predicate carves out supplying every predicate-indexed supremum.

Equations
theorem Lean.Order.sup_eq_sSup {α : Type u} [_root_.CompleteLattice α] (c : α → Prop) :

Core's predicate-indexed supremum is Mathlib's sSup of the carved-out set.

@[instance_reducible]

Core's order read backwards on the order dual.

Equations
@[instance_reducible]

The order dual of a complete lattice: the supremum of a predicate is its infimum below.

Equations

The dual order is the original order with its arguments swapped.

Lattice operations across the bridge #

Std.Internal.Order defines core's top, meet, join, iInf, iSup, himp, and ⌜·⌝ from predicate-indexed suprema, and bot as the supremum of the empty chain. On a carrier whose Lean.Order.CompleteLattice is the bridge above, they are Mathlib's ⊤, ⊓, ⊔, ⨅, ⨆, ⇨, if p then ⊤ else ⊥, and ⊥.

The transfer lemmas live in the namespace LeanOrder, outside Lean.Order. A declaration in Lean.Order, or in a namespace below it, is elaborated with Lean.Order open. That activates core's scoped ⊤, ⊓, ⊔, ⨅, ⨆, and ⇨ notation beside Mathlib's, and it resolves le_top and le_inf to core's lemmas. Outside Lean.Order, the statements use Mathlib's notation and name core's operations in full.

@[simp]

On a Mathlib complete lattice, core's top element is Mathlib's ⊤.

@[simp]

On a Mathlib complete lattice, core's bottom element, the supremum of the empty chain under the chain-complete order of the lattice, is Mathlib's ⊥.

@[simp]
theorem LeanOrder.meet_eq_inf {α : Type u} [CompleteLattice α] (x y : α) :
Lean.Order.meet x y = x ⊓ y

On a Mathlib complete lattice, core's binary meet is Mathlib's ⊓.

@[simp]
theorem LeanOrder.join_eq_sup {α : Type u} [CompleteLattice α] (x y : α) :
Lean.Order.join x y = x ⊔ y

On a Mathlib complete lattice, core's binary join is Mathlib's ⊔.

@[simp]
theorem LeanOrder.iInf_eq_iInf {α : Type u} [CompleteLattice α] {ι : Sort v} (f : ι → α) :
Lean.Order.iInf f = ⨅ (i : ι), f i

On a Mathlib complete lattice, core's infimum of an indexed family is Mathlib's ⨅.

@[simp]
theorem LeanOrder.iSup_eq_iSup {α : Type u} [CompleteLattice α] {ι : Sort v} (f : ι → α) :
Lean.Order.iSup f = ⨆ (i : ι), f i

On a Mathlib complete lattice, core's supremum of an indexed family is Mathlib's ⨆.

On a Mathlib complete lattice, core's embedding ⌜p⌝ of a proposition is ⊤ when p holds and ⊥ otherwise. It is not a simp lemma, since its right-hand side needs p decidable.

@[simp]
theorem LeanOrder.himp_eq_himp {α : Type u} [Order.Frame α] (x y : α) :

On a Mathlib frame, a complete lattice whose meets distribute over suprema, core's Heyting implication is Mathlib's ⇨.