Difference between revisions of "Truth table proofs"

From Computer Science
Jump to: navigation, search
Line 2: Line 2:
  
 
{| class="wikitable"  
 
{| class="wikitable"  
|+ caption="Truth table for ∧ (logical AND)"
 
 
|-
 
|-
 
! A !! B !! A ∧ B
 
! A !! B !! A ∧ B
Line 13: Line 12:
 
|-
 
|-
 
| true || true || true
 
| true || true || true
 +
|}
 +
 +
A truth table can also be used to prove a logical identity. The following proves DeMorgan's law that ¬ (A ∧ B) is equivalent to (¬ A) ∨ (¬ B). Notice that the truth values for these (the last two columns in the table) are always the same.
 +
 +
{| class="wikitable"
 +
|-
 +
! A !! B !! A ∧ B !! ¬ (A ∧ B) !! (&not A) ∨ (&not B)
 +
|-
 +
| false || false || false || true || true
 +
|-
 +
| false || true || false || true || true
 +
|-
 +
| true || false || false || true || true
 +
|-
 +
| true || true || true || false || false
 
|}
 
|}

Revision as of 14:49, 29 August 2022

Truth tables are used to show all possible values that a given logical expression might take. For example, the following gives the definition of the logical AND operation.

A B A ∧ B
false false false
false true false
true false false
true true true

A truth table can also be used to prove a logical identity. The following proves DeMorgan's law that ¬ (A ∧ B) is equivalent to (¬ A) ∨ (¬ B). Notice that the truth values for these (the last two columns in the table) are always the same.

A B A ∧ B ¬ (A ∧ B) (&not A) ∨ (&not B)
false false false true true
false true false true true
true false false true true
true true true false false