public final class FoldKernel extends Object
lineage-spec/algorithms/fold-v1.md): folds the ExplainGraph of one statement of a document
into its Fact Occurrences, FactCandidates and write requirements.
The kernel reads the document the way the reference runner (conformance/run.py, class
Projector) does, so that a validator built on it reports what the reference reports. It also computes
what the reference leaves out and the specification defines: the derived-unit rules of Section 7.3 (every walk
of a statement whose derived text is only OBSERVED is ASSUMED, every write at most
PARTIAL), the bindings of every Occurrence (Sections 7.1, item 6 and 8.1, item 2), the ordinals of
FactCandidates (identity-v1, Section 5.4), and the complete requirements of every write (Sections 7.4 and
7.5).
Exploration is over states (node, label, choices, proof) and terminates on every graph (Section 6). Its
cost grows with the states reached and, for a group of linked ambiguous references, with the number of worlds
(the product of their alternatives); both are bounded, and a statement over a bound throws
FoldLimitException.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_STATES
The most exploration states one statement may reach (every state counts, the first and the last too).
|
static int |
DEFAULT_MAX_WORLDS
The most worlds one group of linked references, or one Fact test, may examine.
|
| Constructor and Description |
|---|
FoldKernel(DocumentIndex index) |
FoldKernel(DocumentIndex index,
int maxStates,
int maxWorlds) |
| Modifier and Type | Method and Description |
|---|---|
Object |
completeness(long statement)
The ExplainGraph completeness of a statement: its
statementCompleteness entry or the graph's. |
List<Map<?,?>> |
edgesOf(long statement)
The micro-edges of one statement, in ref order.
|
StatementFold |
fold(long statement)
Folds one statement (Section 9).
|
boolean |
folded(Object ref) |
DocumentIndex |
getIndex() |
List<Long> |
getStatements()
Every statement of the document and every statement a micro-edge names, in ref order.
|
boolean |
graphCset(Object ref)
True when the ref names a candidate set of the ExplainGraph (the source of an UNRESOLVED reference).
|
boolean |
kept(Object ref) |
List<Finding> |
malformedEdges()
SEMANTIC_FOLD_MALFORMED_EDGE for every micro-edge of the document whose shape is not conformant. |
boolean |
observed(long statement)
True when the statement lies in a derived source unit whose text is only observed (Section 7.3).
|
public static final int DEFAULT_MAX_STATES
public static final int DEFAULT_MAX_WORLDS
public FoldKernel(DocumentIndex index)
public FoldKernel(DocumentIndex index, int maxStates, int maxWorlds)
public DocumentIndex getIndex()
public List<Long> getStatements()
public List<Map<?,?>> edgesOf(long statement)
public Object completeness(long statement)
statementCompleteness entry or the graph's.public boolean graphCset(Object ref)
public boolean observed(long statement)
public List<Finding> malformedEdges()
SEMANTIC_FOLD_MALFORMED_EDGE for every micro-edge of the document whose shape is not conformant.public StatementFold fold(long statement)