docs← Back to article

Markdown for LLMs

Refuse when the order is undefined

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

Download this articlePlain text ↗
# Refuse when the order is undefined

## Intent

I want an explicit refusal when time does not order events of one case.

## Wrong form and why it stays silent

```text title="Incorrect form"
// Два разных события в один момент исполняются в порядке строк дела.
```

Row order has no legal meaning. Two carriers of one instance with equal starts yield fatal SIMULTANEOUS_EVENTS; the fold does not return a partial history.

## Correct form

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

entity Application;
event Tick { }
procedure Filing(app: Application) {
    state Draft initial;
    state Submitted;
    state Done terminal;
    transition Submit { from Draft; to Submitted; on Tick; }
    transition Decide { from Submitted; to Done; on Tick; }
}
const FIRST: Tick = Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z };
```

## Frozen execution scene

P and Q in the table are different instances; E1/E2/E3 are carriers with an explicitly given time.
All identifiers and instants are pinned in the scenes.

| Events and facts | Question | Answer |
|---|---|---|
| two carriers of one instance | `truth(current_state(P,Done))` | `issue(SIMULTANEOUS_EVENTS);` / fatal; `results: []`; runner expected FAIL |
| different instants | `truth(current_state(P,Done))` | `truth_status == TRUE_ONLY;` / `COMPUTED` |
| equal time of different instances | `truth(current_state(P,Submitted))` | `truth_status == TRUE_ONLY;` / `COMPUTED` |
| one carrier of two transitions | `truth(current_state(P,Done))` | `issue(CARRIER_REUSED);` / fatal; `results: []`; runner expected FAIL |
| two grounds of one attempt | `truth(current_state(P,Submitted))` | `truth_status == TRUE_ONLY;` / `COMPUTED` |

```law
test "two carriers at one instant refuse" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Decide, Tick { id: "urn:recipe:k-procedures:06:E2", time: @2026-09-02T09:00:00Z });
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:p"),Done));
    expect issue(SIMULTANEOUS_EVENTS);
    expect evaluation_status == NON_EXECUTABLE;

}
```

```law
test "separate moments transition" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));
assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });
assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Decide, Tick { id: "urn:recipe:k-procedures:06:E2", time: @2026-09-03T09:00:00Z });
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:p"),Done));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;

}
```

```law
test "equal times of different instances hold" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:q"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:q"), Submit, Tick { id: "urn:recipe:k-procedures:06:E2", time: @2026-09-02T09:00:00Z });
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:p"),Submitted));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;

}
```

```law
test "one carrier for two transitions refuses" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Decide, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:p"),Done));
    expect issue(CARRIER_REUSED);
    expect evaluation_status == NON_EXECUTABLE;

}
```

```law
test "two grounds share one attempt" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z }) { id "a1"; }assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z }) { id "a2"; }
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:p"),Submitted));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;

}
```

An independent instance with an earlier valid event does not get a partial result when a neighbour history is fatal. The runner of this scene is also expected FAIL.

```law
test "independent instance gets no partial answer" {
    given {
        context {
            legal_time @2026-09-13T09:00:00Z;
            decision_time @2026-09-13T09:00:00Z;
            knowledge_time @2026-09-13T09:00:00Z;
            timezone "UTC";
        }
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:q"));
        assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:q"), Submit, Tick { id: "urn:recipe:k-procedures:06:Good", time: @2026-09-01T09:00:00Z });
        assert procedure_instance(entity_ref("urn:recipe:k-procedures:06:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Submit, Tick { id: "urn:recipe:k-procedures:06:E1", time: @2026-09-02T09:00:00Z });assert attempted_transition(entity_ref("urn:recipe:k-procedures:06:p"), Decide, Tick { id: "urn:recipe:k-procedures:06:E2", time: @2026-09-02T09:00:00Z });
    }
    evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:06:q"),Submitted));
    expect issue(SIMULTANEOUS_EVENTS);
    expect evaluation_status == NON_EXECUTABLE;

}
```

```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/k-procedures/resources/check.py")
>>> check["check_fatal"](https://github.com/arxohq/law/blob/master/docs/recipes/k-procedures/6)
'К6: fatal и пустой results проверены; частичной истории нет; lawc = lawref'
```

## Counterfactual

Mutation check — LDC-E1343.

Original fragment:

```text
time: @2026-09-02T09:00:00Z
```

Replacement:

```text
missing_time: @2026-09-02T09:00:00Z
```

Scenes with a condition removed are marked separately; the same inputs get a different outcome.

## Boundary

Fatal applies to the whole document, including another instance. Equal time of different instances is allowed: both read the state before the shared temporal group. A time correction must arrive as a corrected event with provenance, not as a hidden sort.

In two fatal rows of the ordinary set the runner returns the **expected FAIL**: document-level fatal leaves `results: []`, and the evaluation_status expectation belongs to a result. The documents of both evaluators match; a separate check requires severity fatal, the correct code, and absence of a partial fold. In these rows NON_EXECUTABLE is an unreachable test expectation, not a result actually returned.