Markdown for LLMs
Compare two acts on one case
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Compare two acts on one case
## Intent
I want to compare two acts on one case.
## Wrong form and why it stays silent
The same predicate name does not prove the same formalization depth. One .lawtest does not execute two programs at once.
```text title="Incorrect form"
fragment F in Missing
```
## Correct form
```law
language "law.core" version "0.2";
package recipe.m05 version "1.0.0";
namespace "urn:recipe:m-queries:05";
source Act { kind policy; }
edition E of Act { language ru; officiality unofficial; materialization_status ABSTRACT_ONLY; in_force [@2026-01-01, infinity); }
fragment F in E { kind article; locator "article/1"; text ru unofficial "Статья 1. Заявление принимается."; }
entity Person;
relation registered(p: Person);
relation eligible(p: Person);
relation approved(p: Person);
@source(F)
rule Decide strict { for p: Person; when registered(p) and eligible(p); then approved(p); }
```
## Frozen execution scene
| Input / variant | Question | Expectation |
|---|---|---|
| 1. full input | `truth(approved(entity_ref("urn:recipe:m-queries:p")))` | `truth_status == TRUE_ONLY; evaluation_status == COMPUTED;` |
| 2. no condition | `truth(approved(entity_ref("urn:recipe:m-queries:p")))` | `truth_status == NEITHER; evaluation_status == COMPUTED;` |
| 3. no registration | `truth(approved(entity_ref("urn:recipe:m-queries:p")))` | `truth_status == NEITHER; evaluation_status == COMPUTED;` |
```law
test "full input establishes" {
given {
context { legal_time @2026-09-13; decision_time @2026-09-13T09:00:00Z; knowledge_time @2026-09-13T09:00:00Z; timezone "UTC"; }
assert registered(entity_ref("urn:recipe:m-queries:p")); assert eligible(entity_ref("urn:recipe:m-queries:p"));
}
evaluate truth(approved(entity_ref("urn:recipe:m-queries:p")));
expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED;
}
```
```law
test "missing condition gives neither" {
given {
context { legal_time @2026-09-13; decision_time @2026-09-13T09:00:00Z; knowledge_time @2026-09-13T09:00:00Z; timezone "UTC"; }
assert registered(entity_ref("urn:recipe:m-queries:p"));
}
evaluate truth(approved(entity_ref("urn:recipe:m-queries:p")));
expect truth_status == NEITHER; expect evaluation_status == COMPUTED;
}
```
```law
test "missing registration gives neither" {
given {
context { legal_time @2026-09-13; decision_time @2026-09-13T09:00:00Z; knowledge_time @2026-09-13T09:00:00Z; timezone "UTC"; }
assert eligible(entity_ref("urn:recipe:m-queries:p"));
}
evaluate truth(approved(entity_ref("urn:recipe:m-queries:p")));
expect truth_status == NEITHER; expect evaluation_status == COMPUTED;
}
```
The second pinned world is shown below:
```law
language "law.core" version "0.2";
package recipe.m05 version "1.0.0";
namespace "urn:recipe:m-queries:05";
source Act { kind policy; }
edition E of Act { language ru; officiality unofficial; materialization_status ABSTRACT_ONLY; in_force [@2026-01-01, infinity); }
fragment F in E { kind article; locator "article/1"; text ru unofficial "Статья 1. Заявление принимается."; }
entity Person;
relation registered(p: Person);
relation eligible(p: Person);
relation approved(p: Person);
@source(F)
rule Decide strict { for p: Person; when registered(p); then approved(p); }
```
The same case and query bytes are fed separately to each program. For the three
table rows world B yields TRUE_ONLY, TRUE_ONLY, NEITHER respectively.
The criterion is truthStatus of one approved(p), not similarity of answer text.
Ordinary law_measure confirms for both worlds one article at depth
EXECUTABLE. Different programHash with the same caseHash is expected.
Check of result fields and extra inputs:
```python
>>> import runpy
>>> checks = runpy.run_path("docs/recipes/m-queries/resources/check.py")
>>> checks["worlds"](https://github.com/arxohq/law/blob/master/docs/recipes/m-queries/5)
True
```
## Counterfactual
The sidecar mutation reproduces `LDC-E5102`. Counterfactual table variants are executed separately; input errors are not passed off as NEITHER.
## Boundary
Comparison is by an explicitly same observed quantity approved(p), not by equality of hashes of different programs. The synthetic second act uses the same interface; these are two separate pinned worlds, not a merge of them.
## Pitfall
SOURCE_ONLY is not comparable with EXECUTABLE as the same formalization — see [Measure formalization depth](/recipes/i-sources/measure-depth/).