Implementing "there exists" processing
The processing patterns we've been looking at can all be summarized with the universal quantifier,
, meaning for all. It's been an implicit part of all of the processing definitions:
- Map: For all items in the source,
, apply the mapfunction,
. We can change notation to have an explicit use of the universal quantifier:
. - Filter: For all items in the source, pass those for which the
filterfunction istrue. Here, also, we've used the universal quantifier to make this explicit:
. - Reduce: For all items in the source, use the given operator and base value to compute a summary. The universal quantification is implicit in the definition of operators like
.
There are also cases where we are only interested in locating a single item. We often describe these cases as a search to show there exists at least one item where a condition is true. This can be called the existential quantifier,
,...