Documentation

CslibFrontier.Computability.PointerMachine.Renaming

Renaming pointer-machine data #

A permutation of the data which commutes with the primitives of the model commutes with execution. Pointers, control and cost are unchanged.

Main definitions #

Main results #

A permutation of the data which the primitives of the model cannot observe.

The identity data renaming.

The inverse of a data renaming.

Apply one data renaming and then another.

def Cslib.PointerMachine.Record.rename {M : Model} {L : Layout} (ρ : M.Renaming) (n : Record M L) :
Record M L

Rename the data fields of a record.

def Cslib.PointerMachine.State.rename {M : Model} {L : Layout} (ρ : M.Renaming) (x : State M L) :
State M L

Rename all data of a state.

@[simp]
theorem Cslib.PointerMachine.State.rename_symm {M : Model} {L : Layout} (ρ : M.Renaming) (x : State M L) :
rename ρ.symm (rename ρ x) = x

Undo a data renaming.

theorem Cslib.PointerMachine.Instr.effect_rename {M : Model} {L : Layout} (ρ : M.Renaming) (i : Instr M L) (x : State M L) :

Instructions commute with renaming.

theorem Cslib.PointerMachine.Instr.next_rename {M : Model} {L : Layout} (ρ : M.Renaming) (i : Instr M L) (x : State M L) :
next (State.rename ρ x) i = next x i

Renaming does not change control flow.

theorem Cslib.PointerMachine.step_rename {M : Model} {L : Layout} (ρ : M.Renaming) (code : List (Instr M L)) (x : State M L) :
step code (State.rename ρ x) = Option.map (State.rename ρ) (step code x)

Every program step commutes with renaming.

theorem Cslib.PointerMachine.Runs.rename {M : Model} {L : Layout} (ρ : M.Renaming) {code : List (Instr M L)} {x y : State M L} {n : ℕ} (h : Runs code x y n) :
Runs code (State.rename ρ x) (State.rename ρ y) n

Renaming changes neither a run's control flow nor its instruction count.

theorem Cslib.PointerMachine.Executes.rename {M : Model} {L : Layout} (ρ : M.Renaming) {code : List (Instr M L)} {x y : State M L} {n : ℕ} (h : Executes code x y n) :
Executes code (State.rename ρ x) (State.rename ρ y) n

Successful executions are invariant under renaming, with the same cost.

theorem Cslib.PointerMachine.Executes.rename_iff {M : Model} {L : Layout} (ρ : M.Renaming) {code : List (Instr M L)} {x y : State M L} {n : ℕ} :
Executes code (State.rename ρ x) (State.rename ρ y) n ↔ Executes code x y n

Data renaming preserves and reflects successful execution at the same cost.