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.
- fresh : AlgorithmFresh mbox c₀ algo
The generated
inboxis fresh for every branch of every process. - used : MailboxUsed mbox algo
A process with a mailbox is a process that receives.
- names : (List.map (fun (x : GuardedPlusCal.Process ComputableTLAPlus.Typ ComputablePlusCal.Expression) => x.name) algo.processes).Nodup
No two processes share a name.
- keys (F : GuardedPlusCal.FIFOs V) : ∃ (key : String × V → GuardedPlusCal.ChanKey V), InitKeys Ξ Ω c₀ algo F key
Each receiving instance starts on a key that resolves, exists, and is its own.
- wellScopedEnv : Ξ.WellScoped
Every operator body in
Ξis closed over its parameters —ExprSemantics.evalLocal's side condition. Holds for anyΞthe checker populates.
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.
The algorithm itself.
Which mailbox each process name gets, as a function of the name the pass will generate.
Which channel each process name receives on.
And the front end's guarantees about them.
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 #
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.
Equations
- Guarded2Network.instAbortSourceProgramSetProdAlgStateStringTrace = { abort := fun (s : Guarded2Network.SourceProgram V Ξ Ω) => (GuardedPlusCal.Algorithm.algebra Ξ Ω s.algo).aborting }
Equations
- Guarded2Network.instDivergeSourceProgramSetProdAlgStateStringTrace = { div := fun (s : Guarded2Network.SourceProgram V Ξ Ω) => (GuardedPlusCal.Algorithm.algebra Ξ Ω s.algo).diverging }
Equations
- Guarded2Network.instBlockSourceProgramSetProdAlgStateStringTrace = { block := fun (s : Guarded2Network.SourceProgram V Ξ Ω) => (GuardedPlusCal.Algorithm.algebra Ξ Ω s.algo).blocking }
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.
Equations
- Guarded2Network.instAbortTargetProgramSetProdAlgStateStringTrace = { abort := fun (algo' : Guarded2Network.TargetProgram V Ξ Ω) => (NetworkPlusCal.Algorithm.algebra Ξ Ω algo').aborting }
Equations
- Guarded2Network.instDivergeTargetProgramSetProdAlgStateStringTrace = { div := fun (algo' : Guarded2Network.TargetProgram V Ξ Ω) => (NetworkPlusCal.Algorithm.algebra Ξ Ω algo').diverging }
Equations
- Guarded2Network.instBlockTargetProgramSetProdAlgStateStringTrace = { block := fun (algo' : Guarded2Network.TargetProgram V Ξ Ω) => (NetworkPlusCal.Algorithm.algebra Ξ Ω algo').blocking }
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).