Relational program-logic baseline #
This file defines RelTriple via the generic two-monad algebra interface
MAlgRelOrdered, instantiated for OracleComp using coupling semantics.
HasCoupling and coupling lemmas remain as semantic bridge lemmas.
Relational postconditions over two output spaces.
Instances For
Equality relation helper for same-type outputs.
Instances For
Coupling-based semantic relational WP for OracleComp.
Instances For
Relational algebra instance for OracleComp, based on coupling semantics.
Relational weakest precondition induced by MAlgRelOrdered for OracleComp.
Instances For
Relational Hoare-style triple with implicit precondition True.
Instances For
Existence of an SPMF coupling witness between two computations.
Instances For
Any relational triple yields a coupling witness.
Pure values on both sides: R a b implies the coupling.
Reflexivity rule for relational triples on equality.
Postcondition monotonicity for relational triples.
Bind composition rule for relational triples.
Equality of programs gives an equality-relation relational triple.
Equality of evaluation distributions gives an equality-relation relational triple.
If two computations have equal output distributions, any reflexive postcondition holds.
Pointwise output-probability equality gives an equality-relation relational triple.
Equality-relation relational triples imply equality of point output probabilities.
Equality-relation relational triples imply equality of evaluation distributions.
Bool-specialized bridge from relational triples to game success equality.
Oracle query coupling rules (pRHL level) #
Same-type identity coupling: querying the same oracle on both sides yields equal outputs.
Bijection coupling (the "rnd" rule from EasyCrypt):
querying the same oracle on both sides, related by a bijection f.
If a relational triple holds for fun a b => f a = g b, then mapping by f and g
produces equal distributions. Generalizes evalDist_eq_of_relTriple_eqRel.
Lift a one-step coupling through bounded iteration.
Equality coupling version of relTriple_replicate.
Lift pointwise relational reasoning through finite list traversals.
Same-input equality-coupling specialization of relTriple_list_mapM.
Loop-invariant rule for bounded left folds over related input lists.
Same-input specialization of relTriple_list_foldlM.
Synchronized branching rule #
Synchronized conditional: if both sides branch on the same condition, the relational triple holds if it holds on both branches.
Pure-left rule: the left side is a pure value, applied via bind decomposition.
Pure-right rule: the right side is a pure value, applied via bind decomposition.
Relational coupling for uniform sampling via bijection.
Given a bijection f : α → α such that R x (f x) for all x,
the two uniform samples are related by R.
Identity coupling for uniform sampling.