summaryrefslogtreecommitdiff
path: root/275/CH8/EX8.8.49a/Ch8_8_49a.sce
blob: 95fe639c737f7dad9c06155c5927702fcb35dba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
clc
clear
disp("Example 8.49a")
printf("\n")
disp("Prove the following boolean identities")
disp("A+BC=(A+B)(A+C)")
A=[0 0 0 0 1 1 1 1]
B=[0 0 1 1 0 0 1 1]
C=[0 1 0 1 0 1 0 1]
for i=1:length(A)
  Y(i)=A(i)+(B(i)*C(i))
  if(Y(i)==2)
    Y(i)=1
  end
end
for i=1:length(A)
  Z(i)=(A(i)+B(i))*(A(i)+C(i))
  if(Z(i)==2)
    Z(i)=1
  end
  if(Z(i)==3)
    Z(i)=1
  end
  if(Z(i)==4)
    Z(i)=1
  end
end
for i=1:length(A)
  if(Z(i)==Y(i))
    printf("_")
  else
    printf("NOT")
    abort
  end
end

  printf("proved")