Sparse RAM register stores on Turing tapes: proof internals #
This module proves the finite-store semantics and codec round trips exposed by the surface module. It is not part of the human-audited definitions layer.
theorem
Complexity.RAM.RegisterStore.read_write_internal
(store : Store)
(hstore : AddressesNodup store)
(address value target : ℕ)
:
theorem
Complexity.RAM.RegisterStore.write_addressesNodup_internal
(store : Store)
(hstore : AddressesNodup store)
(address value : ℕ)
:
AddressesNodup (write store address value)
theorem
Complexity.RAM.RegisterStore.write_valuesNonzero_internal
(store : Store)
(hstore : ValuesNonzero store)
(address value : ℕ)
:
ValuesNonzero (write store address value)
theorem
Complexity.RAM.RegisterStore.decode_write_internal
(store : Store)
(hstore : AddressesNodup store)
(address value : ℕ)
:
theorem
Complexity.RAM.RegisterStore.ofRegs_canonical_internal
(regs : ℕ → ℕ)
(hfinite : (Function.support regs).Finite)
:
theorem
Complexity.RAM.RegisterStore.decode_ofRegs_internal
(regs : ℕ → ℕ)
(hfinite : (Function.support regs).Finite)
:
theorem
Complexity.RAM.RegisterStore.ofRegs_represents_internal
(regs : ℕ → ℕ)
(hfinite : (Function.support regs).Finite)
:
Represents (ofRegs regs hfinite) regs
theorem
Complexity.RAM.RegisterStore.initialStore_canonical_internal
(input : List Bool)
:
Canonical (initialStore input)
theorem
Complexity.RAM.RegisterStore.Snapshot.initial_represents_internal
(input : List Bool)
:
(initial input).Represents (initCfg input)
theorem
Complexity.RAM.RegisterStore.Snapshot.ofCfg_represents_internal
(cfg : Cfg)
(hfinite : (Function.support cfg.regs).Finite)
:
(ofCfg cfg hfinite).Represents cfg
theorem
Complexity.RAM.RegisterStore.Snapshot.curInstr_decode_internal
(program : Program)
(snapshot : Snapshot)
:
theorem
Complexity.RAM.RegisterStore.Snapshot.halted_decode_iff_internal
(program : Program)
(snapshot : Snapshot)
:
theorem
Complexity.RAM.RegisterStore.Snapshot.width_stepInstr_le_internal
(instruction : Instr)
(snapshot : Snapshot)
:
theorem
Complexity.RAM.RegisterStore.Snapshot.width_step_le_internal
(program : Program)
(snapshot : Snapshot)
:
(step program snapshot).width ≤ max (snapshot.width + 1) (max (programStaticWidth program) (stepLogCost program snapshot.decode))
theorem
Complexity.RAM.RegisterStore.Snapshot.length_stepInstr_le_internal
(instruction : Instr)
(snapshot : Snapshot)
:
theorem
Complexity.RAM.RegisterStore.Snapshot.length_run_le_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
List.length (run program fuel snapshot).store ≤ List.length snapshot.store + unitTimeUpto program fuel snapshot.decode
theorem
Complexity.RAM.RegisterStore.Snapshot.width_run_le_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
(run program fuel snapshot).width ≤ snapshot.width + unitTimeUpto program fuel snapshot.decode * (programStaticWidth program + 1) + logTimeUpto program fuel snapshot.decode
theorem
Complexity.RAM.RegisterStore.encodedStoreLength_write_le_internal
(store : Store)
(address value : ℕ)
:
encodedStoreLength (write store address value) ≤ encodedStoreLength store + (Entry.encode (address, value)).length
theorem
Complexity.RAM.RegisterStore.Snapshot.encodedStoreLength_run_le_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
encodedStoreLength (run program fuel snapshot).store ≤ encodedStoreLength snapshot.store + 4 * (unitTimeUpto program fuel snapshot.decode * (programStaticWidth program + 1) + logTimeUpto program fuel snapshot.decode)
theorem
Complexity.RAM.RegisterStore.decodeEntries?_encode_append_internal
(store : Store)
(suffix : List Bool)
:
decodeEntries? (List.length store) (List.flatMap Entry.encode store ++ suffix) = some (store, suffix)
theorem
Complexity.RAM.RegisterStore.Snapshot.encode_run_length_le_amortized_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
(run program fuel snapshot).encode.length ≤ encodedStoreLength snapshot.store + 4 * snapshot.width + 8 * (unitTimeUpto program fuel snapshot.decode * (programStaticWidth program + 1) + logTimeUpto program fuel snapshot.decode) + 2
theorem
Complexity.RAM.RegisterStore.Snapshot.encode_initial_run_length_le_amortized_internal
(program : Program)
(fuel : ℕ)
(input : List Bool)
:
theorem
Complexity.RAM.RegisterStore.Snapshot.encode_run_length_le_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
(run program fuel snapshot).encode.length ≤ (List.length snapshot.store + unitTimeUpto program fuel snapshot.decode + 1) * (4 * (snapshot.width + unitTimeUpto program fuel snapshot.decode * (programStaticWidth program + 1) + logTimeUpto program fuel snapshot.decode) + 2)
theorem
Complexity.RAM.RegisterStore.Snapshot.encode_run_length_le_logTime_internal
(program : Program)
(fuel : ℕ)
(snapshot : Snapshot)
(hcanonical : Canonical snapshot.store)
:
(run program fuel snapshot).encode.length ≤ (List.length snapshot.store + logTimeUpto program fuel snapshot.decode + 1) * (4 * (snapshot.width + logTimeUpto program fuel snapshot.decode * (programStaticWidth program + 1) + logTimeUpto program fuel snapshot.decode) + 2)
theorem
Complexity.RAM.RegisterStore.Snapshot.encode_initial_run_length_le_logTime_internal
(program : Program)
(fuel : ℕ)
(input : List Bool)
: