Chapter 1: if... else and the modus ponens deduction
Chapter 1: if... else and the modus ponens deduction
We can use the built-in if…then logical evaluation to explore the modus ponens argument. Let’s create the proposition, rabbitsAreFluffy and the proposition rabbitsAreSoft, and further assert: that rabbitsAreFluffy implies rabbitsAreSoft. We can write a quick program to explore this:
rabbitsAreFluffy=1;
%implication defined below
if rabbitsAreFluffy,
rabbitsAreSoft=1;
else rabbitsAreSoft=nan; end
%conclusion
rabbitsAreSoft
The proposition following if can either be true or false, and the next line defines the second part of the implication, by telling us what is also true if rabbitsAreFluffy=true. If run as is, the final line (query of the rabbitsAreSoft proposition) will yield a 1 (true). If we change rabbitsAreFluffy to false, then the rabbitsAreSoft proposition has an undefined value based on the implication, and so we assign it nan.