Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a C program to check logical arguments for validity. Some given code: /* Argument Validator Dan Ross Oct 2016 Generates an argument in table

Implement a C program to check logical arguments for validity.

image text in transcribed

Some given code:

/* Argument Validator Dan Ross Oct 2016 Generates an argument in table format and checks the argument for validity. Given the propositions: p = "The moon is made of cheese." q = "Winter is coming." The following argument is VALID: "The moon is made of cheese or winter is coming. The moon is not made of cheese. Therefor, winter is coming." Symbolically: P1: pVq P2: !p Q: q As stored in Argument table for validation: P1 P2 Q p q pVq !p q 0 0 0 1 0 //row0 0 1 1 1 1 //row1 1 0 1 0 0 //row2 1 1 1 0 1 //row3 //0 1 2 3 4 HOWEVER, The following argument is INVALID: "The moon is made of cheese or winter is coming. The moon is made of cheese. Therefor, winter is coming." Symbolically: P1: pVq P2: p Q: q As stored in Argument table for validation: P1 P2 Q p q pVq p q 0 0 0 0 0 //row0 0 1 1 0 1 //row1 1 0 1 1 0 //row2 INVALID HERE 1 1 1 1 1 //row3 */ #include  #pragma warning( disable : 4805) #pragma warning( disable : 4800) // Required logic function prototypes, in operation precedence order. // See previous homework for truth table definitions. bool NOT(bool p); /ot bool AND(bool p, bool q); //and bool OR(bool p, bool q); //inclusive or bool XOR(bool p, bool q); //exclusive or bool IMP(bool p, bool q); //implication bool BCN(bool p, bool q); //bicondition bool MAY(bool p, bool q); //maybe bool BEC(bool p, bool q); //because /* The Argument table Column format is lil propositions, big (compound) propositions, conclusion: p, q, ... z, P1, P2, ... PN, Q Row format is all pqr value permutations in binary count order: 00 01 10 11 etc... */ #define LOTS 42 bool Argument[LOTS][LOTS]; int NLilProps; // how many lil propositions, p thru z int NBigProps; // how many big propositions, P1 thru PN /* Calculates base raised to the power exp */ int my_pow(int base, int exp) { int x = 1; for (int i = 0; i   Implement a C program to check logical arguments for validity Formal logic has many applications in computing, such as program flow control, validation of program correctness, and digital circuitry. Logic is also used to some degree by humans, and thus is useful in helping computers interact more effectively with humans. For example, the classical artificial intelligence sub-field known as 'expert systems' relies heavily on logical inference. "Live long and prosper." - Mr. Spock from Star Trek Requirements 1) You MUST implement function syntax versions of all logical operations, similar to the example given for OR and NOT, and use them EVERYWHERE in the program. See previous HW for truth tables. bool NOT (bool p) bool AND(bool p, bool q) //and (A) bool OR(bool p, bool q); //inclusive or (V) bool XOR (bool p, bool q) //exclusive or (+) bool IMP (bool p, bool q) I/implication (->) bool BCN (bool p, bool q) //bicondition () bool MAY (bool p, bool q) //maybe(?) bool BEC(bool p, bool q) //because () ot () 2) Implement ALL of the following arguments Argument 2 P1: p->r P2: p-q Argument 3 Argument 1 P1: pVo P2: P Argument 4 P1 : (p*)q)A( r->s) P2: pVr Q: qVs Argument 5 P1: p+q P2: q->r Argument 6 P1: p?r P2: p@q  Implement a C program to check logical arguments for validity Formal logic has many applications in computing, such as program flow control, validation of program correctness, and digital circuitry. Logic is also used to some degree by humans, and thus is useful in helping computers interact more effectively with humans. For example, the classical artificial intelligence sub-field known as 'expert systems' relies heavily on logical inference. "Live long and prosper." - Mr. Spock from Star Trek Requirements 1) You MUST implement function syntax versions of all logical operations, similar to the example given for OR and NOT, and use them EVERYWHERE in the program. See previous HW for truth tables. bool NOT (bool p) bool AND(bool p, bool q) //and (A) bool OR(bool p, bool q); //inclusive or (V) bool XOR (bool p, bool q) //exclusive or (+) bool IMP (bool p, bool q) I/implication (->) bool BCN (bool p, bool q) //bicondition () bool MAY (bool p, bool q) //maybe(?) bool BEC(bool p, bool q) //because () ot () 2) Implement ALL of the following arguments Argument 2 P1: p->r P2: p-q Argument 3 Argument 1 P1: pVo P2: P Argument 4 P1 : (p*)q)A( r->s) P2: pVr Q: qVs Argument 5 P1: p+q P2: q->r Argument 6 P1: p?r P2: p@

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago