09.05.2013 Views

Link alle Slide Conferenza La Macchina di Turing - ITIS G. Marconi

Link alle Slide Conferenza La Macchina di Turing - ITIS G. Marconi

Link alle Slide Conferenza La Macchina di Turing - ITIS G. Marconi

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ALAN TURING 1912 - 2012<br />

ESPRESSIVITÀ E COMPLESSITÀ DI UNA IDEA<br />

Roberto Giacobazzi<br />

Dipartimento <strong>di</strong> Informatica<br />

Università degli Stu<strong>di</strong> <strong>di</strong> Verona<br />

Italy<br />

Mathesis: Verona - 10.03.2012 – p.1/56


Un po’ <strong>di</strong> storia<br />

Espressività e complessità<br />

Automi<br />

Automi a pila<br />

Macchine <strong>di</strong> <strong>Turing</strong> limitate<br />

Macchine <strong>di</strong> <strong>Turing</strong> ed il limite del calcolabile<br />

Protezione del co<strong>di</strong>ce<br />

DNA computers<br />

Quantum computers<br />

Cosa vedremo<br />

Mathesis: Verona - 10.03.2012 – p.2/56


Breve storia: Le origini<br />

1900 Hilbert: 23rd: Find a method for deci<strong>di</strong>ng the truth or falsity of any<br />

statement of pre<strong>di</strong>cate calculus (decision procedure)<br />

Programma hilbertiano (1904): riduzione della matematica ad un mero<br />

calcolo <strong>di</strong> simboli privi <strong>di</strong> significato in un sistema <strong>di</strong> assiomi e regole<br />

(metamatematica)<br />

Riduzionismo laplaciano<br />

Certezza algebrica come manipolazione meccanica <strong>di</strong> simboli<br />

(algebristi inglesi: Woodhouse 1801, Boole 1854, Babbage 1834)<br />

Sviluppo industriale: macchine!<br />

Mathesis: Verona - 10.03.2012 – p.3/56


Breve storia: Le origini<br />

1900 Hilbert: 23rd: Find a method for deci<strong>di</strong>ng the truth or falsity of any<br />

statement of pre<strong>di</strong>cate calculus (decision procedure)<br />

Programma hilbertiano (1904): riduzione della matematica ad un mero<br />

calcolo <strong>di</strong> simboli privi <strong>di</strong> significato in un sistema <strong>di</strong> assiomi e regole<br />

(metamatematica)<br />

1930/1 Gödel: Incompletezza e crisi del programma hilbertiano<br />

Indeci<strong>di</strong>bilità: Proposizioni indeci<strong>di</strong>bili nell’artimetica<br />

Critica <strong>di</strong> Poincarè e Weyl (1927) a Hilbert (1905): consistenza della<br />

metamatematica<br />

Intuizionismo Brower (1927)<br />

Mathesis: Verona - 10.03.2012 – p.3/56


Breve storia: Le origini<br />

1900 Hilbert: 23rd: Find a method for deci<strong>di</strong>ng the truth or falsity of any<br />

statement of pre<strong>di</strong>cate calculus (decision procedure)<br />

Programma hilbertiano (1904): riduzione della matematica ad un mero<br />

calcolo <strong>di</strong> simboli privi <strong>di</strong> significato in un sistema <strong>di</strong> assiomi e regole<br />

(metamatematica)<br />

1930/1 Gödel: Incompletezza e crisi del programma hilbertiano<br />

Indeci<strong>di</strong>bilità: Proposizioni indeci<strong>di</strong>bili nell’artimetica<br />

1936 <strong>Turing</strong>: Cosa significa "calcolare"?<br />

<strong>Macchina</strong> o modello?<br />

<strong>Macchina</strong> <strong>di</strong> <strong>Turing</strong> (1936)<br />

<strong>La</strong>mbda-calclo (1928-36) <strong>di</strong> Church e Curry<br />

Funzioni parziali ricorsive (1936) <strong>di</strong> Kleene<br />

Mathesis: Verona - 10.03.2012 – p.3/56


Breve storia: Le origini<br />

1900 Hilbert: 23rd: Find a method for deci<strong>di</strong>ng the truth or falsity of any<br />

statement of pre<strong>di</strong>cate calculus (decision procedure)<br />

Programma hilbertiano (1904): riduzione della matematica ad un mero<br />

calcolo <strong>di</strong> simboli privi <strong>di</strong> significato in un sistema <strong>di</strong> assiomi e regole<br />

(metamatematica)<br />

1930/1 Gödel: Incompletezza e crisi del programma hilbertiano<br />

Indeci<strong>di</strong>bilità: Proposizioni indeci<strong>di</strong>bili nell’artimetica<br />

1936 <strong>Turing</strong>: Cosa significa "calcolare"?<br />

<strong>Macchina</strong> o modello?<br />

1936 Tesi <strong>di</strong> Church-turing: Le funzioni intuitivamente calcolabili sono tutte e<br />

sole le funzioni <strong>Turing</strong>-calcolabili<br />

Informatica come scienza dell’informazione<br />

In<strong>di</strong>pendenza dalla macchina<br />

Profonda ra<strong>di</strong>ce logico-matematica<br />

Mathesis: Verona - 10.03.2012 – p.3/56


Evoluzione storica<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.4/56


Evoluzione storica<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.4/56


Evoluzione storica<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.4/56


Evoluzione storica<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.4/56


e prima?<br />

Mathesis: Verona - 10.03.2012 – p.5/56


a) Un algoritmo è <strong>di</strong> lunghezza finita.<br />

Il concetto <strong>di</strong> algoritmo<br />

b) Esiste un agente <strong>di</strong> calcolo che porta avanti il calcolo eseguendo le<br />

istruzioni dell’algoritmo.<br />

c) L’agente <strong>di</strong> calcolo ha a <strong>di</strong>sposizione una memoria dove vengono<br />

immagazzinati i risultati interme<strong>di</strong> del calcolo.<br />

d) Il calcolo avviene per passi <strong>di</strong>screti.<br />

e) Il calcolo non è probabilistico.<br />

f) Non deve esserci alcun limite finito alla lunghezza dei dati <strong>di</strong> ingresso.<br />

g) Non deve esserci alcun limite alla quantità <strong>di</strong> memoria <strong>di</strong>sponibile.<br />

h) Deve esserci un limite finito alla complessità delle istruzioni eseguibili dal<br />

<strong>di</strong>spositivo.<br />

i) Sono ammesse esecuzioni con un numero <strong>di</strong> passi illimitato.<br />

Mathesis: Verona - 10.03.2012 – p.6/56


Evitare il paradosso <strong>di</strong>agonale!<br />

<br />

<br />

<strong>La</strong> Teoria descrive tutti gli Algoritmi<br />

Per (a+h): |Algoritmi| = N<br />

Per (f): Algoritmi : N −→ N<br />

φ<br />

Con quale scopo?<br />

<br />

A0(x),A1(x),A2(x),A3(x),.... sono una enumerazione degli Algoritmi<br />

Sia h(x) = Ax(x)+1 ....h ∈ Algoritmi?<br />

Mathesis: Verona - 10.03.2012 – p.7/56


Gödel <strong>di</strong>sse:<br />

Tarski has stressed in his lecture (and I think justly)<br />

the great importance of the concept of general<br />

recursiveness (or <strong>Turing</strong>’s computability). It seems to<br />

me that this importance is largely due to the fact that<br />

with this concept one has for the first time succeeded<br />

in giving an absolute definition of an interesting<br />

epistemological notion, i.e. one not depen<strong>di</strong>ng on the<br />

formalism chosen. [ . . . ] By a kind of miracle it is not<br />

necessary to <strong>di</strong>stinguish orders and the <strong>di</strong>agonal<br />

procedure does not lead outside the defined notion.<br />

[K. Gödel, Princeton 1946]<br />

Mathesis: Verona - 10.03.2012 – p.8/56


Informazione e Informatica<br />

Mathesis: Verona - 10.03.2012 – p.9/56


<strong>Macchina</strong> o modello <strong>di</strong> calcolo<br />

Co<strong>di</strong>fica dati in un alfabeto Σ<br />

Co<strong>di</strong>fica descrizione istantanea<br />

Co<strong>di</strong>fica programma<br />

?<br />

Mathesis: Verona - 10.03.2012 – p.10/56


<strong>Macchina</strong> o modello <strong>di</strong> calcolo<br />

Co<strong>di</strong>fica dati in un alfabeto Σ<br />

Co<strong>di</strong>fica descrizione istantanea<br />

Co<strong>di</strong>fica programma<br />

Dispositivo<br />

Risorse (memoria e tempo)<br />

Descrizione <strong>di</strong> transizione <strong>di</strong> stato<br />

(tipo <strong>di</strong> calcolo)<br />

Mathesis: Verona - 10.03.2012 – p.10/56


<strong>Macchina</strong> o modello <strong>di</strong> calcolo<br />

Co<strong>di</strong>fica dati in un alfabeto Σ<br />

Co<strong>di</strong>fica descrizione istantanea<br />

Co<strong>di</strong>fica programma<br />

Collezione <strong>di</strong> insiemi e relazioni<br />

Sequenze <strong>di</strong> simboli<br />

Funzione <strong>di</strong> transizione <strong>di</strong> stato<br />

Mathesis: Verona - 10.03.2012 – p.10/56


<strong>Macchina</strong> o modello <strong>di</strong> calcolo<br />

Co<strong>di</strong>fica dati in un alfabeto Σ<br />

Co<strong>di</strong>fica descrizione istantanea<br />

Co<strong>di</strong>fica programma<br />

Informatica come scienza <strong>di</strong> modelli<br />

Mathesis: Verona - 10.03.2012 – p.10/56


Sia M una data macchina (o modello <strong>di</strong> calcolo)<br />

Sia Σ un alfabeto <strong>di</strong> simboli<br />

Una misura della espressività<br />

Sia σ ∈ Σ ∗ una sequenza finita arbitrariamente lunga <strong>di</strong> simboli (parola)<br />

M |= σ se la macchina M termina accettando σ<br />

Il linguaggio <strong>di</strong> M: L(M) def<br />

=<br />

<br />

σ ∈ Σ ∗ M |= σ<br />

L(M) è un insieme <strong>di</strong> parole (linguaggio)<br />

M1 è più potente <strong>di</strong> M2 se L(M2) ⊆ L(M1)<br />

<br />

Mathesis: Verona - 10.03.2012 – p.11/56


Espressività e Complessità<br />

Complessità: Quanto è <strong>di</strong>fficile risolvere un problema che sappiamo essere<br />

risolvibile?<br />

Espressività Si può risolvere un dato problema con un certo strumento<br />

(macchina o modello)?<br />

Difficoltà = consumo risorse (Es: tempo/spazio)<br />

Cosa è una classe?<br />

Complessità = Espressività con risorse limitate<br />

Come limitiamo le risorse?<br />

Se M è un famiglia <strong>di</strong> macchine:<br />

C(M) def<br />

<br />

= L ⊆ Σ ∗ ∃M ∈ M : L = L(M)<br />

Come si struttura la espressività al variare delle macchine?<br />

Quali proprietà <strong>di</strong> chiusura caratterizzano le classi?<br />

<br />

Mathesis: Verona - 10.03.2012 – p.12/56


<strong>La</strong> gerarchia <strong>di</strong> Chomsky<br />

<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.13/56


...me<strong>di</strong>ante proce<strong>di</strong>menti intuitivamente “calcolabili”!!<br />

<strong>La</strong> gerarchia <strong>di</strong> Chomsky<br />

<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.13/56


Completezza e classi<br />

<br />

<strong>La</strong> funzione <strong>di</strong> riduzione −→ ha complessità A<br />

Se B−completi ⊆ A ⇒ A = B<br />

Mathesis: Verona - 10.03.2012 – p.14/56


Percorrendo la gerarchia: Automi<br />

<br />

Legge dal nastro 1 simbolo alla volta<br />

Esegue transizioni <strong>di</strong> stato <strong>di</strong>screte<br />

<br />

<br />

Gli stati sono finiti: n ∈ N fissati a priori! (es. processore)<br />

Non ha memoria!<br />

Mathesis: Verona - 10.03.2012 – p.15/56


Distinguere numeri pari e numeri <strong>di</strong>spari<br />

11111111111111111111111111111111<br />

<br />

<br />

<br />

<br />

Un esempio<br />

Mathesis: Verona - 10.03.2012 – p.16/56


Non riesce a contare: a n b n per n ∈ N<br />

<br />

<br />

<br />

<br />

a1 a2 a3 ... b1 b2 b3 ... c1 c2 c3 ... accettato!<br />

a1 a2 a3 ... b1 b2 b3 ... b1 b2 b3 ... c1 c2 c3 ... accettato!<br />

a1 a2 a3 ... b1 b2 b3 ... b1 b2 b3 ... b1 b2 b3 ... c1 c2 c3 ... accettato!<br />

....<br />

<br />

Limiti<br />

Mathesis: Verona - 10.03.2012 – p.17/56


Idea<br />

Aumentiamo la potenza:<br />

Par<strong>alle</strong>lismo vs non-determinismo<br />

Permettiamo alla macchina <strong>di</strong> attivare processi in<strong>di</strong>pendenti e par<strong>alle</strong>li<br />

Transizione : Stati −→ 2 Stati<br />

Ad ogni passo i processi attivati sono finiti < ∞<br />

Senza limiti <strong>di</strong> tempo: Sequenziale = Non−deterministico<br />

C(ASFD) = C(ASFND)<br />

Non si aumenta la espressività degli automi amuentandone il grado <strong>di</strong><br />

par<strong>alle</strong>lismo!!<br />

Mathesis: Verona - 10.03.2012 – p.18/56


Il modello non-deterministico<br />

<br />

Mathesis: Verona - 10.03.2012 – p.19/56


Il modello non-deterministico<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.20/56


Percorrendo la gerarchia: Automi a Pila<br />

<br />

Legge dal nastro 1 simbolo alla volta<br />

<br />

Esegue transizioni <strong>di</strong> stato <strong>di</strong>screte (Automa)<br />

Gli stati sono finiti: n ∈ N fissati a priori! (Automa)<br />

Può memorizzare i simboli su una pila (LIFO)<br />

<br />

<br />

Ha una memoria ma limitata nelle azioni (LIFO)!<br />

<br />

Mathesis: Verona - 10.03.2012 – p.21/56


q0 ε a b c<br />

Z q0,ZA q0,ZB q1,ε<br />

A<br />

B<br />

Un esempio<br />

q1 ε a b c<br />

Z q1,Z q1,Z<br />

A q1,ε q1,Z q1,Z<br />

B q1,Z q1,ε q1,Z<br />

L’automa conta: riconosce le sequenze palindrome: abbcbba!!!<br />

Risolve il problema a n b n ...<br />

Mathesis: Verona - 10.03.2012 – p.22/56


a bcba<br />

↓ nastro<br />

q0<br />

↕ pila<br />

Z<br />

abc b a<br />

↓ nastro<br />

q1<br />

↕ pila<br />

B A<br />

⇒<br />

⇒<br />

a b cba<br />

↓ nastro<br />

q0<br />

↕ pila<br />

Z A<br />

abcb a<br />

↓ nastro<br />

q1<br />

↕ pila<br />

A<br />

⇒<br />

⇒<br />

ab c ba<br />

abcba<br />

↓ nastro<br />

q0<br />

↕ pila<br />

Z BA<br />

↓ nastro<br />

q1<br />

↕ pila<br />

Mathesis: Verona - 10.03.2012 – p.23/56


Non riesce a confrontare 3 numeri: a n b n c n<br />

Non-detreminismo è più espressivo del determinismo:<br />

APND: ww r , esempio: abbabbabba<br />

APD: wcw r , esempio: abbabcbabba<br />

C(APD) ⊂ C(APND)<br />

Gli APD sono i parsers dei moderni compilatori (Grammatice Libere da<br />

Contesto).<br />

Limiti<br />

Mathesis: Verona - 10.03.2012 – p.24/56


Percorrendo la gerarchia: MdT limitata in Spazio<br />

Idea: Memoria libera ma limitata in spazio da f(input)<br />

<br />

Legge e scrive sul nastro 1 simbolo alla volta<br />

Esegue transizioni <strong>di</strong> stato <strong>di</strong>screte (Automa)<br />

Gli stati sono finiti: n ∈ N fissati a priori! (Automa)<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.25/56


Limiti e proprietà nello spazio<br />

Nuove classi in spazio:<br />

Space[f(n)] problemi (linguaggi) risolvibili con f(n) memoria (celle)<br />

Lo spazio non <strong>di</strong>pende dal numero <strong>di</strong> nastri!<br />

Tape compression: Space[f(n)] = Space[c·f(n)] con c > 0<br />

Aumentando la co<strong>di</strong>fica dell’alfabeto e degli stati!<br />

Se f(n) ≤ g(n) allora Space[f(n)] ⊆ Space[g(n)]<br />

Cosa succede se confrontiamo determinismo SpaceD con<br />

non-determinismo SpaceN?<br />

Mathesis: Verona - 10.03.2012 – p.26/56


Classi e proprietà nello spazio<br />

EXPSpace = <br />

c>0 SpaceD[2 c·n ]<br />

PSpace = <br />

c>0 SpaceD[n c ]<br />

NPSpace = <br />

c>0 SpaceN[n c ]<br />

LSpace = SpaceD[logn]<br />

NLSpace = SpaceN[logn]<br />

LSpace ⊆ NLSpace ⊆ PSpace ⊆ NPSpace ⊆ EXPSpace<br />

Nello spazio determinismo equivale a non-determinismo (...quasi sempre)<br />

PSpace = NPSpace<br />

LSpace ? = NLSpace<br />

Mathesis: Verona - 10.03.2012 – p.27/56


Percorrendo la gerarchia: MdT limitata in Tempo<br />

Idea: Memoria libera ma limitata in tempo da f(input)<br />

<br />

Legge e scrive sul nastro 1 simbolo alla volta<br />

Esegue transizioni <strong>di</strong> stato <strong>di</strong>screte (Automa)<br />

<br />

<br />

Gli stati sono finiti: n ∈ N fissati a priori! (Automa)<br />

Esegue per al più f(input) passi<br />

1994 Deneba Systems, Inc.<br />

Mathesis: Verona - 10.03.2012 – p.28/56


Limiti e proprietà nel tempo<br />

Nuove classi in tempo:<br />

Time[f(n)] problemi (linguaggi) risolvibili in f(n) passi<br />

Es: moltiplicazione è in Time[n 2 ], sorting in Time[n logn]<br />

Speed-up: Time[f(n)] = Time[c·f(n)] con c > 0.<br />

Il tempo <strong>di</strong>pende in minima misura dal numero <strong>di</strong> nastri<br />

Multitape M, monotape N: TimeN ≤ c·(TimeM) 2<br />

Cosa succede se confrontiamo determinismo TimeD con<br />

non-determinismo TimeN?<br />

Mathesis: Verona - 10.03.2012 – p.29/56


Classi e proprietà nel tempo<br />

PTime = <br />

c>0 TimeD[n c ]<br />

NPTime = <br />

c>0 TimeN[n c ]<br />

EXPTime = <br />

c>0 TimeD[2 n·c ]<br />

NEXP = <br />

c>0 TimeN[2 n·c ]<br />

Nel tempo determinismo e non-determinismo correlati?<br />

PTime ⊆ NPTime ⊆ PSpace<br />

PTime ? = NPTime<br />

PTime ⊂ EXPTime<br />

Church-<strong>Turing</strong> Thesis: a function computable in<br />

polynomial time in any reasonable computational<br />

model using a reasonable time complexity measure is<br />

computable by a deterministic <strong>Turing</strong> Machine in<br />

polynomial time.<br />

Mathesis: Verona - 10.03.2012 – p.30/56


Percorrendo la gerarchia: MdT<br />

Idea: Nessun limite <strong>di</strong> tempo/spazio alla gestione della memoria<br />

Legge e scrive sul nastro 1 simbolo alla volta<br />

Esegue transizioni <strong>di</strong> stato <strong>di</strong>screte (Automa)<br />

Gli stati sono finiti: n ∈ N fissati a priori! (Automa)<br />

Ha tempo e spazio ∞<br />

Ammettimo non-determinismo<br />

Chiaramente (tesi <strong>di</strong> Church):<br />

C(MdTD) = C(MdTND)<br />

Mathesis: Verona - 10.03.2012 – p.31/56


MdT: Il modello<br />

Mathesis: Verona - 10.03.2012 – p.32/56


Limiti e Proprietà assolute<br />

Il problema della terminazione<br />

Ogni programma P ha una sua co<strong>di</strong>fica nei dati: 〈P〉 ∈ Dati<br />

<strong>La</strong> macchina è universale (interprete):<br />

<br />

P(x) se P(x) termina<br />

Int(P,x) =<br />

↑ altrimenti<br />

<strong>La</strong> macchina può <strong>di</strong>vergere!!<br />

<br />

<br />

(P,x) P(x) converge<br />

<br />

non è deci<strong>di</strong>bile<br />

Se lo fosse, allora sia D(P,x) il programma che decide se P(x)↓<br />

<br />

↑ se D(P,〈P〉) = Y<br />

Costruiamo H(P) =<br />

1 se D(P,〈P〉) = N<br />

H(〈H〉)↓ sse D(H,〈H〉) = N sse H(〈H〉)↑<br />

Assurdo!<br />

Mathesis: Verona - 10.03.2012 – p.33/56


E senza limiti?<br />

Nessun limite <strong>di</strong> tempo e spazio ....il problema è quello <strong>di</strong> <strong>Turing</strong> del<br />

1936!!<br />

Possiamo solo <strong>di</strong>re se un problema è calcolabile!<br />

<strong>Turing</strong> argument:<br />

ammette una soluzione algoritmica<br />

tutto ruota intorno alla <strong>Macchina</strong> <strong>di</strong> <strong>Turing</strong> Universale!<br />

Assumiamo termination(P) termina e <strong>di</strong>ce true iff P<br />

termina su tutti gli inputs<br />

E che ne è <strong>di</strong>:<br />

P ≡ while termination(P){ null } ?<br />

Mathesis: Verona - 10.03.2012 – p.34/56


<strong>La</strong> gerarchia rivista<br />

<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.35/56


Le Storie <strong>di</strong> Erodoto...<br />

Nascondere informazioni<br />

Watermarks introdotti per la prima volta a Bologna, nel 1282!<br />

Il termine "<strong>di</strong>gital watermark" fu introdotto nel 1992 da Tirkel e Osborne,<br />

nel paper: A.Z.Tirkel, G.A. Rankin, R.M. Van Schyndel, W.J. Ho, N.R.A.<br />

Mee, C.F. Osborne. “Electronic Water Mark”. DICTA 93, Macquarie<br />

University. p. 666-673<br />

Nel SW: F. Cohen. Operating system protection through program<br />

evolution. Computer & Security 12(6):56-584, 1993.<br />

Mathesis: Verona - 10.03.2012 – p.36/56


Offuscamento: l’idea<br />

Mathesis: Verona - 10.03.2012 – p.37/56


Offuscamento: l’idea<br />

Mathesis: Verona - 10.03.2012 – p.38/56


Oggetti da nascondere?<br />

data objects<br />

source code<br />

control mechanisms<br />

module organization<br />

function names<br />

values (crypto keys, license etc).<br />

Dove sono gestite queste entità?<br />

Il significato <strong>di</strong> “essere a fuoco”<br />

.... nella Semantica!!!<br />

<strong>La</strong> semantica concreta <strong>di</strong> un programma formalizza (è un modello<br />

matematico) le possibili esecuzioni del programma in ogni possibile<br />

ambiente <strong>di</strong> utilizzo!<br />

Mathesis: Verona - 10.03.2012 – p.39/56


<strong>La</strong> semantica<br />

Mathesis: Verona - 10.03.2012 – p.40/56


Oscurità come imprecisione<br />

Offuscare un programma significa rendere un interprete impreciso<br />

ρ è una approssimazione <strong>di</strong> Σ (dati, stati, tracce <strong>di</strong> stati etc)<br />

Una trasformazione τ : P → P tale che [[P]] = [[τ(P)]] (stessa funzione)<br />

ρ([[τ(P)]]) ❁ [[τ(P)]] ρ imprecisione!<br />

Mathesis: Verona - 10.03.2012 – p.41/56


Oscurità come imprecisione<br />

Offuscare un programma significa rendere un interprete impreciso<br />

P : x = a∗b<br />

Sign è approssimazione <strong>di</strong> ℘(Z):<br />

... ...<br />

0−<br />

℘(Z)<br />

0+<br />

...<br />

{−1,−3,−4} {2,3,5}<br />

... 0 1 ...<br />

∅<br />

0−<br />

℘(Z)<br />

∅<br />

0<br />

0+<br />

Mathesis: Verona - 10.03.2012 – p.41/56


Oscurità come imprecisione<br />

Offuscare un programma significa rendere un interprete impreciso<br />

P : x = a∗b<br />

Sign è approssimazione <strong>di</strong> ℘(Z):<br />

... ...<br />

0−<br />

℘(Z)<br />

0+<br />

...<br />

{−1,−3,−4} {2,3,5}<br />

... 0 1 ...<br />

∅<br />

0−<br />

℘(Z)<br />

∅<br />

0<br />

0+<br />

Mathesis: Verona - 10.03.2012 – p.41/56


Oscurità come imprecisione<br />

Offuscare un programma significa rendere un interprete impreciso<br />

x = 0;<br />

P : x = a∗b −→ τ(P) : if b ≤ 0 then {a =−a; b =−b};<br />

while b = 0 {x = a+x; b = b−1}<br />

Sign è preciso per P:<br />

[[P]] Sign = λa, b. Sign(a∗b)<br />

Sign è impreciso per τ(P):<br />

[[τ(P)]] Sign <br />

= λa, b.<br />

0 if a = 0∨b = 0<br />

℘(Z) otherwise<br />

C’e’ un modo per ottenere τ(P) da P?<br />

Mathesis: Verona - 10.03.2012 – p.41/56


Programmi che manipolano programmi?<br />

Y. Futamura, Partial Evaluation of Computation Process, 1971<br />

Considerate due linguaggi (abstract machines): S e T con dati comuni<br />

Interprete: ∀ℓ ∈ {S,T }<br />

int S : S.prog×data −→ data∪{↑} such that int S ∈ S.prog<br />

int T : T .prog×data −→ data∪{↑} such that int T ∈ S.prog<br />

∀P ∈ ℓ.prog, ∀d ∈ data : [P] ℓ (d) = [int ℓ ] S (P,d)<br />

Specializzazione: ∀ℓ ∈ {S,T }<br />

Idea:<br />

spec S : S.prog×data −→ S.prog such that spec S ∈ S.prog<br />

spec T : S.prog×data −→ T .prog such that spec T ∈ S.prog<br />

∀P ∈ S.prog, ∀d,s ∈ data : [P] S (s,d) = [[spec ℓ ] S (P,s)] ℓ (d)<br />

S source language (open)<br />

T secrete architecture (secret)<br />

Mathesis: Verona - 10.03.2012 – p.42/56


Offuscamento per interpretazione?<br />

Y. Futamura, Partial Evaluation of Computation Process, 1971<br />

Offuscare P è compilare da S a T e quin<strong>di</strong> <strong>di</strong> nuovo in S:<br />

[P] S (d) = [int S ] S (P,d)<br />

= [[spec T ] S (int S ,P)] T (d)<br />

= [int T ] S ([spec T ] S (int S ,P),d)<br />

= [[spec S ] S (int T , [spec T ] S (int S ,P))] S (d)<br />

obf(P) = [spec S ] S (int T , [spec T ] S (int S ,P)) ∈ S.prog<br />

Per attaccare obf(P) devi capire la relazione tra S e T<br />

Mathesis: Verona - 10.03.2012 – p.43/56


[Cloackware 2000]<br />

Code Flattening<br />

Idea: “rior<strong>di</strong>na” o “<strong>di</strong>ssimula” il control flow <strong>di</strong> P, senza cambiarne la semantica<br />

Mathesis: Verona - 10.03.2012 – p.44/56


Struttura <strong>di</strong> un self-interpreter: <strong>Turing</strong>!!!<br />

input P,d; Program to be interpreted, and its data<br />

pc := 2; Initialise program counter and store<br />

store := [in ↦→ d,out ↦→ 0,x1 ↦→ 0,...];<br />

while pc < length(P) do<br />

instruction := lookup(P,pc); Find the pc-th instruction<br />

case instruction of Dispatch on syntax<br />

skip : pc := pc+1;<br />

x := e : store := store[x ↦→ eval(e,store)]; pc := pc+1;<br />

... endw ;<br />

output store[out];<br />

eval(e,store) = case e of Function to evaluate expressions<br />

constant : e<br />

variable : store(e)<br />

e1+e2 : eval(e1,store)+eval(e2,store)<br />

e1−e2 : eval(e1,store)−eval(e2,store)<br />

e1∗e2 : eval(e1,store)∗eval(e2,store) ...<br />

Mathesis: Verona - 10.03.2012 – p.45/56


Il seguente programma “appiattito” P ′ ha<br />

solo 1 loop e<br />

un explicit program counter pc<br />

Original program P: Flattened program P ′ :<br />

1. input x;<br />

2. y := 2;<br />

3. while x > 0 do<br />

4. y := y+2;<br />

5. x := x−1<br />

endw<br />

6. output y;<br />

7. end<br />

1. input x; 2. pc := 2;<br />

3. while pc < 6 do<br />

Esempio<br />

4. case pc of<br />

2 : 5. y := 2; 6. pc := 3;<br />

3 : 7. if x > 0 then 8. pc := 4 else 9. pc := 6;<br />

4 : 10. y := y+2; 11. pc := 5;<br />

5 : 12. x := x−1; 13. pc := 3;<br />

endw<br />

14. output y<br />

15. end<br />

Mathesis: Verona - 10.03.2012 – p.46/56


ALAN TURING NEL FUTURO<br />

Mathesis: Verona - 10.03.2012 – p.47/56


Idea: par<strong>alle</strong>lismo massivo e alta densità <strong>di</strong> informazione<br />

DNA: Deoxyribonucleic Acid<br />

Operazioni: annealing, melting, ligation,<br />

polymerase extension, polymerase chain reaction<br />

(PCR)<br />

Annealing: formazione <strong>di</strong> sequenze bilineari<br />

“opposte”<br />

Melting = Annealing −1<br />

Ligation: concatenazione<br />

PCR: amplificazione<br />

Adelman 1994: DNA Computer!!!<br />

DNA Computing<br />

Mathesis: Verona - 10.03.2012 – p.48/56


DNA Computing: <strong>La</strong> tecnologia<br />

Supercomputers DNA-computers<br />

Velocità: 10 12 FLOPS 10 20 ?OPS<br />

Energia: 1 joule ≈ 10 9 OPS 1 joule ≈ 2.19 19 ?OPS<br />

Memoria: 1 bit ≈ 10 12 nm 3<br />

1 bit ≈ 1nm 3<br />

Mathesis: Verona - 10.03.2012 – p.49/56


DNA Computing: TSP<br />

Problema: determinare un ciclo hamiltoniano (TSP) in un grafo<br />

TSP ∈ NPTime<br />

<br />

<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.50/56


DNA Computing: TSP<br />

Problema: determinare un ciclo hamiltoniano (TSP) in un grafo<br />

TSP ∈ NPTime<br />

<br />

<br />

<br />

<br />

<br />

<br />

Mathesis: Verona - 10.03.2012 – p.50/56


DNA Computing: TSP<br />

Idea: Co<strong>di</strong>ficare il grafo su DNA me<strong>di</strong>ante basi complementari e calcolare<br />

me<strong>di</strong>ante merge & anneal<br />

c(Bologna) = AAAGGG c(Livorno) = CGGTGC<br />

c(Torino) = CCGATG c(Roma) = TTAAGG<br />

c(Padova) = CGTCCA c(Napoli) = GATACT<br />

c(Roma → NA) = AGGGAT c(NA → Roma) = ACTTTA<br />

etc...<br />

<br />

Scarico la complessità in tempo sullo spazio!!<br />

Mathesis: Verona - 10.03.2012 – p.51/56


Quantum Computing<br />

Idea: Sovrapposizione coerente (<strong>di</strong> un numero esponenziale) <strong>di</strong> stati induce<br />

par<strong>alle</strong>lismo: esplorazione simultanea <strong>di</strong> tutte le soluzioni<br />

Spazio degli stati = Spazio <strong>di</strong> Hilbert<br />

Spazio vettoriale <strong>di</strong> <strong>di</strong>mensione finita sui complessi C n<br />

Un qbit è C 2<br />

Oltre a 2 stati |0> def<br />

=<br />

<br />

1<br />

0<br />

<br />

e |1> def<br />

=<br />

d<strong>alle</strong> sovrapposizioni lineari |ψ> def<br />

= λ1<br />

λ1,λ2 ∈ C<br />

Quantum-computers<br />

Sono un modello più che una tecnologia!!<br />

<br />

<br />

0<br />

1<br />

1<br />

0<br />

<br />

<br />

ci sono infiniti stati dati<br />

+λ2<br />

<br />

0<br />

1<br />

<br />

con<br />

Mathesis: Verona - 10.03.2012 – p.52/56


Quantum Computing: par<strong>alle</strong>lismo<br />

Idea: un qbit rappresenta i punti <strong>di</strong> una sfera (<strong>di</strong> Bloch).<br />

MdT quantistica<br />

Processore a stati finiti (n. finito <strong>di</strong> qbits)<br />

Nastro: numero infinito <strong>di</strong> qbits<br />

Mathesis: Verona - 10.03.2012 – p.53/56


Quantum Computing: PTime ⊂ QPTime<br />

Idea: <strong>La</strong> macchina può essere contemporaneamente in piú stati: par<strong>alle</strong>lismo<br />

quantistico<br />

Algoritmo Deutsch-Jozsa<br />

Determinare se una funzione su n-bits f : {0,1} n → {0,1} è costante o<br />

bilanciata<br />

Classico: richiede 2 n +1 tests<br />

Quantistico: sovrapposizione <strong>di</strong> n+1 qbit: se bilanciata, i contributi<br />

positivi e negativi delle ampiezze <strong>di</strong> elidono! ...è in QPTime<br />

Tesi <strong>di</strong> Church-<strong>Turing</strong> rivisitata?<br />

Ogni sistema fisico finitamente realizzabile può essere simulato da<br />

un modello <strong>di</strong> macchina computazionale universale che opera con<br />

mezzi finiti<br />

Shor 1994 ha <strong>di</strong>mostrato che Prime ∈ QPTime!!<br />

Problema principale: QPTime ? = NPTime?<br />

Mathesis: Verona - 10.03.2012 – p.54/56


PTime ? = NPTime ....il problema aperto!<br />

DNA-computers<br />

Sono una tecnologia più che un modello<br />

Smart drugs! (Shapiro 2004)<br />

Giustificazioni computazionali ai processi naturali (UNIVR!!)<br />

Quantum-computers<br />

Sono un modello più che una tecnologia<br />

Sono più poteneti e “realizzabili” <strong>di</strong> modelli randomizzati<br />

Sono stati costruiti poco più <strong>di</strong> 10 qbits (1999-2010)<br />

È in fase <strong>di</strong> stu<strong>di</strong>o 1 registro da 100 qbit!!<br />

Fondamentale per RSA (Prime ∈ QPTime!!)<br />

E domani?<br />

Correzione errori: errori <strong>di</strong> 10 −4 per operazione sono tollerabili<br />

Mathesis: Verona - 10.03.2012 – p.55/56


Grazie!<br />

Mathesis: Verona - 10.03.2012 – p.56/56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!