File size: 8,188 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import Mathlib
import OAI.GroupTheory.SimpleOvergroups.EnlargementEffective
import OAI.GroupTheory.SimpleOvergroups.MatrixEffective
import OAI.GroupTheory.SimpleOvergroups.EffectiveActions

namespace OAI


namespace SimpleFInftyOvergroups.EffectiveNames.Double
open BoundedEncoding NamedAction
noncomputable section
open scoped Classical

variable {A kβ‚€ k₁ kβ‚‚ P₁ Pβ‚‚ : Type*}
  [CommRing kβ‚€] [CommRing k₁] [CommRing kβ‚‚]
  [Primcodable A] [Primcodable kβ‚€] [Primcodable k₁] [Primcodable kβ‚‚]
  [Finite kβ‚€] [Finite k₁] [Finite kβ‚‚]
  [Primcodable P₁] [Primcodable Pβ‚‚] [Finite P₁] [Finite Pβ‚‚]
  {n : β„•}

abbrev Gβ‚€ (k A : Type*) (n : β„•) := MatrixWords.Word k A n
abbrev Xβ‚€ (k A : Type*) (n : β„•) := MatrixWords.Point k A n
abbrev G₁ (P k A : Type*) (n : β„•) := Enlargement.Word P (Gβ‚€ k A n)
abbrev X₁ (P k A : Type*) (n : β„•) := Enlargement.Point P (Gβ‚€ k A n) (Xβ‚€ k A n)
abbrev Gβ‚‚ (P₁ Pβ‚‚ k A : Type*) (n : β„•) := Enlargement.Word Pβ‚‚ (G₁ P₁ k A n)
abbrev Xβ‚‚ (P₁ Pβ‚‚ k A : Type*) (n : β„•) := Enlargement.Point Pβ‚‚ (G₁ P₁ k A n) (X₁ P₁ k A n)

abbrev base (grade : List A β†’ β„•) := MatrixWords.nameOperations (k:=kβ‚€) (n:=n) grade
abbrev first (grade : List A β†’ β„•) := Enlargement.operations (P:=P₁) (base (kβ‚€:=kβ‚€) (n:=n) grade)
abbrev operations (grade : List A β†’ β„•) :=
  Enlargement.operations (P:=Pβ‚‚) (first (P₁:=P₁) (kβ‚€:=kβ‚€) (n:=n) grade)

variable (e₁ : P₁ β†’ Enlargement.Coeff.Name k₁) (eβ‚‚ : Pβ‚‚ β†’ Enlargement.Coeff.Name kβ‚‚)
variable (grade : List A β†’ β„•) (omega : List A) (f : List A β†’ Part (List A))

def partialGroupKey : Gβ‚‚ P₁ Pβ‚‚ kβ‚€ A n β†’ Part (β„• Γ— β„•) :=
  Enlargement.partialGroupKey (first grade) eβ‚‚
    (Enlargement.partialGroupKey (base grade) e₁
      (MatrixWords.partialGroupKey (k:=kβ‚€) (n:=n) omega f))

def partialPointKey : Xβ‚‚ P₁ Pβ‚‚ kβ‚€ A n β†’ Part β„• :=
  Enlargement.partialPointKey (first grade) eβ‚‚
    (Enlargement.partialPointKey (base grade) e₁
      (MatrixWords.partialPointKey (k:=kβ‚€) (n:=n) omega f))

def test (w : List (Letter (Gβ‚‚ P₁ Pβ‚‚ kβ‚€ A n) (Xβ‚‚ P₁ Pβ‚‚ kβ‚€ A n))) :
    Part (Result (β„• Γ— β„•) β„•) :=
  (operations grade).test (partialGroupKey e₁ eβ‚‚ grade omega f)
    (partialPointKey e₁ eβ‚‚ grade omega f) w

variable {m : β„•} (C : WordCalculus (FreeMonoid A) m)
attribute [local instance] WordCalculus.rawMatrixAction

abbrev calculus := Enlargement.calculus (k:=kβ‚‚)
  (Enlargement.calculus (k:=k₁) (MatrixWords.calculus (k:=kβ‚€) (n:=n) C))

variable (he₁ : βˆ€ p, Enlargement.Coeff.value (e₁ p) * Enlargement.Coeff.value (e₁ p) =
    Enlargement.Coeff.value (e₁ p))
  (heβ‚‚ : βˆ€ p, Enlargement.Coeff.value (eβ‚‚ p) * Enlargement.Coeff.value (eβ‚‚ p) =
    Enlargement.Coeff.value (eβ‚‚ p))

abbrev interpret₁ := Enlargement.interpretation (base (MatrixWords.grade C)) e₁
  (MatrixWords.interpretation (k:=kβ‚€) (n:=n) C) he₁

abbrev interpretation := Enlargement.interpretation (first (MatrixWords.grade C)) eβ‚‚
  (interpret₁ (kβ‚€:=kβ‚€) (n:=n) e₁ C he₁) heβ‚‚

omit [Finite k₁] [Finite kβ‚‚] [Primcodable P₁] [Primcodable Pβ‚‚] [Finite P₁] [Finite Pβ‚‚] in
 theorem partialGroupKey_full {d : β„•} (w : Gβ‚‚ P₁ Pβ‚‚ kβ‚€ A n)
    (hw : (operations (MatrixWords.grade C)).gcost w ≀ d)
    (hf : βˆ€ u, MatrixWords.grade C u ≀ d β†’
      (C.normal (FreeMonoid.ofList u)).toList ∈ f u) :
    (interpretation e₁ eβ‚‚ C he₁ heβ‚‚).gkey w ∈
      partialGroupKey e₁ eβ‚‚ (MatrixWords.grade C) C.omega.toList f w := by
  apply Enlargement.partialGroupKey_full _ _ _ _ _ _ hw
  intro g hg
  apply Enlargement.partialGroupKey_full _ _ _ _ _ _ hg
  intro h hh
  exact MatrixWords.partialGroupKey_full C f h hh hf

omit [Finite k₁] [Finite kβ‚‚] [Primcodable P₁] [Primcodable Pβ‚‚] [Finite P₁] [Finite Pβ‚‚] in
 theorem partialPointKey_full {d : β„•} (x : Xβ‚‚ P₁ Pβ‚‚ kβ‚€ A n)
    (hx : (operations (MatrixWords.grade C)).xcost x ≀ d)
    (hf : βˆ€ u, MatrixWords.grade C u ≀ d β†’
      (C.normal (FreeMonoid.ofList u)).toList ∈ f u) :
    (interpretation e₁ eβ‚‚ C he₁ heβ‚‚).xkey x ∈
      partialPointKey e₁ eβ‚‚ (MatrixWords.grade C) C.omega.toList f x := by
  apply Enlargement.partialPointKey_full _ _ _ _ _ _ hx
  intro y hy
  apply Enlargement.partialPointKey_full _ _ _ _ _ _ hy
  intro z hz
  exact MatrixWords.partialPointKey_full C f z hz hf

omit [Finite k₁] [Finite kβ‚‚] [Primcodable P₁] [Primcodable Pβ‚‚] [Finite P₁] [Finite Pβ‚‚] in
 theorem test_full {d : β„•} (w : List (Letter (Gβ‚‚ P₁ Pβ‚‚ kβ‚€ A n) (Xβ‚‚ P₁ Pβ‚‚ kβ‚€ A n)))
    (hw : (operations (MatrixWords.grade C)).wordCost w ≀ d)
    (hf : βˆ€ u, MatrixWords.grade C u ≀ d β†’
      (C.normal (FreeMonoid.ofList u)).toList ∈ f u) :
    (operations (MatrixWords.grade C)).totalTest
      (interpretation e₁ eβ‚‚ C he₁ heβ‚‚).gkey (interpretation e₁ eβ‚‚ C he₁ heβ‚‚).xkey w ∈
      test e₁ eβ‚‚ (MatrixWords.grade C) C.omega.toList f w := by
  exact Operations.test_full _ _ _ _ _
    (fun g hg => partialGroupKey_full e₁ eβ‚‚ f C he₁ heβ‚‚ g hg hf)
    (fun x hx => partialPointKey_full e₁ eβ‚‚ f C he₁ heβ‚‚ x hx hf) w hw


local instance : Primcodable (Gβ‚‚ P₁ Pβ‚‚ kβ‚€ A n) := inferInstance
local instance : Primcodable (Xβ‚‚ P₁ Pβ‚‚ kβ‚€ A n) := inferInstance

 theorem primrec_inv_base : Primrec ((base (kβ‚€:=kβ‚€) (n:=n) grade).inv) := MatrixWords.primrec_inverse
omit [Finite kβ‚€] in
 theorem primrec_act_base : Primrecβ‚‚ ((base (kβ‚€:=kβ‚€) (n:=n) grade).act) :=
  (Primrec.list_append.comp Primrec.fst (Primrec.fst.comp Primrec.snd)).pair
    (Primrec.snd.comp Primrec.snd)
omit [Finite P₁] in
 theorem primrec_inv_first : Primrec ((first (P₁:=P₁) (kβ‚€:=kβ‚€) (n:=n) grade).inv) :=
  Enlargement.primrec_inverse _ (primrec_inv_base grade)
omit [Finite P₁] [Finite Pβ‚‚] in
 theorem primrec_plan : Primrecβ‚‚ ((operations (P₁:=P₁) (Pβ‚‚:=Pβ‚‚) (kβ‚€:=kβ‚€) (n:=n) grade).plan) :=
  Enlargement.primrec_plan _ (primrec_inv_first grade)

variable {Param : Type*} [Primcodable Param] {F : Param β†’ List A β†’ Part (List A)}

 theorem partrec_partialGroupKey (hF : Partrecβ‚‚ F) :
    Partrecβ‚‚ (fun p : Param => partialGroupKey (kβ‚€:=kβ‚€) (n:=n) e₁ eβ‚‚ grade omega (F p)) :=
  Enlargement.partrec_partialGroupKey _ eβ‚‚ Primrec.list_append (primrec_inv_first grade)
    (Enlargement.partrec_partialGroupKey _ e₁ Primrec.list_append (primrec_inv_base grade)
      (MatrixWords.partrec_partialGroupKey omega hF))

 theorem partrec_partialPointKey (hF : Partrecβ‚‚ F) :
    Partrecβ‚‚ (fun p : Param => partialPointKey (kβ‚€:=kβ‚€) (n:=n) e₁ eβ‚‚ grade omega (F p)) :=
  Enlargement.partrec_partialPointKey _ eβ‚‚ Primrec.list_append (Enlargement.primrec_act _)
    (Enlargement.partrec_partialPointKey _ e₁ Primrec.list_append (primrec_act_base grade)
      (MatrixWords.partrec_partialPointKey omega hF))

 theorem partrec_test (hF : Partrecβ‚‚ F) :
    Partrecβ‚‚ (fun p : Param => test (kβ‚€:=kβ‚€) (n:=n) e₁ eβ‚‚ grade omega (F p)) :=
  Operations.partrec_test _ (primrec_plan grade).to_comp
    (partrec_partialGroupKey e₁ eβ‚‚ grade omega hF) (partrec_partialPointKey e₁ eβ‚‚ grade omega hF)

omit [Finite P₁] [Finite Pβ‚‚] in
 theorem primrec_gcost (hg : Primrec grade) :
    Primrec ((operations (P₁:=P₁) (Pβ‚‚:=Pβ‚‚) (kβ‚€:=kβ‚€) (n:=n) grade).gcost) :=
  Enlargement.primrec_gcost _ (Enlargement.primrec_gcost _ (MatrixWords.primrec_gcost hg))

omit [Finite P₁] [Finite Pβ‚‚] in
 theorem primrec_xcost (hg : Primrec grade) :
    Primrec ((operations (P₁:=P₁) (Pβ‚‚:=Pβ‚‚) (kβ‚€:=kβ‚€) (n:=n) grade).xcost) :=
  Enlargement.primrec_xcost _ (Enlargement.primrec_gcost _ (MatrixWords.primrec_gcost hg))
    (Enlargement.primrec_xcost _ (MatrixWords.primrec_gcost hg) (MatrixWords.primrec_xcost hg))

omit [Finite P₁] [Finite Pβ‚‚] in
 theorem primrec_cost (hg : Primrec grade) :
    Primrec ((operations (P₁:=P₁) (Pβ‚‚:=Pβ‚‚) (kβ‚€:=kβ‚€) (n:=n) grade).letterCost) :=
  (operations grade).primrec_letterCost (primrec_gcost grade hg) (primrec_xcost grade hg)
end
end SimpleFInftyOvergroups.EffectiveNames.Double

end OAI