Documentation

GaudisCrypt.Syntax.ModuleVar

Module variables of a generic theory: module_var #

module_var RO.m : FMap «from» «to»

declares the module variable RO.m of a theory whose types are section variables, as global_var does (the slot of ⟨"N.RO.m", T⟩, N.RO.m the full name, with its Lens.IsGlobalVar instance, disjoint from the other globals by instance search), but taking the section's instances too. With the theory's operators in a class whose types are outParams (class Params (from to : outParam Type)), that instance is what determines the types where the variable is used alone (RO.m, §RO.m), as EC's RO.m is used. (global_var takes only the section variables its type mentions, so there the types would stay undetermined.) The type may depend on the theory's operators (module_var I.qs : List rand with rand := BitWord.word l, l an operator; Syntax/ModuleVarTest.lean).

The name's key proof is a theorem of its own, RO.m.key_eq : k = VariableName.encode "N.RO.m", proven once here. With the proof rfl (as VariableName.mk makes it), every use of the instance would evaluate encode "N.RO.m" again — in instance search, to check the proof against the instance's pattern, and in the kernel — which for a name of 50 characters is some 0.5 s per disjointness found; with the theorem it is nothing (its type is already the pattern's).

module_var x : T: see the module docstring.

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