Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

In class, we implemented FSA by making state, initial, final, and arc basic facts in the database. Let's do an implementation now where these are

In class, we implemented FSA by making state, initial, final, and arc basic facts in the database. Let's do an implementation now where these are structures. We will ultimately write a function go/3 that takes three arguments: a specification of an FSA (as described below), a state, and a string. The function returns true or false depending on whether the string is accepted from that state.

Here's an example:

go( fsa( initial(1), final([3]), arcs([ arc(1,a,2), arc(2,b,3), arc(2,b,2) ]) ), 1, "abbb").

The logic of the approach is that go/3 will look at that first argument, rather than facts in the database.

The first step, however, is to write a function that will extract the initial state from such an FSA representation getinitial/2. The first argument is an FSA representation like above and the second is the output.

In [ ]:

%%CONSULT%Your code here

In [ ]:

getinitial(fsa(initial(33),final([]),arcs([])),33).

In [ ]:

getinitial(fsa(initial(7),final([]),arcs([])),7).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The detailed answer for the above question is provided below To implement the getin... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students explore these related Programming questions