Documentation

Transfer.Translate.ParamDB

The persistent @[param] constant database #

The term-level translator ParamTranslate.translate consumes a db : NameMap (Expr × Expr) mapping an abstract constant c to its transferred counterpart c' together with a witness wᶜ : RArrow PA PB c c'. Without an ambient store that database must be assembled and passed by hand at each call site.

This module makes the database persistent and ambient:

A witness is registered once with @[param], and the translator resolves the constant from the registry with no explicit db argument.

The persistent @[param] database #

The persistent environment extension backing @[param]. Its state maps an abstract constant's name to (transferred const name, witness lemma name). addEntryFn inserts a single registration; addImportedFn re-folds all entries contributed by imported modules so the database is cross-file.

Peel RArrow PA PB c c' from a lemma's type. RArrow has four implicit type arguments {A A' B B'}, two relation arguments PA PB, and the two function arguments f f' — eight application arguments in total. The abstract constant c and its transferred counterpart c' are the last two; their head-constant names are returned.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Materialise the persistent @[param] registry into the NameMap (Expr × Expr) that ParamTranslate.translate consumes: each stored (c', lemmaName) becomes (Expr.const c' [], Expr.const lemmaName []).

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Driver command #

      #param_translate t runs the term-level parametricity translation ⟦t⟧ against the ambient @[param] registry (no explicit database), logging the transferred term and the type of the relatedness proof.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For