docs← Back to article

Markdown for LLMs

Keep the ground of a position change

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# Keep the ground of a position change

## Intention

I want to keep a dated decision about a position and a reproducible previous result.

Declaring a fact does not change Main.

## Incorrect form and why it stays silent

```text title="Incorrect form"
// recorded(p, "waived") само заменяет статус Main на WAIVED.
```

A fact about a decision and a position status are different things. The shown profile accepts a decision only from an authorised source, in its scope and as of the snapshot; the record alone does not change the lifecycle. The lifecycle change itself executes through the status literal over the position entry, shown in the waiver scene below.

## Correct form

```law
language "law.core" version "0.2";
package recipes.zh.r06 version "0.1.0";
namespace "urn:recipe:zh-violation:06";

entity Person;
relation enrolled(p: Person);
relation done(p: Person);
rule Primary defeasible { for p: Person; when enrolled(p);
    then duty Main { bearer p; achieve done(p) during [@2026-09-01, @2026-09-10]; };
}
entity Authority;
relation decision_record(p: Person, kind: Text, at: Date, issuer: Authority);
relation authorised(issuer: Authority);
relation in_scope(p: Person);
relation recorded(p: Person, kind: Text);
rule Record strict { for p: Person; for kind: Text; for at: Date; for issuer: Authority;
    when decision_record(p, kind, at, issuer) and authorised(issuer) and in_scope(p) and at <= @2026-09-13;
    then recorded(p, kind);
}
```

## Frozen execution scene

| Facts and snapshot | Question | Answer |
|---|---|---|
| previous snapshot; 2026-09-13 | `positions()` | `position(Main, UNDETERMINED);` |
| waived; 2026-09-13 | `truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "waived"))` | `truth_status == TRUE_ONLY;` |
| suspended; 2026-09-13 | `truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "suspended"))` | `truth_status == TRUE_ONLY;` |
| terminated; 2026-09-13 | `truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "terminated"))` | `truth_status == TRUE_ONLY;` |
| the record does not change the status; 2026-09-13 | `positions()` | `position(Main, UNDETERMINED);` |
| waiver executes; 2026-09-13 | `positions()` | `position(Main, WAIVED);` |

```law
test "previous snapshot stays undetermined" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate positions();
    expect position(Main, UNDETERMINED);
    expect evaluation_status == COMPUTED;
}
```

```law
test "recorded waiver decision" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "waived", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q")); assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "waived"));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "recorded suspension decision" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "suspended", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q")); assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "suspended"));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "recorded termination decision" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "terminated", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q")); assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "terminated"));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "record alone changes no status" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "waived", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q")); assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate positions();
    expect position(Main, UNDETERMINED);
    expect evaluation_status == COMPUTED;
}
```

```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/zh-violation/resources/check.py")
>>> check["check_snapshots"]()
'Ж6: разные манифесты; прежний документ воспроизводится'
```

source not authorised → recorded is not established.

```law
test "unauthorised source records nothing" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "waived", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q"));  assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "waived"));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

out of scope → recorded is not established.

```law
test "out-of-scope decision records nothing" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "waived", @2026-09-12, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "waived"));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

decision later than the snapshot → recorded is not established.

```law
test "late decision records nothing" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p")); assert decision_record(entity_ref("urn:recipe:zh-violation:06:p"), "waived", @2026-09-14, entity_ref("urn:recipe:zh-violation:06:q")); assert authorised(entity_ref("urn:recipe:zh-violation:06:q")); assert in_scope(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate truth(recorded(entity_ref("urn:recipe:zh-violation:06:p"), "waived"));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

The waiver executes as a case-level record: the status literal over the position entry is asserted, not a rule head. The position entry is derived at runtime, so the whole case travels through `caseJson`; the surface cannot express such a case, and the replacement of given with JSON is transport, not semantics.

```law
test "waiver over position executes" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-30T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert enrolled(entity_ref("urn:recipe:zh-violation:06:p"));
    }
    evaluate positions();
    expect position(Main, WAIVED);
    expect evaluation_status == COMPUTED;

}
```

```json
{
  "assertions": [
    {
      "evidence": [],
      "id": "urn:recipe:zh-violation:06#assert-enrolled",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:zh-violation:06:p",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:zh-violation:06#enrolled"
      },
      "origin": "case_input",
      "package": "urn:recipe:zh-violation:06"
    },
    {
      "evidence": [],
      "id": "urn:recipe:zh-violation:06#assert-waived",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:position:urn:recipe:zh-violation:06#Primary:90544417f148467419843e970b56699d064d656eaa561ac6a77c686ef310ad84",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:law:std#waived"
      },
      "origin": "case_input",
      "package": "urn:recipe:zh-violation:06"
    }
  ],
  "context": {
    "decisionTime": "2026-09-13T09:00:00+05:00",
    "knowledgeTime": "2026-09-30T09:00:00+05:00",
    "legalTime": "2026-09-13",
    "timezone": "Asia/Almaty"
  },
  "options": {}
}
```

## Counterfactual

Diagnostic mutation `then recorded(p, kind);` → `then waived(p);`: LDC-E2102. Semantic differences are pinned as separate scenes.

## Boundary

Mutations of the Record head into `waived(p)`, `suspended(p)` and `terminated(p)` are each rejected at lowering; all three rejections are pinned in the sidecar.

The lifecycle executes: a unary literal without an interval acts as a point on the decision date; the binary form adds a scope of full or violation, the ternary form adds an interval. The duty ladder reads covering terminated as TERMINATED, else covering waived as WAIVED, else covering suspended as SUSPENDED, else the ordinary fulfillment ladder; expiry applies only without a terminal lifecycle status. The waiver scene above shows WAIVED with byte parity between implementations. The recorded entry stays a profile input, not a substitute for the status literal. The source is represented by an authorised teaching source; scope and time are named explicitly. Two cases yield two manifests; the previous document is repeated without rewriting history.