%% An example due to Horst Reichel of TU Dresden. % For example, % |: L = [ a, b, e, a , b, c, d | L ], go( L, s0 ). % should succeed, and % |: automaton( L, s0 ). % should produce a number of different paths (if you keep pressing semicolon). trans( s0, a, s1 ). trans( s1, b, s2 ). trans( s2, e, s0 ). trans( s2, c, s3 ). trans( s3, d, s0 ). :- coinductive0 automaton/2. :- table automaton/2. automaton( [ X | T ], St ) :- trans( St, X, NewSt ), automaton( T, NewSt ).