Logic Programming + Finite State Machines Flashcards

1
Q

What are the 5 data objects/terms

A

-Numbers
-Atoms
-Variables
-Compound terms
-Lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a number

A

A number may be either an integer or a floating point
quantity (e.g 42 or -816.22)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an atom

A

An atom is a constant that does not have a numerical value. It
begins with a lowercase letter, or is quoted (e.g buffalo or ‘The X Files’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a variable

A

A variable stands for a term that is to be determined. It begins
with an uppercase letter or ‘_’ (e.g X or Person_A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a compound term

A

A compound term consists of a functor followed by a
sequence argument terms in brackets (e.g dog(rover))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a list

A

A list is a structured data type made up of a sequence of terms
enclosed in square brackets and separated by commas (e.g [dog, X, 220, 500])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What could a clause be

A

A clause may be
-a fact
-a rule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a fact

A

A fact is taken to be true. It must be an atom or a compound term and end in a full stop (e.g christmas. or dog(fido).)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a rule

A

A rule may be either true or false — only computation will
show. It must be an atom or a compound term, followed by a
“:-” followed by further atoms or a compound terms,
separated by commas (e.g grandfather(X, Y) :- father(X, Z), parent(Z, Y).)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the declarative reading of h :- t1, t2, … tk

A

h is true if t1, t2, … tk are all true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the procedural reading of h :- t1, t2, … tk

A

To compute h, compute t1, t2, … tk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a predicate

A

A predicate is defined by several clauses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a list

A

A list is made up of elements (possibly of different type)
enclosed in square brackets and separated by commas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Cons Notation

A

The “cons” (or “|”) notation allows one to represent a list as
being constructed from some leading elements and a list (e.g [1, 2, 3 | [4, 5]] = [1, 2, 3, 4, 5])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

sum_list( [], 0 ).
sum_list( [H|T], R )
:- sum_list( T, W ),
R is H + W.
In this predicate, what does H and T stand for

A

H is the head of the list, and T is the Tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the member predicate

A

The member predicate is true when an element is a member of a list
member_list( E, [E|] ).
member_list( E, [
|T] )
:- member_list( E, T ).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the append predicate

A

An append predicate appends two lists
append_list( [], Y, Y ).
append_list( [H|T], Y, [H|W] )
:- append_list( T, Y, W ).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the reverse predicate

A

A reverse predicate reverses a list
reverse_list( [], [] ).
reverse_list( [H|T], R )
:- reverse_list( T, W ),
append( W, [H], R ).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How can an atom be viewed as a list of ASCII codes

A

The “name” predicate allows one to convert from an atom to a list of integers
name( ace, X ).
X = [ 97, 99, 101 ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Not really anything but just an example of making characters uppercase idk it might be useful

A

make_upper( [], [] ).
make_upper( [H|T], [V|W] )
:- to_upper( H, V ),
make_upper( T, W ).

to_upper( A, B )
:- B is A - 32.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the infix operator to carry out arithmetic

A

The operator ‘is’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What happens if the left argument of the arithmetic is an unbound variable

A

Bind it to the result of evaluating evaluating the right argument, and succeed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What happens if the left argument is a number, or a bound variable with a numerical values

A

Succeed if the right argument has the same numerical value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are the arithmetic operators

A

X + Y: sum of X and Y
X - Y: difference of X and Y
X * Y: product of X and Y
X / Y: quotient of X and Y
X // Y: integer quotient of X and Y
X mod Y: remainder when X is divided by Y
X ^ Y: value of X to the power Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the arithmetic functions

A

abs( N, X ): absolute value of N
sin( N, X ): sine of N (in radians)
cos( N, X ): cosine of N (in radians)
log( N, X ): natural logarithm of N
sqrt( N, X ): square root of X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What are the relational operators

A

X =:= Y: X and Y are same value
X == Y: X and Y are not same value
X > Y: X greater than Y
X >= Y: X greater than or equal to Y
X < Y: X less than Y
X =< Y: X less than or equal to Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What are the unification operators

A

X = Y: X and Y can be unified
X = Y: X and Y cannot be unified
(ok so its supposed to be a backslash for the bottom one but its not appearing)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is the only logical negation operator

A

+ X not X
(backslash isnt working here either)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is the closed-word assumption

A

What is stated is true; what is not stated is false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What does ‘negation as failure’ mean

A

Anything that cannot be
proved true is false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

How do you construct ‘if-then-else’

A

By using -> ; (e.g maxof( X, Y, Z )
:- ( X =< Y
-> Z = Y
; Z = X
). )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

How does Prolog attempt to satisfy a sequence of goals

A

It system attempts to
satisfy each goal in turn, working from left to right. If all the goals succeed in turn, the sequence of goals succeeds
as a whole.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

A goal must be a call term, what is a call term

A

Either an atom, a compound
term, or an “is”, but not a number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

How does the Prolog system work to satisfy a single goal

A

It works through the
clauses in the database from top to bottom, examining those
clauses that have a functor and arity that unify with the goal.
(A functor is the atom part of a compound term and arity is the number of arguments)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is unification

A

The matching algorithm used to choose a particular clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

How do two numbers unify

A

Two numbers unify if and only if they are the same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

How do two atoms unify

A

Two atoms unify if and only if they are the same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

How do variables unify

A

Two unbound variables, say A and T, always unify, with the
two variables bound to each other.
An unbound variable and a term that is not a variable always
unify, with the variable bound to the term.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

How do two compound terms unify

A

Two compound terms unify if and only if they have the same
functor and the same arity, and their arguments can be unified
pairwise, working from left to right.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

How do two lists unify

A

Two lists unify if and only if they have the same number of
elements and their elements can be unified pairwise, working
from left to right.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

How do substitutions work

A

In general, the result of unification is a substitution
σ = X1/t1, X2/t2, . . . Xn/tn
where ti is a term to be substituted for variable Xi.
This substitution is carried forward to further unifications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What is backtracking

A

If any goal fails, the Prolog system tries to find another way of satisfying the most recently satisfied previous goal.
h :- t1, t2, … tk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

How does a logic program generate permutations

A

It will generate one permutation at a time, on demand from the tester, backtracking to consider
further permutations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Why do purists not like the modification of the database

A

They see as being against the spirit of logic programming. Like other advanced features, they need to be used with care

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

What is a classical expert system

A

-A database of elementary facts about the domain;
-Some domain rules for knowledge acquisition;
-Some inference rules for reasoning from data;
-A facility for generating explanations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What are the 4 examples of classical expert systems

A

-Dendral;
-MYCIN;
-PROSPECTOR;
-SHRDLU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What is Dendral

A

The 1965 Dendral system (a contraction of DENDRitic ALgorithm) generates all possible arrangements of a set of atoms, and searches through it for likely ones, consistent with
the rules of chemical valence.
The heuristics employed are based on judgment and chemical knowledge — experience and intuition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What is MYCIN

A

The 1972 MYCIN system (many antibiotics have the suffix “-mycin”) is designed to assist physicians in the diagnosis of bacterial infections.
Knowledge is encoded as 350 decision rules which embody the clinical decision criteria of infectious disease experts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

What is PROSPECTOR

A

The 1976 PROSPECTOR system was designed for decision-making problems in mineral exploration. It aids geologists in evaluating exploration sites or regions for occurrences of ore deposits of particular types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

What is SHRDLU

A

The 1968 SHRDLU system allowed the user to communicate with the computer in natural language, moving objects and querying the state of a simplified “blocks world.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is blackboard architecture

A

In expert systems, a blackboard architecture is one where a shared “blackboard” is iteratively updated by a diverse group of knowledge sources, starting with a problem specification and ending with a solution.
The Prolog database readily supports this architecture.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

What is the difference between static and dynamic predicates

A

A static predicate cannot be modified as the program runs — by default, predicates are static ones.
A dynamic predicate can be modified as the program runs — predicates may be declared as dynamic ones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

How do you add clauses to a database

A

A clause can be added to the database with:
* asserta( X ) — add a clause X at the beginning of the database;
* assertz( X ) — add a clause X at the end of the database;
* assert( X ) — add a clause X at the beginning of the database.

54
Q

How do you delete clauses from the database

A

A clause can be removed from the database with:
* retract( X ) — remove a clause X from the database;
* retractall( X ) — remove all facts or clauses that unify with X from the database.

55
Q

What issues can arise from having all functions at the top level?

A

Name space pollution can occur, clashes caused by reuse of the same name

56
Q

In Haskell what does a where definition do?

A

A where definition allows one to name a value, and to use it in
an expression.
e.g
sumList :: [ Int ] -> Int
sumList []
= 0
sumList (x:xs)
= x + sxs
where
sxs = sumList xs

57
Q

In Haskell what does a let definition do?

A

A let definition allows one to name a value, and to use it in an
expression
e.g.
lengthList :: [Int] -> Int
lengthList []
= 0
lengthList (x:xs)
= let
lxs = length xs
in
1 + lxs

58
Q

Define Partial Application in Haskell

A

Partial application in Haskell refers to the process of supplying a function with fewer arguments than it expects, resulting in a new function that takes the remaining arguments. This allows you to create specialized versions of functions and promotes code reuse and composability.
e.g
– Original function
add :: Int -> Int -> Int
add x y = x + y

– Partial application
addThree :: Int -> Int
addThree = add 3

– Example usage
result :: Int
result = addThree 4

59
Q

Define Curried functions(Indian haha)

A

A function that takes multiple arguments may be converted into
a succession of functions that each take a single argument.

e.g.
add2 :: Int -> Int -> Int

60
Q

Define uncurried form(not indian haha)

A

Functions of two or more arguments may also be defined in
uncurried form, this looks like:
multiply2 :: (Int, Int) -> Int

61
Q

Define the pointfree style

A

The pointfree style means that the arguments of a function
are not explicitly named.
e.g.
minList :: [Int] -> Int
minList xs =
head (sort xs)

would be :

minList2 :: [Int] -> Int
minList2 =
head . sort

62
Q

Note: Haskell functions can be defined using Lambda abstractions

A

idk what that is it doesnt say - comes later

63
Q

What are the Standard type classes in Haskell

A
  1. Eq;
    2 Ord;
    3 Show;
    4 Read.
64
Q

Define the EQ class

A

The Eq class provides (==) and (/=) methods.
All basic datatypes except for functions and IO are instances of
this class.

65
Q

Define the Ord Class

A

The Ord class provides (<=), (<), (>) and (>=) methods.
All basic datatypes except for functions and IO are instances of
this class

66
Q

Define the Show Class

A

The Show class provides the method
show :: a -> String
All basic datatypes except for functions and IO are instances of
this class
It’s typically used for “unparsers” that output values
e.g.
digits :: Int -> String
digits n
| otherwise = digits d ++ [ chr (ord ’0’ + m) ]
where
(d, m) = n ‘divMod‘ 10

can be written as

digits2 :: Int -> String
digits2 n =
show n

n < 10 = [ chr (ord ’0’ + n) ]

67
Q

Define the read class

A

The Read class provides the method
read :: String -> a
All basic datatypes except for functions and IO are instances of
this class.
Is typically used for “parsers” that input values

e.g.

number2 :: String -> Int
number2 xs =
read xs

68
Q

Define higher order functions and the three that we need to know

A

A higher-order function is one that takes a function as an
argument or returns a function as a result.
Three important examples are:

1 map
2 filter
3 foldr

69
Q

Define the map function

A

The map function applies a function to list elements

70
Q

Define the filter function

A

The filter function applies a predicate to pick list elements.

71
Q

Define the foldr Function

A

The foldr function folds a function into list elements.
^idk what that means but coolio

72
Q

Define a list comprehension

A

A list comprehension expresses one list in terms of the
elements of another. From the first list we generate elements,
which we test and transform to form elements of the result.
[ 2 * n | n <- [5,6,7] ]

73
Q

What is Lazy Evaluation

A

A lazy functional programming language evaluates the
arguments of functions and of constructors only when
necessary to give a result and then only as far as necessary
to give a result.

74
Q

Define a generator tester structure

A

The generator/tester structure has a generator component
that generates all values that might be solutions, and tester
component that filters out the values that actually are solutions.

75
Q

What is meant by this statement?
Functional programs must not change the state of the world
when they do calculation

A

This refers to a key principle in functional programming known as referential transparency or immutability.

In functional programming, functions are expected to be referentially transparent, meaning that their output is solely determined by their input and they have no side effects. This principle extends to the idea that functions should not modify external state or have observable interactions with the outside world during their execution.

Bottom line: there must be no side-effects

76
Q

What is an Action in Haskell

A

An action is a value of type IO a that, when performed, may do
some input/output, before delivering a value of type a.

77
Q

What does the Then operator do in Haskell

A

The then operator, (»), performs a first action, discards the result, and performs a second action.

e.g.
putStr2 :: String -> IO ()
putStr2 s
= putStr s&raquo_space; putStr s

78
Q

What does the Bind Operator do Haskell?

A

The bind operator, (»=), passes the result of performing a
first action to a (parameterised) second action.

e.g.
snooper :: IO ()
snooper
= readFile “/etc/passwd”&raquo_space;=
putStrLn

(»=) :: IO a -> (a -> IO b) -> IO b

79
Q

What does the do notation do in Haskell?

A

The do notation provides a more convenient notation.
test :: String -> String -> IO String
test fn s
= do writeFile fn s
readFile fn

main :: IO ()
main
= do s <- test “a.txt” “a”
putStrLn s

80
Q

Define the Lambda calculus

A

The lambda calculus (or λ-calculus) is a formal system for
expressing computation through abstraction and application,
using variable binding and substitution.

81
Q

In the Lambda calculus what are constants

A

The constants are things like integers, characters, booleans
and operators.
Strictly, speaking, constants are unnecessary.

82
Q

In Lambda calculus what are variables

A

A variable is a name
^all it says

83
Q

In Lambda calculus what are Applications

A

An application of a function to an argument is written by
juxtaposition.
Parentheses disambiguate.
looks like (fa)

84
Q

In Lambda calculus what are Functions

A

A function is described by a λ-abstraction.
A λ-abstraction binds a variable; if there is no λ-abstraction,
then the variable is free

85
Q

What are the three conversion rules in the Lambda calculus

A

1 alpha conversion;
2 beta conversion;
3 eta conversion

86
Q

What is Alpha conversion

A

Alpha conversion (α-conversion) allows one to rename bound
variables.
e.g.
(λx.x + 2) ⇒ (λw.w + 2)

87
Q

What is Beta conversion

A

Beta conversion (β-conversion) allows one to apply a lambda
abstraction to an argument.
(λx.x + 2) 9 ⇒ 9 + 2

88
Q

What is Eta Conversion

A

Eta conversion (η-conversion) allows one to drop a
λ-abstraction over a function.
(λx.f x) ⇒ f

89
Q

What are some properties(4) of Parallel functional programming

A

1 concurrency is implicit, not explicit;
2 any shared data needs no protection;
3 reasoning remains easy;
4 results remain determinate

90
Q

What does the statement “Functional programs are blessed with an abundance of parallelism” mean?

A

Because expressions lack side-effects, they can be evaluated
in any order, or in parallel.

91
Q

What does this statement mean?
Functional programs are cursed by an embarrassment of
parallelism.

A

Just because an expression could be evaluated in parallel, it
does not mean that it should be evaluated in parallel

92
Q

What are three things that should be considered before creating a task to evaluate an expression

A

1 is the result going to be useful?
2 is the computation large enough?
3 is there spare processing capacity?

93
Q

What does the Par annotation do?

A

The pseudo-function par evaluates its arguments in parallel: x
on another processor (if possible), and y on the current
processor.
e.g.
par :: a -> b -> b
par x y = y

94
Q

What does the Seq annotation do?

A

The pseudo-function seq evaluates its arguments in sequence:
x then y
e.g
seq :: a -> b -> b
seq ⊥ y = ⊥
seq x y = y

95
Q

How is output done in Prolog

A

With the “write” predicate which displays a term structure, “nl” displays a new line and “writeln” combines the two

96
Q

How is input done in Prolog

A

With the “read” predicate, which reads a term

97
Q

What are the three classical forms of parallelism in Prolog

A

-“unification parallelism”;
-“or-parallelism”;
-“and-parallelism”

98
Q

What is unification parallelism

A

Unification parallelism arises during the unification of the
arguments of a goal with the arguments of a clause head with
the same name and arity. Unification parallelism unifies the arguments of complex structures in parallel.
(e.g [1, f(4)] = [1, R] as R is bound to f(4) i think)

99
Q

Why might it be hard to implement unification parallelism

A

It might be hard to implement unification parallelism because a substitution must be read/written by multiple processors.

100
Q

What is or-parallelism

A

Or-Parallelism arises when a goal may be unified with more than one clause in parallel. Or-Parallelism explores the search space generated by the presence of multiple clauses in parallel.
(e.g
f(a).
f(b).
f(c).
^that is three separate functions happening)

101
Q

Why might it be hard to implement or-parallelism

A

It might be hard to implement or-parallelism because the
parallel implementation must still have sequential behaviour.

102
Q

What is and-parallelism

A

And-Parallelism arises when more than one subgoal may be
satisfied in parallel. And-Parallelism exploits the presence of more than one
subgoal that may be satisfied in parallel.
(e.g f(a) :- e(1), f(b).)

103
Q

Why might it be hard to implement and-parallelism

A

It might be hard to implement and-parallelism because the
parallel implementation must account for data dependencies
between subgoals

104
Q

What happened on 2nd September 1945

A

General Douglas MacArthur invited the
representatives of Japan and the Allies to sign a surrender
document ending World War 2.
(not relevant but its in the lecture notes and made me laugh)

105
Q

What did the Ministry of International Trade and Industry (MITI) do

A

MITI excelled in working with the private sector
closely but neutrally, knowing different plans and problems of
individual firms, and coordinating and guiding them. They were repsonsible for the Fifth Generation Project

106
Q

What is the Fifth Generation Project

A

The Fifth Generation Project was intended to:
* make Japan a leader in the computer industry by
developing knowledge information processing systems
built using logic programming.
* stimulate original research, making the results widely
available, so refuting accusations that Japan exploits
knowledge from abroad without contributing any of its own

107
Q

Why was logic programming chose for the Fifth Generation Project

A

Logic programming was chosen because it unifies innovations in:
-software engineering;
-databases;
-artificial intelligence;
-computer architecture.

108
Q

Explain software engineering in terms of logic programming

A

In the field of software engineering, logic programs can serve as executable specifications, that can be made more efficient by program transformation

109
Q

Explain databases in terms of logic programming

A

In the field of databases, logic programs have been shown to
be adequate both as a query language, and for describing
integrity constraints

110
Q

Explain artificial intelligence in terms of logic programming

A

In the field of artificial intelligence, logic programs naturally implement rules of the form A if B1 and . . . and Bn

111
Q

Explain computer architecture in terms of logic programming

A

In the field of computer architecture, logic programs provide a way to overcome the von Neumann bottleneck through single assignment.

112
Q

What is a finite state automaton

A

A Finite State Automaton (FSA), is a model of computation based on the idea of a system changing state due to inputs supplied to it, until a final or acceptor state is reached.

113
Q

Why a finite automata useful

A

They are a useful model for many important kinds of
hardware and software (e.g representing process states on a processor)

114
Q

What are the central concepts of automata theory

A

-alphabets;
-strings;
-languages.

115
Q

What is an alphabet in terms of FSA

A

An alphabet, Σ, is a finite, nonempty set of symbols.
Example:
Σ = a, b, . . . z

116
Q

What is a string in terms of FSA

A

A string is a finite sequence of symbols chosen from some
alphabet. The set of all possible strings over an alphabet Σ is Σ∗.
Example:
bccd is a string drawn from Σ = a, b, . . . z.

117
Q

What is a language in terms of FSA

A

If Σ is an alphabet, and L ⊆ Σ∗, then L is a language over Σ.
Example:
{abc, def, ghi} is a language drawn from Σ∗, where
Σ = a, b, . . . z.

118
Q

What does a deterministic finite automata (DFA) consist of

A

-a finite set of states;
-a finite set of input symbols;
-a transition function;
-a start state;
-a set of accepting or final states.

119
Q

How are states represented in DFA

A

The finite set of states is often denoted Q.
Each state may be drawn as a circle.

120
Q

How are input symbols represented in DFA

A

The finite set of input symbols is often denoted Σ.
Each symbol may be drawn as a label of a transition arrow (so just either numbers or letters labelling the arrows)

121
Q

How are transition functions represented in DFA

A

The transition function may be described by a number of cases,
δ(p, a) = q.
Each case, δ(p, a) = q, may be drawn as an arrow from the
circle for p to the circle for q, labelled a.

122
Q

How is the start state represented in DFA

A

The start state, q0, is one of the states in Q.
The arrow drawn into the start state q0 is labelled Start.

123
Q

How is the accepting/final state represented in DFA

A

The accepting or final states are a subset of Q. The machine
may halt in accepting states provided it has no input left.
All other states become rejecting states if there is no input left.
Final or accepting states are marked by double circles.

124
Q

What is the difference between deterministic and non-deterministic automata

A
  • on each input, a deterministic automaton can transition
    from its current state to another state;
  • on each input (or on no input), a nondeterministic
    automata can transition form its current state to several
    states.
125
Q

What is regular expression

A

A regular expression provides an algebraic (and so
declarative) description of a deterministic or nondeterministic
finite state automaton.

126
Q

What are the three operations for regular expressions

A

The algebra of regular expressions combines constants and variables denoting languages using three operations:
-closure;
-concatenation;
-union.

127
Q

What is the closure operation

A

The closure of a language L is denoted L∗.
It represents the set of those strings that can be formed by
taking any number of strings from L, and concatenating them.
The “*” operator has the highest precedence — it applies to the
smallest sequence of symbols to its left.

128
Q

What is the concatenation operation

A

The concatenation of languages L and M is denoted LM.
It is the set of strings that can be formed by taking any string in
L and appending any string in M.
Concatenation has the next highest priority — expressions that
are juxtaposed are grouped together.

129
Q

What is the union operation

A

The union of two languages L and M is denoted L + M.
It is the set of strings that are either in L or M, or both.
The “+” operator has the lowest priority — expressions may be
grouped by unions in any order.

130
Q

Just some examples of regular expression

A

0* + 1 means any number of 0s or a 1
101* means 10 and any number of 1s
10 + 01 means 10 or 01
0(10)* means 0 and any number of 10s