Documentation

VCVio.ProgramLogic.Tactics.Relational

Relational VC Tactics #

User-facing relational VCGen tactics and syntax.

rvcstep applies one relational VCGen step.

It first lowers GameEquiv / evalDist equality goals into relational mode, then tries the obvious structural relational rule on RelTriple / RelWP / eRelTriple goals: synchronized conditionals, simulateQ, Functor.map, bounded traversals, bind decomposition, or random/query coupling.

rvcstep using t supplies the explicit witness needed for the current shape:

rvcstep with thm forces one explicit relational theorem/assumption step.

Instances For

    rvcgen repeatedly applies relational VCGen steps across all current goals until stuck.

    rvcgen using t uses the explicit hint t for the first step on the main goal, then continues with ordinary hint-free relational VCGen on all remaining goals.

    rvcgen with thm forces one explicit relational theorem step on the main goal, then continues with ordinary hint-free relational VCGen on all remaining goals.

    Instances For

      rel_conseq weakens or strengthens the postcondition of a RelTriple goal.

      Given a goal RelTriple oa ob R', applies relTriple_post_mono to produce:

      1. RelTriple oa ob ?R — the triple with a (possibly easier) postcondition
      2. ∀ x y, ?R x y → R' x y — the implication between postconditions

      Use rel_conseq with R to specify the intermediate postcondition explicitly.

      Instances For

        rel_inline unfolds definitions and then tries to close or simplify the relational goal. Use rel_inline foo bar to unfold specific definitions, or just rel_inline to simplify.

        Instances For

          Proof mode entry tactics #

          by_equiv transforms a GameEquiv g₁ g₂ goal into RelTriple g₁ g₂ (EqRel α). Also works for evalDist g₁ = evalDist g₂ goals. Always targets RelTriple (coupling-based), never RelTriple' (eRHL-based), so that rvcstep / rvcgen work on the resulting goal.

          Instances For

            rel_dist reduces a RelTriple oa ob (EqRel α) goal to evalDist oa = evalDist ob.

            This is the reverse direction of by_equiv: while by_equiv enters relational mode from a distributional equality, rel_dist exits relational mode back to distributional reasoning.

            Useful when both sides are equal in distribution but not syntactically identical, and the equality is easier to prove at the evalDist level than via stepwise coupling.

            Instances For

              game_trans introduces an intermediate game for transitivity of GameEquiv.

              Given a goal g₁ ≡ₚ g₃, game_trans g₂ produces two subgoals:

              1. g₁ ≡ₚ g₂
              2. g₂ ≡ₚ g₃

              This is the fundamental tactic for multi-step game-hopping chains.

              Instances For

                by_dist transforms a TV distance or advantage bound goal into a subgoal suitable for relational or coupling reasoning.

                Instances For

                  by_upto bad applies the "identical until bad" TV-distance theorem for simulateQ. It leaves the standard four subgoals: initial non-bad state, agreement off bad, and bad-state monotonicity for each implementation.

                  Instances For