| << Prev | - Up - | Next >> |
In the lecture, we represented haha1 in Prolog as follows:
initial(1).
final(4).
arc(1,2,h).
arc(2,3,a).
arc(3,4,!).
arc(3,2,h).But we could also have represented it like this:
initial(1).
final(4).
arc(1,2,h).
arc(2,3,a).
arc(3,2,h).
arc(3,4,!).Does it make any difference which way we represent it?
Here's the code for recognize1 given in the lecture:
recognize1(Node,[]) :-
final(Node).
recognize1(Node_1,String) :-
arc(Node_1,Node_2,Label),
traverse1(Label,String,NewString),
recognize1(Node_2,NewString).Suppose we changed it to this:
recognize1(Node,[]) :-
final(Node),!.
recognize1(Node_1,String) :-
arc(Node_1,Node_2,Label),
traverse1(Label,String,NewString),!,
recognize1(Node_2,NewString). What effect would this change have? What sort of FSAs would not be affected by the change?
Write FSAs that generate the following languages:
where
where 
| << Prev | - Up - | Next >> |