% The language: (a**2n)(b**m), for n>=1, m>=0. For example,
% aa, aaaa, aab, aaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbb.
% Define the language (a**2n)(b**m) with the predicates
% final, trans, and/or silent

final(s2).
final(s3).
trans(start,a,s1).
trans(s1,a,s2).
trans(s2,a,s1).
trans(s2,b,s3).
trans(s3,b,s2).

accepts(State,[]) :- final(State).

accepts(State,[X|Rest]) :- trans(State,X,State1), accepts(State1,Rest).

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *