Skip to main content

Module nary_reference

Module nary_reference 

Source
Expand description

Host-side reference scorer for n-ary rule patterns.

The parity anchor for the device n-ary scoring stage: a direct, obviously-correct interpretation of NaryRulePattern coverage semantics over host fact tables. The device kernel, when it lands, must reproduce these counts bit-for-bit on bounded inputs — exactly the role the Python prototype played for the binary engine.

Coverage semantics, stated once: an example tuple (one head assignment) is covered by a pattern iff there exists an assignment of the pattern’s join variables such that every body atom’s bound row exists in its candidate relation. Head positions are fixed by the example; join variables are searched. The search is a plain backtracking walk — the reference optimizes for auditability, not speed.

Structs§

HostRelation
One candidate relation’s facts as host rows; row length is the arity.
ReferenceCoverage
Coverage counts for one pattern over one example set pair.

Functions§

score_pattern_reference
Score one pattern against positive and negative example tuples.