Question: Prolog CODE assignment. Need help with the code that will fulfill these requirements. Please and thank you in advance. Recall, a Deterministic Finite Automaton (FDA)

Prolog CODE assignment. Need help with the code that will fulfill these requirements. Please and thank you in advance.  Prolog CODE assignment. Need help with the code that will fulfill
these requirements. Please and thank you in advance. Recall, a Deterministic Finite
Automaton (FDA) is as quadruple over an alphabet . where Q is

Recall, a Deterministic Finite Automaton (FDA) is as quadruple over an alphabet . where Q is a set of states, as E Q is an initial state, F is a set offinal states, and is a transition function from a current state and input symbol to a next state, :Q x Q. For example, the automaton depicted above is defined as, Is 91 20.92).512.1.92). 42.4 where -|0, 1, "). Functional Requirements Part I 1. Create a Prolog language program that can be rsed to execute any arbitrary Deterministic Finite Automaton corresponding to the DFA definition above. In this program, we will calculate the set of states in a DFA from its transitions. Hence, o not create a "state(dfl.a) type fact Use atoms, such as ql to represent states and characters, such as'", '1', and 'O' to represent the labels on transitions. Represent the example DFA on the previous page as the atom dfl. a. Create a predicate fact for representing the starting state in a DFA b. Create predicate facts for representing the final states in a DFA c. Represent each transition as a "4-tuple" predicate facts, which includes the DFA, such as dfl, a from state, such as ql, a label, such as 'l', and a to state, such as q2. dfaAccept(DFA, InputStr):- b. a. dfAcceptR(DFA, [HITI, currentState) :- c. dfaAccept(DFA, [ 1 CurrenctState You may find the built-in predicates, string to list(Str, List) and char_chode(Ch, Code) to be helpful in translating between strings, lists, and characters. 3. Here are some examples executions your program should handle: ?-dfaAccept (dfl, 1.01") true. ?- dfaAccept stateFactory "10.10.10" false 4. You can assume the input string contains only characters in 5. Use the build-in "findall" and "list to set" predicates to implement a rule, allStates(DFA, States- which uses the "transition" predicate definitions to collect all of the states in the DFA 0,1 0,1 start q142 0,1 93 94 0,1 75 0,1 Recall, a Deterministic Finite Automaton (FDA) is as quadruple over an alphabet . where Q is a set of states, as E Q is an initial state, F is a set offinal states, and is a transition function from a current state and input symbol to a next state, :Q x Q. For example, the automaton depicted above is defined as, Is 91 20.92).512.1.92). 42.4 where -|0, 1, "). Functional Requirements Part I 1. Create a Prolog language program that can be rsed to execute any arbitrary Deterministic Finite Automaton corresponding to the DFA definition above. In this program, we will calculate the set of states in a DFA from its transitions. Hence, o not create a "state(dfl.a) type fact Use atoms, such as ql to represent states and characters, such as'", '1', and 'O' to represent the labels on transitions. Represent the example DFA on the previous page as the atom dfl. a. Create a predicate fact for representing the starting state in a DFA b. Create predicate facts for representing the final states in a DFA c. Represent each transition as a "4-tuple" predicate facts, which includes the DFA, such as dfl, a from state, such as ql, a label, such as 'l', and a to state, such as q2. dfaAccept(DFA, InputStr):- b. a. dfAcceptR(DFA, [HITI, currentState) :- c. dfaAccept(DFA, [ 1 CurrenctState You may find the built-in predicates, string to list(Str, List) and char_chode(Ch, Code) to be helpful in translating between strings, lists, and characters. 3. Here are some examples executions your program should handle: ?-dfaAccept (dfl, 1.01") true. ?- dfaAccept stateFactory "10.10.10" false 4. You can assume the input string contains only characters in 5. Use the build-in "findall" and "list to set" predicates to implement a rule, allStates(DFA, States- which uses the "transition" predicate definitions to collect all of the states in the DFA 0,1 0,1 start q142 0,1 93 94 0,1 75 0,1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!