Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

1.1k questions

1.3k answers

1.7k comments

556 users

0 votes
Hi, I have tried to submit the following answer to the brainteaser on propositional logic.

x1<->x2&x1->x3&x3->x4&x5&x5->!x2

The online tool accepts this and outputs a truth table but the automatic checker in the exercise shows 0%.

What is the correct format for this? Please guide.

P.S. I'm sorry if this is a duplicate, couldn't find any older reference.
closed with the note: Question has been answered.
in * TF "Emb. Sys. and Rob." by (610 points)
closed by
A great lesson on syntax vs semantics. Your formula is a formula that does use the allowed variables. But it is not equivalent to the problem description. See “operator precedence” in the lecture notes.

Due to operator precedence, your formula is incorrect. But one can change your formula by just adding a bunch of parenthesis until it is correct.

1 Answer

+1 vote

Maybe you have to take care of priorities of the logic operators. Shouldn't it be rather like this?

 (x1<->x2)&(...  

Your formula is parsed as x1<->((((x2&x1)->(x3&x3))->(x4&x5&x5))->!x2) which is probably not what you want.

by (170k points)
This is in fact what you should check for. If you set the parentheses correctly (as hinted in this answer) your solution will be correct. I also increased the number of tries to 20, so please don't be afraid to try out your corrected solution.
Thank you for the answer. Yes adding the brackets worked. I had omitted the brackets because I wasn't sure if they were supported by the correction system.

Since on the teaching tool page: https://es.cs.uni-kl.de/tools/teaching brackets are not mentioned in the set of supported operators. I do believe that this is because brackets are not exactly an operator.
Interesting thought. But leaving out parentheses doesn't make the tool guess which parentheses you meant. You'd have to convert your formula to an equivalent one that uses only operator precedence and does not need parentheses.

Pro-Tip for the future: Just use the teaching tools to test your assumption. e.g. test what happens if you enter parenthesis.
Yes, brackets are not operators. However, they are required to disambiguate formulas since without brackets, we do not know whether a&b|c means (a&b)|c or a&(b|c). If you do not like brackets, you could use postfix or prefix notation which has been used in elder pocket calculators. Then, (a&b)|c becomes | & a b c while a&(b|c) becomes & a | b c. But usually, people do not like these notations.

Related questions

Imprint | Privacy Policy
...