Question: Please have this in Racket form, I have these equations to help out with solving this problem. and Implement a function called tautology? that takes

 Please have this in Racket form, I have these equations to

Please have this in Racket form, I have these equations to help out with solving this problem.

help out with solving this problem. and Implement a function called tautology?

and

that takes as input a fully parenthesized formula and returns true if

Implement a function called tautology? that takes as input a fully parenthesized formula and returns true if it is a tautology and false otherwise. As was the case in the previous lab, the formula will contain at least one set of parentheses for each operator, but may contain more. The best strategy for doing is to use an insight called Quine's method. It is based on the observation that if a formula, such as (p or (not p) ), is a tautology, the result of substituting p with true is a tautology and the result of substituting p with false is also a tautology. This implies a computational strategy: to evaluate whether a formula F is a tautology 1. Collect all of the propositional variables. 2. Substitute every occurrence of the first variable with \#t and every occurrence of the same variable with #f 3. Make two recursive calls to Tautology? "And" the results. 4. When all possible substitutions have been made, i.e., the formula contains only truth values, evaluate the formula and return the results. Here is an illustration, the formula ( p implies ( q and p ) is not a tautology, a fact that we discover by finding a branch in this process that evaluates to \#f replaces all instances of variable a with element val (define substitute (lambda (L a val) (cond ((null? L) '()) ;if first item is list, recur on both parts ((list? (car L)) (cons (substitute (car L) a val) (substitute (cdr L) a val))) ;if the first item is what we're hunting for, replace it w val and recur ((equal? (car L) a) (cons val (substitute (cdr L) a val))) ; otherwise, save it and recur (else (cons (car L) (substitute (cdr L) a val))) )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!