Skip to content
docs
Arxo ↗

Distinguish a wrong carrier from other refusals

For LLMs6 sections

I want to explain why an attempt did not change the state, without mixing reasons.

Incorrect form
// Любая невалидная попытка якобы есть TRANSITION_CARRIER_TYPE_MISMATCH.

The code applies only to a mismatch with on Filed. Other reasons are read from procedure_step. Presentation to an entity without procedure_instance is a separate EVENT_OUTSIDE_PROCEDURE.

Arxo Law
language "law.core" version "0.2";
package recipes.k.r07 version "0.1.0";
namespace "urn:recipe:k-procedures:07";
entity Application;
event Filed { }
event ElectronicFiled: Filed { }
event Other { }
relation ready(app: Application);
relation approved(app: Application);
procedure Filing(app: Application) {
state Draft initial;
state Done terminal;
transition Submit { from Draft; to Done; on Filed; when ready(app); requires approved(app); }
}

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 factsQuestionAnswer
foreign carriertruth(current_state(P,Done))truth_status == NEITHER; / COMPUTED
state preservedtruth(current_state(P,Draft))truth_status == TRUE_ONLY; / COMPUTED
false guard with the right typetruth(current_state(P,Done))truth_status == NEITHER; / COMPUTED
no instancetruth(current_state(P,Done))truth_status == NEITHER; / COMPUTED
on removedtruth(current_state(P,Done))truth_status == TRUE_ONLY; / COMPUTED
repeat from a left statewhy_not(valid_transition(P,Submit,Filed { id: "urn:recipe:k:N:E2", time: @2026-09-03T09:00:00Z }))blocked_by("urn:recipe:k-procedures:07#Filing/Submit","from"); / COMPUTED
foreign carrier leaves neither
Arxo Law
test "foreign carrier leaves neither" {
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:07:p"));assert ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Other { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });
}
evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:07:p"),Done));
expect truth_status == NEITHER;
expect evaluation_status == COMPUTED;
expect issue(TRANSITION_CARRIER_TYPE_MISMATCH);
}
draft state survives foreign carrier
Arxo Law
test "draft state survives foreign carrier" {
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:07:p"));assert ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Other { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });
}
evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:07:p"),Draft));
expect truth_status == TRUE_ONLY;
expect evaluation_status == COMPUTED;
}
false guard blocks despite right type
Arxo Law
test "false guard blocks despite right type" {
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:07:p"));assert not ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Filed { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });
}
evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:07:p"),Done));
expect truth_status == NEITHER;
expect evaluation_status == COMPUTED;
expect not issue(TRANSITION_CARRIER_TYPE_MISMATCH);
}
missing instance answers neither
Arxo Law
test "missing instance answers neither" {
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 ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Filed { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });
}
evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:07:p"),Done));
expect truth_status == NEITHER;
expect evaluation_status == COMPUTED;
expect issue(EVENT_OUTSIDE_PROCEDURE);
}
removed on admits other carrier
Arxo Law
test "removed on admits other carrier" {
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:07:p"));assert ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Other { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });
}
evaluate truth(current_state(entity_ref("urn:recipe:k-procedures:07:p"),Done));
expect truth_status == TRUE_ONLY;
expect evaluation_status == COMPUTED;
}
repeat from abandoned state names from
Arxo Law
test "repeat from abandoned state names from" {
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:07:p"));assert ready(entity_ref("urn:recipe:k-procedures:07:p")); assert approved(entity_ref("urn:recipe:k-procedures:07:p"));assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Filed { id: "urn:recipe:k-procedures:07:E1", time: @2026-09-02T09:00:00Z });assert attempted_transition(entity_ref("urn:recipe:k-procedures:07:p"), Submit, Filed { id: "urn:recipe:k-procedures:07:E2", time: @2026-09-03T09:00:00Z });
}
evaluate why_not(valid_transition(entity_ref("urn:recipe:k-procedures:07:p"),Submit,Filed { id: "urn:recipe:k-procedures:07:E2", time: @2026-09-03T09:00:00Z }));
expect blocked_by("urn:recipe:k-procedures:07#Filing/Submit","from");
expect evaluation_status == COMPUTED;
}
Python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/k-procedures/resources/check.py")
>>> check["check_steps"](https://github.com/arxohq/law/blob/master/docs/recipes/k-procedures/7)
'К7: причины шагов и отсутствие лишних предупреждений проверены; lawc = lawref'

Mutation check — LDC-E1344.

Original fragment:

Output
on Filed;

Replacement:

Output
on ready;

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

A warning does not block computation; an order fatal from Refuse when the order is undefined does. A non-event in the carrier position is static E1347, and an unsuitable event type is a regular runtime outcome. A subtype is allowed — see Check event type and transition conditions.

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.