Skip to main content

Discrete Math with SageMath: Learn math with open-source software

Section 4.1 Logical Operators

In Sage, the logical operators are AND &, OR |, NOT ~, conditional ->, and biconditional <->.
Name Sage Operator Mathematical Notation
AND & \(\land\)
OR | \(\lor\)
NOT ~ \(\lnot\)
Conditional -> \(\rightarrow\)
Biconditional <-> \(\leftrightarrow\)

Subsection 4.1.1 Boolean Formula

Sage’s propcalc.formula() function allows for the creation of Boolean formulas using variables and logical operators. We can then use show function to display the mathematical notations.