(Semi-)lattices #
Semilattices are partially ordered sets with join (least upper bound, or sup
) or meet (greatest
lower bound, or inf
) operations. Lattices are posets that are both join-semilattices and
meet-semilattices.
Distributive lattices are lattices which satisfy any of four equivalent distributivity properties,
of sup
over inf
, on the left or on the right.
Main declarations #
-
SemilatticeSup
: a type class for join semilattices -
SemilatticeSup.mk'
: an alternative constructor forSemilatticeSup
via proofs that⊔
is commutative, associative and idempotent. -
SemilatticeInf
: a type class for meet semilattices -
SemilatticeSup.mk'
: an alternative constructor forSemilatticeInf
via proofs that⊓
is commutative, associative and idempotent. -
Lattice
: a type class for lattices -
Lattice.mk'
: an alternative constructor forLattice
via proofs that⊔
and⊓
are commutative, associative and satisfy a pair of "absorption laws". -
DistribLattice
: a type class for distributive lattices.
Notations #
a ⊔ b
: the supremum or join ofa
andb
a ⊓ b
: the infimum or meet ofa
andb
TODO #
- (Semi-)lattice homomorphisms
- Alternative constructors for distributive lattices from the other distributive properties
Tags #
semilattice, lattice
See if the term is a ⊂ b
and the goal is a ⊆ b
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Join-semilattices #
A SemilatticeSup
is a join-semilattice, that is, a partial order
with a join (a.k.a. lub / least upper bound, sup / supremum) operation
⊔
which is the least element larger than both factors.
- sup : α → α → α
- le : α → α → Prop
- lt : α → α → Prop
- le_refl : ∀ (a : α), a ≤ a
The supremum is an upper bound on the first argument
The supremum is an upper bound on the second argument
The supremum is the least upper bound
Instances
A type with a commutative, associative and idempotent binary sup
operation has the structure of a
join-semilattice.
The partial order is defined so that a ≤ b
unfolds to a ⊔ b = b
; cf. sup_eq_right
.
Equations
- SemilatticeSup.mk' sup_comm sup_assoc sup_idem = SemilatticeSup.mk ⋯ ⋯ ⋯
Instances For
Equations
- OrderDual.instSup α = { sup := fun (x x_1 : α) => x ⊓ x_1 }
Equations
- OrderDual.instInf α = { inf := fun (x x_1 : α) => x ⊔ x_1 }
Alias of the reverse direction of sup_eq_left
.
Alias of the forward direction of sup_eq_right
.
Alias of the reverse direction of sup_eq_right
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
If f
is monotone, g
is antitone, and f ≤ g
, then for all a
, b
we have f a ≤ g b
.
Meet-semilattices #
A SemilatticeInf
is a meet-semilattice, that is, a partial order
with a meet (a.k.a. glb / greatest lower bound, inf / infimum) operation
⊓
which is the greatest element smaller than both factors.
- inf : α → α → α
- le : α → α → Prop
- lt : α → α → Prop
- le_refl : ∀ (a : α), a ≤ a
The infimum is a lower bound on the first argument
The infimum is a lower bound on the second argument
The infimum is the greatest lower bound
Instances
Equations
- OrderDual.instSemilatticeSup α = let __spread.0 := inferInstanceAs (PartialOrder αᵒᵈ); let __spread.1 := inferInstanceAs (Sup αᵒᵈ); SemilatticeSup.mk ⋯ ⋯ ⋯
Equations
- OrderDual.instSemilatticeInf α = let __spread.0 := inferInstanceAs (PartialOrder αᵒᵈ); let __spread.1 := inferInstanceAs (Inf αᵒᵈ); SemilatticeInf.mk ⋯ ⋯ ⋯
Alias of the forward direction of inf_eq_left
.
Alias of the reverse direction of inf_eq_left
.
Alias of the reverse direction of inf_eq_right
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
A type with a commutative, associative and idempotent binary inf
operation has the structure of a
meet-semilattice.
The partial order is defined so that a ≤ b
unfolds to b ⊓ a = a
; cf. inf_eq_right
.
Equations
- SemilatticeInf.mk' inf_comm inf_assoc inf_idem = OrderDual.instSemilatticeInf αᵒᵈ
Instances For
Lattices #
A lattice is a join-semilattice which is also a meet-semilattice.
- sup : α → α → α
- le : α → α → Prop
- lt : α → α → Prop
- le_refl : ∀ (a : α), a ≤ a
- inf : α → α → α
The infimum is a lower bound on the first argument
The infimum is a lower bound on the second argument
The infimum is the greatest lower bound
Instances
Equations
- OrderDual.instLattice α = let __spread.0 := OrderDual.instSemilatticeSup α; let __spread.1 := OrderDual.instSemilatticeInf α; Lattice.mk ⋯ ⋯ ⋯
The partial orders from SemilatticeSup_mk'
and SemilatticeInf_mk'
agree
if sup
and inf
satisfy the lattice absorption laws sup_inf_self
(a ⊔ a ⊓ b = a
)
and inf_sup_self
(a ⊓ (a ⊔ b) = a
).
A type with a pair of commutative and associative binary operations which satisfy two absorption laws relating the two operations has the structure of a lattice.
The partial order is defined so that a ≤ b
unfolds to a ⊔ b = b
; cf. sup_eq_right
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Distributivity laws #
Distributive lattices #
A distributive lattice is a lattice that satisfies any of four
equivalent distributive properties (of sup
over inf
or inf
over sup
,
on the left or right).
The definition here chooses le_sup_inf
: (x ⊔ y) ⊓ (x ⊔ z) ≤ x ⊔ (y ⊓ z)
. To prove distributivity
from the dual law, use DistribLattice.of_inf_sup_le
.
A classic example of a distributive lattice is the lattice of subsets of a set, and in fact this example is generic in the sense that every distributive lattice is realizable as a sublattice of a powerset lattice.
- sup : α → α → α
- le : α → α → Prop
- lt : α → α → Prop
- le_refl : ∀ (a : α), a ≤ a
- inf : α → α → α
The infimum distributes over the supremum
Instances
Equations
- OrderDual.instDistribLattice α = let __spread.0 := inferInstanceAs (Lattice αᵒᵈ); DistribLattice.mk ⋯
Prove distributivity of an existing lattice from the dual distributive law.
Equations
- DistribLattice.ofInfSupLe inf_sup_le = DistribLattice.mk ⋯
Instances For
Lattices derived from linear orders #
Equations
- LinearOrder.toLattice = let __spread.0 := o; Lattice.mk ⋯ ⋯ ⋯
A lattice with total order is a linear order.
See note [reducible non-instances].
Equations
- Lattice.toLinearOrder α = let __spread.0 := inst✝³; LinearOrder.mk ⋯ inst✝¹ inst✝² inst✝ ⋯ ⋯ ⋯
Instances For
Equations
- instDistribLattice = let __spread.0 := inferInstanceAs (Lattice α); DistribLattice.mk ⋯
Equations
- instDistribLatticeNat = inferInstance
Dual order #
Function lattices #
Equations
- Pi.instSemilatticeSup = SemilatticeSup.mk ⋯ ⋯ ⋯
Equations
- Pi.instSemilatticeInf = SemilatticeInf.mk ⋯ ⋯ ⋯
Equations
- Pi.instLattice = let __spread.0 := inferInstanceAs (SemilatticeSup ((i : ι) → α' i)); let __spread.1 := inferInstanceAs (SemilatticeInf ((i : ι) → α' i)); Lattice.mk ⋯ ⋯ ⋯
Equations
- Pi.instDistribLattice = DistribLattice.mk ⋯
Monotone functions and lattices #
Pointwise supremum of two monotone functions is a monotone function.
Pointwise infimum of two monotone functions is a monotone function.
Pointwise maximum of two monotone functions is a monotone function.
Pointwise minimum of two monotone functions is a monotone function.
Pointwise supremum of two monotone functions is a monotone function.
Pointwise infimum of two monotone functions is a monotone function.
Pointwise maximum of two monotone functions is a monotone function.
Pointwise minimum of two monotone functions is a monotone function.
Pointwise supremum of two monotone functions is a monotone function.
Pointwise infimum of two monotone functions is a monotone function.
Pointwise maximum of two monotone functions is a monotone function.
Pointwise minimum of two monotone functions is a monotone function.
Pointwise supremum of two antitone functions is an antitone function.
Pointwise infimum of two antitone functions is an antitone function.
Pointwise maximum of two antitone functions is an antitone function.
Pointwise minimum of two antitone functions is an antitone function.
Products of (semi-)lattices #
Equations
- Prod.instSemilatticeSup α β = let __spread.0 := inferInstanceAs (PartialOrder (α × β)); let __spread.1 := inferInstanceAs (Sup (α × β)); SemilatticeSup.mk ⋯ ⋯ ⋯
Equations
- Prod.instSemilatticeInf α β = let __spread.0 := inferInstanceAs (PartialOrder (α × β)); let __spread.1 := inferInstanceAs (Inf (α × β)); SemilatticeInf.mk ⋯ ⋯ ⋯
Equations
- Prod.instLattice α β = let __spread.0 := inferInstanceAs (SemilatticeSup (α × β)); let __spread.1 := inferInstanceAs (SemilatticeInf (α × β)); Lattice.mk ⋯ ⋯ ⋯
Equations
- Prod.instDistribLattice α β = let __spread.0 := inferInstanceAs (Lattice (α × β)); DistribLattice.mk ⋯
Subtypes of (semi-)lattices #
A subtype forms a ⊔
-semilattice if ⊔
preserves the property.
See note [reducible non-instances].
Equations
- Subtype.semilatticeSup Psup = SemilatticeSup.mk ⋯ ⋯ ⋯
Instances For
A subtype forms a ⊓
-semilattice if ⊓
preserves the property.
See note [reducible non-instances].
Equations
- Subtype.semilatticeInf Pinf = SemilatticeInf.mk ⋯ ⋯ ⋯
Instances For
A subtype forms a lattice if ⊔
and ⊓
preserve the property.
See note [reducible non-instances].
Equations
- Subtype.lattice Psup Pinf = let __spread.0 := Subtype.semilatticeInf Pinf; let __spread.1 := Subtype.semilatticeSup Psup; Lattice.mk ⋯ ⋯ ⋯
Instances For
A type endowed with ⊔
is a SemilatticeSup
, if it admits an injective map that
preserves ⊔
to a SemilatticeSup
.
See note [reducible non-instances].
Equations
- Function.Injective.semilatticeSup f hf_inj map_sup = let __spread.0 := PartialOrder.lift f hf_inj; SemilatticeSup.mk ⋯ ⋯ ⋯
Instances For
A type endowed with ⊓
is a SemilatticeInf
, if it admits an injective map that
preserves ⊓
to a SemilatticeInf
.
See note [reducible non-instances].
Equations
- Function.Injective.semilatticeInf f hf_inj map_inf = let __spread.0 := PartialOrder.lift f hf_inj; SemilatticeInf.mk ⋯ ⋯ ⋯
Instances For
A type endowed with ⊔
and ⊓
is a Lattice
, if it admits an injective map that
preserves ⊔
and ⊓
to a Lattice
.
See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
A type endowed with ⊔
and ⊓
is a DistribLattice
, if it admits an injective map that
preserves ⊔
and ⊓
to a DistribLattice
.
See note [reducible non-instances].
Equations
- Function.Injective.distribLattice f hf_inj map_sup map_inf = let __spread.0 := Function.Injective.lattice f hf_inj map_sup map_inf; DistribLattice.mk ⋯
Instances For
Equations
- ULift.instSemilatticeSupULift = Function.Injective.semilatticeSup ULift.down ⋯ ⋯
Equations
- ULift.instSemilatticeInfULift = Function.Injective.semilatticeInf ULift.down ⋯ ⋯
Equations
- ULift.instLatticeULift = Function.Injective.lattice ULift.down ⋯ ⋯ ⋯
Equations
- ULift.instDistribLatticeULift = Function.Injective.distribLattice ULift.down ⋯ ⋯ ⋯
Equations
- ULift.instLinearOrderULift = LinearOrder.liftWithOrd ULift.down ⋯ ⋯ ⋯ ⋯
Equations
- Bool.instDistribLattice = inferInstance