Vous êtes sur la page 1sur 3

Automate finite Automat: A-alfabet S-multimi de stari S0 include S-multimi de stari intiale Sf-S-multimi de stari finale F-functia de trecere

dintr-o stare in alta f(S,A)->S(S) S-starea curenta a automatului A-simbolul curent S- o stare noua a ^ | S0-> Starea intiala b ^ | S1-> c ^ | S2-> a b .. x ^ | Sk-> Null ^ | Sk+1 starea
finala

..

..

..

Functia de trecere: a) f(S0,a)=S1 f(S1,b)=S2 f(Sr,c)=S0 . Stare|Simbol S0 S1 S2 ..

a S1 -

b S0

c S4 S0

c)Ggraful de trecere dintr-o stare in alta S0 a S1 c b b

S2
S3

Ex: (a,b)nc(d,e)mf, n>=0,n-par, m>=1, m-impar cdef ababcdef cdededef Adevar stare initiala a S0 S1 b S2 abcdef ababcf ababcdede Fals

S4 d e

S3

S5
e S6 S7 d f S8 Stare finala

domains s=symbol, ls=s* predicates initial(s) final(s) move(s,s,s)%f-a trecere automat(s)%pr principal caut(s,s) clauses initial(s0). final(s8). move(s0,a,s1). move(s0,b,s2). move(s2,b,s3). .. move(s6,f,s8).

automat(L):-initial(S),caut(S,L). caut(S,[]):-final(S). caut(S,[A|L]):-move(S,A,SN),caut(SN,L). goal: automat([a,b,a,b,c,d,e,f]) Yes Goal:automat([a,b,c,d,e]) No