Logical Expressions and Boolean Algebra
Thijs Gillebaart avatar
Written by Thijs Gillebaart
Updated over a week ago

Grasple supports Logical Expressions as input. You can use these logical expressions to create Boolean Algebra exercises. In this article we will show you:

  • how to define logical expressions

  • equivalence of logical expressions and precedence

  • how to evaluate logical expressions into booleans

  • how to ask for elements in the truth table

Defining a logical expression and precedence

You can use the following operators via their latex symbols to construct logical expressions.

You can insert these symbols via the logical expression menu in the equation insert menu

Below you can see an example on how these can be used to ask for a logical expression as answer.

Equivalence of logical expressions

Two expressions are seen as equivalent when their truth tables are equal. For example you can see that the answer "p \land \not q \land" is also seen as equivalent to "p \land \not q".


We use the most common precedence of operators as explained here. Below you can see a couple of examples how this precedence influences the interpretation of an logical expression:

  • "p \\land q \\lor r" will be interpreted as "Or(And(p, q), r))"

  • "p \\lor q \\land r" will be interpreted as "Or(p, And(q, r)))"

  • "p \\lor q \\implies r" will be interpreted as "Implies(Or(p, q), r)"

  • "p \\land q \\implies r" will be interpreted as "Implies(And(p, q), r)"

How to evaluate logical expressions into booleans

You can use substitution to evaluate logical expressions (as you would do with algebraic expressions). The result will be either a logical expression or an integer (1 or 0). See below a short example on how to use logical expressions and substitution

How to ask for values in a truth table

With the above setup you can create questions where you ask for values in a truth table. We advice to use T or F as answer in an open math question or use multiple choice answers.

See below a simple example based on the above parameters.

Questions and/or feedback?

If you have any questions or feedback, please reach out to us via the chat icon in the bottom or email us at support@grasple.com.

Did this answer your question?