Documentation

GaudisCrypt.Logic.ECProgress

The closer on goals about values: ec_prep, ec_progress, ec_close #

ec_values     -- a goal `∀ σ, …` about program states: every read a value, or an error
ec_prep       -- introduce, take the hypotheses apart, substitute, simplify the tests
ec_progress   -- EC's `progress`: `ec_prep`, split the goal, close what closes
ec_close      -- EC's `auto => /#`: the same, an error if a goal is left

The closer works in two phases.

First the states go (ec_values): a goal ∀ σ, P or ∀ σ₁ σ₂, P about program states (the side goal of a rule: the guards of an if, a conseq) is brought to the read normal form and every read is generalized to a value, as ec_skip does (Logic/ReadNorm.lean); a state that survives is an error naming the place. A goal that is not of that shape (after ec_auto or ec_skip it is already about values) is left as it is. The same is done at states bound further in (EC's final memories, P → ∀ τ₁ τ₂, frames → Q, of a while or conseq), when the introduction reaches them. A memory that is in the context (EC's &m; the other side's memory in the side goal of a one-sided rcond) is not bound by the goal: its reads, in the goal and the hypotheses, are made values after the introduction (generalize_reads_all), without the check that it does not survive.

Then logic, on a goal about values. What auto_prep (Logic/ECClose.lean) does about states (reads through writes, frames, glob, renamings) has nothing to do there, and what is left of it is logic. ec_prep is that part alone, in auto_prep's order:

No step of the second phase looks at a state.

The old tactics (auto_prep, auto_progress, auto_close) are unchanged (notes/SHA3/TacticReview.md, step 3).

Introduce every leading binder of the goal (as it is spelled: no unfolding): one that is not a hypothesis under its own name, a hypothesis without a name. At a binder that is a program state (the final memories under the hypotheses of a while or conseq goal, P → ∀ τ₁ τ₂, …) the rest of the goal is first brought to values, as at the top (ReadNorm.generalizeStrict: an error if such a state survives).

The first phase: a goal ∀ σ, P or ∀ σ₁ σ₂, P about program states in read normal form, every read a value (ReadNorm.generalizeStrict: an error if a state survives); any other goal as it is.

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

    e is a variable or a tuple of variables.

    One hypothesis (x, y) = e or e = (x, y) — a tuple of variables and a term that is not written as a pair — replaced by the two component equations, x = e.1 and y = e.2. none if there is no such hypothesis.

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

      The facts mem_eq_reads read off so far, shared by the tactic runs of a file: for a memories' equation (its type) and a read G, the fact's type. ec_progress runs ec_prep again on each part of the goal it splits, where the fact read off before is still in the context: it is copied then, not read off again (simp by fp_disjoint, seconds each).

      EC's sp over (x, y) <- e leaves (x, y) = e: every such hypothesis (a tuple of variables equal to a term not written as a pair) becomes the component equations x = e.1, y = e.2, which the substitution then uses.

      Equations
      Instances For

        The closer's first phase: a goal about one or two program states, ∀ σ, P, in read normal form with every read a value; an error if a state survives. Any other goal is left as it is.

        Equations
        Instances For

          Introduce every leading binder: a value under its own name, a hypothesis without a name (ec_intro stops at the first hypothesis; this goes on). A program state among the binders is not introduced: its reads are generalized to values first (an error if it survives).

          Equations
          Instances For

            The memories' equation read off, for every read of the goal (before the reads become values): for each hypothesis equating two memories' globals as chains of writes (X.set v (… x) = Y.set w (… y), what sp leaves from byequiv's ={glob}, also inside a conjunction) and each read G.get x of a memory in the goal (a variable, a glob region), the hypothesis G.get x = G.get y, when reading G through both sides' writes gives that (touched_set_of_le_compl by fp_disjoint, the reads' lemmas).

            Equations
            Instances For

              Pairs put back together: for hypotheses a.1 = b.1 and a.2 = b.2 (a, b variables of a product type, what taking ={sa, sc} apart at x <- (sa, sc) leaves), the hypothesis a = b (Prod.ext), which subst_vars then uses (EC's auto sees the pair).

              Equations
              Instances For

                The preparation of a goal about values: see the module docstring.

                Equations
                Instances For

                  The memories' equation read off (EC's auto after sp through a game's initializations): a goal G.get x = G.get y (a variable or a glob region read in two memories), and a hypothesis a = b equating the two memories' globals as chains of writes (X.set v (… x) = Y.set w (… y), what sp leaves from byequiv's ={glob}): G.get of both sides, read through the writes (simp_reads_all; touched_set_of_le_compl by fp_disjoint for a region), is the goal.

                  Equations
                  Instances For

                    EC's progress on a goal about values: ec_prep, the goal split (∧, if), each part closed by rfl, an assumption (either way round), trivial, omega (also with the boolean guards (a && b) = true/= false taken apart) or simp_all; the parts it cannot close are left as they were.

                    Equations
                    Instances For

                      EC's auto => /# on a goal about values: ec_progress, an error if a goal is left (then nothing is changed).

                      Equations
                      Instances For