scala programming language
£20-250 GBP
Paid on delivery
I have done this solution but required some changes as mentioned below
you have
def isFormula(e: Expr): Boolean =
e match {
case Lit(x) = > x == 0 II x = = 1
case Var(x) => true
case Two("&&", -' e1, e2) = > isFormula(e1) &&
isFormula(e2)
case Three("//", -' e1, e2) = > isFormula(e1) &&
isFormula(e2)
}
but this is not proper Scala syntax and the case Three is totally wrong as
there are no expressions with 3 operands. The One case is missing too.
it should be something like
def isFormula(e: Expr): Boolean =
e match {
case Lit(x) => x == 0 || x == 1
case Var(x) => true
case Two("&&", op, e1, e2) => isFormula(e1) && isFormula(e2)
case Two("//", op, e1, e2) => isFormula(e1) && isFormula(e2)
}
So try to add the One case to this and add to the Two cases also the ‘implies' and ‘equiv’.
In the isTautology you have
def isTautology(e: Expr): Option[Boolean] = {
// First of all, check that e represents a formula. If not, then
// no meaningful analysis can be applied, so return None.
if (!isFormula(e))
None
// At this point e must be a logical expression so the following
// code will determine whether or not it represents a tautology.
e match {
case Lit(x) = > x != 0 II x != 1
case Var(x) => true
case Two("&&", -' e1, e2) = > !isFormula(e1) &&
!isFormula(e2)
case Three("//", -' e1, e2) = > !isFormula(e1) &&
!isFormula(e2)
}
}
but of course this doesn’t make any sense at all as you just pasted
a bit of the isFormula into it and put in a negation in the operands.
So try first to make the isFormula working.
I need this solution within 1 days.
Project ID: #28960684
About the project
Awarded to:
Hi I can help you with this. I've done a lot of functional programming and I love it. I'd like to know about this more.
3 freelancers are bidding on average £109 for this job
Hi, I am a certified developer, Used Scala for most of my applications and deployed successfully with in the timeframe. Please let’s discuss and discuss more on problems which you are facing. Thank you, Naresh
Hello successful buyer My name is Ana I have go through your request and its fully understand I do your work perfectly And I will deliver your work within 24 hours Kindly contact me for more discussion on this proj More