Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3611030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:49:36+00:00 2026-05-18T21:49:36+00:00

Said I have got 2 CNF logical phrases a,b and my distrib function should

  • 0

Said I have got 2 CNF logical phrases a,b and my distrib function should return the CNF form of a|b (a OR b).

Replacing rules that I’ve got are:

1) Replace p|(q&r) by (p|q)&(p|r) 
2) Replace (q&r)|p by (q|p)&(r|p) 

A prop defined this way:

datatype prop = Atom of string | Not of prop | And of prop*prop | Or of prop*prop;

The function:

local
fun doOr(prop1,prop2) = (Or(prop1,prop2))

fun distrib1 (Or(Atom(sName1),Atom(sName2) ) ) = Or(Atom(sName1), Atom(sName2) )
    |distrib1 (Or(Not(Atom(sName1) ),Atom(sName2) ) ) = Or(Not(Atom(sName1) ), Atom(sName2) )
    | distrib1 (Or(Atom(sName1),Not(Atom(sName2) ) ) ) = Or(Atom(sName1), Not(Atom(sName2) ) )
    | distrib1 (Or(Not(Atom(sName1)),Not(Atom(sName2) ) ) ) = Or(Not(Atom(sName1)), Not(Atom(sName2) ) )
    | distrib1 (Or(prop1,And(prop2,prop3) ) ) = And( distrib1(Or(prop1,prop2) ), distrib1(Or(prop1,prop3) ) ) 
    | distrib1 (Or(And(prop1, prop2), prop3) ) ) = And( distrib1(Or(prop1,prop3) ), distrib1(Or(prop2,prop3) ) ) 

in
fun distrib (prop1,prop2) = distrib1(doOr(prop1,prop2) );
end;

Well, I don’t know if the function itself is right although I just went through all the base options and the replacing rules but for now I get the above errors when the EQALOP appear after the distrib1 function and the constructors error appear the distrib function.

Why I get those errors? I am not sure but maybe I am supposed to use let and not local but then how can I transform it to a let structure?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:49:37+00:00Added an answer on May 18, 2026 at 9:49 pm

    In the last case of distrib1 you have a total of 3 opening parentheses, but 4 closing:

    | distrib1 (Or(And(prop1, prop2), prop3) ) ) =
    

    Which is why you get the the syntax error about the RPAREN.

    You’re getting an error in distrib because distrib1 has not been defined due to the syntax errors and thus it is an unknown variable. Fixing the syntax error in distrib1 will fix this too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As said in the title, I have a scrollview that should be listening for
Ok so I got this piece of vendor software that they said should be
I have got a little problem with repositioning a div that should serve as
I have a ethenet access control device that is said to be able to
In C# you can not have indexed properties. That said, how do I convert
I got a C++ program (source) that is said to work in parallel. However,
Please suppose I have a function that accepts a pointer as a parameter. This
Here is my problem: I have got a Python build script that executes several
I have website (thebyandby.com) that got hacked several weeks ago. The problem is, the
I've got an issue involving a website that I have been using VS 2008

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.