Documentation

GaudisCrypt.Logic.StateEq

Equal states after the same writes #

subst_states    -- from `X.set a s₁ = X.set b s₂` (and so on inward), `s₁ = s₂`

EC's sp over the same initializations on both sides, from equal memories, leaves the memories equal: ={glob D} holds for any D after it. Ours leaves the equation of the two states before the writes, in the form ∃ old values, (the states with the old values written back) are equal, next to the new values (S.m{1} = FMap.empty, …). When the new values agree on both sides, the states themselves are equal: subst_states peels the writes from the outside in (Lens.eq_of_set_eq_of_get_eq, each X.get sᵢ read through the inner writes and rewritten with the hypotheses), down to σ₁ = σ₂.

theorem GaudisCrypt.Lens.eq_of_set_eq_of_get_eq {a : Type u_1} {m : Type u_2} (X : Lens a m) {x y : a} {s₁ s₂ : m} (h : X.set x s₁ = X.set y s₂) (hg : X.get s₁ = X.get s₂) :
s₁ = s₂

Two states that are equal after a write of the same lens, and agree on that lens before it, are equal.

X.set x s (a write of the lens X): (X, x, s).

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

    A hypothesis X.set x s₁ = X.set y s₂ (the same lens on both sides).

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

      Equal states after the same writes: see the module docstring. Each hypothesis X.set x s₁ = X.set y s₂ whose X.get s₁ = X.get s₂ follows from the reads through writes and the hypotheses (simp_reads, simp only [*]) is replaced by s₁ = s₂, until no write is left on either side. Fails if no hypothesis can be peeled.

      Equations
      Instances For