User Tools

Site Tools


opus:fall2012:dmckinn2:discretepart1

discrete Keyword 1

left projection

Definition

Left Projection, in programming logic always returns the left-side value in a Truth table. So for values P and Q in a truth table, the left projection always reflects the value of P.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • wikipedia
  • class
  • Reference 3

discrete Keyword 1 Phase 2

Left Complementation

Definition

Left Complement is similar to negation p. it is a logic operation that basically negates the p. For example if p was a 1 it would not matter what q was the result would be a 0. Likewise if p was a 0 regardless of q the result would be a 1.

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:

#include<stdio.h>
#include<stdlib.h>
char lproj(char, char);
char p;
char q;
int main()
{
 printf("P | Q | X | \n");
 printf("----------- \n");
 p = 0;
 q = 0;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 0;
 q = 1;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 1;
 q = 0;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 1;
 q = 1;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 printf("enter either 1 or 0 for P\n");
 printf(":");
 scanf("%d", &p);
 printf("enter either 1 or 0 for Q\n");
 printf(":");
 scanf("%d", &q);
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 return(0);
}
char lproj(char p, char q)
{
char x;
if(p==1)
{
    x=0;
}
if(p==0)
{
    x=1;
}
return(x);
}

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

lab46:~/src/discrete$ ./ttable
P | Q | X |
-----------
0 | 0 | 1
0 | 1 | 1
1 | 0 | 0
1 | 1 | 0
enter either 1 or 0 for P
:0
enter either 1 or 0 for Q
:1
0 | 1 | 1
opus/fall2012/dmckinn2/discretepart1.txt · Last modified: 2012/09/30 17:06 by dmckinn2