Skip to content

s2/flow: protocol rule defs in entry facts - #10

Merged
vic merged 1 commit into
mainfrom
flow-rules
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
flow-rules

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

FLOW rung: entry facts may use the rule defs of a binder protocol (s1 facts.srs:238-322).

  • Each binder protocol with rule defs is solved once over its next facts. A rule atom in a def's entry facts holds when its tuple is in that model.
  • Rule defs become D rules: variables are the lowercase names in state positions, numbered from the params.
  • Every arg of a rule atom is a state position (as s1 statePos), so a variable that appears only in a rule atom is enumerated.

Tests (tests/s2/flow, 28 cases): tests/rules.srs (twoKnocks; reach with two clauses and recursion) at the call sites and in the bodies, a call with no solution, a call that holds only through the recursive clause, and a state with two ops where the rule names one.

Mutants: rule atoms always hold, rule atoms without state positions, only the first clause of each rule. Each changes the output. A fourth mutant (the op of next as a variable) proved equivalent, so the dead guard it targeted was removed. Local tests/run.sh: 182 ok, 0 FAIL.

A protocol is its own Datalog program: each binder protocol with rule defs is solved once over its next
facts (one per transition), and a rule atom in a def's entry facts holds when its tuple is in that
model. Rule defs become D rules: variables are the lowercase names in state positions, numbered from
the params; every arg of a rule atom is a state position (as s1 statePos), so a variable that appears
only in a rule atom, like s3 in twoKnocks(s, s3), is enumerated too.

tests/s2/flow: tests/rules.srs (twoKnocks; reach with two clauses and recursion) at the call sites and
in the bodies, a call whose rule atom has no solution, a call that holds only through the recursive
clause, and one whose state has two ops where the rule names one. Mutants: rule atoms always hold, rule
atoms without state positions, only the first clause of each rule: each changes the output.
@vic
vic merged commit 1fcef3e into main Nov 9, 2026
3 checks passed
@vic
vic deleted the flow-rules branch November 9, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant