Explaining Computation of a Turing Machine - turing-machines

I am having some trouble interpreting what this Turing machine actually does (i.e., I am uncertain how to explain it in plain English).
I believe I have created the state diagram correctly using the transition table I was given (although not 100% on this either).
From what I can see this TM will halt in an accepting state (q2) whenever the input is of the form
(a || b || B)*Ba*c(a || b || c || B)*,
that is any amount of a's, b's, and blanks (but no c's), followed by at least one blank, any amount of a's, and exactly one c. Anything can come after since we go left upon finding first c.
I suppose my question is
a) Is my work up to this point correct? and
b) Is there a more meaningful explanation of this Turing machine (i.e. a richer description than I wrote of the input that halts in (q2)).

Some observations:
q0 reads left to right, doesn't change the tape, and stops when it hits c.
q1 reads left to right, swaps a and b, halts when it sees a B and turns around when it hits an a.
The only way to for the TM to halt is if
There is a c somewhere on the tape to the right of the initial tape position
In q1, the last pass from right to left sees only b and leaves only a between the first c and the rightmost B to the left of c.
q1 changes everything between the first c and the rightmost b to the left of that c to a b eventually
Given initial tape configuration >BxBycz, the machine will always halt in configuration >BxB(a^|y|)cz. It accepts any string that contains c.
Your state diagram disagrees with the table in that the table has the transition function defined so that f(q1, a) = (q0, b, L) and f(q1, b) = (q1, a, L), but your diagram shows f(q1, a) = (q1, a, L) and f(q1, b) = (q0, b, L).


Can a decider be built with 2 “opposite” recognizers?

If I have 2 turing machines, A and B, let's say that A accepts every word in a language L that has a property P, while B does the opposite, it accepts every word that does not have the property P. I don't know if A and B would reject in their complementary cases, all I can say is that they are recognizers. Can I build a Turing Machine that decides if a word is in the language L?
I was thinking of making an abstract turing machine C composed of both A and B where, if a word "enters" C, then this word would "enter" both A and B at the same time and consequently accepting the moment A accepts and rejecting when B accepts, and thus, always halting? Does this follow? or I am missing something?
Sorry if I'm being too informal on my explanations.

Develop Turing Machine to count number of As and Bs in a String

The given Language is
L = {a^n b^n where n>= 0}
I have to develop a turing machine for it but i dont get the logic. will it go like this if an a is not followed by a b you go to halt reject state, but how we check if the count of a and b are equal?
will be very grateful for any response
A Turing Machine decides a language if it enters the halt-accept state when the input tape initially contains a string in the language, and enters the halt-reject state otherwise.
So, to decide your language L, you need to define states and transitions so that when the tape contains a string a^n b^n the TM ends up in halt-accept, and such that it ends up in halt-reject otherwise.
We can assume a single-tape TM and that you don't need the input tape restored to its original state after processing has finished (that is, we can do whatever we want to the tape and don't need to clean up or move the tape head anywhere in particular). What we need is a strategy for processing the tape so that we can reliably know when the string is or isn't in the language. In your case, we need a's followed by b's, with the same number of a's and b's. If you had to do this task in real life, how might you approach it?
You could first count the a's and then count the b's, and then see if the numbers are equal; however, this doesn't really simplify matters for us, since telling whether two numbers are equal is actually a somewhat harder problem than telling if two strings have the same length (the language ww | w in {a, b}* is context-sensitive, whereas a^n b^n is context-free).
Another approach is the "one for me, one for you" approach used by pirates when dividing treasure and mathematicians when establishing bijections among sets: to show that two sets have the same number of elements, you simply pair them off such that all elements are in exactly one pair. This doesn't yield the same problem that counting did, in that we don't have the same subproblem to solve: whereas the other problem yielded a harder subproblem, this one yields a subproblem of exactly the same difficulty as the original. Indeed, it's a smaller instance of the exact same problem! By erasing one a and then erasing a corresponding b, we can reduce a problem of size n to one of size n - 2. By repeating this process, we will eventually erase the whole tape and accept, or run out of symbols to pair with, and reject.
This is our design. For implementation, we will require an initial state. From the initial state, we can assume we are looking at the first non-blank tape cell, if any. If the tape cell is blank, the input is empty and we must accept since a^0 b^0 is in the language with n = 0. If the tape cell has b, we may halt-reject since we were expecting to see an a, if anything, first. If the tape cell has a, then we need to look for a corresponding b to erase.
Now, which b should we erase? Currently, we know where the input ends since we have a blank immediately after the last input symbol. If we use blanks to erase b's before that, we will have no good way of knowing whether we might have more input to the right of any currently blank cell. You could overcome this by introducing a new tape symbol E for erased cells; then, when erasing, write E instead of blank to indicate erasure. Then, it really doesn't matter which b you erase. If you prefer not to use a new tape symbol, however, you can instead erase the b immediately before the blank at the end of the input (rejecting if an a is found there instead) and achieve the same thing.
In any event, after erasing a corresponding b, we can return to the beginning of the tape (the blank cell first reached after moving left) and repeat the process over and over again until we accept or reject.
Here is a sample implementation:
Q T Q' T' D
-- - -- -- -
// accept on empty tape
q0 B hA B S
// erase an a or reject if no a
q0 a q1 B R
q0 b hR b S
// scan to end of input
q1 B q2 B L
q1 a q1 a R
q1 b q1 b R
// erase last b or reject if none
q2 B qR B S
q2 a qR a S
q2 b q3 B S
// scan to beginning of input, then repeat
q3 B q0 B R
q3 a q3 a L
q3 b q3 b L

Is WW where W belongs to {a,b}* a context free language?

Is WW where W belongs to {a,b}* a context free language?
If yes, please provide the PDA for it.
No, it is not
Assume, for sake of contradiction, that it is, then there is a PDA that accept it.
According to the pumping lemma (for CFGs), there is a length p such that for every word (we will pick one shortly) s there are some substring u,v,w,x,y such that s=uvwxy and:
uv^n wx^n y is in the language for any positive n
Let's consider the word a^p b^p a^p b^p, and such u,v,w,x,y
Either vwx contains the middle of the word, or it's entirely contained in the first half, or it is entirely contained in the second half.
If it's in the first half, then in the word uv^2 wx^2 y. We have added a total length of no more than p, thus we have "moved" the mid-point by no more than p/2, so right now the mid-point continues with b, but the word starts with a a, so it's not of the form ww
Same argument goes for it being in the second half.
Now let's assume it contains the middle, and consider uwy (using n=0). Since |vwx|<=p, then we have removed from the a's and b's in the middle, but not from the a's and b's at the edges. We have also removed a positive amount of letters, so uwy is of the form a^p b^k a^m b^p were either k<p or m<p. Eitherway, it's not of the form of ww

Artificial Intelligence - Fuzzy Systems

I have some practice exam questions and answers which are as follows:
However, I am unsure as to why the solution to question 1 (highlighted) begins with 1-... - could somebody please explain this? Do all NOT / ¬ solutions begin with 1-... and if so, why?
Many thanks.
The notation is a bit confusing, because it is mixing fuzzy set theory and fuzzy logic. Here not A probably means the complement (anything but A, sometimes written as A with a bar above the letter A or as A^C) of the fuzzy set A. (Confirm with your tutor later).
The function \mu_A (LaTeX syntax, I do not know, how to enter greek symbols here) is a function which assigns a grade of containment for the set A. I.e. \mu_A(x) = 0.6 means that x is contained in A with a grade of 0.6 (similar but not identical to the probability of x being an element of A). \mu_A(x) = 0 means that x is not an element of A.
So if the grade of containment for x in A is some value v, than a natural definition of the grade of containment in the complement of A (here written as not A) is 1-v (this is also similar to probability theory: if the probability of an element being in some set A is v, then the probability of the element being in A's complement is 1-v).
Thus the containment function \mu_{not A} for the complement can be defined as \mu_{not A} = 1 - \mu_A.
This definition is consistent with union (max) and intersection (min) so that the usual laws of set theory are still correct (like de Morgan's law: the complement of the union of A and B is the intersection of the complements of A and B: not(A u B) = (not A) \intersect (not B)).

Construct a Turing-Machine to decide ww^Rw

w^R is the reverse of w and w is {0, 1}* . So the TM needs to decide a word followed by the reverse of this word followed by the word.
I don't want the answer, I just want a lead to start and to get on the right track.
Since some time has passed and the answer probably isn't needed anymore, I guess I'll propose a solution for the benefit of future students looking for an example of how one language can be recognized by a Turing machine.
Here's the idea. We'll take as the tape alphabet {0, 1, a, b, c, d} and make a single-tape singly-infinite tape Turing machine that recognizes w w^R w. The machine will work in five phases:
Replace 0s and 1s in the prefix w w^R with a's and b's.
See whether w w^R is a palindrome.
Restore the tape to its pristine state.
Replace 0s and 1s in the suffix w^R w with c's and d's.
See whether w^R is a palindrome.
Note that this is simply one easy (for me to understand, that is) way to show that there exists a Turing machine to recognize this language. Naturally, showing that there exists an algorithm to solve this in any Turing-equivalent system of computation is just as good (it proves there exists a TM)... still, this outlines the construction of one such TM. Also note that there may be a simpler, more efficient or more intuitive TM to solve this problem... again, this is only one approach.
Step 1 will work as follows:
Precondition: The tape begins with a blank, contains any string in (0+1)*, and is followed by an infinite string of blank squares.
Postcondition: Halts if tape is empty or if length is not a multiple of 3; else, the tape begins with a blank, is followed by (a+b)^2n (c+d)^n, followed by an infinite string of blanks.
Move to the right.
If empty, halt accept. Otherwise, Scan to the right until you find an empty tape square, then move left.
Change the tape to c if 0 or d if 1.
Scan left until you find an empty tape square. Move right.
If the tape is 0 or 1, change to a or b then move right. If the tape is c or d, halt reject.
If the tape is 0 or 1, change to a or b then move right. If the tape is c or d, halt reject.
If tape is c or d, scan to the beginning of the tape and go to Step 2. Otherwise, scan right until c or d, then move left.
Change the tape to c if 0 or d if 1.
Scan left until you find either a or b. Move right.
Repeat starting at 4.
Step 2 will work as follows:
Precondition: The tape begins with a blank, is followed by (a+b)^2n (c+d)^n, followed by an infinite string of blanks.
Postcondition: Halts if the prefix (a+b)^2n isn't a palindrome; otherwise, leaves the tape in a state like D (c+d)^3n D*
Move right.
If tape is a (or b), move right. If tape is c or d, go to the beginning of the tape, then go to Step 3.
If the tape is c, d or blank, halt reject. Otherwise, scan right until you find a c, d or blank. Move left.
If the tape is a b (or a), halt reject. Otherwise, change this to a c (or d) and scan back to the left until you see a blank, a c or a d. Move right. Change a (or b) to c (or d). Move right.
Repeat starting at step 2.
Step 3 will work as follows
Precondition: Tape is D (c+d)^3n D*
Postcondition: Tape is D (0+1)^3n D*
Move right.
If tape is c, write 0 and move right. If tape is d, write 1 and move right. If tape is blank, move to first blank space at the end of tape and go to step 4.
Repeat step 2.
Step 4 and 5 work just like steps 1 and 2, except you work backwards (the tape now looks like D (c+d)^n (a+b)^2n D*, and you must check to see whether the (a+b)^2n part is a palindrome.
Any string passing both these tests must be of the form w w^R w where w is in (0+1)*.
As a hint, note that wwRw must have length 3n for some n (since each character appears exactly three times). You might therefore build a Turing machine that works by somehow counting the length of the string, using this to determine where the boundaries of the three strings are, and then checking that the three pieces all have the appropriate composition. If you can't count up a multiple of 3 characters, you could immediately reject.
Depending on what sort of TM is allowed, this might be easiest with a multitrack or multitape Turing machine so that you can mark up the letters with some extra information.
Hope this helps!