--- title: Ideals of distributive lattices author: Ayberk Tosun start-date: 2024-02-14 --- This module contains the definition of the notion of ideal over a distributive lattice. \begin{code} {-# OPTIONS --safe --without-K #-} open import UF.FunExt open import UF.PropTrunc open import UF.Subsingletons open import UF.Subsingletons-FunExt module Locales.DistributiveLattice.Ideal (pt : propositional-truncations-exist) (fe : Fun-Ext) (pe : Prop-Ext) where open import Locales.DistributiveLattice.Definition fe pt open import Locales.DistributiveLattice.Properties fe pt open import Locales.Frame pt fe open import MLTT.List open import MLTT.Spartan open import UF.Equiv hiding (_β ) open import UF.Logic open import UF.Powerset-MultiUniverse open import UF.SubtypeClassifier open AllCombinators pt fe hiding (_β¨_) open PropositionalTruncation pt hiding (_β¨_) \end{code} The type of ideals of a distributive lattice. \begin{code} is-inhabited : (L : DistributiveLattice π€) β π {π₯} β£ L β£α΅ β Ξ© (π€ β π₯) is-inhabited L S = Ζ x κ β£ L β£α΅ , x β S is-downward-closed : (L : DistributiveLattice π€) β π {π₯} β£ L β£α΅ β Ξ© (π€ β π₯) is-downward-closed L I = β±― x κ β£ L β£α΅ , β±― y κ β£ L β£α΅ , x β€α΅[ L ] y β y ββ I β x ββ I where open DistributiveLattice L is-closed-under-binary-joins : (L : DistributiveLattice π€) β π {π₯} β£ L β£α΅ β Ξ© (π€ β π₯) is-closed-under-binary-joins L I = β±― x κ β£ L β£α΅ , β±― y κ β£ L β£α΅ , x ββ I β y ββ I β (x β¨ y) ββ I where open DistributiveLattice L record Ideal (L : DistributiveLattice π€) : π€ βΊ Μ where open DistributiveLattice L field I : π {π€} β£ L β£α΅ I-is-inhabited : is-inhabited L I holds I-is-downward-closed : is-downward-closed L I holds I-is-closed-under-β¨ : is-closed-under-binary-joins L I holds I-contains-π : (π ββ I) holds I-contains-π = β₯β₯-rec (holds-is-prop (π ββ I)) β I-is-inhabited where β : Ξ£ x κ X , (x ββ I) holds β π β I β (x , p) = I-is-downward-closed π x (πα΅-is-bottom L x) p module IdealNotation (L : DistributiveLattice π€) where _βα΅’_ : β£ L β£α΅ β Ideal L β Ξ© π€ x βα΅’ β = Ideal.I β x infix 30 _βα΅’_ _ββ±_ : β£ L β£α΅ β Ideal L β π€ Μ x ββ± β = (x βα΅’ β) holds is-ideal : (L : DistributiveLattice π€) β π {π€} β£ L β£α΅ β Ξ© π€ is-ideal L I = is-inhabited L I β§ is-downward-closed L I β§ is-closed-under-binary-joins L I Idealβ : DistributiveLattice π€ β π€ βΊ Μ Idealβ {π€} L = Ξ£ I κ π {π€} β£ L β£α΅ , is-ideal L I holds to-idealβ : (L : DistributiveLattice π€) β Ideal L β Idealβ L to-idealβ L β = I , I-is-inhabited , I-is-downward-closed , I-is-closed-under-β¨ where open Ideal β to-ideal : (L : DistributiveLattice π€) β Idealβ L β Ideal L to-ideal L β@(I , ΞΉ , Ξ΄ , Ξ½) = record { I = I ; I-is-inhabited = ΞΉ ; I-is-downward-closed = Ξ΄ ; I-is-closed-under-β¨ = Ξ½ } ideal-equiv-idealβ : (L : DistributiveLattice π€) β (Ideal L) β (Idealβ L) ideal-equiv-idealβ L = (to-idealβ L) , (to-ideal L , Ξ» _ β refl) , (to-ideal L) , Ξ» _ β refl ideal-extensionality : (L : DistributiveLattice π€) β (Iβ Iβ : Ideal L) β Ideal.I Iβ β Ideal.I Iβ β Ideal.I Iβ β Ideal.I Iβ β Iβ οΌ Iβ ideal-extensionality L Iβ Iβ Ο Ο = Iβ οΌβ¨ refl β© to-ideal L (to-idealβ L Iβ) οΌβ¨ β β© to-ideal L (to-idealβ L Iβ) οΌβ¨ refl β© Iβ β where open Ideal Iβ renaming (I to Iββ²) open Ideal Iβ renaming (I to Iββ²) q : (x : β£ L β£α΅) β Iββ² x οΌ Iββ² x q x = to-subtype-οΌ (Ξ» _ β being-prop-is-prop fe) (pe (holds-is-prop (x ββ Iββ²)) (holds-is-prop (x ββ Iββ²)) (Ο x) (Ο x)) β‘ : to-idealβ L Iβ οΌ to-idealβ L Iβ β‘ = to-subtype-οΌ (Ξ» I β holds-is-prop (is-ideal L I)) (dfunext fe q) β = ap (to-ideal L) β‘ \end{code} Closed under finite joins. \begin{code} module _ (L : DistributiveLattice π€) (I : Ideal L) where open IdealNotation L open Ideal I hiding (I) ideals-are-closed-under-finite-joins : (xs : List β£ L β£α΅) β (((x , _) : type-from-list xs) β (x βα΅’ I) holds) β (join-listα΅ L xs βα΅’ I) holds ideals-are-closed-under-finite-joins [] Ο = I-contains-π ideals-are-closed-under-finite-joins (x β· xs) Ο = I-is-closed-under-β¨ x (join-listα΅ L xs) (Ο (x , in-head)) IH where β : (k : type-from-list xs) β (prβ k βα΅’ I) holds β (k , r) = Ο (k , in-tail r) IH : (join-listα΅ L xs βα΅’ I) holds IH = ideals-are-closed-under-finite-joins xs β \end{code} The principal ideal. \begin{code} module PrincipalIdeals (L : DistributiveLattice π€) where open DistributiveLattice L down-closure : β£ L β£α΅ β π {π€} β£ L β£α΅ down-closure x = Ξ» y β y β€α΅[ L ] x principal-ideal : β£ L β£α΅ β Ideal L principal-ideal x = let open PosetReasoning (poset-ofα΅ L) β : is-downward-closed L (down-closure x) holds β y z p q = y β€β¨ p β© z β€β¨ q β© x β β‘ : is-closed-under-binary-joins L (down-closure x) holds β‘ a b c p = β¨-is-least L a b x (c , p) in record { I = down-closure x ; I-is-inhabited = β£ x , β€-is-reflexive (poset-ofα΅ L) x β£ ; I-is-downward-closed = β ; I-is-closed-under-β¨ = β‘ } \end{code} Some nice syntax. Tried turning this into a definition with the same precedence, but it doesn't seem to work. \begin{code} syntax principal-ideal x = β x infix 32 principal-ideal \end{code}