Question

please give me program that solve a Proof in  Discrete write a c program

please give me program that solve a Proof in  Discrete

write a c program

Homework Answers

Answer #1

Let us suppose, we have a boolean expression as given below:

= P v ~(P^Q)

We need to prove that the above expression is a tautology by using a Programming Language C program.

The program to generate a truth table of the above boolean expression is given below:

#include <stdio.h>
#include <stdbool.h>

int main()
{
//boolean variable declaration
bool p,q;

//display table header
printf("P Q P^Q ~(P^Q) (P v ~(P^Q)) \n");
  
//display the table data
for ( int i = 0 ; i < 4 ; i++ )
{
p = ( i >> 0 ) & 0x01;
q = ( i >> 1 ) & 0x01;

//display p and q
printf("%d ", p);
printf("%d ", q);

printf("%d %d %d\n", (p&&q), (p&&q), (p||!(p&&q)));
}
return 0;
}

OUTPUT:

A given boolean expression is a tautology if it is always true and doesn't depend upon the input. The above proposition is a tautology if the above proposition is true for all types of input values of P and Q.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write PROLOG program to solve this problem Give a binary resolution proof that is found by...
Write PROLOG program to solve this problem Give a binary resolution proof that is found by PROLOG interpreter I married a widow (lets call her W) who has a grown-up daughter (call her D). My father (F), who visited us quite often, fell in love with my step daughter and married her. Hence, my father became my son-in-law and my step-daughter became my mother. Some months later, my wife gave birth to a son (S1), who became the brother-in-law of...
Prove that {n^3} does not converge to any number. please give me detailed proof, thanks
Prove that {n^3} does not converge to any number. please give me detailed proof, thanks
a) Write Chebyshev’s inequality both for discrete and continuous random variables without proof. c) When Chebyshev’s...
a) Write Chebyshev’s inequality both for discrete and continuous random variables without proof. c) When Chebyshev’s inequality doesn’t give any information about the spread of a random variable? d) Compare Chebyshev’s inequality with 68-95-99.7 rule in the case of normally distributed random variable. Which one gives stronger result in this case?
Please give me 2 examples of : 1. stochastic processes with discrete parameter spaces and continuous...
Please give me 2 examples of : 1. stochastic processes with discrete parameter spaces and continuous state spaces 2. stochastic processes with continuous parameter spaces and discrete state spaces 3. stochastic processes with discrete parameter spaces and continuous state spaces 4. stochastic processes with continuous parameter spaces and continuous state spaces
Can you solve this C program by using Function? Q1. Write a C program to ring...
Can you solve this C program by using Function? Q1. Write a C program to ring the computer bell at any number of times you specify. Use the system clock as a delay, you need to include the time header file.
java thread question. Could you please give me a multiple thread program example that all threads...
java thread question. Could you please give me a multiple thread program example that all threads run in parallel?
pl use R code to do that and show me the program In c give the...
pl use R code to do that and show me the program In c give the correct F value using the anova table you generated. In c, give the correct P-value using the anova table you generated. In c , give the correct unadjusted R2, expressed as a percentage. c.scv Low Moderate VeryHigh 6 4 8 8 10 19 6 5 19 6 7 10
Using C++ code, write a program named q5.cpp to solve the equation 2n = 14.27 for...
Using C++ code, write a program named q5.cpp to solve the equation 2n = 14.27 for n.
Question Rewrite the following C program using switch-case statement. and give me an output please use...
Question Rewrite the following C program using switch-case statement. and give me an output please use printf and scanf #include<stdio.h> int main(void) {      int semester;           printf("What is your Studying Level (1-8)?> ");      scanf("%d" , &semester);      if(semester == 1 || semester == 2)           printf("Your are a freshman!\n ");      else if(semester == 3 || semester == 4)           printf("Your are sophomore!\n ");      else if(semester == 5 || semester == 6)           printf("Your are...
please write a proof: There exists a minimum value of k ∈ N such that for...
please write a proof: There exists a minimum value of k ∈ N such that for every positive integer n ≥ k, ∃x, y ∈ N ∪ {0} such that n = 4x + 7y.