Documentation

Guarded2Network.Lemmas.Correctness

The pass, as Compiler.Correctness states a pass: the compiled algorithm's initial states are covered by related source ones, and its behaviour refines the source's. Everything below this file proves it; this file is only the packaging.

Two program types, and both are forced.

SourceProgram bundles an algorithm with the front-end facts about it. Compiler.Correctness quantifies over every program of its source type, so a hypothesis hoisted outside — ∀ algo, AlgorithmFresh mbox c₀ algo — would ask one mailbox assignment to be fresh for every algorithm at once, which no assignment is. The statement would hold vacuously and say nothing. Bundling puts each algorithm next to its own mbox/c₀, which is how every rung below already reads them.

TargetProgram is a phantom index: the pass's output is an algorithm and nothing more, but the framework's Reduce/Abort/Diverge classes take the semantics as an outParam, so the program type has to determine the value universe its semantics is taken in. ComputableNetworkPlusCal. Algorithm does not mention V; TargetProgram V Ξ Ω does.

The two program types #

Everything the front end owes this pass, at one algorithm. Three syntactic conditions and one semantic: AlgorithmFresh (the generated inbox collides with nothing the source uses), MailboxUsed (a declared mailbox is one its process receives on, checkReceiveChannels), Nodup on the process names (duplicateProcessName) — and InitKeys, the key a receiving instance starts on, which is the one thing here no checker establishes.

keys quantifies over the FIFO map because InitKeys.declared is stated against it: which map an initial state carries is not fixed until that state is chosen. The other two clauses do not mention it, so nothing is lost by letting the witness depend on it.

Instances For

    A source program of this pass: an algorithm, the mailbox and channel assignment its processes are read at, and the front end's facts about all three. See this file's module doc for why the facts are bundled into the type rather than hoisted into a hypothesis.

    Instances For

      A target program of this pass — a compiled algorithm, indexed by the value universe its semantics is taken in. The index is phantom; see this file's module doc for why it is there.

      Equations
      Instances For

        Their semantics, as the framework indexes it #

        @[implicit_reducible]

        The reduce slot of the refinement is the terminating semantics ⟦A⟧⁺Algebra.reducing (every partial run) cut to runs that end in a done configuration. See Algebra.terminating.

        Equations
        • One or more equations did not get rendered due to their size.
        @[implicit_reducible]

        The reduce slot is the terminating semantics ⟦A⟧⁺, as for the source.

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

        The pass itself, at those two types. Algorithm.toNetwork never looks at anything a SourceProgram carries beyond the algorithm — the rest is what the proof reads.

        Equations
        Instances For

          The theorem #

          Guarded2Network is a correct pass. The whole development meets here.

          The relation is algRelatesTo at the mailbox read off the compiled algorithm — which is why Compiler.Correctness indexes its relation by the target program, and why both halves live inside one triple. The init half is Algorithm.init_refines, the refinement half is Algorithm.toNetwork_refines, and triple_forall is what lets one run of the pass answer both at every prefix function at once.

          And so it is correct in the composable form, which is what a whole-pipeline statement chains (Compiler.Correct.comp).