Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Boolean algebra

by merlyn (Sage)
on Nov 13, 2000 at 18:14 UTC ( #41305=note: print w/replies, xml ) Need Help??

in reply to Boolean algebra

I'd attempt this, but your specification is inconsistent, and as I was looking at it, I stopped working on it until you clarify. Specifically:
  • The order of variables in the output string had to be the same as the input string.
This specification cannot be used with your sample data because you have the items delivered in different orders in the subexpressions: (abdc) vs (adc-b). So are you saying:
  1. that we're permitted to select a subexpression at random with which to comply, or
  2. that your sample data would never be the actual data, or
  3. that this rule can be tossed out?
(Each of those yields a slightly different solution in my mind, because I can optimize for some things differently in each. {grin})

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: Re: Boolean algebra
by le (Friar) on Nov 13, 2000 at 18:41 UTC
    Maybe I wasn't clear.
    • The order of variables in the output string had to be the same as the input string.
    This means that
    are equally correct input strings (they are even the same expression since (a AND b AND c) OR (b AND NOT a AND c) is the same as (c AND b AND NOT a) OR (b AND c AND a)).

    But the output of the first reduction would be

    and of the second reduction

    Of course there can be many negated variables like this:
    which would result in
      Why is the second one (cb) and not (bc), since both orderings are in the input string? What permits me to pick one subexpression over the other? You still aren't clear, and the specification is still ambiguous to me.

      -- Randal L. Schwartz, Perl hacker

        Sorry for being ambigous.

        Let's start over:
        The whole expression ((...)(...)) can be simplified if the two partial expressions (inside the braces) differ in just one negated variable.

        If the whole expression can be simplified, then the result is the first partial expression without the variable that differs. (So have to pick first partial expression.)

        That's why (in these two examples) one output is (cb) and the other one is (bc)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://41305]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-04-02 05:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found