OAI/Computability/WLIdentification/StackCommands.lean
19 declarations, 0 contain sorry, 0 declared as axioms
- inductive
OAI.WLIdentification.StackModel.Commandline 11Source documentation
Finite structured source code. Tests and registers have fixed finite range; all unbounded data remain in the explicitly named bit stacks.
inductive Command (K R : Type) where …
- abbrev
OAI.WLIdentification.StackModel.Command.Controlline 23 - instance
OAI.WLIdentification.StackModel.Command.controlFintypeline 29 - def
OAI.WLIdentification.StackModel.Command.entryline 32 - def
OAI.WLIdentification.StackModel.Instruction.mapline 41 - theorem
OAI.WLIdentification.StackModel.Instruction.map_mapline 48 - theorem
OAI.WLIdentification.StackModel.Instruction.map_idline 50 - def
OAI.WLIdentification.StackModel.Command.codeline 56 - def
OAI.WLIdentification.StackModel.Command.programline 69 - inductive
OAI.WLIdentification.StackModel.Command.Execline 77Source documentation
Execution costs count actual finite-control stack instructions.
inductive Exec [DecidableEq K] : Command K R → R → (K → Word) → R → (K → Word) → ℕ → Prop | skip (s S) : Exec .skip s S s S 1 | push (k f s S) : Exec (.push k f) s S s (Function.update S k (S k ++ [f s])) 1 | pop (k f s S) : Exec (.pop k f) s S (f s (S k).getLast?) (Function.update S k (S k).dropLast) 1 | modify (f s S) : Exec (.modify f) s S (f s) S 1 | seq {c d s S t T u U a b} : Exec c s S t T a → Exec d t T u U b → Exec (.seq c d) s S u U (b + a) | branch_true {test c d s S t T n} : test s = true → Exec c s S t T n → Exec (.branch test c d) s S t T (n + 1) | branch_false {test c d s S t T n} : test s = false → Exec d s S t T n → Exec (.branch test c d) s S t T (n + 1) | while_false (test c s S) : test s = false → Exec (.while test c) s S s S 1 …Mentions: OAI.WLIdentification.StackModel.Command, OAI.WLIdentification.Word
- def
OAI.WLIdentification.StackModel.Command.Embedsline 95Source documentation
A compositional (not oracle) embedding of all source control locations.
def Embeds (P : Program K Λ R) (c : Command K R) (e : Control c → Λ) (next : Λ) : Prop := …
Mentions: OAI.WLIdentification.StackModel.Program, OAI.WLIdentification.StackModel.Command, OAI.WLIdentification.StackModel.Command.Control
- theorem
OAI.WLIdentification.StackModel.Command.embeds_seq_leftline 99 - theorem
OAI.WLIdentification.StackModel.Command.embeds_seq_rightline 110 - theorem
OAI.WLIdentification.StackModel.Command.embeds_branch_leftline 121 - theorem
OAI.WLIdentification.StackModel.Command.embeds_branch_rightline 132 - theorem
OAI.WLIdentification.StackModel.Command.embeds_while_bodyline 143 - theorem
OAI.WLIdentification.StackModel.Command.Exec.executionline 154Source documentation
This induction supplies every control-flow transition, even nested loops.
theorem Exec.execution {c : Command K R} {s S t T n} (h : Exec c s S t T n) (P : Program K Λ R) (e : Control c → Λ) (next : Λ) (he : Embeds P c e next) : (StackModel.step P)^[n] ⟨.inr (e c.entry), s, S⟩ = ⟨.inr next, t, T⟩ := by …Mentions: OAI.WLIdentification.StackModel.Command, OAI.WLIdentification.StackModel.Command.Exec, OAI.WLIdentification.StackModel.Program, OAI.WLIdentification.StackModel.Command.Control, OAI.WLIdentification.StackModel.Command.Embeds, OAI.WLIdentification.StackModel.step
- theorem
OAI.WLIdentification.StackModel.Command.program_embedsline 197 - theorem
OAI.WLIdentification.StackModel.Command.Exec.runline 203