cfahlgren1/math / lean /OAI /Combinatorics /IndependentSets /Machines /MachineFiniteAlphabet.lean
cfahlgren1's picture
download
raw
3.41 kB
import Mathlib
import OAI.Combinatorics.IndependentSets.Machines.Runtime
import OAI.Combinatorics.IndependentSets.Machines.MachineRepeat
namespace OAI
namespace IndependentSetsGames.Foundations.Complexity.MachineFiniteAlphabet
open Turing
def FiniteAlphabet (M : FinTM2) : Prop := ∀ k, Finite (M.Γ k)
theorem input_finite (M : FinTM2) : Finite (M.Γ M.k₀) := by
let := M.Γk₀Fin
infer_instance
theorem of_homogeneous (M : FinTM2) {α : Type} [Finite α]
(alphabet : ∀ k, M.Γ k = α) : FiniteAlphabet M := by
intro k
rw [alphabet k]
infer_instance
theorem of_bool (M : FinTM2) (alphabet : ∀ k, M.Γ k = Bool) : FiniteAlphabet M :=
of_homogeneous M alphabet
theorem of_equiv (M : FinTM2) {α : Type} [Finite α]
(alphabet : ∀ k, M.Γ k ≃ α) : FiniteAlphabet M := by
intro k
exact Finite.of_equiv α (alphabet k).symm
theorem symbols_finite (M : FinTM2) (finiteAlphabet : FiniteAlphabet M) :
Finite (Σ k, M.Γ k) := by
let := M.kFin
let : ∀ k, Finite (M.Γ k) := finiteAlphabet
infer_instance
theorem sequential_machine (first second : FinTM2)
(relabel : first.Γ first.k₁ → second.Γ second.k₀)
(fallback : second.Γ second.k₀)
(hfirst : FiniteAlphabet first) (hsecond : FiniteAlphabet second) :
FiniteAlphabet (MachineSequential.machine first second relabel fallback) := by
intro tape
rcases tape with tape | tape | tape
· exact hfirst tape
· exact hsecond tape
· exact input_finite second
theorem compose {α β γ αΓ βΓ γΓ : Type}
{ea : α → List αΓ} {eb : β → List βΓ} {ec : γ → List γΓ}
{f : α → β} {g : β → γ}
(first : TM2ComputableInPolyTime ea eb f)
(second : TM2ComputableInPolyTime eb ec g) (fallback : βΓ)
(hfirst : FiniteAlphabet first.tm) (hsecond : FiniteAlphabet second.tm) :
FiniteAlphabet (MachineSequential.compose first second fallback).tm := by
exact sequential_machine first.tm second.tm
(fun symbol => second.inputAlphabet.symm (first.outputAlphabet symbol))
(second.inputAlphabet.symm fallback) hfirst hsecond
theorem composeBits {α β γ : Type}
{ea : α → List Bool} {eb : β → List Bool} {ec : γ → List Bool}
{f : α → β} {g : β → γ}
(first : TM2ComputableInPolyTime ea eb f)
(second : TM2ComputableInPolyTime eb ec g)
(hfirst : FiniteAlphabet first.tm) (hsecond : FiniteAlphabet second.tm) :
FiniteAlphabet (MachineSequential.composeBits first second).tm :=
compose first second false hfirst hsecond
theorem repeat_machine (body : FinTM2)
(input : body.Γ body.k₀ ≃ Bool) (output : body.Γ body.k₁ ≃ Bool)
(hbody : FiniteAlphabet body) :
FiniteAlphabet (MachineRepeat.machine body input output) := by
intro tape
cases tape with
| inl tape => exact hbody tape
| inr _ => exact input_finite body
end IndependentSetsGames.Foundations.Complexity.MachineFiniteAlphabet
namespace IndependentSetsGames.Foundations.PCP.AlphabetTable
open IndependentSetsGames.Foundations.Complexity
theorem Driver.finiteAlphabet (q : Nat) :
MachineFiniteAlphabet.FiniteAlphabet (Driver.machine q) := by
intro k
change Finite Bool
infer_instance
theorem Runtime.finiteAlphabet (q : Nat) :
MachineFiniteAlphabet.FiniteAlphabet (Runtime.tablePolynomialTime q).tm :=
Driver.finiteAlphabet q
end IndependentSetsGames.Foundations.PCP.AlphabetTable
end OAI

Xet Storage Details

Size:
3.41 kB
·
Xet hash:
f0bd02963bf4c6febeb5309dd551246b8c4654d8f0a2ce5fcfa6336934d281ac

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.