Outputs/Decimal/soundness.lean is the write-once third artifact. It contains the
format-specific facts that Triptych cannot infer from the grammar alone. These fall into two
separate groups.
The generated Decimal.parse needs no parser-correctness proof from the user:
Decimal.parse_sound, Decimal.parse_complete, and
Decimal.parse_reject were already generated and proved in Artifact 2.
Two surrounding choices still require evidence. First, the declared ofSpec and
toSpec functions must be inverse on accepted specification values. For Decimal, the
range constraint makes the potentially lossy Int64.ofInt conversion faithful:
Second, the declared serializer decimalToStr requires one proof obligation,
Decimal.encode_view. It says that serializing any Int64 produces text whose
decoded view is valid and whose specification value, converted with Int64.ofInt, equals
the original value:
This is the single toString obligation. From it, Triptych derives acceptance, value
preservation, generated-parser roundtrip, serializer injectivity, and normalization. For
example:
The parser Cedar.Spec.Ext.Decimal.parse clause names an implementation that Triptych did
not generate. Using it directly therefore requires three separate agreement proofs:
Decimal.extparse_complete: every valid input with that value is accepted externally.
Decimal.extparse_reject: the external parser returns Option.none exactly for
invalid inputs.
The stronger Decimal.RuleRegistrySoundness.parser_agrees theorem is proved separately by
decomposing Cedar's executable parser with reusable parser rules. The generated soundness
obligation is then a direct projection:
Once those parser obligations and the shared Decimal.encode_view serializer certificate
are available, the external parser receives its own roundtrip theorem:
This external roundtrip is derived, not a fourth external-parser obligation. It reuses the same
serializer certificate that proves the generated-parser roundtrip. Reusable registry rules help
prove the substantive Decimal.RuleRegistrySoundness.parser_agrees theorem, but that
format-specific theorem is not itself registered. Soundness and completeness apply its two
directions directly; the view theorem uses simp with the reusable optional-witness rule
to compose it with generated view facts.