.


:




:

































 

 

 

 


1.




. . f (0,0,1) < f (0,1,0) f (0,1,0) > f (0,1,1), , .

. ., f (0,0,0) = f(1,1,1), .

. . f (0,1,1) = f (1,0,1) = f (1,1,0) / 0,1,1/, .

.

:

f1(x1,x2,x3) = C0 Å C1&X1 Å C2&X2 Å C3&X3.

Ci:

f (0,0,0) = 1 / /

0 Å 1&0 Å C2&0 ÅC3&0 = 1, .., 0 = 1.

f (1,0,0)=0 / /

0 Å C1 &1 Å C 2&0 Å C 3&0 = 0, .., 1 = 1.

f (0,1,0) = 1/ /

0 Å C1 &0 Å C 2&1 Å C 3&0 = 1, .., 2 = 0.

f (0,0,1) = 0 / /

0 Å C 1&0 Å C 2&0 Å C 3&1 = 0,.., 3 = 0.

f1(x1,x2,x3) = 1.

f f 1 :

1 2 3 0 0 0 0 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 f(x1,x2,x3) 1 f1(x1,x2,x3)

. . ,

.

: 1

 

5. , , , , 1 : 0, 1, 2, 3,6,12

 

:

x1 x2 x3 x4 f(x1 x2 x3 x4)
  0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1    

 

, 1 :

: f(x1,x2,x3,4 ) =

: f(x1,x2,x3,4)=

, 0 :

:

f(x1,x2,x3,4)=

:

f(x1,x2,x3,4)=

:

1) 1 1 :

f(x1,x2,x3,4) =

 

2) 0 0 :

f(x1,x2,x3,4)=

6. , , 1 : 2, 3, 6, 7, 11.

 

:

x1 x2 x3 x4 f(x1 x2 x3 x4)
  0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1    

 

1 :

(1) (1) (2) (2)          

 

:

 

 

 
        +
+ + + +  

 

 

f1(x1,x2,x3,x4) = ˅

 

 

7. -, , 1 : 6, 7, 8, 10, 11, 13.

:

x1 x2 x3 x4 f(x1 x2 x3 x4)
  0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1    

 

1 :

1)

0 -

I - 1000

II 0110, 1010

III - 0111, 1011, 1101

IV -

2)

0 -

I - 10_0

II 011_, 101_

III -

 

 

:

  10_0 011_ 101_  
  +      
    +    
      +  
    +    
      +  
        +

 

f1(x1,x2,x3,x4) =

 

 

8. , , 1 : 2, 3, 4, 5, 10, 12, 13, 15.

 

:

x1 x2 x3 x4 f(x1 x2 x3 x4)
  0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1    

 

f1(x1,x2,x3,x4) = ˅ ˅

 

9. : , .

 

 

 

 

:

: V = {v1, v2, v3, v4, v5, v6,v7}

: = { x1, x2, x3, x4, x5, x6,x7, x8, x9}

 

 

A()7×7 = aij =

 

 

 

:

B()6×95 = bij =

  x1 x2 x3 x4 x5 x6 x7 x8 x9
v1                  
v2 -1 -1              
v3     -1 -1          
v4                  
v5                  
v6               -1  
v7         -1 -1 -1   -1

 

10. :

;

;

;

;

.

 

:

0

9

7

1

  v1 v2 v3 v4 v5 v6 v7
             
             
             

 

μ() :

μ() = |E()| - |V()| + k,

|E()| - .

|V()| - .

k .

, μ() = |E()| - |V()| + k = 9 7 + 1 = 3

 

11. , :

( );

( , );

( , , );

, ( ).

:

, .

.

, , - - , , .

,

 

 

, . .

 

.

 

, . .

 

. .

 

 

12. : , , , .

 

, , G, D(G) , dij vi vj. .

 

D(G) =

 

 

G : r(vj) = max d(vi,vj) i, j = 1, 2, ,5. : r(v1) = 0, r(v2) =2, r(v3) =1, r(v4) = 0, r(v5) =0, r(v6) = 1, r(v7) = 1.

G, G. , R(G) = 0 D(G) = 2, v1, v4, v5.

 

 

13. ,

D = U(A∩B)

 

:

 

Program d;

uses crt;

const a=[1,2,3,5,7,8,10]

b=[1,2,3,5];

var r:set of byte;

i: byte;

begin

clrscr;

writeln;

r:=a-b;

for i:=1 to 255 do

var r:set of byte;

i: byte;

begin

clrscr;

writeln;

d:=a+r;

for i:=1 to 255 do

if i in r then write(i, );

readln;

end.

 

14. , : P Í = {(x, y): x + y = 0, x, y Î , }. , 10 .

, .

 

:

A = { -3; -2; -1; 1; 2; 3; 4; 5; 6; 7}

P = (-3;3), (-2;2), (-1;1),(1;-1),(2;-2),(3;-3)

:

1) -

2)

-

= 1 (-1;1) .

3)

-

= -1 y = 1 (-1;1)

4)

-

5)

-

6)

, .

7)

-

= -1 y = 1 z = 7 (-1;1) , (1;7)

8)

-

= 1 y = 3 1≠3 (1;3) (3;1)

++

 

  #include <iostream> #include <conio.h> #include <stdio.h> #include <fstream> #include <locale.h> #include <math.h> using namespace std;   // void Display(int A[],int k, int m[4][4]); void Display(int A[],int k, int** m);   // void SortMas(int a[], long N){ long i = 0, k = N; int temp; bool flag = 0;   while (flag!= true){ flag = true; for (i=0; i < k-1; i++){ if (a[i] > a[i+1]){ temp = a[i]; a[i] = a[i+1]; a[i+1] = temp; flag = false; } } } }   // c void MakeSet(int m[], int k, int n){ int i, j; srand(time(0)); for (i = 0; i < k; i++){ m[i] = rand()%n+1; int j = 0; while (j < i){ if (m[i] == m[j]){ m[i] = rand()%n+1; j=-1; } j++; } } }     //o void Display(int A[],int k, int** m){ //output of set cout<<"\n\n"; cout<<" |"; for (int i = 0; i < k; i++){ cout.width(3); cout<<A[i]<<" |"; }   //print line cout<<"\n"; cout<<" "; for(int i = 0; i < k+1; i++){ cout<<"-----"; } cout<<"\n";   //print array for (int i = 0; i < k; i++){ cout<<" "; cout.width(4); cout<<A[i]<<" |"; for (int j = 0; j < k; j++){ cout.width(3); cout<<m[i][j]<<" |";; }   if(i < k-1){ cout<<"\n"; cout<<" "; for(int i = 0; i < k+1; i++) { cout<<"-----"; } } cout<<"\n"; }   //print line cout<<" "; for(int i = 0; i < k+1; i++){ cout<<"-----"; } }     void Display(int A[],int k, int m[4][4]){ //output of set cout<<"\n\n"; cout<<" |"; for (int i = 0; i < k; i++){ cout.width(3); cout<<A[i]<<" |"; }   //print line cout<<"\n"; cout<<" "; for(int i = 0; i < k+1; i++){ cout<<"-----"; } cout<<"\n";   //print array for (int i = 0; i < k; i++){ cout<<" "; cout.width(4); cout<<A[i]<<" |"; for (int j = 0; j < k; j++){ cout.width(3); cout<<m[i][j]<<" |";; }   if(i < k-1){ cout<<"\n"; cout<<" "; for(int i = 0; i < k+1; i++) { cout<<"-----"; } } cout<<"\n"; }   //print line cout<<" "; for(int i = 0; i < k+1; i++){ cout<<"-----"; } }   // int ref (int m[4][4], int k){ int q; for (int i = 0; i<k; i++){ if (m[i][i]==0){ // 0 - q=0; break; } else q=1; // - } return q; }   // int antiref (int m[4][4], int k){ int q; for (int i = 0; i<k; i++){ if (m[i][i]==1){ // 0 - q=0; break; } else q=1; // } return q; }   // int sym (int m[4][4], int k){ int q=0; for (int i = 0; i<k; i++){ for (int j = 0; j<k; j++){ if (m[i][j]==m[j][i] && m[i][j]==1 && m[j][i]==1 && i!= j) q++; } } if (q>0) return 1; // 1 else return 0; }   // int antisym (int m[4][4], int k){ int q; for (int i = 0; i<k; i++){ for (int j = 0; j<k; j++){ if ((m[i][j]==m[j][i]==1 && i==j) || (m[i][j]==0 && i!=j) || (m[i][j]!=m[j][i])) q=1; // , // else { q=0; break; } } if (q==0) break; } return q; }   // // - int trans (int a[4][4], int k){ int mat[4][4]; int q=0;   // mat[4][4] for (int i = 0; i<4; i++) for (int j = 0; j<4; j++) mat[i][j]=a[i][j];   // - . // mat[4][4] for (int l = 0; l<k; l++) for (int i = 0; i<k; i++) for (int j = 0; j<k; j++) mat[i][j] = (mat[i][j] || (mat[i][l] && mat[l][j]));   // mat[4][4] [4][4] // , [4][4] , - . for (int i = 0; i<4; i++) for (int j = 0; j<4; j++){ if (mat[i][j] == a[i][j]) q=1; else { q=0; return q;} } return 1; }   int main (){ srand(time(0)); int key; int i; int Na; do{ system("cls"); cout<<"\n"; cout<<" Please, input size set A --> "; cin>>Na; }while (Na<1 || Na>10);   int *A = new int[Na];//   int **M = new int *[Na]; // for (int i = 0; i<Na; i++){ M[i] = new int [Na]; }   int M2[4][4] = { 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };   int A2[4] = {1, 2, 3, 4};   MakeSet(A,Na,15);// SortMas(A,Na); // do {   system("cls"); cout<<"\n\n\n"; cout<<" MENU: \n"; cout<<" 1) Output the matrix of truth for the relationship antisymmetry... \n"; cout<<" 2) Output the matrix of truth for the relationship transitivity... \n"; cout<<" 3) Check the properties of relations... \n"; cout<<" If you want to EXIT input 0\n"; cout<<" Please make your choice. --> ";   cin>>key; // putchar (key);     switch (key){ case 1:{ system("cls"); cout<<"\n DEMO of antisymmetry relation: R = ((b >= a) && (a+b)^2 % 3!= 0)? 1: 0"; for (int i = 0; i<Na; i++){ for (int j = 0; j<Na; j++){ M[i][j] = ((A[j] >= A[i]) && (A[i]+A[j])*(A[i]+A[j]) % 3!= 0)? 1:0; } } Display(A,Na,M); cout<<"\n\n Press any key!> "; getch(); break; } case 2:{ system("cls"); cout<<"\n."; cout<<"\n DEMO of transitivity relation: R = A:B? 1: 0"; for (int i = 0; i<Na; i++){ for (int j = 0; j<Na; j++){ M[i][j] = (A[i] % A[j] == 0)? 1:0; } } Display(A,Na,M); cout<<"\n\n Press any key!> "; getch(); break; } case 3:{ system("cls"); cout<<"\n Check the properties of relation R(A)={{1,1},{1,2},{2,1},{2,2},{3,3},{4,4}}:"; Display(A2,4,M2); cout<<"\n This relation is: ";   if (ref(M2,4)) cout<<"\n -reflexive";   if (antiref(M2,4)) cout<<"\n -antireflexive";   if ((ref(M2,4) + antiref(M2,4))==0) cout<<"\n -not refleksive not antirefleksive";   if (sym(M2,4)) cout<<"\n -symmetric";   if (antisym(M2,4)) cout<<"\n -antisymmetric";   if (trans(M2,4)) cout<<"\n -transitive"; else cout<<"\n -not transitive";   cout<<"\n\n Press any key!> "; getch(); break; } }     } while (key!= 0); delete []A; for (int i = 0; i<Na; i++){ delete[] M[i]; } delete[] M; return 0; }

 





:


: 2017-01-21; !; : 2128 |


:

:

: , .
==> ...

2126 - | 1768 -


© 2015-2024 lektsii.org - -

: 0.108 .