EasyCrypt-Style Auto Tactic #
This file provides an auto-style meta-tactic that chains together
wp, sync, conditional resolution, and goal closure, analogous to
EasyCrypt's auto tactic.
Main tactics #
ssprove_auto_ec- EasyCrypt-style auto: wp + rnd + skip, repeatssprove_auto_ec!- Aggressive version including sim-like behavior
What EasyCrypt does #
EasyCrypt's auto is a meta-tactic that chains:
wpto consume deterministic suffixesrndfor random samplingskipfor empty programs- Repeats until no progress
How it maps to CatCrypt #
We chain our existing tactics in the same order:
ssprove_wpfor deterministic tailsssprove_syncfor synchronized operations (EasyCrypt'srnd)rHoare_ret_same/rHoare_reflfor empty programs (EasyCrypt'sskip)ssprove_rcondt/ssprove_rcondffor conditionals
References #
- EasyCrypt: ecAuto tactic
ssprove_auto_step performs one round of EasyCrypt-style automation.
It tries (in order):
- WP step (consume deterministic tail)
- Sync rule (coupling for matching operations)
- Bind decomposition
- Conditional resolution
- Dead code elimination
- Goal closure (rfl, assumption, trivial)
Equations
- CatCrypt.Tactics.tacticSsprove_auto_step = Lean.ParserDescr.node `CatCrypt.Tactics.tacticSsprove_auto_step 1024 (Lean.ParserDescr.nonReservedSymbol "ssprove_auto_step" false)
Instances For
ssprove_auto_ec is the EasyCrypt-style auto tactic.
It normalizes code, then repeatedly applies auto steps until no more progress can be made. Finally, it tries to close all remaining goals.
This tactic handles common patterns:
- Programs with deterministic tails followed by sampling
- Identical programs (reflexivity)
- Programs differing only in dead code
- Programs with matching conditionals
Example:
-- Prove two games equivalent when they sample and return the same thing
theorem game_equiv : rHoare eqPre
(do let k ← SPComp.sample Bool; pure (xor k x))
(do let k ← SPComp.sample Bool; pure (xor k x))
eqPost := by
ssprove_auto_ec
Equations
- CatCrypt.Tactics.tacticSsprove_auto_ec = Lean.ParserDescr.node `CatCrypt.Tactics.tacticSsprove_auto_ec 1024 (Lean.ParserDescr.nonReservedSymbol "ssprove_auto_ec" false)
Instances For
ssprove_auto_ec! is a more aggressive version that also tries
reflexivity and full simplification upfront.
It first attempts to prove the goal by reflexivity (identical programs), then falls back to step-by-step automation.
Equations
- CatCrypt.Tactics.tacticSsprove_auto_ec! = Lean.ParserDescr.node `CatCrypt.Tactics.tacticSsprove_auto_ec! 1024 (Lean.ParserDescr.nonReservedSymbol "ssprove_auto_ec!" false)