Skip to content

Commit 6028508

Browse files
Update docs with information about new branching fields (#3838)
fixes [#3834](#3834)
1 parent ab4a7fb commit 6028508

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

docs/2022-07-18-JSON-RPC-Server-API.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,35 +242,37 @@ An additional `next-states` field contains all following states of the branch po
242242
"jsonrpc": "2.0",
243243
"id": 1,
244244
"result": {
245-
"state": {
246-
"term": {"format":"KORE", "version":1, "term":{}},
247-
"predicate": {"format":"KORE", "version":1, "term":{}},
248-
"substitution": {"format":"KORE", "version":1, "term":{}},
249-
},
250-
"depth": 2,
251245
"reason": "branching",
246+
"depth": 0,
247+
"state": <T><k> a ~> . </k> <val> X </val></T>
252248
"next-states": [
253249
{
254-
"term": {"format": "KORE", "version": 1, "term": {}},
255-
"predicate": {"format":"KORE", "version":1, "term":{}},
256-
"substitution": {"format":"KORE", "version":1, "term":{}},
250+
"term": <T><k> c ~> . </k> <val> X </val></T>,
251+
"predicate": #Not (X #Equals 0),
252+
"rule-id": "6974170fb1496dc2cae5b77afce0c12386d66ce73a4b2344c6512681ba06c70d",
253+
"rule-predicate": #Not (X #Equals 0),
254+
"rule-substitution": {...}
257255
},
258256
{
259-
"term": {"format": "KORE", "version": 1, "term": {}},
260-
"predicate": {"format":"KORE", "version":1, "term":{}},
261-
"substitution": {"format":"KORE", "version":1, "term":{}},
257+
"term": <T><k> b ~> . </k> <val> 0 </val></T>,
258+
"rule-id": "79cf50846fb75eb486ff134a1a00f1546aee170ae548228b79d8898c12c93d2b",
259+
"rule-predicate": X #Equals 0,
260+
"substitution": V #Equals X #And X #Equals 0 #And ...
262261
}
263-
],
264-
"logs": []
262+
]
265263
}
266264
}
267265
```
268266

267+
(note, in the example above theconfiguation and conditions have been pretty printed for clarity. The actual response would contain a `{"format":"KORE", "version":1, "term":{...}}` JSON term.)
268+
269269
##### Clarifications
270270
* It is possible that some of the `next-states` in a `branching` result have not actually taken rewrite steps. If one of the branches is stuck because of the added (branching) side condition, `next-states` will also contain this branch, with a term identical to the one in `state` and the branching condition added to the prior `predicate` from `term`.
271271
Rationale: The branching should be indicated to the user. A subsequent `execute` step starting from this stuck `state` will of course immediately report `stuck`.
272272
* `branching` results are preferred to `cut-point-rule` and `terminal-rule` results. That means, if execution reaches a branch with one of the applying rules having a label/ID from `cut-point-rules` or `terminal-rules`, the response will be `branching`.
273273
Rationale: The branching information must be provided, assuming the client will re-execute on each branch.
274+
* The `rule-predicate` term is a subterm of the `predicate` response and signals the requires clause predicate that was undecidable and thus caused branching. Note that variables inside `rule-predicate` may not always be present in the configuration, as they may have been simplified away.
275+
* `rule-substitution` is the substitution of the internal variables of the rules LHS with terms in the configuration before the rewrite. This data is purely for diagnostic purposes and should not be used for any reasoning as it contains interal variable names from the applied rule. The `substitution` field on the other hand is returned when the backend infers a new equality for some of the variables present in the configuration, e.g. when the backend splits on the condition `X == 0`, it adds `X == 0` into the substitution field in the response.
274276

275277
#### Optional Logging
276278

0 commit comments

Comments
 (0)