- Considerare la logica booleana assumendo 1 = Vero e 0 = Falso. Calcolare il valore di verita' dell'espressione (not (Vero and Falso)) and (Vero or Falso) (not (Vero and Falso)) and (Vero or Falso) (not Falso) and Vero Vero and Vero Vero - Date tre variabili booleane a b e c si scriva una funzione booleana f(a,b,c) che vale 1 solo quando due di esse hanno valore 1. Si descrive per enumerazione (TABELLA DI VERITA') 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 - Si descriva ora la funzione precedente in termini di and, or e not 1) Trovare espressioni and / not che "identificano" le sequenze da mettere ad 1: 0 1 1 --> not a and b and c 1 0 1 --> a and not b and c 1 1 0 --> a and b and not c 2) Mettere in or tutte queste sequenze (not a and b and c) or (a and not b and c) or (a and b and not c) - Siano a2, a1, b2, b1 i bit che rappresentano due numeri interi positivi (A=a2a1 e B=b2b1). Sia r una variabile booleana che vale 1 se e solo A e' maggiore di B (A>B). Ad esempio, quando A=11 e B=10, allora a2=1, a1=1, b2=1, b1=0 e r=1. Si descriva r come funzione di a2, a1, b2, b1 usando operazioni and or e not. Tabella di verita' a2 a1 b2 b1 r 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 Ora, espressioni and not che "identificano" r=1 0 1 0 0 --> not a2 and a1 and not b2 and not b1 1 0 0 0 --> a2 and not a1 and not b2 and not b1 1 0 0 1 --> a2 and not a1 and not b2 and b1 1 1 0 0 --> a2 and a1 and not b2 and not b1 1 1 0 1 --> a2 and a1 and not b2 and b1 1 1 1 0 --> a2 and a1 and b2 and not b1 Metterle in or (not a2 and a1 and not b2 and not b1) or (a2 and not a1 and not b2 and not b1) or (a2 and not a1 and not b2 and b1) or (a2 and a1 and not b2 and not b1) or (a2 and a1 and not b2 and b1) or (a2 and a1 and b2 and not b1) - I signori A, B, C e D fanno parte di un consiglio di amministrazione. Sapendo che hanno a disposizione le seguenti quote di possesso azionario A=40%, B=25%, C=20%, D=15%, definire tramite tabella di verita' la funzione booleana che decide quando il consiglio di amministrazione e' in grado di approvare una mozione. Esprimere tale funzione tramite and or e not. - Il presidente di una squadra di calcio vuol comprare 4 giocatori dal costo di 2, 5, 6 e 8 milioni di euro, ma ha a disposizione solo 8 milioni. Siano a2, a5, a6, a8 variabili booleane che valgono 1 se e solo se si acquistano, rispettivamente, i giocatori da 2, 5, 6, 8 milioni. Sia r una variabile che e' vera se e solo se l’insieme di giocatori che si decide di comprare costa meno della cifra disponibile. Ad esempio, se a2=1, a5=1, a6=0, a8=0, allora r=1. Si definisca r come funzione delle variabili a2, a5, a6, a8 usando operazioni and, or e not. - Teorema di De Morgan: date due variabili booleane a e b, not (a or b) = not a and not b. Similmente, not (a and b) = not a or not b Dimostrarlo. Si fa banalmente con le tabelle di verita' a b a and b not (a and b) not a not b not a or not b 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 0 0 0 a b a or b not (a or b) not a not b not a and not b 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 0 0 0