Skip to main content

Module plan

Module plan 

Source
Expand description

Mixed plan contract: dispatch each rule into either the future WCOJ multiway path or the existing binary-fallback lowering.

Builds on PR 1’s super::analyze_typed and the PR 5 typed gate’s vertex-type derivation to assemble per-rule RulePlan values that downstream callers (planner, mixed-execution evaluator, kernel test harness) consume to decide which path each rule takes. This slice ships only the contract — no executor integration, no RIR lowering, no CUDA, no cost model beyond super::AppearanceOrder.

§Verdicts

Each rule produces exactly one of:

Type conflicts — a variable that gets contradictory types from different body atoms — are NOT verdicts. They surface as PlanError::ConflictingVariableType; the planner refuses to plan a rule whose fixture is internally contradictory. Caller must fix the fixture before re-planning.

§Determinism

plan_rule / plan_rules are pure functions of their inputs. explain_plans is canonical: plans are sorted by head_predicate (lexicographic), with same-head ties broken by the rendered line content itself — string-lex on the verdict tag (so binary-fallback < multiway), then on the boundary list or variable-order vector. Input position is never the tie-breaker, so the output is identical for any permutation of the input, including reversal of same-head rules. Locked by explain_plans_is_canonical_under_same_head_reorder.

Enums§

PlanError
Hard errors from plan_rule / plan_rules / plan_scc_rules.
RulePlan
Plan choice for a single rule.

Functions§

explain_plans
Render a canonical textual explain of a plan slice.
plan_rule
Plan a single rule. See module-level docs for the contract.
plan_rules
Plan a slice of rules. Order-preserving: plans[i] is the plan for rules[i].
plan_scc_rules
Plan a mutually-recursive rule group with PR 8 transitive type inference engaged.