Documentation

GaudisCrypt.Logic.PRHLFrame

Framing a procedure judgment by footprints #

EasyCrypt's call keeps everything the two callees do not touch (its module restrictions frame the rest of the memory). prhlProc_frame_lens is that for procedures confined to footprints: a relation between a lens outside the left callee's footprint and one outside the right callee's is added to both conditions (hoareProc_frame on each side). prhlProc_frame_equal_outside is its instance at the complement of a lens L: callees that only touch L keep the states equal outside L (Lens.equal_outside), the frame of prhlProc_abstract_call_equal_outside_module's oracle premise.

theorem GaudisCrypt.prhlProc_frame_lens {sig₁ sig₂ : ProcedureSignature} {p₁ : Procedure sig₁} {p₂ : Procedure sig₂} {A : sig₁.ParamType → VariableAssignment → sig₂.ParamType → VariableAssignment → Prop} {B : sig₁.ret → VariableAssignment → sig₂.ret → VariableAssignment → Prop} {α : Type u_1} {β : Type u_2} (X₁ : Lens α VariableAssignment) (X₂ : Lens β VariableAssignment) (h₁ : ∀ (a : sig₁.ParamType), (procedureDenotation p₁ a).inFootprint X₁.footprintᶜ) (h₂ : ∀ (a : sig₂.ParamType), (procedureDenotation p₂ a).inFootprint X₂.footprintᶜ) (R : α → β → Prop) (h : prhlProc A p₁ p₂ B) :
prhlProc (fun (a₁ : sig₁.ParamType) (g₁ : VariableAssignment) (a₂ : sig₂.ParamType) (g₂ : VariableAssignment) => A a₁ g₁ a₂ g₂ ∧ R (X₁.get g₁) (X₂.get g₂)) p₁ p₂ fun (r₁ : sig₁.ret) (g₁ : VariableAssignment) (r₂ : sig₂.ret) (g₂ : VariableAssignment) => B r₁ g₁ r₂ g₂ ∧ R (X₁.get g₁) (X₂.get g₂)

The frame rule for footprints: a relation R between X₁ (untouched by p₁) and X₂ (untouched by p₂) is kept.

theorem GaudisCrypt.prhlProc_frame_equal_outside {sig₁ sig₂ : ProcedureSignature} {p₁ : Procedure sig₁} {p₂ : Procedure sig₂} {A : sig₁.ParamType → VariableAssignment → sig₂.ParamType → VariableAssignment → Prop} {B : sig₁.ret → VariableAssignment → sig₂.ret → VariableAssignment → Prop} {Ω : Type} (L : Lens Ω VariableAssignment) (h₁ : ∀ (a : sig₁.ParamType), (procedureDenotation p₁ a).inFootprint L.footprint) (h₂ : ∀ (a : sig₂.ParamType), (procedureDenotation p₂ a).inFootprint L.footprint) (h : prhlProc A p₁ p₂ B) :
prhlProc (fun (a₁ : sig₁.ParamType) (g₁ : VariableAssignment) (a₂ : sig₂.ParamType) (g₂ : VariableAssignment) => A a₁ g₁ a₂ g₂ ∧ L.equal_outside g₁ g₂) p₁ p₂ fun (r₁ : sig₁.ret) (g₁ : VariableAssignment) (r₂ : sig₂.ret) (g₂ : VariableAssignment) => B r₁ g₁ r₂ g₂ ∧ L.equal_outside g₁ g₂

Callees confined to L keep the states equal outside L (prhlProc_frame_lens at the complement of L).

theorem GaudisCrypt.prhlProc_frame_equal_outside_module {sig₁ sig₂ : ProcedureSignature} {A : sig₁.ParamType → VariableAssignment → sig₂.ParamType → VariableAssignment → Prop} {B : sig₁.ret → VariableAssignment → sig₂.ret → VariableAssignment → Prop} {Ω : Type} (L : Lens Ω VariableAssignment) (M₁ : Module.Proc sig₁) (M₂ : Module.Proc sig₂) (h₁ : FVP.fvP M₁ ≤ L.footprint) (h₂ : FVP.fvP M₂ ≤ L.footprint) (h : prhlProc A M₁.procedure M₂.procedure B) :
prhlProc (fun (a₁ : sig₁.ParamType) (g₁ : VariableAssignment) (a₂ : sig₂.ParamType) (g₂ : VariableAssignment) => A a₁ g₁ a₂ g₂ ∧ L.equal_outside g₁ g₂) M₁.procedure M₂.procedure fun (r₁ : sig₁.ret) (g₁ : VariableAssignment) (r₂ : sig₂.ret) (g₂ : VariableAssignment) => B r₁ g₁ r₂ g₂ ∧ L.equal_outside g₁ g₂

prhlProc_frame_equal_outside for modules' procedures, by their footprints.