i want help with my assignment. I can understand this is not a place where you find someone to do your homework so i also tried other sites like CHEGG study with the same account info (telling you so it doesnt come in mind i am not trying)but still no one is able to help me out to get through it. So i thought after trying other options i should seek help here too. Again i can understand this is not a place where you get your assignment done but stil it is a place where i can find help that will make me able to understand the concepts. Please try your best to simplify things as i am really weak in this subject and dont have much time left now, a couple of hours left. I waster time on chegg study. I am uploading the picture
Part 2: rename the four vectors a, b, c and d. Rules for valid patterns are as follows:
a must be followed by either a or c;
b must be followed by either a or c;
c must be followed by either b or d;
d must be followed by either b or d;
the string cannot start with b or d since those pull in 1 on the bottom
This suggests the following DFA:
q s q' q s q' q s q' q s q' q s q' q s q'
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
q0 a qA qA a qA qB a qA qC a qX qD a qX qX a qX
q0 b qX qA b qX qB b qX qC b qB qD b qB qX b qX
q0 c qC qA c qC qB c qC qC c qX qD c qX qX c qX
q0 d qX qA d qX qB d qX qC d qD qD d qD qX d qX
In this DFA, all states qA, qB, qC and qD (and, optionally, q0) are accepting, and qX is not. qX is the dead state which gets visited once the DFA knows enough about the input to reject it.
Part 3: rename the vectors as in part 2. Rules for valid patterns are as follows:
all strings are made up of a whole number of chunks;
valid chunks are: aaa, aba, acc, adc, baa, bbb, bcc, bdd, cac, cbc, cca, cda, dac, dbd, dca, ddb.
An NFA for these looks like this:
q s q' q s q' q s q' q s q' q s q'
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
q0 a qA qA a qAA qB a qBA qC a qCA qD a qDA
q0 b qB qA b qAB qB b qBB qC b qCB qD b qDB
q0 c qC qA c qAC qB c qBC qC c qCC qD c qDC
q0 d qD qA d qAD qB d qBD qC d qCD qD d qDD
q s q' q s q' q s q' q s q'
--- -- -- --- -- -- --- -- -- --- -- --
qAA a q0 qBA a q0 qCA c q0 qDA c q0
qAB a q0 qBB b q0 qCB c q0 qDB d q0
qAC c q0 qBC c q0 qCC a q0 qDC a q0
qAD c q0 qBD d q0 qCD a q0 qDD b q0
Here, q0 is the accepting state (if the empty string is not to be accepted, create a new state q0' and only visit q0 once). Any transition not depicted indicates that the NFA crashes; this could be made into an equivalent DFA by filling in the missing transitions and having them go to a new dead state (like qX in the last example).
Related
I need some help with designing Turing machine that accepts language
L= {a^n+1 b^2n c^3n: n>=0}
There are a lot of correct ways to do this. I will just walk through one of them I hope illustrates a useful way to attack these problems.
First, we notice the commonality n between the three segments. We will cross off symbols from each section, one at a time, to make sure they have the right relationships. First, we can verify that the relationship between a and b is right. Then, we can check the relationship between a and c. If those are both right, we are done.
First, let's get rid of the pesky "+1" from the a. This means we have at least one a regardless of what n is. So, we can begin by changing a to X. Now, the remaining input should have n instances of a, 2n instances of b and 3n instances of c. If we don't have the one a, we can halt-reject immediately; we can't have n+1 instances of a if we don't have at least one.
Now, if there are more instances of a, cross it off by writing A in its place, and go cross off two instances of b by writing B in their places. Then, go back and look for more instances of a, bouncing back and forth until there are no more instances of a. Then, verify there are no more instances of b; if so, there were twice as many instances of b as there were of a, and the first two sections have the right relationship. If at any point you didn't have enough b to cross off, or if after you ran out of a you still had b, then you can safely halt-reject at this point.
Next, you can do the same thing for instances of A and c, just cross off three instances of c instead of two. If we find the A get exhausted at the same time as the c do, we are done and halt-accept.
The transitions might look like this:
Q T Q' T' d comment
q0 a q1 X right account for +1
q1 a q2 A right n>0 case, continue
q1 # hA # same n=0 case, accept
q2 a q2 a right skip uncrossed a
q2 B q2 B right skip crossed b
q2 b q3 B right find first uncrossed b, cross it
q3 b q4 B left find next b, cross it
q4 B q4 B left find last uncrossed a
q4 a q2 A right cross it
q4 A q4 A left skip crossed a, if any
q4 X q5 X right ran out of a to cross
q5 A q5 A right skip crossed a
q5 B q5 B right skip crossed b
q5 c q6 c left verify existence of some c
q6 C q6 C left skip crossed c
q6 B q6 B left skip crossed b
q6 A q7 a right find last crossed a, uncross
q6 X q10 X right ran out of crossed a
q7 a q7 a right skip uncrossed a
q7 B q7 B right skip crossed b
q7 C q7 C right skip crossed c
q7 c q8 C right find first uncrossed c, cross
q8 c q9 C right cross 2nd uncrossed c
q9 c q6 C left cross 3rd uncrossed c
q10 a q10 a right skip uncrossed a
q10 B q10 B right skip crossed b
q10 C q10 C right skip crossed c
q10 # hA # same accept if no leftover symbols until end
Since we are not supposed to solve your homework :), I solved the following language on JFLAP and you can change it a little bit for your language. The logic is the same and you'd need to add a couple of states.
L = {a^n+1 b^2n : n >= 0}
Design a PDA for the following language
L = {a^nb^m : m ≥ n, m-n is even}.
Let's start with a PDA for a^n b^m where m >= n. A PDA can push an a to the stack for every a it sees, pop a b for every b it sees, and if it runs out of b while there are still a on the stack, it rejects.
Now, what else do we need to do to exclude the case where m - n is odd? Well, m - n is odd means we have some b left over in the input. We can simply modify our accepting state so that on further b, it moves to a new state (encoding odd b) and then back to the accepting state on the next b, encoding the requirement that the residual b must be even.
A full PDA might look like this:
q s S q' S'
q0 a Z q0 aZ
q0 a ax q0 aax
q0 b Zx q2 Z
q0 b ax q1 x
q1 b ax q1 x
q1 b Z q2 Z
q2 b Z q1 Z
Check that to see if it works, there might be some bugs. The way to read this is:
From state q, on input s, with stack configuration S, the PDA can transition to state q' and update the stack configuration to S'.
So here is where I am stuck, I have to construct a PDA that would accept words from {a,b}* with the condition n(a) is less than or equal to 2n(b)
Put yourself into the frame of mind of a pushdown automaton. All you know how to do is read input and the stack, and then push/pop and change state based on what you see. If you start reading a string and need to tell whether it's in the language, what can you do?
It seems to me the best we can do starting out is to remember how many as we are reading. Until we see bs, there's no reason to do anything else. That is, simply read as and push them on the stack. The following rules should suffice:
Q i s Q' s'
-- -- -- -- --
q0 a Z q0 aZ
q0 a a q0 aa
Now, what happens when we see a b? If we want at least twice as many bs as as, we can't just cross of as for each b, since that would give at least as many bs as as but not at least twice as many.
What if we cross off two as for each b? Well, that gives us at least half as many bs as as, which is the wrong direction. This suggests crossing off one a for every two bs, which turns out to be correct. The rules:
Q i s Q' s'
-- -- -- -- --
q0 b a q1 a
q1 b a q2 -
q2 b a q1 a
Note we created a new state q2 which has one rule in common with q0 but not the ones for reading as. Indeed, once we start reading bs, we don't want to allow any more as to be read. Leaving out the rules will crash the automaton and reject the string.
If we have exactly twice as many bs as as, we will end up in state q2 with no more input and an empty stack. If we have additional bs, we need a rule to allow them. It suffices to add a self loop on state q2:
Q i s Q' s'
-- -- -- -- --
q2 b Z q2 Z
Taken together, these states and transitions should be pretty close to a working PDA for your language. Other options would have been to write a CFG first and then apply an algorithm to convert the CFG to a PDA, for example, a top-down or bottom-up parser.
I want to design a turing machine that accepts the language L= {a^2b^2n: n>=1}
:. a square b square(n)
If your language is a^2 b^2n = {aabb, aabbbb, aabbbbbb, ...}, the language is regular and a TM for it first reads two as, then two bs, then either blank or two additional bs at a time until a blank is found.
q t q' t' d
-----------------------
q0 a q1 a right // read two a's from the
q1 a q2 a right // beginning of the tape
q2 b q3 b right // read at least two b's
q3 b q4 b right
q4 # hA # left // read more pairs of b's
q4 b q3 b right // or halt if input is done
If your language is a^2n b^2n = {aabb, aaaabbbb, aaaaaabbbbbb, ...}, the language is context-free and a TM for it crosses off matching aas and bbs until you run out of symbols.
q t q' t' d
-----------------------
q0 a q1 # right // erase two a's from
q1 a q2 # right // the front of the tape
q2 a q2 a right // scan to the end
q2 b q2 b right // of the tape
q2 # q3 # left
q3 b q4 # left // erase two b's from
q4 b q5 # left // the end of the tape
q5 a q5 a left // scan to the beginning
q5 b q5 b left // of the tape
q5 # q6 # right
q6 a q1 a right // try to start erasing a's
q6 # hA # - // or halt if all input is erased
I am confused with dependency preserving property of database relations (tables). Do we have to look at initial FD set or what else? I tried to solve some problems on this subject. The questions before this one all feed my initial estimation, which is 'look at the given FD set. If you don't lose any of them in your new relation set, then this is dependency preserving'.
But when I come to this question I am confused.
Consider the relation R = (A B C D E F G H) and the following FD set:
FD1 E -› D
FD2 B, E -› C G
FD3 D, G -› E
FD4 C -› A B
FD5 E, G -› C
FD6 A, E -› B D
FD7 C, E, D -› G
FD8 A, G -› E
These are the given relations
R1 (E F G H)
R2 (A B E G)
R3 (C D E G)
R4 (A B C)
Answer says that this decomposition is dependency preserving. According to my estimation we lose FD2 so, this must not be dependency preserving.
I need an expert to clarify this concept for me.
This question was a part of homework questions. I wasn't sure if I am thinking right when I do the homework.
In my answer I wrote:
This decomposition is not dependency preserving because in this decomposition we loose the FD DF--> BC .
And my database teacher accepted this answer as an right answer I wanted to clearify the subject here also.
Ferda
The decomposition is dependency preserving as FD2 BE->CG can be achieved by relations R2(BE->G) and R3(EG->C).
Closure of BE gives CG.