Documentation

GaudisCrypt.Language.ModuleExpressionConfluence

Confluence of module-expression reduction #

The two open facts about ModuleExpression.MultiStepReduction that everything downstream of reduce rests on: reduction is confluent (stuck reducts are unique), and termination is invariant along it. Split off from ModuleExpressionBasics.lean so the syntax, typing, reduction and normal-form development there stays independent of them; ModuleExpression.lean is where their consequences live.

The argument of a δ-redex #

inst.toModuleExpr is a closed tuple of procedures: it determines inst, and — once parallel reduction is in place — nothing reduces inside it. Together with the renaming/substitution invariance proved in ModuleExpressionBasics.lean, these say the δ-rule has no critical pair with anything.

theorem GaudisCrypt.HoleSigs.Instantiation.toModuleExpr_injective {holes : HoleSigs} (inst inst' : holes.Instantiation) :
inst.toModuleExpr = inst'.toModuleExpr → inst = inst'

Distinct instantiations give distinct tuples: the δ-rule's contractum is determined by the redex.

Parallel reduction #

ParStep contracts any set of redexes of a term at once (Tait–Martin-Löf). It sits between ReductionStep and MultiStepReduction, so it has the same transitive-reflexive closure, and — unlike ReductionStep — it has the diamond property, which is what gives confluence.

Parallel reduction: contract any set of the redexes present in the term, simultaneously. A δ-redex needs no premise for its argument: inst.toModuleExpr has no redexes inside.

Instances For

    Parallel reduction is reflexive: contract nothing.

    A single reduction step is a parallel step.

    A parallel step is a multi-step reduction.

    Parallel reduction survives a renaming.

    theorem GaudisCrypt.ModuleExpression.ParStep.liftSubst_of_forall {σ τ : ℕ → ModuleExpression} (h : ∀ (n : ℕ), (σ n).ParStep (τ n)) (n : ℕ) :

    Two substitutions that agree up to parallel reduction still do so under a binder.

    Parallel reduction survives a simultaneous substitution that itself reduces in parallel.

    Parallel reduction survives β-substitution: the key lemma behind the diamond property.

    Nothing reduces inside the argument of a δ-redex.

    Inversion #

    The complete development #

    completeDevelopment m contracts every redex m has, and nothing else (a δ-redex counts only when its argument is already a procedure tuple). Takahashi's triangle property — every parallel reduct of m reduces in parallel to completeDevelopment m — gives the diamond property, hence confluence. Noncomputable only because of the classical test for the δ-rule.

    A δ-redex develops to its contractum.

    An application of a procedure with holes whose argument is not a procedure tuple develops componentwise.

    Takahashi's triangle property: every parallel reduct of m parallel-reduces to the complete development of m.

    Confluence #

    The diamond property of ParStep is Takahashi's triangle read twice; Relation.church_rosser turns it into confluence of the transitive-reflexive closure, and that closure is MultiStepReduction because ParStep sits between ReductionStep and it.

    theorem GaudisCrypt.ModuleExpression.ParStep.diamond {m n1 n2 : ModuleExpression} (h1 : m.ParStep n1) (h2 : m.ParStep n2) :
    ∃ (d : ModuleExpression), n1.ParStep d ∧ n2.ParStep d

    Diamond property of parallel reduction.

    Church–Rosser: a term's reducts can always be brought back together.

    A stuck expression reduces to nothing but itself.