Documentation

CatCryptCore.Tactics.VC

VC tactics: mvcgen-driven closers for SPComp side conditions #

The support-level Std.Do bridge (CatCrypt.Core.StdDoBridge) makes mvcgen walk SPComp do-blocks. This file packages that into goal-shape-dispatched tactics for the recurring side conditions of CatCrypt's security proofs:

Each tactic also takes an optional ident list (e.g. ssprove_nofail [myGame]) that unfolds the named definitions first, so mvcgen / the combinator cascade can see the underlying do-block.

Closing-simp cascade #

The bridge's examples show the closing idiom for the VCs mvcgen leaves: either pure rfl, or a simp with the WP-unfolding lemmas plus the support-shape lemmas and Heap.get_set_same.

Closer for mvcgen-generated VCs on SPComp goals: rfl, then the bridge unfolding simp set, then simp_all. Fails if any goal survives.

Equations
Instances For

    Best-effort variant of sp_vc_close: never fails, leaves the VCs the cascade misses (used by ssprove_phoare, where partial progress is the point).

    Equations
    Instances For

      ssprove_ispure #

      ssprove_ispure_syn closes SPComp.IsPure c goals for fully concrete c built from sample / pure / fail / bind (and do-notation over them) by the syntactic route: reify c into RawCode, apply the soundness lemma RawCode.eval_isPure_of_stateFree, and discharge StateFree by constructor search. Depth-independent: no per-step combinator search. Fails cleanly (for first-fallback) on programs containing abstract sub-programs, liftSDistr, ite, or heap access.

      Equations
      Instances For

        ssprove_ispure_syn [d₁, d₂, ...] unfolds the named game definitions first, then runs the syntactic route.

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

          ssprove_ispure_cascade closes SPComp.IsPure c goals for c built from sample / pure / fail / liftSDistr / bind (and hypotheses), by the structural combinator cascade. The leading show is the goal-shape guard that makes ssprove_vc dispatch correctly.

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

            ssprove_ispure closes SPComp.IsPure c goals: syntactic backend first (ssprove_ispure_syn — all-or-nothing), then the structural combinator cascade (ssprove_ispure_cascade — handles abstract sub-programs via hypotheses).

            Equations
            Instances For

              ssprove_ispure [d₁, d₂, ...] unfolds the named game definitions first, then runs the syntactic-then-cascade dispatch.

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

                ssprove_nofail #

                ssprove_nofail closes SPComp.NoFail c: lowers to the trivial total-correctness triple via triple_noThrow_true_iff_noFail, runs mvcgen over the bridge's @[spec] lemmas, and closes the VCs with sp_vc_close. This is the shape of the NoFail side goals ssprove_upto leaves.

                Equations
                Instances For

                  ssprove_nofail [d₁, d₂, ...] unfolds the named game definitions first so mvcgen can walk the do-block.

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

                    ssprove_phoare #

                    ssprove_phoare lowers a unary pHL goal pHoare P c Q to the partial-correctness (⇓?) Std.Do triple via pHoare_iff_triple, runs mvcgen, and best-effort-closes the VCs. VCs the cascade misses are left open for the user.

                    Equations
                    Instances For

                      ssprove_phoare [d₁, d₂, ...] unfolds the named definitions first.

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

                        ssprove_vc umbrella #

                        ssprove_vc dispatches on the goal head: SPComp.IsPure → ssprove_ispure, SPComp.NoFail → ssprove_nofail, pHoare → ssprove_phoare.

                        Equations
                        Instances For

                          ssprove_vc [d₁, d₂, ...] unfolds the named definitions first.

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

                            Tactic Tests #

                            IsPure of a sampled do-block, NoFail of a sample/set/get block (the side-goal shape ssprove_upto produces), and a pHoare lowering.

                            @[reducible, inline]

                            Demo location storing a Bool.

                            Equations
                            Instances For

                              Syntactic-branch tests (ssprove_ispure_syn) #

                              noncomputable def vcG₀ :

                              Demo game writing its sampled bit to the heap.

                              Equations
                              Instances For
                                noncomputable def vcG₁ :

                                Demo game writing the negated bit.

                                Equations
                                Instances For