Cohesive Systems logoCOHESIVE SYSTEMS

Search Cohesive Systems

Ready

Search Cohesive Systems

Find product pages, building blocks, technical articles, and graph definitions.

Element-Predicate Duality

Element-predicate duality is the relationship between the elements of a thing and the predicates that can be asserted of them. Programmers use it whenever a Predicate<T>, a function T -> Bool, selects items from a collection: the predicate picks out elements, and with enough predicates it singles out one item. The relationship reads in both directions. A predicate is a function on elements, and an element is equally a function on predicates, the one that evaluates each predicate at that element:

p:Element→Boolx:Predicate→Bool,x(p)=p(x)\begin{aligned} p &: \mathsf{Element} \to \mathsf{Bool} \\ x &: \mathsf{Predicate} \to \mathsf{Bool}, \qquad x(p) = p(x) \end{aligned}

It is an instance of duality and symmetry, and event-state duality is its most important instance in the model.

Duality as Reversal

The essence of duality is reversal. Negating real numbers reverses their order while exchanging max⁡\max with min⁡\min and floor with ceiling. Complementing a Boolean algebra reverses its order while exchanging true with false and conjunction with disjunction, which is De Morgan duality. Taking the opposite of a category reverses its arrows while exchanging limits with colimits. The third generalizes the first two, since an order is a category with an arrow from aa to bb whenever a≤ba \le b.

Element-predicate duality arises from categorical duality by choosing two objects: gg to serve as a singleton and kk to serve as truth values. For any object aa:

  • the elements of aa are the arrows g→ag \to a;
  • the predicates on aa are the arrows a→ka \to k;
  • applying a predicate to an element is composition, g→a→kg \to a \to k, which yields an arrow g→kg \to k.

The arrows g→kg \to k form the set of truth values KK. Reversing the category exchanges the roles of gg and kk, so elements become predicates and predicates become elements, while KK stays the same and every application yields the same truth value as before. For sets the natural choice is g={0}g = \{0\} and k={0,1}k = \{0, 1\}, which gives elements and subsets. For locally compact abelian groups the natural choice is the integers and the unit circle, which gives Pontryagin duality.

Chu Spaces

Keeping only the elements, the predicates, and the results of application gives a table. A Chu space over KK is a triple (A,r,X)(A, r, X), where AA is a set of elements, XX is a set of predicates, and r:A×X→Kr : A \times X \to K gives the value of each predicate at each element. Its dual is (X,rˇ,A)(X, \check{r}, A): the same table transposed.

r(a,x)=x(a)rˇ(x,a)=r(a,x)r(a, x) = x(a) \qquad \check{r}(x, a) = r(a, x)

Rows describe elements by the predicates they satisfy, and columns describe predicates by the elements that satisfy them. Two conditions remove redundancy:

  • Extensional: no two columns are equal, so a predicate is determined by which elements satisfy it. Each predicate can then be identified with a function A→KA \to K, and the Chu space is a pair (A,X)(A, X) with X⊆KAX \subseteq K^{A}.
  • Separable: no two rows are equal, so elements that satisfy the same predicates are the same element. This is Leibniz's identity of indiscernibles.

A biextensional Chu space is both. Biextensional Chu spaces are to Chu spaces as partial orders are to preorders: equivalent elements are identified.

Not every function A→KA \to K need be admitted as a predicate. Which predicates are admitted is where the structure lives. A Chu space is a generalized topological space whose open sets, the admitted predicates, need not be closed under union or intersection, and whose truth values need not be two.

Morphisms

A map from (A,r,X)(A, r, X) to (B,s,Y)(B, s, Y) is a pair of functions in opposite directions, f:A→Bf : A \to B on elements and g:Y→Xg : Y \to X on predicates, such that

s(f(a),y)=r(a,g(y))s(f(a), y) = r(a, g(y))

Elements move forward and predicates move backward. Asking whether yy holds after moving aa by ff is the same as asking whether g(y)g(y) held of aa before. When predicates are functions, g(y)=y∘fg(y) = y \circ f. This is continuity in topology, where the inverse image of an open set is open. In programming it is the duality between state transformers and predicate transformers: a program moves states forward and pulls postconditions back to preconditions, as in Dijkstra's weakest preconditions.

Beyond Truth and Falsity

KK need not be Boolean. A richer KK records more about how an element stands with respect to a predicate. When KK carries the structure of a quantale, the table induces distances on both elements and predicates, and Plotkin's theorem shows that this induced structure is all the enriched structure there is. Event-state duality uses this to derive time and information from a single table.

Instances in the Model

  • Event-state duality. A schedule is a Chu space with events as elements and states as predicates. An automaton is its transpose, with states as elements and events as predicates.
  • Automata. The Hankel matrix of a language relates past histories to future histories by whether their concatenation is accepted. A state machine factors this table through its states, with reachability as an algebra map from histories and observability as a coalgebra map to behaviors.
  • Observables. An observable is a predicate on state valued in a richer KK. The state is known by how it answers its observables.
  • Invariants. An invariant is a predicate that every admitted state must satisfy.
  • The Yoneda lemma. The Yoneda lemma characterizes an object by its relationships to all others. Element-predicate duality is its elementary form, and Lawvere distance gives its metric form.

The State-Event-Predicate Triangle

Three spaces in the model relate pairwise by element-predicate duality.

  • State space, studied through state machines: the possible states of a system and the transitions among them.
  • Event space, studied through processes and process calculi: the occurrences of a system and the order and choice among them.
  • Predicate space, studied through assurance: the properties claimed of a system and the evidence for them.

Each side of the triangle is a table relating the elements of one space to those of another:

SideTable entryReadingTheory
States and eventshas event ee occurred in state xx?event-state dualityautomata and schedules
States and predicatesdoes state xx satisfy predicate PP?invariants, assertions, observablesstate predicates, Hoare logic
Events and predicateswhat must hold before ee for PP to hold after?preconditions, trace propertiespredicate transformers, temporal logic, safety and liveness

The sides fit together. Events act on states forward as transitions and on predicates backward as predicate transformers. An invariant II is preserved by event ee exactly when II implies the weakest precondition of ee with respect to II. A property of whole histories, such as a safety or liveness property, is a predicate on the event side, and its truth at a state depends on which events have occurred there.

Assurance also needs more than Boolean truth values. Assurance distinguishes established, conditional, refuted, and unknown claims, and warns that failure to derive a claim is not derivation of its failure. That is the distinction between not yet and never that richer KK draw in event-state duality, and the absence of excluded middle that Heyting algebras formalize. Predicate space is therefore naturally valued in an enriched KK, as event space and state space are.

Modeling Checks

  • What are the elements, what are the predicates, and what are the truth values?
  • Which predicates are admitted, and what structure does that choice express?
  • Are elements with the same answers to every predicate treated as identical?
  • Do maps move elements forward and pull predicates back consistently?
  • Is a Boolean answer enough, or must unknown, partial, or graded answers be kept distinct?

Formal relations

  • refines: Duality and Symmetry — Gives the general duality between elements and predicates, of which event-state duality and the state-event-predicate triangle are instances.

External References