module Order.Instances.Pointwise.Diagrams where

Pointwise joins and meetsπŸ”—

This module establishes that joins and meets are a pointwise construction, in the following sense: Suppose that and are families of elements with a poset, such that, for all we have 1, then when is given the pointwise ordering.

module _ {β„“β‚’ β„“α΅£ β„“α΅’} {I : Type β„“α΅’} {P : I β†’ Poset β„“β‚’ β„“α΅£} where
  private module P {i} = Poset (P i)

  is-top-pointwise
    : βˆ€ {t} (pt : βˆ€ i β†’ is-top (P i) (t i))
    β†’ is-top (Pointwise I P) t
  is-top-pointwise pt fam i = pt i (fam i)

  has-top-pointwise
    : (βˆ€ i β†’ Top (P i))
    β†’ Top (Pointwise I P)
  has-top-pointwise pt .Top.top i = pt i .Top.top
  has-top-pointwise pt .Top.has-top = is-top-pointwise Ξ» i β†’ pt i .Top.has-top

  is-bottom-pointwise
    : βˆ€ {b} (pt : βˆ€ i β†’ is-bottom (P i) (b i))
    β†’ is-bottom (Pointwise I P) b
  is-bottom-pointwise pb fam i = pb i (fam i)

  has-bottom-pointwise
    : (βˆ€ i β†’ Bottom (P i))
    β†’ Bottom (Pointwise I P)
  has-bottom-pointwise pt .Bottom.bot i = pt i .Bottom.bot
  has-bottom-pointwise pt .Bottom.has-bottom =
    is-bottom-pointwise Ξ» i β†’ pt i .Bottom.has-bottom

  is-meet-pointwise
    : βˆ€ {f g h} (pms : βˆ€ i β†’ is-meet (P i) (f i) (g i) (h i))
    β†’ is-meet (Pointwise I P) f g h
  is-meet-pointwise pwise .is-meet.meet≀l i = pwise i .is-meet.meet≀l
  is-meet-pointwise pwise .is-meet.meet≀r i = pwise i .is-meet.meet≀r
  is-meet-pointwise pwise .is-meet.greatest lb' lb'<f lb'<g i =
    pwise i .is-meet.greatest (lb' i) (lb'<f i) (lb'<g i)

  is-join-pointwise
    : βˆ€ {f g h} (pjs : βˆ€ i β†’ is-join (P i) (f i) (g i) (h i))
    β†’ is-join (Pointwise I P) f g h
  is-join-pointwise pwise .is-join.l≀join i = pwise i .is-join.l≀join
  is-join-pointwise pwise .is-join.r≀join i = pwise i .is-join.r≀join
  is-join-pointwise pwise .is-join.least lb' lb'<f lb'<g i =
    pwise i .is-join.least (lb' i) (lb'<f i) (lb'<g i)

With a couple more variables, we see that the results above are a special case of both arbitrary lubs and glbs being pointwise:

module
  _ {β„“β‚’ β„“α΅£ β„“α΅’ β„“β±Ό} {I : Type β„“α΅’} {J : Type β„“β±Ό} {P : J β†’ Poset β„“β‚’ β„“α΅£}
    (F : I β†’ (j : J) β†’ ⌞ P j ⌟)
    (m : (j : J) β†’ ⌞ P j ⌟)
  where

  is-lub-pointwise
    : (βˆ€ j β†’ is-lub (P j) (Ξ» i β†’ F i j) (m j))
    β†’ is-lub (Pointwise J P) F m
  is-lub-pointwise pwise .is-lub.fam≀lub i j = pwise j .is-lub.fam≀lub i
  is-lub-pointwise pwise .is-lub.least ub' fi<ub' j =
    pwise j .is-lub.least (ub' j) Ξ» i β†’ fi<ub' i j

  is-glb-pointwise
    : (βˆ€ j β†’ is-glb (P j) (Ξ» i β†’ F i j) (m j))
    β†’ is-glb (Pointwise J P) F m
  is-glb-pointwise pwise .is-glb.glb≀fam i j = pwise j .is-glb.glb≀fam i
  is-glb-pointwise pwise .is-glb.greatest ub' fi<ub' j =
    pwise j .is-glb.greatest (ub' j) Ξ» i β†’ fi<ub' i j

Every subset is a least upper bound of singleton sets.

subset-singleton-lub
  : βˆ€ {β„“} {A : Type β„“} (P : A β†’ Ξ©)
  β†’ is-lub (Subsets A) {I = βˆ«β‚š P} (singleton βŠ™ fst) P
subset-singleton-lub P .is-lub.fam≀lub (x , x∈P) y = rec! Ξ» x=y β†’ subst (_∈ P) x=y x∈P
subset-singleton-lub P .is-lub.least ub sing≀ub x x∈P =
  sing≀ub (x , x∈P) x (inc refl)

  1. In the code, this means that is-meet holds, but we will abuse this β€œfunctional” notation for clarity.β†©οΈŽ