Markdown for LLMs
Replay an answer from the same inputs
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Replay an answer from the same inputs
## Intent
I want to replay an answer from the same inputs.
## Wrong form and why it stays silent
Current time must not be substituted for a stored legal date; a mistyped time axis is not a date.
```text title="Incorrect form"
effective [@2026-10-01, @2026-09-01);
```
## Correct form
```law
language "law.core" version "0.2";
package recipe.m06 version "1.0.0";
namespace "urn:recipe:m-queries:06";
entity Person;
relation filed(p: Person);
relation accepted(p: Person);
rule Accept strict { for p: Person; effective [@2026-09-01, @2026-10-01); when filed(p); then accepted(p); }
```
## Frozen execution scene
| Input / variant | Question | Expectation |
|---|---|---|
| 1. inside the window | `truth(accepted(entity_ref("urn:recipe:m-queries:p")))` | `truth_status == TRUE_ONLY; evaluation_status == COMPUTED;` |
| 2. different legal date | `truth(accepted(entity_ref("urn:recipe:m-queries:p")))` | `truth_status == NEITHER; evaluation_status == COMPUTED;` |
```law
test "inside window replays identically" {
given {
context { legal_time @2026-09-13; decision_time @2026-09-13T09:00:00Z; knowledge_time @2026-09-13T09:00:00Z; timezone "UTC"; }
assert filed(entity_ref("urn:recipe:m-queries:p"));
}
evaluate truth(accepted(entity_ref("urn:recipe:m-queries:p")));
expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED;
}
```
```law
test "other law date changes hashes" {
given {
context { legal_time @2026-10-01; decision_time @2026-09-13T09:00:00Z; knowledge_time @2026-09-13T09:00:00Z; timezone "UTC"; }
assert filed(entity_ref("urn:recipe:m-queries:p"));
}
evaluate truth(accepted(entity_ref("urn:recipe:m-queries:p")));
expect truth_status == NEITHER; expect evaluation_status == COMPUTED;
}
```
Replay feeds the same CLIR, case, query, and semantic version 0.2. All
canonical answer bytes are checked, not only truthStatus. Then two runs
receive different execution receipts:
```json
[
{"engine": "one", "executedAt": "2026-09-13T10:00:00Z"},
{"engine": "two", "executedAt": "2026-09-14T10:00:00Z"}
]
```
The receipt is passed as a separate receipt.json / EvaluationRequest.receipt field.
Both implementations keep the whole answer unchanged. Changing legal_time in scene 2
leaves the program’s theoryHash and artifactHash, but changes caseHash and resultHash.
Thus the three hashes theory/artifact/result cannot be used interchangeably.
Check of result fields and extra inputs:
```python
>>> import runpy
>>> checks = runpy.run_path("docs/recipes/m-queries/resources/check.py")
>>> checks["replay"](https://github.com/arxohq/law/blob/master/docs/recipes/m-queries/6)
True
```
## Counterfactual
The sidecar mutation reproduces `LDC-E4109`. Counterfactual table variants are executed separately; input errors are not passed off as NEITHER.
## Boundary
The execution receipt is not part of resultHash.
## Pitfall
The result is invariant when the receipt changes, and changes when legal_time changes.