Using judgment_mathlib

Checking proof correspondence

A new version of the judgment_mathlib library, or any proof-backed replacement of a statement library, can have different declaration identities from the library it replaces. For example, a typedef with a proved witness has different content from the same typedef whose witness was assumed. Comparing the old and new statement digests alone cannot establish or refute correspondence.

Keep the original expected statements immutable. Rebuild each in its checked source signature, transport it through explicit checked images, and compare the result with the proposition of the corresponding independently checked target proof. Store provides transport_term for the closed-term step. It returns syntax, not a proof.

Independent inputs

The producer supplies a candidate proof library and proposed correspondence. The verifier separately supplies the original goal inventory and approved foundation. A useful correspondence input identifies these roles explicitly:

Input Required check
Original library and goal inventory Bind the source manifest, original alias set, term bytes and type-variable identities before reading producer output.
Candidate proof library Load it whole into a fresh bank, every row rechecked (Library.snapshot); audit every axiom against the independently built foundation.
Source constructor and parameter list Resolve the actual source declaration, then provide a checked target type and distinct designated type parameters.
Source constant Provide a closed checked target term of the translated type.
Source axiom, definition or composite fact Provide a checked, closed target fact stating exactly the translated obligation.
Root alias and target proof provider Resolve the exact requested alias and check its actual proof and proposition; names alone convey no authority.

Content identities locate declarations and bind files; they are not proof authority. Matching symbol names do not provide implicit images. Proposed images must resolve to checked objects in the target session and pass Store's interpretation contract (ST4.2).

Checked transport

  1. Construct the approved foundation independently. Load the candidate proof library in full (Library.snapshot, every row rechecked) and open two sessions over one snapshot, the common base: a target session that holds the candidate's proofs, and a source session in which the original source signature is declared. Do not merge the source assumptions into the target. Audit the entire candidate theory's axioms, not just the chosen root's dependencies.
  2. Rebuild the original expected proposition in its source theory. Preserve its original bytes and type-variable correspondence. The original goal inventory remains fixed; a producer cannot regenerate it from candidate statements to make a comparison pass.
  3. Give the images over an explicitly justified common base: constants maps each source constant outside the base to a closed target term of the translated type, and type_images each source type constructor to a target type over designated parameters (TypeImage). transport_term(source, target, base, expected, constants, budget, type_images) checks the images, then translates the closed source term. It checks no proof obligation: reuse validates the complete interpretation, every source declaration outside the base, and requires a proof image for each source axiom and definition.
  4. Compare the returned expression's node (translated.node()) with the statement of the corresponding independently checked target fact (fact.statement_node()). Both are nodes of the target session. Bind the exact root alias and its type-variable images too; equal counts or renamed schematic variables are insufficient evidence.
  5. Retain source expectations and candidate audit identities separately. A transported target term may be serialized for an audit, but must never replace the original expected-goal bytes.

For a source axiom, the proof image can be an independently derived target fact; the target needs no declaration for the old axiom. A changed typedef requires its type image, both Abs and Rep constant images and proof images of both translated composite facts. When its source existence witness is an axiom, that witness also requires a checked target proof image. This applies even when the selected goal uses only Abs: reuse validates every source declaration outside the base.

transport_term checks its handles, and that the term is closed, before it reads a node. It runs inside session transactions: a read-back transaction in the source and one in the target, or one alone when both are the same session. Success keeps only the translated expression and publishes no declaration; failure discards both transactions. Walks charge the caller's budget, and checked construction also spends each session's allowance.

Classes and instances

The public transport keeps classes and instances in the shared base and refuses a source with nonbase ones; it never infers a class or instance image from names.

judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub