Replacing the upstream module of a cascade by an equivalent one preserves behaviour
ProvedMindUploadTheory.cascade_substitution_preserves_behaviorConsider a cascade of two deterministic modules. The upstream module has states , transition and output ; the downstream module has states , transition and output . At each step the composite reads an input , moves by and moves by the current output of ; its output is that of . Let be another upstream module and states with
Then for every state of and every word , the composites started from and give the same output after .
In the replacement pillar of the mind-upload.com program this is the basic step of replacing parts one at a time: substituting an equivalent module never changes the behaviour of the whole system.
Formalization Note The composite step is fun (p : SA × SB) i => (stepA p.1 i, stepB p.2 (outA p.1)), read with List.foldl.
import Mathlib.Logic.Basic
namespace MindUploadTheory
theorem cascade_substitution_preserves_behavior {I M O SA SA' SB : Type*}
(stepA : SA → I → SA) (outA : SA → M) (stepA' : SA' → I → SA') (outA' : SA' → M)
(stepB : SB → M → SB) (outB : SB → O) (a : SA) (a' : SA')
(hA : ∀ w : List I, outA (w.foldl stepA a) = outA' (w.foldl stepA' a')) (s : SB) :
∀ w : List I,
outB (w.foldl (fun (p : SA × SB) (i : I) => (stepA p.1 i, stepB p.2 (outA p.1))) (a, s)).2 =
outB (w.foldl (fun (p : SA' × SB) (i : I) => (stepA' p.1 i, stepB p.2 (outA' p.1))) (a', s)).2 := by sorry
end MindUploadTheory