File size: 4,897 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | import Mathlib
import OAI.Computability.FiniteCompiler.Quotients
import OAI.GroupTheory.SimpleOvergroups.CommonCompiler
import OAI.GroupTheory.SimpleOvergroups.ContractedNormalForms
namespace OAI
namespace SimpleFInftyOvergroups.CommonCompiler
noncomputable section
open FiniteAlgebraicEnvelopes Compiler MachineRealization
open SemanticEncoding
open scoped Classical Compiler.HeadCodec
variable {S T Ξ Q : Type*} [Fintype T] [Fintype Ξ] [Fintype Q]
[DecidableEq T] [DecidableEq Ξ] [DecidableEq Q] [Primcodable Q]
variable (A : Simulator.Alphabet S Ξ) (M : Simulator.Machine Q Ξ)
(p : S) (B : Simulator.Alphabet T (Bool Γ Ξ)) (index : β)
local instance compilerSemanticsSectorOrder :
LinearOrder (Control.Sector T (Bool Γ Ξ) (ParameterMachine.State Q index)) :=
ParameterCode.finiteOrder index
abbrev Mon := Word.Presentation B (ParameterMachine.machine A M p index)
local instance compilerSemanticsMonoidWithZero : MonoidWithZero (Mon A M p B index) :=
Word.monoidWithZero B (ParameterMachine.machine A M p index)
variable (decode : β g a, B.output g = some a β g = B.input a)
{f : β Γ List T β Part (List T)}
(budget : β m, PartialBudget (fun w => f (index,w)) m)
(realizes : Word.Realizes B (ParameterMachine.machine A M p index) (fun w => f (index,w)))
def evaluation : FreeMonoid (Letter T Ξ Q) β* Mon A M p B index :=
(PresentedMonoid.mk (Word.Rel B (ParameterMachine.machine A M p index))).comp
(retractWord index)
omit [Fintype T] [Fintype Ξ] [Fintype Q] [DecidableEq Q] [Primcodable Q] in
theorem evaluation_surjective : Function.Surjective (evaluation A M p B index) := by
intro h
obtain β¨w,hwβ© := PresentedMonoid.surjective_mk h
refine β¨includeWord index w, ?_β©
simpa only [evaluation, MonoidHom.comp_apply, retract_include_word] using hw
omit [Fintype T] [Fintype Ξ] [Fintype Q] [DecidableEq T] [DecidableEq Ξ]
[DecidableEq Q] [Primcodable Q] in
theorem includeWord_injective : Function.Injective (includeWord (T:=T) (Ξ:=Ξ) (Q:=Q) index) :=
Function.LeftInverse.injective (retract_include_word index)
def normal (w : FreeMonoid (Letter T Ξ Q)) : FreeMonoid (Letter T Ξ Q) :=
(calculus A M p B index decode (budget 0) realizes).normal w
theorem normal_at (m : β) :
(calculus A M p B index decode (budget m) realizes).normal = normal A M p B index decode budget realizes := rfl
theorem evaluation_iff (u v : FreeMonoid (Letter T Ξ Q)) :
evaluation A M p B index u = evaluation A M p B index v β
normal A M p B index decode budget realizes u = normal A M p B index decode budget realizes v := by
change _ β includeWord index _ = includeWord index _
rw [(includeWord_injective (T:=T) (Ξ:=Ξ) (Q:=Q) index).eq_iff]
change Word.present B (ParameterMachine.machine A M p index) (retractWord index u).toList =
Word.present B (ParameterMachine.machine A M p index) (retractWord index v).toList β _
exact Word.present_eq_iff_normal B (ParameterMachine.machine A M p index) decode
(fun m => (budget m).totalize) (fun m => realizes.computesAt _ _ (budget m)) _ _
theorem normal_idempotent (w : FreeMonoid (Letter T Ξ Q)) :
normal A M p B index decode budget realizes (normal A M p B index decode budget realizes w) =
normal A M p B index decode budget realizes w := by
exact (calculus A M p B index decode (budget (Word.grade w.toList)) realizes).idempotent w le_rfl
def normalPresentation : NormalPresentation (FreeMonoid (Letter T Ξ Q)) (Mon A M p B index) where
q := evaluation A M p B index
surjective := evaluation_surjective A M p B index
normal := normal A M p B index decode budget realizes
omega := FreeMonoid.ofList [.zero]
zero := by
change Word.present B (ParameterMachine.machine A M p index)
[retractLetter index .zero] = Word.present B (ParameterMachine.machine A M p index) [.zero]
rw [show retractLetter index (.zero : Letter T Ξ Q) = .zero from retract_include index .zero]
complete := evaluation_iff A M p B index decode budget realizes
idempotent := normal_idempotent A M p B index decode budget realizes
fixesZero := (calculus A M p B index decode (budget 0) realizes).normal_omega
include decode budget realizes in
theorem zero_ne_one : (0 : Mon A M p B index) β 1 := by
intro h
let P := normalPresentation A M p B index decode budget realizes
have he := (P.complete P.omega 1).mp (by rw [P.zero,map_one]; exact h)
have hone : P.normal 1 = 1 :=
(calculus A M p B index decode (budget 0) realizes).normal_one
rw [P.fixesZero,hone] at he
have he' := congrArg FreeMonoid.toList he
change [.zero] = ([] : List (Letter T Ξ Q)) at he'
contradiction
include decode budget realizes in
theorem nontrivial : Nontrivial (Mon A M p B index) :=
nontrivial_of_ne _ _ (zero_ne_one A M p B index decode budget realizes)
end
end SimpleFInftyOvergroups.CommonCompiler
end OAI
|