Explanation

Explanation :: # (opaque)

Bounded explanation of descriptions and already-bound interpretation results. Typed facts come directly from the source; rendering never resolves zones, lowers calendar selections, invents tolerances or parses diagnostic text. Semantic status is carried by the facts; Report.status describes rendering completeness only. Caller limits bound visited facts and UTF-8 output bytes. Fact budgets count indexed fact accesses. A snapshot presentation fact may inspect at most 32 source annotations; no fact access traverses zone rules. Coverage and complete selections expose cached counts and indexed members; fact access never scans earlier members or computes total width. A selection batch exposes its reported evaluation status/counts separately from rendering status. Limited batches describe the request and context without presenting partial work as complete or empty coverage. Recurrence facts describe stored rules and effective selectors without generating candidates. COUNT is a rule limit before exclusions, not an emitted-result count. Clock selector facts include normalized defaults; they do not reconstruct which fields appeared in the source text. Each embedded text field is previewed to 256 bytes before formatting, using UTF-8 boundaries and a visible ellipsis. TextLimit reports such previews.

Zero fact/byte budgets visit no facts. A line that exceeds the remaining byte budget emits a UTF-8 prefix plus "..." when at least three bytes remain, then reports ByteLimit. ByteLimit takes precedence over field-preview truncation; TextLimit takes precedence over FactLimit when both affected the report.

new : Source -> Explanation

Retain a source for indexed facts or bounded rendering, without interpreting it.

fact_count : Explanation -> U64

Return the number of facts available from the retained source without rendering them.

fact_at : Explanation, U64 -> [End, Item(SemanticFact)]

Read one zero-based source fact; return End beyond fact_count. This does not resolve zones, enumerate recurrence occurrences, or complete a limited batch.

plain : Explanation, Budget -> Report

Render newline-separated semantic facts within both budgets. Text fields are previewed to 256 bytes; inspect Report.status to detect any truncation. The text is explanatory prose, not an interchange format.

to_inspect : Explanation -> Str

Summarize the explanation and its fact count without rendering all facts.

Source : [DateRecurrence(DateRecurrence), TimedRecurrence(TimedRecurrence), ICalTimedRule(ICalTimedRule), Coverage(Coverage), ResolvedBoundary(ResolvedBoundary), ResolvedSelection(ResolvedSelection), SelectionBatch(Batch), CalendarValue(Value), QualifiedCalendarValue(QualifiedCalendarValue), EdtfDate(EdtfDate), OffsetTimestamp(OffsetTimestamp), Ixdtf(Ixdtf), Snapshot(Snapshot), ExactInterval(ExactInterval), ICalDateTime(ICalDateTime), ICalDuration(ICalDuration), ICalPeriod(ICalPeriod)]

A supported description, rule, coverage value, or stored interpretation result. SelectionBatch also permits explaining why evaluation remains incomplete.

Budget : { max_facts : U64, max_utf8_bytes : U64 }

Per-render limits on indexed fact accesses and total UTF-8 output bytes. A zero limit prevents any fact from being visited.

Report : { text : Str, status : [Complete, Limited([FactLimit, ByteLimit, TextLimit])], visited_facts : U64, total_facts : U64 }

Rendered text, visited/available fact counts, and rendering completeness. Limited identifies a fact budget, byte budget, or individual text preview limit; Complete does not assert that the source interpretation is complete.