Status: normative draft
Version: 1
Proof obligation: P9
Date: 2026-07-11
Define document-boundary semantics for GLYPH multi-document corpora.
P9 proves that a query match is valid only when all query bytes belong to one document.
A byte sequence formed by concatenating the suffix of one document with the prefix of another document is not a valid match.
P9 depends on proof obligations P1 through P8.
A corpus is an ordered list:
documents = [D0, D1, ..., Dn-1]
Each document is an independent byte sequence.
Document identity and order are committed under P4.
The corpus is not semantically equivalent to:
D0 || D1 || ... || Dn-1
for substring matching.
For non-empty query q, coordinate (doc_id, doc_offset) is a valid match if
and only if:
0 <= doc_id < document_count
0 <= doc_offset
doc_offset + len(q) <= len(document[doc_id])
document[doc_id][doc_offset:doc_offset+len(q)] == q
All bytes must come from the same document.
Given:
D0 = b"ab"
D1 = b"cd"
query:
b"bc"
is not present.
The byte sequence exists only in the accidental physical concatenation:
b"abcd"
It is not part of either document.
Required result:
match_count = 0
coordinates = []
Count must equal the number of document-local coordinates.
Required:
FM_count
==
naive_document_local_count
==
len(full_locate_coordinates)
Count must not include suffixes whose query span crosses a document boundary.
Boundary filtering only after count is forbidden.
Locate must return only canonical coordinates:
(doc_id, doc_offset)
Every returned span must fit completely inside the referenced document.
A global concatenated offset is insufficient unless it is deterministically converted and checked against the document boundary table.
An evidence artifact for a multi-document corpus must bind:
- corpus identity;
- document table identity;
- query identity;
- exact match count;
- canonical document-local coordinates;
- document-boundary policy identifier.
Required policy identifier:
document_boundary_policy =
"DOCUMENT_LOCAL_MATCHES_ONLY_V1"
Replay must independently verify:
- corpus identity;
- document ordering;
- document lengths;
- query identity;
- every coordinate;
- every matched byte span;
- exact count;
- absence of cross-document coordinates;
- boundary policy identifier.
Replay must not trust byte_check=true without recomputing the byte spans.
An implementation may use:
- virtual sentinels;
- boundary tables;
- separate indexes;
- a generalized suffix array;
- another representation preserving the same semantics.
The physical implementation is not authoritative.
The document-local match model is authoritative.
For a physical concatenation, a boundary table must at minimum determine:
- document ID;
- global start offset;
- document byte length;
- global exclusive end offset.
A global candidate [start, start + query_length) is valid only if:
start >= document_start
start + query_length <= document_end
for one and the same document.
Empty documents:
- remain part of corpus identity;
- contribute no suffix byte positions;
- produce no query matches;
- preserve their document IDs.
Identical documents remain distinct.
Example:
D0 = b"same"
D1 = b"same"
query:
b"same"
produces:
match_count = 2
coordinates = [(0, 0), (1, 0)]
Given:
D0 = b"a"
D1 = b"ab"
D2 = b"abc"
query b"ab" matches only:
(1, 0)
(2, 0)
It must not be synthesized from the end of D0 and the beginning of D1.
Boundary semantics apply identically when documents begin or end with:
0x00;0xFF;- invalid UTF-8 bytes;
- newline;
- carriage return;
- repeated binary values.
A query may end exactly at a document boundary.
Valid condition:
doc_offset + query_length == document_length
It must not consume any byte from the next document.
A query longer than a document cannot match inside that document.
No continuation into the next document is permitted.
Bounded locate must apply only after the exact document-local result set is known.
Required:
match_count = exact full document-local count
returned_coordinates =
canonical_prefix(full_document_local_coordinates)
A bounded locate response must not hide a cross-document count discrepancy.
P9 fixtures must include:
b"ab"+b"cd"queried withb"bc";b"\x00"+b"\xff"queried withb"\x00\xff";b"\xff"+b"\x00"queried withb"\xff\x00";- empty document between non-empty documents;
- duplicate documents;
- prefix-related documents;
- one-byte documents;
- query ending exactly at document end;
- query longer than every document;
- all 256 byte values split across documents;
- repeated same byte split across boundaries;
- newline and carriage-return boundaries.
The validator must reject:
- count includes a cross-document occurrence;
- locate includes a cross-document coordinate;
- global offset maps across a boundary;
- coordinate uses wrong document;
- coordinate starts at document end;
- coordinate ends after document end;
- artifact omits boundary policy;
- artifact uses wrong boundary policy;
- artifact count differs from document-local oracle;
- replay trusts stored
byte_check=true; - replay uses physical concatenation as oracle;
- duplicate document occurrence is collapsed;
- empty document changes later document IDs;
- document order mutation is ignored;
- document length mutation is ignored;
- bounded locate prefixes an invalid full result.
For every non-empty query:
result_set
=
{
(doc_id, doc_offset)
|
document[doc_id][doc_offset:doc_offset+len(query)]
== query
and
doc_offset + len(query) <= len(document[doc_id])
}
No other occurrence exists in GLYPH semantics.
P9 does not yet prove:
- artifact schema integrity;
- bundle manifest integrity;
- portable replay path integrity;
- tamper-evident packaging;
- membership or non-membership proof completeness.
Those belong to later obligations.
P9 is complete only when:
- this specification exists;
- an independent document-local oracle exists;
- count equals document-local count;
- locate equals document-local coordinates;
- artifact carries the boundary policy;
- replay independently recomputes boundaries;
- binary boundary fixtures pass;
- all mutation fixtures fail;
- top-level verification remains green.
Canonical corpus identity binds the ordered document sequence.
For documents:
[doc_0, doc_1]
the reordered sequence:
[doc_1, doc_0]
must have a different corpus identity when the document entries differ.
A fixture that swaps two byte-identical documents does not represent an observable order mutation because the ordered byte-and-length sequence remains identical. Therefore document-order rejection fixtures must use asymmetric documents while replaying the artifact committed to the original order.
P9 must reject replay when:
- the supplied document order differs from the committed order;
- the stored corpus identity remains bound to the original corpus;
- document-local coordinates would be interpreted under different
doc_idassignments.