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

I have got a designing dilema. I have a class named UserAccount that represent
Please suppose I have a function that accepts a pointer as a parameter. This
I've heard it said that the Entity Framework is overkill or that it's difficult
As Knuth said, We should forget about small efficiencies, say about 97% of the
It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd
It has been said that C# can be regarded as a functional programming language,
Very basic question - but I couldn't find an answer. I have got a
I am using dshownet(first time) and C#. I have got a sample to take
Hi Masters Of Web Development. I have a not that simple question this time.
Rather than population said DOM object with an external page such as HTML CFM

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.