81 Filter Conditions

A filter is not a relation-valued expression. It is a Boolean condition translated relative to the current path frame. Applying a filter strengthens the frame condition and preserves the current result interface.

s.supplier.[city = "London"].name

In logic-frame display notation, the filter contributes an additional predicate to the frame:

name=N:String
where ∃S:Supplier ∃C:String (
    s.supplier(S)
    ∧ S.city(C)
    ∧ C = "London"
    ∧ S.name(N)
)

The expression inside square brackets is interpreted in the context supplied by the receiver frame. Names such as city are resolved through that context. The bracketed expression therefore does not stand alone as a first-class relation, m-relation, or relation literal.

Selection as a Relation View

When the filtered frame is later observed and materialised as an s-relation, the result looks like an ordinary relational selection. That is an extensional view of the frame, not the primary denotation of the bracketed expression.

path frame  --add filter condition-->  filtered path frame
filtered path frame  --observe under heading H-->  selected s-relation extension

This is the same pattern used throughout the Query and Relations parts: Predica source expressions translate to logic frames; relation-shaped results are obtained by observing the extensions of those frames under chosen headings.

Why Not Intensional Relations Here?

It is sometimes useful in logic and model theory to describe a predicate intensionally, before its extension in a particular model is known. Predica can use that vocabulary informally, but the surface filter syntax does not make bracketed predicates into relation values. In particular:

  • [a = b] is not a standalone binary relation with attributes a and b;
  • e.[a = b] is not defined by joining e with a first-class relation value;
  • renaming is specified by result labels, not by deriving it from relation join and projection.

Implementations may optimise filters using indexes, joins, semi-joins, factorised representations, or other relational techniques. Those are implementation strategies for preserving the logic-frame semantics, not additional surface meanings for square brackets.