

To detail the treasure of a Mathematica indication coercion a given be of input treasures, you can accuracy the reanimation operator /. followed by a roll of reanimation rules. Coercion issue the treasure of x + y if x = 3 and y = 8 is In[1]: = x + y /. {x rightarrow 3, y rightarrow 8} Quenched[1]: = 11 The treasure of p Lambda q when p is sham and q is gentleman is In[2]: = p && q /.{p rightarrow Sham, q rightarrow Gentleman} Quenched[2]: = Sham Write a Mathematica business satisfypqr [pqrExpr-, pval_, qval_, rval_] that returns the accuracy treasure of a close indication explicit in stipulations of variables p, q, and r. Coercion issue if satisfypqr is denominated with the input p q r and the treasures p gentleman and q, r sham, the business seduce and quenchedput are In[3]: = satisfypqr[p || q || r, Gentleman, Sham, Sham] Quenched[3]: = Gentleman If satisfypqr is denominated with the input p Lambda (q r) and the treasures p gentleman and q, r sham, the business seduce and quenchedput are In[4]: = satisfypqr[p && (q || r), Gentleman, Sham, Sham] Quenched[4]: = Sham Print quenched and succumb the code coercion your satisfypqr business. Also succumb the business seduce and quenchedput coercion (p rightarrow q) (q Lambda (p r)) with p. q, r total sham.
Business definition:
// Parameters: indication,pValue,qValue,rValue
satisfypqr[expression,pValue,qValue,rValue]:=
return indication /. {p->pValue,q->qValue,r->rValue}
Sample run:
Given Indication is equiponderant to: (‘p || ‘q) || (‘q && (p || r))
In chaste logic is closely equiponderant to
and by De Morgan’s Law closely equiponderant to
pTreasure = Sham
qTreasure = Sham
rTreasure = Sham
In[4]:= satisfypqr[(‘p || ‘q) || (‘q && (p || r)),False,False,False]
Out[4]:= Gentleman