logica booleana

annuncio pubblicitario
Esercitazione di laboratorio
logica booleana
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
Tabelle di verità: riepilogo
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
ESERCIZIO d’esempio: espressione logica
• Dati x=0; y=1, z=0 (equivale a dire x=false; y=true;
z=false), valutare la seguente espressione logica:
• ((Not X and (Y or Z)) and (Not Z)) XOR X
1
1
1
0
1
1
1
SEGUENDO L’ORDINE DATO DALLE PARENTESI:
PRIMO PASSAGGIO
SECONDO PASSAGGIO
TERZO PASSAGGIO
RISULTATO: 1
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
ESERCIZI: espressioni logiche
• Dati x=1; y=1, z=0 (equivale a dire x=false; y=true;
z=false), valutare le seguenti espressioni logiche:
1. ((Not X and (Y or Z)) and (Not Z)) XOR X
2. (Y AND X) OR (X AND Y)
3. (Y OR X) AND (X OR Y)
4. (NOT(Z) AND NOT(Y)) XOR X
5. NOT(Z) AND (NOT(Y) XOR X)
6. ((NOT(NOT(X))) AND (Y OR Z) OR X
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
Soluzione esercizio 1: espressione logica
• Dati x=1; y=1, z=0 (equivale a dire x=false; y=true;
z=false), valutare la seguente espressione logica:
• ((Not X and (Y or Z)) and (Not Z)) XOR X
0
1
1
0
0
0
0
SEGUENDO L’ORDINE DATO DALLE PARENTESI:
PRIMO PASSAGGIO
SECONDO PASSAGGIO
TERZO PASSAGGIO
RISULTATO: 0
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
Soluzioni esercizi: espressioni logiche
1. ((Not X and (Y or Z)) and (Not Z)) XOR X = 0 (FALSO)
2. (Y AND X) OR (X AND Y) = 1 (VERO)
3. (Y OR X) AND (X OR Y) = 1 (VERO)
4. (NOT(Z) AND NOT(Y)) XOR X = 1 (VERO)
5. NOT(Z) AND (NOT(Y) XOR X) = 1 (VERO)
6. ((NOT(NOT(X))) AND (Y OR Z) OR X =1 (VERO)
Prof. Raffaella Folgieri
DEMM – Dipartimento di economia, management e metodi quantitativi
Scarica