User Tools

Site Tools


opus:fall2012:mwitter3:discretepart1

discrete Keyword 1

nonimplication/difference/but not

Definition

Nonimplicion/difference/but not means that the only true output is if p is true and q is false. Everything else is false. So if p is 0 and q is 1 the output should be 0.

References

discrete Keyword 1 Phase 2

Converse Nonimplication

Definition

Converse Non-implication is the negation of the reverse of implication. implication is if … then where it is only false if the first term “p” is true and the second term “q” is false so converse non-implication is only true if the first term “p” is false and the second term “q” is true

References

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * converse nonimplication
 */
 
#include <stdio.h>
 
char nonimp(char, char);
 
int main() {
 
	char p;
	char q;
	char r;
 
	printf(" Nonimplicaton \n  Truth Table\n");
	printf("- - - - - - - -\n");
	printf("|  P | Q | X  |\n");
	printf("- - - - - - - -\n");
 
	p = 0;
	q = 0;
	printf("|  %d | %d | %d  |\n", p,q, nonimp(p,q));
 
	p = 0;
	q = 1;
	printf("|  %d | %d | %d  |\n", p,q, nonimp(p,q));
 
	p = 1;
	q = 0;
	printf("|  %d | %d | %d  |\n", p,q,nonimp(p,q));
 
	p = 1;
	q = 1;
 
	printf("|  %d | %d | %d  |\n", p,q,nonimp(p,q));
	printf("- - - - - - - - \n");
 
	printf("Number for p: ");
	scanf("%hhd%*c", &p);
 
	printf("Number for q: ");
	scanf("%hhd", &q);	
 
	printf("Number for r: ");
	scanf("%hhd", &r);
 
	printf("- -  - - - - - -\n  ");
	printf("%d | %d | %d | %d\n" ,p,q,r, nonimp(p,q));
 
 
	}
 
	char nonimp(char p, char q) {
 
	char r;
	char result;
 
	if((p == 1) & (q == 0) & (r == 0) )
		result = 0;
	else
		result = 1;
 
	return(result);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ gcc -o cnonimp cnonimp.c
lab46:~$ ./cnonimp
 Nonimplicaton 
  Truth Table
- - - - - - - -
|  P | Q | X  |
- - - - - - - -
|  0 | 0 | 1  |
|  0 | 1 | 1  |
|  1 | 0 | 0  |
|  1 | 1 | 1  |
- - - - - - - - 
Number for p: 0
Number for q: 0
Number for r: 1
- -  - - - - - -
  0 | 0 | 1 | 1
lab46:~$ 
opus/fall2012/mwitter3/discretepart1.txt · Last modified: 2012/09/30 15:56 by mwitter3