Skip to content

Commit df135ea

Browse files
committed
fix(a2ml-core): make sectionTitlesOf total (trusted-base gate)
The governance / Trusted-base reduction policy flagged Profiles.idr:207 as an undocumented `partial` escape hatch. Rather than document new proof debt, eliminate it: sectionTitlesOf now recurses only on the block-list tail and extracts TOP-LEVEL section titles, which is total by construction and exact for the flat record dialects (the 6a2 family). Nested-section extraction for general markup remains the translator's responsibility (it supplies DocFacts directly), so conformance never depended on the recursive walk. Verified locally: scripts/check-trusted-base.sh . exits 0 (15 pre-existing documented hatches; zero new). No escape hatches in the new a2ml-core modules. https://claude.ai/code/session_01XZhw6Fq27eoeyEB4LR3a2c
1 parent d43acde commit df135ea

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

a2ml/src/A2ML/Profiles.idr

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,21 @@ checkProfile pd f =
200200
-- Fact extraction from the v1.0 core (section titles)
201201
-- ============================================================================
202202

203-
||| Recursively collect every Section title. Marked partial for the same reason
204-
||| as TypedCore.collectIds: the walk recurses through the section-body wrapper.
205-
||| Decidability of conformance does not depend on this being total.
203+
||| Collect the TOP-LEVEL Section titles of a document. Total by construction:
204+
||| it recurses only on the block-list tail and never descends through section
205+
||| bodies, so it introduces no escape hatch (cf. TypedCore.collectIds, which is
206+
||| `partial`). Flat record dialects — the entire 6a2 family — have only
207+
||| top-level sections, so this is exact for them. Nested-section extraction for
208+
||| general markup is the translator's responsibility: the translator supplies
209+
||| `DocFacts` directly, so conformance never relies on this helper recursing.
206210
export
207-
partial
208211
sectionTitlesOf : Doc -> List String
209-
sectionTitlesOf (MkDoc blocks) = concatMap go blocks
212+
sectionTitlesOf (MkDoc blocks) = collect blocks
210213
where
211-
go : Block -> List String
212-
go (Section s) = s.title :: sectionTitlesOf (MkDoc s.body)
213-
go _ = []
214+
collect : List Block -> List String
215+
collect [] = []
216+
collect (Section s :: bs) = s.title :: collect bs
217+
collect (_ :: bs) = collect bs
214218

215219
-- ============================================================================
216220
-- Composition: union of constraints (SPEC Section 8.1)

0 commit comments

Comments
 (0)