module Order.Diagram.Glb.Reasoning {o β„“} (P : Poset o β„“) where

Reasoning about greatest lower boundsπŸ”—

This module provides syntax and reasoning combinators for working with partial orders that have all greatest lower bounds.

module Glbs
  {β‹‚      : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ Ob}
  (β‹‚-glbs : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ is-glb P f (β‹‚ f))
  where

  glbs : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ Glb P f
  glbs f = record { glb = β‹‚ f ; has-glb = β‹‚-glbs f }

  module glbs {I} {f : I β†’ Ob} = Glb (glbs f)
  open glbs using () renaming (glb≀fam to β‹‚-proj; greatest to β‹‚-universal) public

Performing two nested meets over and is the same as taking a single meet over

  β‹‚-twice
    : βˆ€ {I : Type o} {J : I β†’ Type o} (f : (i : I) β†’ J i β†’ Ob)
    β†’ β‹‚ (Ξ» i β†’ β‹‚ Ξ» j β†’ f i j)
    ≑ β‹‚ {I = Ξ£ I J} (Ξ» p β†’ f (p .fst) (p .snd))
  β‹‚-twice f =
    ≀-antisym
      (β‹‚-universal _ (Ξ» (i , j) β†’ ≀-trans (β‹‚-proj i) (β‹‚-proj {f = f i} j)))
      (β‹‚-universal _ Ξ» i β†’ β‹‚-universal _ Ξ» j β†’ β‹‚-proj (i , j))

Let and be a pair of families. If there is a map such that then the meet of is smaller than the meet of

  ⋂≀⋂-over
    : βˆ€ {I J : Type o} {f : J β†’ Ob} {g : I β†’ Ob}
    β†’ (to : I β†’ J)
    β†’ (βˆ€ i β†’ f (to i) ≀ g i)
    β†’ β‹‚ f ≀ β‹‚ g
  ⋂≀⋂-over to p =  β‹‚-universal _ Ξ» i β†’ ≀-trans (β‹‚-proj (to i)) (p i)

As a corollary, if is smaller than for each then the meet of is smaller than the meet of

  ⋂≀⋂
    : {I : Type o} {f g : I β†’ Ob}
    β†’ (βˆ€ i β†’ f i ≀ g i)
    β†’ β‹‚ f ≀ β‹‚ g
  ⋂≀⋂ p = ⋂≀⋂-over (Ξ» i β†’ i) p

Taking the meet over a contractible family is equal the unique value of the family.

  β‹‚-singleton
    : βˆ€ {I : Type o} {f : I β†’ Ob}
    β†’ (p : is-contr I)
    β†’ β‹‚ f ≑ f (p .centre)
  β‹‚-singleton {f = f} p = ≀-antisym
    (β‹‚-proj (p .centre))
    (β‹‚-universal _ Ξ» i β†’ ≀-refl' (ap f (p .paths i)))

We also provide syntax for binary meets and top elements.

  module _ (x y : Ob) where opaque
    private
      it : Meet P x y
      it = Glb→Meet (lower-glb (glbs _))

    infixr 25 _∩_
    _∩_ : Ob
    _∩_ = it .Meet.glb

    ∩-meets : is-meet P x y _∩_
    ∩-meets = it .Meet.has-meet

  opaque
    has-top : Top
    has-top = Glb→Top (lower-glb (glbs (λ ())))

  open Meets ∩-meets public
  open Top has-top using (top; !) public

There is a distributive law relating binary and infinitary meets.

  ∩-distrib-β‹‚-≀l
    : βˆ€ {I : Type o} {x : Ob} {f : I β†’ Ob}
    β†’ x ∩ β‹‚ f ≀ β‹‚ Ξ» i β†’ x ∩ f i
  ∩-distrib-β‹‚-≀l =
    (β‹‚-universal _ Ξ» i β†’ ∩-universal _ βˆ©β‰€l (≀-trans βˆ©β‰€r (β‹‚-proj i)))

If the infinitary meet is taken over a non-empty family, then the previous distributive law can be extended to an equality.

  ∩-distrib-nonempty-β‹‚-l
    : βˆ€ {I : Type o} {x : Ob} {f : I β†’ Ob}
    β†’ βˆ₯ I βˆ₯
    β†’ x ∩ β‹‚ f ≑ β‹‚ Ξ» i β†’ x ∩ f i
  ∩-distrib-nonempty-β‹‚-l i =
    ≀-antisym
     ∩-distrib-β‹‚-≀l
     (rec! (Ξ» i β†’ ∩-universal _ (≀-trans (β‹‚-proj i) βˆ©β‰€l) (⋂≀⋂ Ξ» _ β†’ βˆ©β‰€r)) i)

Large meetsπŸ”—

Let be a poset. If has all meets of size then it has all meets, regardless of size.

is-complete→is-large-complete
  : (glbs : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ Glb P f)
  β†’ βˆ€ {β„“} {I : Type β„“} (F : I β†’ Ob) β†’ Glb P F
is-complete→is-large-complete glbs {I = I} F =
  cover-preserves-glb
    (Ξ©-corestriction-is-surjective F)
    (glbs fst)

We also provide some notation for large meets.

module
  Large
    {β‹‚      : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ Ob}
    (β‹‚-glbs : βˆ€ {I : Type o} (f : I β†’ Ob) β†’ is-glb P f (β‹‚ f))
  where

  open Glbs β‹‚-glbs using (glbs)

  opaque
    β‹‚α΄Έ : βˆ€ {β„“} {I : Type β„“} (F : I β†’ Ob) β†’ Ob
    ⋂ᴸ F = is-complete→is-large-complete glbs F .Glb.glb

    β‹‚α΄Έ-proj : βˆ€ {β„“} {I : Type β„“} {F : I β†’ Ob} (i : I) β†’ β‹‚α΄Έ F ≀ F i
    β‹‚α΄Έ-proj = Glb.glb≀fam (is-completeβ†’is-large-complete glbs _)

    β‹‚α΄Έ-universal : βˆ€ {β„“} {I : Type β„“} {F : I β†’ Ob} (x : Ob) β†’ (βˆ€ i β†’ x ≀ F i) β†’ x ≀ β‹‚α΄Έ F
    ⋂ᴸ-universal = Glb.greatest (is-complete→is-large-complete glbs _)