0% found this document useful (0 votes)
98 views

Automate Finite in Prolog

The document describes a finite state automaton including its alphabet, states, initial states, final states, and transition function. It provides an example of an automaton with 8 states and transitions between them on symbols a, b, c, d, e, f. It also gives Prolog code to define and test automata.

Uploaded by

Mary22222
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

Automate Finite in Prolog

The document describes a finite state automaton including its alphabet, states, initial states, final states, and transition function. It provides an example of an automaton with 8 states and transitions between them on symbols a, b, c, d, e, f. It also gives Prolog code to define and test automata.

Uploaded by

Mary22222
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like