Skip to content

Commit

Permalink
fix equivalent statements comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-Lubliner committed Sep 3, 2024
1 parent e2c57b0 commit 549a8fb
Showing 1 changed file with 54 additions and 52 deletions.
106 changes: 54 additions & 52 deletions source/logic/sec-tautology.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,68 @@

<section xml:id="sec-tautology" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Analyzing Logical Equivalences</title>
<subsection>
<title>Equivalent Statements</title>
<p>
By comparing the truth tables, we can ascertain if two logical statements are equivalent, meaning they have identical truth values for all possible inputs.
</p>
<aside>
<title>Notes</title>
<subsection>
<title>Equivalent Statements</title>
<p>
When working with Sage symbolic logic, the <c>==</c> operator compares semantic equivalence.
</p>
<sage>
<input>
h = propcalc.formula("x | ~y")
s = propcalc.formula("x &amp; y | x &amp; ~y | ~x &amp; ~y")
h == s
</input>
</sage>
<p>
Do not attempt to compare equivalence of truth tables.
</p>
<sage>
<input>
# Warning:
# Even though these truth tables look identical,
# the comparison will return False.
h.truthtable() == s.truthtable()
</input>
</sage>
<p>
This approach is invaluable in simplifying logical expressions in computer algorithms and understanding proofs in mathematical logic.
However, we can compare equivalence of truth table <c>lists</c>.
</p>
</aside>
<sage>
<input>
E1 = propcalc.formula('(p -&gt; q) &amp; (q -&gt; r)')
E2 = propcalc.formula('p -&gt; r')
T1 = E1.truthtable()
T2 = E2.truthtable()
T1 == T2
</input>
<output></output>
</sage>
</subsection>
<sage>
<input>
h_list = h.truthtable().get_table_list()
s_list = s.truthtable().get_table_list()
h_list == s_list
</input>
</sage>
</subsection>
<subsection>
<title>Tautologies</title><idx><h>tautology</h></idx>
<p>
A tautology is a logical statement that is always true. The <c>is_tautology()</c> function checks whether a given logical expression is a tautology.
</p>
<aside>
<title>Notes</title>
<title>Tautologies</title><idx><h>tautology</h></idx>
<p>
Understanding tautologies is essential in computer science, particularly in optimizing algorithms and validating logical propositions in software verification. It's also fundamental in mathematical proof strategies, such as proof by contradiction.
A tautology is a logical statement that is always true. The <c>is_tautology()</c> function checks whether a given logical expression is a tautology.
</p>
</aside>
<sage>
<input>
a = propcalc.formula('p | ~p')
a.is_tautology()
</input>
<output></output>
</sage>
<aside>
<title>Notes</title>
<p>
Understanding tautologies is fundamental in mathematical proof strategies, such as proof by contradiction.
</p>
</aside>
<sage>
<input>
a = propcalc.formula('p | ~p')
a.is_tautology()
</input>
</sage>
</subsection>

<subsection>
<title>Contradictions</title><idx><h>contradiction</h></idx>
<p>
In contrast to tautologies, contradictions are statements that are always false.
</p>
<aside>
<title>Notes</title>
<title>Contradictions</title><idx><h>contradiction</h></idx>
<p>
Analyzing the relationship between tautologies and contradictions can aid in the development of critical thinking skills, which are essential for debugging in programming, constructing mathematical proofs, and designing logical circuits.
In contrast to tautologies, contradictions are statements that are always false.
</p>
</aside>
<sage>
<input>
A = propcalc.formula('p &amp; ~p')
A.is_contradiction()
</input>
<output></output>
</sage>
<sage>
<input>
A = propcalc.formula('p &amp; ~p')
A.is_contradiction()
</input>
</sage>
</subsection>

</section>

0 comments on commit 549a8fb

Please sign in to comment.