Hey. Just want to organize the answers, for anyone needing this in the future.
Please do not rely on the format. This is a community version, as there isn't a official one.
Correct means it has been verified by a tutor. You can click on the icon to jump to the source.
Verified means I have found someone with the same answer on Ed. Please note this DOES NOT mean absolutely correct. You can click on the icon to jump to the source.
Unchcked means I failed to find any asnwer on Ed, or it is an open-ended question, and I found my answer correct.
If you find anything wrong with it, even any typo, please do fire a PR, or change directly.
$\psi =\lnot (\lnot P \lor Q) \lor R$
$\psi = (P \land \lnot Q) \lor R$
$\psi \models (\lnot Q\lor R)$
$\rho = \lnot P \lor \lnot Q \lor R$
$(\lnot Q \lor R) \models (\lnot P \lor \lnot Q \lor R)$ I misunderstood the question at first, it is asking for a single $\varphi$ that would satisfy all these conditions.
1:
$R \leftrightarrow S$ 2:
$\lnot(R\lor S)\to \lnot P$ 3:
$Q\to (R \oplus S)$ 4:
$(R\land S)\to Q$
In = LogicalExpand[Implies[Q, Xor[R, S]] && Implies[R && S, Q] && Equivalent[R, S] && Implies[! (R || S), ! P]]
Out = ! P && ! Q && ! R && ! S
Hence, by mathematica, and as Bernhard Andersson pointed out, Macguffin cannot show films that week.
You need to give an interpretations that makes it valid and another that makes it unsatisfiable, read more.
Consider
Consider
Hence,
To show is not valid, only need to give a counter example.
Consider
Hence,
As Aimee Liang pointed out, it is more rigoros to use
$F(z, x)$ , which stands for$z$ is a friend of$x$ , instad of$F(x, z)$ .
$\forall x \forall y \lnot (M(x)\land \forall z(\lnot D(z)\lor L(x, z)))\lor (\lnot M(y)\lor\lnot L(y, x))$ I don't want to type anymore, I will list the outline, you can check Jordi Van Der Meer's step-by-step solution here.
Push
$\lnot$ inreplace
$z$ by$f(x, y)$ Distribute
$\land$
It means Mice don't like mice who like dogs.
Harold likes himself:
$L(b,b)$ Negate the formula:
$\lnot L(b,b)$ Note that
$a$ ,$b$ ,$c$ are constants, and cannot be mapped.
The string is basically any number of
ab
followed by any number ofba
.
abba
bababa
ababba
Both lhs and rhs need to be able to match the string.
State | a | b |
---|---|---|
S={1} | A | Z |
A*={2,4,5} | B | C |
B*={4,5} | B | D |
C*={3,5} | Z | D |
D*={5} | Z | D |
Z={} | Z | Z |
aa*b*
Please refer to Jordi Van Der Meer's answer.
A string made up of 28 "a"s.
Please refer to Jordi Van Der Meer's answer:
Additional explanation by Alex, and I quote
For every sequence of 'a's, there is a single parse tree. For all sequences shorter than 18, we apply a single rule, so the parse tree is unique. For all sequences longer than 18, we know that the string was generated by the rule S → Ta^18, then some number of applications of the rule T → Ta.
The number 18 was chosen as we have proven that every integer greater than 17 can be written as a sum of 4s and 7s (Part A)
Basically, just interchange
$\forall$ with$\exists$ .Don't forget to interchange
$\land$ with$\to$ , as$\exists_x F\equiv \lnot \forall_x \lnot F$
Note that (L\M)*
, but L*\M*
let L = {a, b}
Let M = {a}
L*\M* = {a, b}* \ {a}*
(L\M)* = {b}*
ab
is in L*\M*
, but not in (L\M)*
.
For alternative answer, please refer to here.
I used Gauss's formula in this question, could be wrong tho. The tricky
0
cause is dealt bylength xs
, otherwise I needed to usen+1
.
import Data.List
isTotalFct :: Int -> [(Int,Int)] -> Bool
isTotalFct n xs = (sum $ nub $ map (\(x, _) -> x) xs) == (0 + n) * count `div` 2
where count = length xs
import Data.List
isIdempotent :: Int -> [(Int,Int)] -> Bool
isIdempotent n xs = all (\(x, y) -> (elem (y, (apply y xs)) xs)) xs
-- Apply the function to a value.
--
-- Parameters:
-- $0: The input value
-- $1: The function
apply :: Int -> [(Int,Int)] -> Int
apply n ((x,y):xs) = if (n == x) then y else (apply n xs)
please note in the last operation, you can go
left
orright
.Basically, you would go to the end of the string (first state), then move left 3 times to check if it is an
a
.If the string was not long enough, it would have been rejected when moving the pointer back (left).
As Bernhard Andersson said, you need to consume the character (to
x
), in order to prevent the pointer from staying at the left most position instead of rejecting when the string is not long enough. (Yes, the Turing Machine stays there when you try to go left at the left most position.)
Congrates on finishing the sample exam!
- Nov 6, 9am, fixed Q1B, by Bernhard Andersson
- Nov 6, 12am, fixed Q9, by Bernhard Andersson
- Nov 6, 9pm, fixed Q5A missing
b
loop in the graph, by Aimee Liang - Nov 6, 9pm, fixed Q3A, use
$F(z, x)$ instead of$F(x, z)$ , by Aimee Liang - Nov 7, 11pm, fixed Q4 typo, the string is basically any number of ab followed by any number of ba.
- Nov 7, 11pm, fixed Q1A, the question is asking for a single $\varphi$
- NOv 8, 5pm, fixed Q3A, representation problems with brackets