import OAI.Computability.UniqueGames.Machines.MachineExpanderTableProgramLemmas namespace OAI section /-! Static, pointwise Boolean presentation of the actual family tape alphabet. Every conversion below is an identity on symbols and has no machine runtime. -/ namespace UniqueGamesTheorem.Foundations.Complexity.MachineExpanderFamily open Turing def boolWord : (tape : Tape) → List Bool → List (Alphabet tape) | .inl (.inl _), word => word | .inl (.inr _), word => word | .inr _, word => word def toBoolWord : (tape : Tape) → List (Alphabet tape) → List Bool | .inl (.inl _), word => word | .inl (.inr _), word => word | .inr _, word => word def fromBoolTapes (base : Tape → List Bool) : (tape : Tape) → List (Alphabet tape) := fun tape => boolWord tape (base tape) def toBoolTapes (base : (tape : Tape) → List (Alphabet tape)) : Tape → List Bool := fun tape => toBoolWord tape (base tape) @[simp] theorem toBoolWord_boolWord (tape : Tape) (word : List Bool) : toBoolWord tape (boolWord tape word) = word := by rcases tape with tape | tape · cases tape <;> rfl · rfl @[simp] theorem boolWord_toBoolWord (tape : Tape) (word : List (Alphabet tape)) : boolWord tape (toBoolWord tape word) = word := by rcases tape with tape | tape · cases tape <;> rfl · rfl @[simp] theorem toBool_fromBool (base : Tape → List Bool) : toBoolTapes (fromBoolTapes base) = base := by funext tape exact toBoolWord_boolWord tape (base tape) @[simp] theorem fromBool_toBool (base : (tape : Tape) → List (Alphabet tape)) : fromBoolTapes (toBoolTapes base) = base := by funext tape exact boolWord_toBoolWord tape (base tape) private theorem transport_tapes_apply {K : Type} {Γ Δ : K → Type} (h : Γ = Δ) (base : (k : K) → List (Γ k)) (k : K) : MachineAlphabetTransport.tapes h base k = Eq.mp (congrArg (fun alphabet => List (alphabet k)) h) (base k) := by cases h rfl theorem toBoolTapes_eq_transport (base : (tape : Tape) → List (Alphabet tape)) : toBoolTapes base = MachineAlphabetTransport.tapes alphabet_eq base := by funext tape rw [transport_tapes_apply] rcases tape with tape | tape · cases tape <;> rfl · rfl theorem fromBoolTapes_eq_transport (base : Tape → List Bool) : fromBoolTapes base = MachineAlphabetTransport.tapes alphabet_eq.symm base := by funext tape rw [transport_tapes_apply] rcases tape with tape | tape · cases tape <;> rfl · rfl @[simp] theorem fromBoolTapes_update (base : Tape → List Bool) (tape : Tape) (word : List Bool) : fromBoolTapes (Function.update base tape word) = Function.update (fromBoolTapes base) tape (boolWord tape word) := by funext k by_cases h : k = tape · subst k simp [fromBoolTapes] · simp [fromBoolTapes, h] @[simp] theorem toBoolTapes_update (base : (tape : Tape) → List (Alphabet tape)) (tape : Tape) (word : List (Alphabet tape)) : toBoolTapes (Function.update base tape word) = Function.update (toBoolTapes base) tape (toBoolWord tape word) := by funext k by_cases h : k = tape · subst k simp [toBoolTapes] · simp [toBoolTapes, h] theorem configuration_fromBool {ρ : Type} {d : Nat} (label : Option (Label d)) (state : State ρ d) (base : Tape → List Bool) : MachineAlphabetTransport.configuration alphabet_eq.symm ⟨label, state, base⟩ = ⟨label, state, fromBoolTapes base⟩ := by rw [MachineAlphabetTransport.configuration_mk, fromBoolTapes_eq_transport] theorem configuration_toBool {ρ : Type} {d : Nat} (label : Option (Label d)) (state : State ρ d) (base : (tape : Tape) → List (Alphabet tape)) : MachineAlphabetTransport.configuration alphabet_eq ⟨label, state, base⟩ = ⟨label, state, toBoolTapes base⟩ := by rw [MachineAlphabetTransport.configuration_mk, toBoolTapes_eq_transport] end UniqueGamesTheorem.Foundations.Complexity.MachineExpanderFamily end end OAI