Class Product

All Implemented Interfaces:
Lattice

public class Product
extends AbstractLattice
The (categorical) product of lattices. As for every algebraic theory, elements are tuples, and operations are implemented componentwise.

Note that the product of zero lattices is the trivial lattice with one element.

  • Method Details

    • of

      public static Lattice of​(Lattice... lattice)
      Return the product of the provided lattices.
      Parameters:
      lattice - the lattices whose product has to be computed.
      Returns:
      the product of the specified lattices.
    • isDistributive

      public boolean isDistributive()
      Description copied from interface: Lattice
      Return true if this lattice is distributive.
      Specified by:
      isDistributive in interface Lattice
      Overrides:
      isDistributive in class AbstractLattice
      Returns:
      true if this lattice is distributive.
    • elements

      public Collection<Element> elements()
      Description copied from class: AbstractLattice
      Generate iteratively all elements of this lattice.

      This methods uses Lattice.generators() to obtain an initial set of elements, and then computes joins and meets of all available elements until no new elements are generated. It is expected that concrete subclasses will override this method with an ad hoc, more efficient implementation.

      It is strongly suggested that concrete subclasses that do not override this method cache its result internally.

      Specified by:
      elements in interface Lattice
      Overrides:
      elements in class AbstractLattice
      Returns:
      the set of elements of this lattice.
    • generators

      public Collection<Element> generators()
      Description copied from interface: Lattice
      Return a collection of generators for the lattice. The set will not include zero or one. There is no guarantee of freeness or minimality.
      Returns:
      a collection of generators.
    • proj

      public Element proj​(Element e, int i)
      Project the provided element on a component specified by index.
      Parameters:
      e - an element of this product.
      i - a component, specified by its index starting at 0.
      Returns:
      the projection of e on the i-th component.
    • valueOf

      public Element valueOf​(String name)
      Description copied from interface: Lattice
      Return an element of this lattice, given its name.

      Certain lattices make it possible to define names for elements. This method returns the element corresponding to the provided name.

      Parameters:
      name - the name of an element of this lattice.
      Returns:
      the element of this lattice named name.
    • tuple

      public Element tuple​(Element... element)
      Return an element of this product given a tuple of elements from its factors.
      Parameters:
      element - a list of elements from each factor of this product, in the same order.
      Returns:
      the element of the product defined by the tuple element.
    • one

      public Element one()
      Description copied from interface: Lattice
      Return the one of this lattice.

      Note that there is no guarantee that the returned element is the only element representing one in this lattice. Other ones may arise from computations, but they will always be equal to the element returned by this method.

      Returns:
      the one of this lattice.
    • zero

      public Element zero()
      Description copied from interface: Lattice
      Return the zero of this lattice.

      Note that there is no guarantee that the returned element is the only element representing zero in this lattice. Other zeroes may arise from computations, but they will always be equal to the element returned by this method.

      Returns:
      the zero of this lattice.
    • join

      public Element join​(Element... element)
      Description copied from interface: Lattice
      Return the join of the provided elements. In particular, upon the empty list of arguments returns zero, and upon a singleton list the only specified element.
      Parameters:
      element - the elements whose join has to be computed.
      Returns:
      the join of the provided elements.
    • meet

      public Element meet​(Element... element)
      Description copied from interface: Lattice
      Return the meet of the provided elements. In particular, upon the empty list of arguments returns one, and upon a singleton list the only specified element.
      Parameters:
      element - the elements whose meet has to be computed.
      Returns:
      the meet of the provided elements.
    • component

      public Lattice component​(int k)
      Return a component lattice, given its index.

      The component lattices of a product are numbered from 0. This method provides access by index to such components.

      Parameters:
      k - a component index.
      Returns:
      the component lattice of index k.
    • comp

      public boolean comp​(Element x, Element y)
      Description copied from class: AbstractLattice
      Check whether two elements are comparable using Lattice.meet(Element[]).
      Specified by:
      comp in interface Lattice
      Overrides:
      comp in class AbstractLattice
      Parameters:
      x - an element.
      y - another element.
      Returns:
      true iff x.meet(y) equals x or y.
    • leq

      public boolean leq​(Element x, Element y)
      Description copied from class: AbstractLattice
      Check whether an element is smaller than or equal to another element using Lattice.meet(Element[]).
      Specified by:
      leq in interface Lattice
      Overrides:
      leq in class AbstractLattice
      Parameters:
      x - an element.
      y - another element.
      Returns:
      true iff x.meet(y) equals x.
    • toString

      public String toString()
      Overrides:
      toString in class Object