1 include "turing/turing.ma".
4 axiom q0 : Q. axiom q1 : Q. axiom q2 : Q. axiom q3 : Q. axiom q4 : Q. axiom q5 : Q.
5 axiom q6 : Q. axiom q7 : Q. axiom q8 : Q. axiom q9 : Q. axiom q10 : Q. axiom q11 : Q.
6 axiom q12 : Q. axiom q13 : Q. axiom q14 : Q. axiom q15 : Q. axiom q16 : Q.
12 [lista di simboli] fa match su un simbolo qualunque nella lista
13 ad esempio [#|,] fa match con la gratella "#", la barra verticale "|" e la virgola ","
15 Convenzione variabili:
16 - x,y,z,D = bit (non marcati)
17 - *x,*y,*z,*D = bit marcati
18 - c,d,e = caratteri (bit marcati e non marcati e separatori)
21 c/D --> Q : leggo c, scrivo c, mi sposto a D e passo allo stato Q
22 c/d/D --> Q : leggo c, scrivo d, mi sposto a D e passo allo stato Q
24 MACCHINA per confronto tuple:
25 =============================
28 ls # current # ... | input , output , D | ... # rs
34 ls # current # ... | input , output , D | ... # rs (rimuove le marcature e si sposta sull'output)
39 ls # current # ... | input , output , D | ... # rs (sposta la marcatura alla tupla successiva)
47 \forall c != *z. c/L --> 1
48 \forall x. *x/x/R --> 2(x)
51 \forall y. y/*y/R --> 3(x)
55 \forall y.\forall c != *y. c/R --> 3(x)
60 \forall x. x/*x/L --> 1
64 \forall c != |. c/R --> 5
68 \forall x. x/*x/L --> 7
71 \forall c != #. c/L --> 7
75 \forall c != #. c/L --> 8
76 \forall x. *x/x/L --> 8
80 \forall x. x/*x/L --> FAILURE
89 [ mark x ⇒ 〈q2 x,〈bit x,R〉〉
92 [ bit y ⇒ 〈q3 x,〈mark y,R〉〉
93 | grid ⇒ 〈q3 x,〈grid,R〉〉
96 [ mark y ⇒ match bool_eqb x y with
97 [ true ⇒ 〈q4,〈bit y,R〉〉
98 | false ⇒ 〈q5,〈bit y,R〉〉 ]
101 [ comma ⇒ 〈qSuccess,〈comma,R〉〉
102 | bit x ⇒ 〈q1,〈mark x,L〉〉
103 | _ ⇒ 〈qsink,〈c,N〉〉 ]
108 [ bit x ⇒ 〈q7,〈mark x,L〉〉
109 | _ ⇒ 〈qsink,〈c,N〉〉 ]
111 [ grid ⇒ 〈q8,〈grid,L〉〉
114 [ grid ⇒ 〈q9,〈grid,R〉〉
115 | mark x ⇒ 〈q8,〈bit x,L〉〉
118 [ bit x ⇒ 〈qFailure,〈mark x,L〉〉
119 | _ ⇒ 〈qsink,〈c,N〉〉 ]
120 | qsink ⇒ 〈qsink,〈c,N〉〉 ]
134 ==============================
135 MACCHINA PER COPIA NUOVO STATO IN CURRENT
136 ==============================
140 ls # current # ... | in_state , out_state , D | ... # rs
145 ls # out_state # ... | in_state , out_state , D | ... # rs
150 \forall x. x/*x/L --> 1
161 \forall x. x/*x/R --> 4
166 \forall x. *x/x/R --> 5(x)
170 \forall y. y/*y/L --> 7(x)
173 \forall D. D/*D/L --> 7(x)
177 \forall y. *y/x/R --> 3
181 \forall D. *D/D/L --> 9
187 ==================================
188 MACCHINE PER SPOSTARE LA "TESTINA"
189 ================================
191 Lo spostamento a sx si ottiene mediante
193 ls x # current y # macchina # rs
195 ls x # current # y macchina # rs
197 ls x # current # macchina # y rs
199 ls # x current # macchina # y rs
201 ls # current x # macchina # y rs
204 Lo spostamento a dx si ottiene mediante
206 ls # current x # macchina # y rs
208 ls x # current # macchina # y rs
210 ls x # current # macchina y # rs
212 ls x # current y # macchina # rs
217 Sposta il carattere binario su cui si trova la testina oltre il primo # alla sua sinistra.
231 \forall x.x/L --> 1(x)
234 \forall c != #. c/x/R --> 2(c)
238 \forall d. d/c/L --> 0
241 \forall c. c/#/L --> 4
249 Sposta il carattere binario su cui si trova la testina oltre il primo # alla sua destra.
263 \forall x.x/R --> 1(x)
266 \forall c != #. c/x/L --> 2(c)
270 \forall d. d/c/R --> 0
273 \forall c. c/#/L --> 4
281 Sposta il carattere binario su cui si trova la testina appena prima del primo # alla sua destra.
294 \forall x. x/R --> 1(x)
297 \forall c != #. c/x/L --> 2(c)
301 \forall d. d/c/R --> 0