Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Verifying Mathematical Arguments in Maple

In previous sections of this book where Maple was discussed, we learned how to work with logical operators, and how to define some examples of propositions. Here, we extend what we’ve done previously to analyze mathematical arguments in Maple.

As is often the case in software development, sometimes the tools we already have at our disposal are the best tools available. We can utilize commands we’ve previously discussed to handle all of the work for us! Remember that a mathematical argument is just a special type of compound proposition, so it only makes sense to use commands from Maple’s Logic package.

Using the Tautology Command

Remember that a mathematical argument with premises p1, p2, p3, …, pn and conclusion q is just the compound proposition

(p1 ∧ p2 ∧ p3 ∧ … ∧ pn) → c.

Whenever the implication is always true, we say it is a logical implication and we can write

(p1 ∧ p2 ∧ p3 ∧ … ∧ pn) ⟹ c.

The Tautology command discussed in Chapter 1, Section A is perfect for such a use case.

As a reminder, the Tautology command can take in an optional second argument. That second argument must be an unevaluated name because if the supplied expression is not a tautology, Maple can provide a counter-example in the second argument.

Maple (Worksheet): Verifying Arguments are Logical Implications

> with(Logic):

> p1 := x ⇒ z:

> p2 := ¬y ⇒ x:

> p3 := ¬z:

> c := y:

> expression := (p1 ∧ p2 ∧ p3) ⇒ c:

> Tautology(expression, counter_example)

true

> counter_example

Notice that when trying to see what the newly introduced counter_example variable contained, no output was produced, even though we did not end the line with a colon. That’s because no counter-example could be produced, and so that variable was set to the value NULL.

Here, the basic idea is to simply define all of the desired premises along with a conclusion, and then simply stick the final expression into the Tautology command. We did not have to look up any additional functionality, we just had to use out existing tools in a new way.

Let’s see what happens when we pass in an invalid converse argument to the Tautology command:

Maple (Worksheet): Testing an Invalid Argument

> with(Logic):

> p1 := x ⇒ y:

> p2 := y:

> c := x:

> expression := (p1 ∧ p2 ∧ p3) ⇒ c:

> Tautology(expression, counter_example)

false

> counter_example

{x = false, y = true}

Examining a Truth Table

A tautology occurs when an expression always evaluates to true. While the Tautology command is great at simply spitting out the answer, it may not always give us the full picture when the argument we provide is not a valid argument.

Specifically, the second argument to the Tautology command can only contain one counter example if the argument is not valid. What if there are more counter examples?

We can examine a truth table to see all combinations of truth values that yield a counter example. Of course, if every number in the value column is a 1, then there is no counter example, and the provided argument is valid!

Maple (Worksheet):Tabulating a Small Argument

> with(Logic):

> p1 := x:

> p2 := x ⇒ ¬y:

> p3 := ¬y ⇒ ¬z:

> c := ¬z:

> expression := (p1 ∧ p2 ∧ p3) ⇒ c:

> TruthTable(expression, form = MOD2)

However, when an argument is built out of a large number of primitive propositions, Maple can have some trouble displaying the whole table, as demonstrated below. However, there is a simple command that will let Maple display tables of a large size. Keep in mind, displaying too much information can start to slow down Maple’s speed.

Figure 2.A.1: The interface command alters how Maple’s interactive environment functions. In this particular section, we care about how much of a table Maple is willing to display.

Maple (Worksheet): Tabulating a Large Argument

> with(Logic):

> p1 := v ⇒ x:

> p2 := x ⇒ y:

> p3 := z ∨ ¬y:

> p4 := ¬z ∨ w:

> p5 := ¬w:

> c := ¬v:

> expression := (p1 ∧ p2 ∧ p3 ∧ p4 ∧ p5) ⇒ c:

> TruthTable(expression, form = MOD2)

32 x 6 DataFrame

> interface(rtablesize = 32):

> TruthTable(expression, form = MOD2)