% -*- prolog -*-

%%% a(string) means string is accepted, ie in language.
%%% eg a([f, o, o]), assuming "foo" is in language.

%%% NFA

%%% Start state

a(S) :- b(0, S).

%%% b(s1, string) means string is accepted starting at state s1.

%%% Accepting states:

b(0, []).
b(30, []).
b(50, []).

%%% Transitions:

b(0, [x | S]) :- b(31, S).
b(0, [x | S]) :- b(51, S).

b(30, [x | S]) :- b(31, S).
b(31, [x | S]) :- b(32, S).
b(32, [x | S]) :- b(30, S).

b(50, [x | S]) :- b(51, S).
b(51, [x | S]) :- b(52, S).
b(52, [x | S]) :- b(53, S).
b(53, [x | S]) :- b(54, S).
b(54, [x | S]) :- b(50, S).
