Skip to main content

polydat_core/iteration/comprehension/predicate/
mod.rs

1// Copyright 2024-2026 Jonathan Shook
2// SPDX-License-Identifier: Apache-2.0
3
4//! Filter predicates — comprehension_forms.md §10.9: their
5//! evaluation (§10.9.1) and their analysis.
6//!
7//! A predicate is the text carried by
8//! [`crate::iteration::comprehension::ast::Comprehension::Filter`],
9//! parsed by [`parse_predicate`] with the language's one precedence
10//! table. [`CompiledPredicate`] evaluates it against a tuple on every
11//! path that filters and decides whether it is total. The analyzer
12//! produces [`PredicateInfo`] from the same tree for the optimizer's
13//! R5 (per-axis filter pushdown).
14//!
15//! ## Module layout
16//!
17//! - [`eval`] — `CompiledPredicate`, the evaluator, and its totality
18//!   check.
19//! - [`info`] — `PredicateInfo` and supporting enums.
20//! - [`coordset`] — `CoordSet` carrying per-coord discrete /
21//!   continuous classification.
22//! - [`recognizers`] — the §10.9.5 pattern catalog.
23//! - [`analyzer`] — entry point + dispatch.
24
25pub mod analyzer;
26pub mod coordset;
27pub mod eval;
28pub mod info;
29pub mod recognizers;
30
31pub use analyzer::analyze;
32pub use coordset::{CoordInfo, CoordKind, CoordSet};
33pub use eval::{CompiledPredicate, ValueKind, element_kind};
34pub use info::{
35    Determinism, Factorization, Monotonicity, OpaqueReason, PerAxisMap, PredicateInfo,
36    RangeConstraint,
37};
38pub use polydat_grammar::comprehension::predicate::{
39    Comparison, Predicate, PredicateKind, PredicateLiteral, parse_predicate,
40};