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:
RulePlan::MultiwayCandidate— cleared the typed gate; ready for WCOJ. Carries theHypergraphRuleand thesuper::AppearanceOrder-resolved variable order so the future kernel does not re-derive them.RulePlan::BinaryFallback— failed the typed gate on at least one structural / type-coverageBoundary. Carries everyBoundarythat fired so explain output and downstream callers see all reasons rather than only the first one.
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§
- Plan
Error - Hard errors from
plan_rule/plan_rules/plan_scc_rules. - Rule
Plan - 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 forrules[i]. - plan_
scc_ rules - Plan a mutually-recursive rule group with PR 8 transitive type inference engaged.