Markdown for LLMs
Sources: source, edition, publication, fragment, @source, label
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Sources: source, edition, publication, fragment, @source, label
**In one sentence:** these constructs answer the question "where the
norm text comes from and how to check a formalization against the document",
without changing conclusion semantics. Take them when a norm needs a checkable
address: which act (`source`), which content (`edition`), which bytes
(`publication`), which text sample (`fragment`), how the norm binds to the
sample (`@source`) and how to show it to a lawyer (`label`).
Every norm carries a checkable address — act, edition, publication, fragment — while conclusions stay exactly as computed.
## 1. When to take it and when not to
| Instead of | Selection rule |
|---|---|
| `@source` anchor vs `origin` field in `assert` | `origin` says where the case fact comes from; `@source` says where the norm text comes from. A case fact takes `origin`, a norm address takes `@source`. Mixing them is a mistake: an anchor does not confirm formalization correctness |
| `fragment` vs full text in the publication | A fragment is only a sample for formalized norms: `Fragment.texts` enter the semantic hash whole, and fragments for unformalized act parts move the package hash by layout edits. Full text lives in the publication, whose bytes are not part of CLIR |
| `edition` with `PINNED_*` vs `ABSTRACT_ONLY` | Pinning is declared only when the bytes are nearby and hashes recalculated: otherwise the honest `ABSTRACT_ONLY`. Declared pinning without bytes gives warnings `LDC-E5206`/`LDC-E5207` |
| `label` vs the fragment's official text | A label is presentation, outside `semanticHash`; a fragment's official `text` is not a label and enters the hash whole. A translated name is a label; a translated norm is a new fragment |
## Grammar: annotations, labels, sources (EBNF verbatim from the grammar)
Annotations, labels, and lexical blocks (where text and grammar differ, the grammar is canonical):
```ebnf
annotation = "@", annotation_name,
[ "(", [ annotation_args ], ")" ] ;
annotation_name = qualified_name | "source" ;
annotation_args = annotation_arg, { ",", annotation_arg }, [ "," ] ;
annotation_arg = [ identifier, "=" ], expression ;
label_item = "label", language_tag,
label_status, string_literal,
( ";" | grammatical_forms_block ) ;
lexical_block = source_lexical_block | label_lexical_block ;
source_lexical_block = "@", "source", [ "(", [ annotation_args ], ")" ],
"{", { top_declaration }, "}", [ ";" ] ;
label_lexical_block = "label", language_tag, label_status, string_literal,
"{", { top_declaration }, "}", [ ";" ] ;
label_status = "official" | "unofficial" | "translation" ;
grammatical_forms_block = "{", { grammatical_form_item }, "}", [ ";" ] ;
grammatical_form_item = ( form_slot | "template" ), string_literal, ";" ; (* "template" — шаблон предиката §218.2 *)
```
The source model — work, edition, publication, fragment:
```ebnf
source_decl = "source", identifier, "{",
{ source_item },
"}" ;
source_item = stable_id_item
| "kind", qualified_name, ";"
| "jurisdiction", expression, ";"
| "authority", expression, ";"
| "number", string_literal, ";"
| label_item
| metadata_item ;
edition_decl = "edition", identifier, "of", reference, "{",
{ edition_item },
"}" ;
edition_item = stable_id_item
| "language", language_tag, ";"
| "officiality", identifier, ";"
| "materialization_status", identifier, ";"
| lifecycle_item
| content_hash_item
| label_item
| metadata_item ;
publication_decl = "publication", identifier, "of", reference, "{",
{ publication_item },
"}" ;
publication_item = stable_id_item
| "media_type", string_literal, ";"
| "uri", string_literal, ";"
| "retrieved_at", temporal_literal, ";"
| content_hash_item
| metadata_item ;
fragment_decl = "fragment", identifier, "in", reference, "{",
{ fragment_item },
"}" ;
fragment_item = stable_id_item
| "kind", identifier, ";"
| "locator", string_literal, ";"
| "parent", reference, ";"
(* Errata E-0082: закреплённый текст пишется и
однострочно — leviathan-1651, noahide,
http-framing, emancipation-1863. *)
| "text", language_tag, label_status,
( text_block | string_literal ), ";"
| content_hash_item
| label_item
| metadata_item ;
```
## 2. Minimal example
Package `research.sources.anchored_rule`: a teaching act, an abstract edition, one
fragment, a rule with a full anchor (`relation`, `coverage`).
```law
source PARK_RULES {
kind municipal_act;
jurisdiction RESEARCH;
number "2026-1";
label ru-KZ official "Правила выгула (учебный акт)";
}
edition PARK_RULES_2026_RU of PARK_RULES {
language ru;
officiality official;
adopted @2026-03-01;
in_force [@2026-04-01, infinity);
materialization_status ABSTRACT_ONLY;
}
fragment PARK_ART1 in PARK_RULES_2026_RU {
kind article;
locator "article/1";
label ru-KZ official "Статья 1. Допуск на площадку";
text ru official """Зарегистрированная собака допускается на площадку для выгула.""";
}
entity Dog { label ru-KZ official "Собака"; }
relation registered(d: Dog) kind institutional { label ru-KZ official "зарегистрирована в реестре"; }
relation may_use_ground(d: Dog) kind institutional { label ru-KZ official "допускается на площадку для выгула"; }
@source(PARK_ART1, relation = formalizes, coverage = partial)
rule GroundAccess strict {
label ru-KZ official "Статья 1. Допуск на площадку";
for d: Dog;
when registered(d);
then may_use_ground(d);
}
```
Case facts: `registered(urn:case:research:sources:rex)` with `origin case_input`.
Query: `evaluate truth(may_use_ground(...))`.
Observed engine answer (installed `law`, semantics `law.core/0.2`):
```text
law test research.sources.anchored_rule: мир research.sources.anchored_rule
ok [research.sources.anchored_rule#authored] tests/01-access-granted.lawtest / urn:query:research-sources-01
ok [research.sources.anchored_rule#authored] tests/02-access-absent.lawtest / urn:query:research-sources-02
итого: 2 проверено, 2 прошли, 0 не прошли, 0 не исполнены; код 0
```
`law engine check` — `check OK`, no warnings. Sensitivity: removing
the `registered` fact changes the expectation from `TRUE_ONLY` to `NEITHER`
(the second scenario test) — the example is not vacuous.
Nearest wrong outcome and anchor invariance (verified by run on a scratch copy
of the package): removing the
`@source(PARK_ART1, relation = formalizes, coverage = partial)` line and keeping
everything else leaves `law engine check` at `check OK` and `law test` at 2/2.
The anchor does not affect the conclusion (tracing, not proof); only the
CLIR changes (the `anchor` node disappears) and the proof graph. The reverse
would be the mistake: expecting anchor removal to "switch off" the rule.
## 3. Example by domain
- **Law:** Kazakh Civil Code (package `kz.corpus.civilcode`, Kazakhstan) — the `source GK_RK` link,
a `PINNED_UNOFFICIAL_COPY` edition, a publication with
a `uri` to the official portal and a nearby text copy, fragments per
article, anchors on every norm (see `corpus-forms.md`).
- **Standard/protocol:** the one-line pinned-text form on `http-framing`
(see `corpus-forms.md`) — the same `fragment` + `content_hash` device as
in law.
- **Science:** morphological forms in
package `kz.constitution.sources` (Kazakhstan; 10 form occurrences —
the only corpus package with forms).
- **Teaching case:** `research.sources.lexical_blocks` — the same device in miniature:
the `@source(TOKEN_ART1) { label ... { rule ... } }` lexical block hands the
anchor to every nested declaration; the neighbouring declaration after
`}` inherits nothing.
## 4. How the engine answers
Table — observed runs of this directory's examples (installed `law`,
semantics `law.core/0.2`):
| Facts | Question | Answer | Why |
|---|---|---|---|
| `registered` | `may_use_ground` | `TRUE_ONLY` | rule under `@source` with `relation`/`coverage` fired as a plain one |
| no facts | `may_use_ground` | `NEITHER` | `registered` premise not established; the anchor does not substitute article text |
| `registered` | `tag_issued` | `TRUE_ONLY` | rule from the `@source(TOKEN_ART1) { label … { rule … } }` lexical block — a plain rule |
- Metadata does not change semantics: a rule under an anchor and a label fires as
a plain one. "Publication bytes do not take part in computation" was
not directly verified on these examples: both examples are `ABSTRACT_ONLY`
without publications.
- In `proof` the anchor lands as tracing (`anchors` of the node); it does
not confirm formalization correctness and does not affect the conclusion.
- An annotation with attributes (`relation`/`coverage`/`quote`) materializes as an `anchor` node (`<rule>/anchor/<k>`); a document with
such a node is written `schemaVersion: law.core.ir/0.4`.
- In `why_not` a missing fact gives `NEITHER`: the anchor does not substitute
article text.
- Publication bytes take no part in computation: an earlier scenario row "without `local_path`" gives the same `TRUE_ONLY` (these examples have no publications — both examples are `ABSTRACT_ONLY`).
- Four static pinning checks on `check`: `LDC-E5201` (text
hash), `LDC-E5204` (document hash, ahead of the rest), `LDC-E5202` (byte
occurrence without normalization), `LDC-E5205` (hash duty on fragments
of `PINNED_*` editions).
## 5. Common mistakes
1. Fragment text retyped instead of byte-copied — `LDC-E5201`, with a
pinned publication `LDC-E5202` (in detail — `pitfalls.md`, item 1).
2. Edition declared `PINNED_*`, fragment without a hash — `LDC-E5205`
(`pitfalls.md`, item 2).
3. Anchor to an undeclared name — warning `LDC-E5103` (`pitfalls.md`, item 6).
4. Explicit `@id` on `source`/`edition`/`fragment` does not execute — warning
`LDC-E1372`; confirmed by run: `law engine check` on an example
variant with `@id("urn:research:sources:park-rules-2026")` issued exactly
this warning and `check OK` (`pitfalls.md`, item 9).
5. Label or `text` without a status — `LDC-E0201` (`pitfalls.md`, item 8).
6. A `quote` not found as a continuous substring of the fragment — `LDC-E5208`
(`pitfalls.md`, item 7).
## 6. References
- Tutorials: [first package](/tutorials/first-package/) (first fragment and its hash), [real article source](/tutorials/real-article-source/) (anchor address against pinned text), [pinned edition](/tutorials/pinned-edition/) (publication next to the package).