Le tavole di verità
Le tavole di verità sono tabelle che permettono di stabilire il valore di verità di una proposizione composta. $$ \begin{array}{cr|c} p & q & p∧q \\ \hline F & F & F \\ F & V & F \\ V & F & F \\ V & V & V \end{array} $$
Per costruire una tavola di verità scrivo i valori di verità di ogni proposizione semplice della proposizione composta, tenendo conto delle varie combinazioni.
Un esempio pratico
Considero la seguente proposizione composta
$$ a \wedge ( b \vee c ) $$
E' una proposizione logica composta da tre proposizioni semplici (a,b,c) e due connettivi logici: la congiunzione ( ∧ ) e la disgiunzione inclusiva ( ∨ ).
Come si costruisce la tavola di verità?
Per creare la tavola di verità disegno una tabella con
- una colonna per ogni proposizione semplice
- una colonna per la proposizione composta (alla fine della tabella)
In questo caso la tabella ha quattro colonne perché ci sono tre proposizioni semplici (a,b,c)
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline & & & \\ & & & \\ & & & \\ & & & \end{array} $$
Una volta definito il numero delle colonne della tabella, devo capire quante righe inserire nella tabella.
Per farlo, calcolo le combinazioni dei valori di verità delle proposizioni semplici.
Ogni proposizione ha due (2) valori di verità (vero o falso) e le proposizioni semplici sono tre (3).
Quindi, le combinazioni possibili sono due alla terza ossia otto
$$ C(a,b,c) = 2^3 = 8 $$
Scrivo otto righe vuote nella tabella.
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline & & & \\ & & & \\ & & & \\ & & & \\ & & & \\ & & & \\ & & & \\ & & & \end{array} $$
A questo punto inserisco i valori di verità delle proposizioni semplici.
Nella colonna dell'ultima proposizione semplice alterno i valori di verità (V e F) in ciascuna riga, iniziando con il valore F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline & & \text{F} & \\ & & \text{V} & \\ & & \text{F} & \\ & & \text{V} & \\ & & \text{F} & \\ & & \text{V} & \\ & & \text{F} & \\ & & \text{V} & \end{array} $$
Nota. Io sono abituato a costruire la tabella in questo modo. Nulla vieta di costruirla seguendo un altro ordine. Ad esempio, iniziando dalla prima proposizione semplice anziché dall'ultima, oppure dal valore di verità V(vero) anziché F(falso).
Nella colonna precedente a quella appena compilata alterno i valori di verità (vero e falso).
Questa volta però alterno i valori di verità a coppie di due ( F F V V ) sempre iniziando con il valore F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline & \text{F} & \text{F} & \\ & \text{F} & \text{V} & \\ & \text{V} & \text{F} & \\ & \text{V} & \text{V} & \\ & \text{F} & \text{F} & \\ & \text{F} & \text{V} & \\ & \text{V} & \text{F} & \\ & \text{V} & \text{V} & \end{array} $$
Continuo a ritroso sulla colonna precedente, dove alterno i valori di verità (vero e falso).
Questa volta alterno i valori a coppie di quattro ( F F F F V V V V ) sempre iniziando dal valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \\ \text{F} & \text{F} & \text{V} & \\ \text{F} & \text{V} & \text{F} & \\ \text{F} & \text{V} & \text{V} & \\ \text{V} & \text{F} & \text{F} & \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nota. Nella costruzione delle combinazioni dei valori logici (vero e falso) bisogna alternare i valori di verità seguendo le potenze di 2n da n=0 in poi. $$ 1 , 2, 4, 8, 16, 32,... $$ Quindi, nella prima colonna che si compila si alternano i valori logici uno a uno, poi si alternano a coppie di due, poi a coppie di quattro, a coppie di otto, ecc.
Sono finite le combinazioni delle proposizioni semplici.
A questo punto calcolo i valori di verità della proposizione composta nell'ultima colonna.
In ogni riga della tabella sostituisco i valori di verità delle proposizioni semplici nell'ultima colonna dove si trova la proposizione composta.
Ad esempio, nella prima riga le proposizioni semplici hanno i valori a=F, b=F e c=F
Ne consegue che a∧(b∨c)=F∧(F∨F)=F∧F=F.
Nella prima riga il risultato della proposizione composta è il valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \\ \text{F} & \text{V} & \text{F} & \\ \text{F} & \text{V} & \text{V} & \\ \text{V} & \text{F} & \text{F} & \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella seconda riga le proposizioni semplici hanno i valori di verità a=F, b=F, c=V
Ne consegue che a∧(b∨c)=F∧(F∨V)=F∧V=F.
Nella seconda riga il risultato della proposizione composta è il valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \\ \text{F} & \text{V} & \text{V} & \\ \text{V} & \text{F} & \text{F} & \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella terza riga le proposizioni semplici hanno i valori di verità a=F, b=V, c=F
Ne consegue che a∧(b∨c)=F∧(V∨F)=F∧V=F.
Nella terza riga il risultato della proposizione composta è il valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \\ \text{V} & \text{F} & \text{F} & \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella quarta riga le proposizioni semplici hanno i valori di verità a=F, b=V, c=V
Ne consegue che a∧(b∨c)=F∧(V∨V)=F∧V=F.
Nella quarta riga il risultato della proposizione composta è il valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \text{F} \\ \text{V} & \text{F} & \text{F} & \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella quinta riga le proposizioni semplici hanno i valori di verità a=V, b=F, c=F
Ne consegue che a∧(b∨c)=V∧(F∨F)=V∧F=F.
Nella quinta riga il risultato della proposizione composta è il valore di verità F (falso).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \text{F} \\ \text{V} & \text{F} & \text{F} & \text{F} \\ \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella sesta riga le proposizioni semplici hanno i valori di verità a=V, b=F, c=V
Ne consegue che a∧(b∨c)=V∧(F∨V)=V∧V=V.
Nella sesta riga il risultato della proposizione composta è il valore di verità V (vero).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \text{F} \\ \text{V} & \text{F} & \text{F} & \text{F} \\ \text{V} & \text{F} & \text{V} & \text{V} \\ \text{V} & \text{V} & \text{F} & \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nella settima riga le proposizioni semplici hanno i valori di verità a=V, b=V, c=F
Ne consegue che a∧(b∨c)=V∧(V∨F)=V∧V=V.
Nella settima riga il risultato della proposizione composta è il valore di verità V (vero).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \text{F} \\ \text{V} & \text{F} & \text{F} & \text{F} \\ \text{V} & \text{F} & \text{V} & \text{V} \\ \text{V} & \text{V} & \text{F} & \text{V} \\ \text{V} & \text{V} & \text{V} & \end{array} $$
Nell'ottava e ultima riga le proposizioni semplici hanno i valori di verità a=V, b=V, c=V
Ne consegue che a∧(b∨c)=V∧(V∨V)=V∧V=V.
Nell'ottava riga il risultato della proposizione composta è il valore di verità V (vero).
$$ \begin{array}{c|c} a & b & c & a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F} \\ \text{F} & \text{F} & \text{V} & \text{F} \\ \text{F} & \text{V} & \text{F} & \text{F} \\ \text{F} & \text{V} & \text{V} & \text{F} \\ \text{V} & \text{F} & \text{F} & \text{F} \\ \text{V} & \text{F} & \text{V} & \text{V} \\ \text{V} & \text{V} & \text{F} & \text{V} \\ \text{V} & \text{V} & \text{V} & \text{V}\end{array} $$
Il risultato finale è la tavola di verità della proposizione composta.
Un consiglio pratico. Quando le proposizioni sono formate da altre proposizioni composte è utile aggiungere delle colonne dove inserire i valori di verità dei calcoli intermedi. Ad esempio, nell'esempio appena visto potrei aggiungere una colonna dove scrivere il valore di verità della proposizione composta (b v c). In questo modo suddivido un problema complesso in diversi sottoproblemi più semplici da calcolare. $$ \begin{array}{c|c} a & b & c & (b \vee c)& a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F}& \\ \text{F} & \text{F} & \text{V} & \text{V}& \\ \text{F} & \text{V} & \text{F} & \text{V}& \\ \text{F} & \text{V} & \text{V} & \text{V}& \\ \text{V} & \text{F} & \text{F} & \text{F}& \\ \text{V} & \text{F} & \text{V} & \text{V}& \\ \text{V} & \text{V} & \text{F} & \text{V} & \\ \text{V} & \text{V} & \text{V} & \text{V}& \end{array} $$ Una volta ottenuti i risultati dei calcoli intermedi li sostituisco nell'ultima colonna dove si trova la proposizione composta della tavola di verità
$$ \begin{array}{c|c} a & b & c & (b \vee c)& a \ \wedge \ (b \ \vee \ c) \\ \hline \text{F} & \text{F} & \text{F} & \text{F}& \text{F} \\ \text{F} & \text{F} & \text{V} & \text{V}& \text{F} \\ \text{F} & \text{V} & \text{F} & \text{V}& \text{F} \\ \text{F} & \text{V} & \text{V} & \text{V}& \text{F} \\ \text{V} & \text{F} & \text{F} & \text{F}& \text{F} \\ \text{V} & \text{F} & \text{V} & \text{V}& \text{V} \\ \text{V} & \text{V} & \text{F} & \text{V} & \text{V} \\ \text{V} & \text{V} & \text{V} & \text{V}& \text{V}\end{array} $$ Questo modo di operare evita gli errori dovuti a sviste o distrazioni. Inoltre, in caso di errore è più semplice capire dove è la causa.
E così via.