Register Renaming for Structured Resizable Word RAM Programs (RCode.rename) #
Provides register-view projection (RData.comap), write-back extension (RData.extend), structured
program renaming (RCode.rename), and big-step demonic execution lifting (RDemonicExec.rename,
RDemonicExec.rename_eq) along injective register maps f : Fin r → Fin r', mirroring
Cslib.WordRAM.Code.rename and Cslib.WordRAM.Exec.rename on Cslib.WordRAM.Resizable.
Main definitions #
Cslib.WordRAM.Resizable.RData.comap,Cslib.WordRAM.Resizable.RData.extend: register-view projection and write-back extension onRData.Cslib.WordRAM.Resizable.RCode.rename: register renaming onRCode B r.
Main results #
Cslib.WordRAM.Resizable.RCode.readsWidth_rename: register renaming preservesReadsWidth.Cslib.WordRAM.Resizable.RDemonicExec.rename,Cslib.WordRAM.Resizable.RDemonicExec.rename_eq: liftingRDemonicExecalong injective register embeddings while preserving unmapped registers.
theorem Cslib.WordRAM.Resizable.RData.extend_comap {r r' : ℕ} {f : Fin r → Fin r'} (hf : Function.Injective f) (x : RData r') :
theorem Cslib.WordRAM.Resizable.RData.Bounded.comap {r r' w : ℕ} {x : RData r'} (hx : Bounded w x) (f : Fin r → Fin r') :
Bounded w (RData.comap f x)
theorem Cslib.WordRAM.Resizable.RData.Bounded.extend {r r' : ℕ} {f : Fin r → Fin r'} {w : ℕ} {y : RData r} {x : RData r'} (hf : Function.Injective f) (hy : Bounded w y) (hx : Bounded w x) :
Bounded w (RData.extend f y x)
theorem Cslib.WordRAM.Resizable.evalResizable_rename {B : Basis} {r r' : ℕ} {f : Fin r → Fin r'} (hf : Function.Injective f) (o : Op B r) (w : ℕ) (x : RData r') :
evalResizable w (Op.rename f o) x = Option.map (fun (y : RData r) => RData.extend f y x) (evalResizable w o (RData.comap f x))
Evaluating a renamed instruction on RData r' commutes with RData.comap and RData.extend.
theorem Cslib.WordRAM.Resizable.RDemonicExec.rename {B : Basis} {r r' : ℕ} {f : Fin r → Fin r'} (hf : Function.Injective f) {w L_peak T : ℕ} {c : RCode B r} {x : RData r'} {P : RData r → Prop} (h : RDemonicExec w L_peak c (RData.comap f x) T P) :
RDemonicExec w L_peak (RCode.rename f c) x T fun (z : RData r') => ∃ (y : RData r), P y ∧ z = RData.extend f y x
Demonic execution register renaming (RDemonicExec.rename).
Lifts RDemonicExec along any injective register embedding f : Fin r → Fin r', preserving all
unmapped registers outside Set.range f.
theorem Cslib.WordRAM.Resizable.RDemonicExec.rename_eq {B : Basis} {r r' : ℕ} {f : Fin r → Fin r'} (hf : Function.Injective f) {w L_peak T : ℕ} {c : RCode B r} {x : RData r'} {y : RData r} (h : RDemonicExec w L_peak c (RData.comap f x) T fun (x : RData r) => x = y) :
Deterministic postcondition specialization of RDemonicExec.rename.