Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Mat_Logika_Algebra_i_ischislenie_vyskazyvany

.pdf
Скачиваний:
216
Добавлен:
15.02.2015
Размер:
1.27 Mб
Скачать

51

end do

end do

end do

end do

end do

end proc;

Get6Log := proc (f) local x, y, z, x1, y1, z1;

for x in true, false do for y in true, false do for z in true, false do for x1 in

true, false do for y1 in true, false do for z1 in true, false do print( x, y, z, x1, y1, z1, f( x, y, z, x1, y1, z1 ) )

end do end do

end do end do

end do end do

end proc

52

Отсюда начинаются варианты контрольных заданий от 1 до 40. Номер варианта - число после f.

Вкаждой результирующей строке идут значения трех переменных,

азатем значение булевой функции.

Если какая-нибудь нормальная форма неверная, то после таблицы истинности об этом сообщается.

Вариант N-1

> f1:=(a,b,c)->ifthen(equiva(a and not b, c), a or b

and c);

fDNF:=(x,y,z)-> x or z;

fKNF:=(x,y,z)-> x or z;

GetLog(f1);

f1 := ( a, b, c ) ifthen( equiva( a and not b, c ), a or b and c )

 

 

 

 

fDNF := ( x, y, z ) x or z

 

 

 

 

fKNF := ( x, y, z ) x or z

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

false

ДНФ -> false

КНФ -> false

false

false

true

true

ДНФ -> true

КНФ -> true

false

true

false

false

ДНФ -> false

КНФ -> false

false

true

true

true

ДНФ -> true

КНФ -> true

true

false

false

true

ДНФ -> true

КНФ -> true

true

false

true

true

ДНФ -> true

КНФ -> true

true

true

false

true

ДНФ -> true

КНФ -> true

true

true

true

true

ДНФ -> true

КНФ -> true

53

Вариант N-2

> f2:=(a,b,c)->ifthen( equiva(a , (b and not c)),a or

not c);

fDNF:=(x,y,z)-> x or not z;

fKNF:=(x,y,z)-> x or not z;

GetLog(f2);

f2 := ( a, b, c ) ifthen( equiva( a, b and not c ), a or not c )

 

 

 

 

fDNF := ( x, y, z ) x or

not

z

 

 

 

fKNF := ( x, y, z ) x or

not

z

 

x

y

z

f

ДНФ

 

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

true

ДНФ -> true

КНФ -> true

false

false

true

false

ДНФ -> false

КНФ -> false

false

true

false

true

ДНФ -> true

КНФ -> true

false

true

true

false

ДНФ -> false

КНФ -> false

true

false

false

true

ДНФ -> true

КНФ -> true

true

false

true

true

ДНФ -> true

КНФ -> true

true

true

false

true

ДНФ -> true

КНФ -> true

true

true

true

true

ДНФ -> true

КНФ -> true

54

Вариант N-3

> f3:=(a,b,c)->ifthen( a and ifthen(b ,a),not ifthen(not

b, c));

fDNF:=(x,y,z)-> not x or (not z and not y);

GetLog(f3);

f3 := ( a, b, c ) ifthen( a and ifthen( b, a ),

not ifthen( not b, c ) )

 

 

 

fDNF := ( x, y, z ) not ( x and ( z or y ) )

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

true

ДНФ -> true

КНФ -> KNF?

false

false

true

true

ДНФ -> true

КНФ -> KNF?

false

true

false

true

ДНФ -> true

КНФ -> KNF?

false

true

true

true

ДНФ -> true

КНФ -> KNF?

true

false

false

true

ДНФ -> true

КНФ -> KNF?

true

false

true

false

ДНФ -> false

КНФ -> KNF?

true

true

false

false

ДНФ -> false

КНФ -> KNF?

true

true

true

false

ДНФ -> false

КНФ -> KNF?

"КНФ неверная"

55

Вариант N-4

> f4:=(a,b,c)->ifthen( ifthen(a and not b, b),not ift-

hen(b, c));

fDNF:=(x,y,z)-> not x or (z and not y);

GetLog(f4);

f4 := ( a, b, c ) ifthen( ifthen( a and not b, b), not ifthen( b, c ) )

 

 

 

fDNF := ( x, y, z ) not x or z and not y

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

false

ДНФ -> true

КНФ -> KNF?

false

false

true

false

ДНФ -> true

КНФ -> KNF?

false

true

false

true

ДНФ -> true

КНФ -> KNF?

false

true

true

false

ДНФ -> true

КНФ -> KNF?

true

false

false

true

ДНФ -> false

КНФ -> KNF?

true

false

true

true

ДНФ -> true

КНФ -> KNF?

true

true

false

true

ДНФ -> false

КНФ -> KNF?

true

true

true

false

ДНФ -> false

КНФ -> KNF?

"ДНФ неверная" "КНФ неверная"

56

Вариант N-5

> f5:=(a,b,c)->ifthen(

ifthen(a, b and not c),ifthen(ifthen(a,b),ifthen(a,

c)));

fDNF:=(x,y,z)-> not x or z or not y and x;

GetLog(f5);

f5 := ( a, b, c ) ifthen( ifthen( a, b and not

c ), ifthen( ifthen( a, b), ifthen( a, c ) ) )

 

 

fDNF := ( x, y, z ) not x or z or not y and x

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

true

ДНФ -> true

КНФ -> KNF?

false

false

true

true

ДНФ -> true

КНФ -> KNF?

false

true

false

true

ДНФ -> true

КНФ -> KNF?

false

true

true

true

ДНФ -> true

КНФ -> KNF?

true

false

false

true

ДНФ -> true

КНФ -> KNF?

true

false

true

true

ДНФ -> true

КНФ -> KNF?

true

true

false

false

ДНФ -> false

КНФ -> KNF?

true

true

true

true

ДНФ -> true

КНФ -> KNF?

"КНФ неверная"

57

Вариант N-6

> f6:=(a,b,c)->ifthen( a and (b or not c),equiva(not

b,a));

fDNF:=(x,y,z)-> not x or (x and not y) or (z and not y)

;

fKNF:=(x,y,z)-> not x or not y ; GetLog(f6);

f6 := ( a, b, c ) ifthen( a and ( b or not

c ), equiva( not b, a ) )

 

fDNF := ( x, y, z ) not x or x and

not

y or z and not y

 

 

 

fKNF := ( x, y, z ) not ( x and y )

 

x

y

z

f

 

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

true

ДНФ -> true

КНФ -> true

false

false

true

true

ДНФ -> true

КНФ -> true

false

true

false

true

ДНФ -> true

КНФ -> true

false

true

true

true

ДНФ -> true

КНФ -> true

true

false

false

true

ДНФ -> true

КНФ -> true

true

false

true

true

ДНФ -> true

КНФ -> true

true

true

false

false

ДНФ -> false

КНФ -> false

true

true

true

false

ДНФ -> false

КНФ -> false

58

Вариант N-7

> f7:=(a,b,c)->(ifthen(a or b,(not a and b) or ifthen(a,

c))) and c;

fDNF:=(x,y,z)-> z;

fKNF:=(x,y,z)-> z;

GetLog(f7);

f7 := ( a, b, c ) ifthen( a or b,

not a and b or ifthen( a, c ) ) and c

 

 

 

 

fDNF := ( x, y, z ) z

 

 

 

 

fKNF := ( x, y, z ) z

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

false

ДНФ -> false

КНФ -> false

false

false

true

true

ДНФ -> true

КНФ -> true

false

true

false

false

ДНФ -> false

КНФ -> false

false

true

true

true

ДНФ -> true

КНФ -> true

true

false

false

false

ДНФ -> false

КНФ -> false

true

false

true

true

ДНФ -> true

КНФ -> true

true

true

false

false

ДНФ -> false

КНФ -> false

true

true

true

true

ДНФ -> true

КНФ -> true

59

Вариант N-8

> f8:=(a,b,c)->ifthen(ifthen( a or b, c),ifthen(a, not

b) or ifthen(a, not c));

fDNF:=(x,y,z)-> not x or not y or not z ;

GetLog(f8);

f8 := ( a, b, c ) ifthen( ifthen( a or b, c ), ifthen( a, not b) or ifthen( a,

not c ) )

 

 

fDNF := ( x, y, z ) not ( x and y and z )

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

true

ДНФ -> true

КНФ -> KNF?

false

false

true

true

ДНФ -> true

КНФ -> KNF?

false

true

false

true

ДНФ -> true

КНФ -> KNF?

false

true

true

true

ДНФ -> true

КНФ -> KNF?

true

false

false

true

ДНФ -> true

КНФ -> KNF?

true

false

true

true

ДНФ -> true

КНФ -> KNF?

true

true

false

true

ДНФ -> true

КНФ -> KNF?

true

true

true

false

ДНФ -> false

КНФ -> KNF?

"КНФ неверная"

60

Вариант N-9

> f9:=(x,y,z)->(ifthen(not x, y) or ifthen(not x, y and

z)) and z;

fDNF:=(x,y,z)-> x and z or y and z;

GetLog(f9);

f9 := ( x, y, z ) ( ifthen( not x, y ) or ifthen( not x, y and z ) ) and z

 

 

fDNF := ( x, y, z ) x and z or y and z

 

x

y

z

f

ДНФ

КНФ

=====

=====

=====

=====

=======

=======

false

false

false

false

ДНФ -> false

КНФ -> KNF?

false

false

true

false

ДНФ -> false

КНФ -> KNF?

false

true

false

false

ДНФ -> false

КНФ -> KNF?

false

true

true

true

ДНФ -> true

КНФ -> KNF?

true

false

false

false

ДНФ -> false

КНФ -> KNF?

true

false

true

true

ДНФ -> true

КНФ -> KNF?

true

true

false

false

ДНФ -> false

КНФ -> KNF?

true

true

true

true

ДНФ -> true

КНФ -> KNF?

"КНФ неверная"

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]