Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: A "but" operator.

by dragonchild (Archbishop)
on Sep 27, 2004 at 18:35 UTC ( #394282=note: print w/ replies, xml ) Need Help??


in reply to Re^2: A "but" operator.
in thread A "but" operator.

"A but B" <=> "A and !B". Which, scarily enough, is equivalent to "!(A -> B)" (A implies B, or "if A, then B"). Which, if you think and squint, makes a weird kind of sense.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

I shouldn't have to say this, but any code, unless otherwise stated, is untested


Comment on Re^3: A "but" operator.
Re^4: A "but" operator.
by Plankton (Priest) on Sep 27, 2004 at 20:30 UTC

    I think you are trying to say a "but" operator is equivalent "not and" operator and that !(A->B) is equivalent to "but". I am assuming that "!" symbolizes the negation operator and "->" symbolized the if-then ( or implies ) operator.

    Yet ...
    PQP->Q
    TTT
    TFF
    FTT
    FFT

    PQP and Q!(P and Q)
    TTTF
    TFFT
    FTFT
    FFFT
    So I would say "A and !B"is not equivalent to "!(A -> B)" and I wouldn't say "A but B" <=> "A and !B", but I could just be misunderstanding your notation. :)

    As far a what a but operator is I would say it should be equivalent to the "Boolean And" operator. And is not needed in a programming language. The word "but" is used in commonly to emphasis that an assumption is false. Example ...

    If a student where to errorously assume that multiplaction is 
    the same as addition the student might state ...
    
    
    1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 and 1 * 1 = 2
    
    
    ... which we know to be false.  The student's teacher would say ...
    
    
    1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 but 1 * 1 != 2
    
    
    ... to correct the student.
    
    
    This is the same as
    
    
    1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 and 1 * 1 != 2
    
    
        T and T and T and T is TRUE
    
    
    It is not equal to
    
    
    1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 and not (1 * 1 != 2)
    
    
    
         T and T and T and F is FALSE
    

    But merely gives emphasis to the fact that the student's assumption is false.

    Janitored by davido: removed excess spaces within pre tags that caused horizontal scrolling.


    Plankton: 1% Evil, 99% Hot Gas.
      You forgot a couple ...
      P and not Q!(P -> Q)
      FF
      TT
      FF
      FF

      Hence, the relation holds.

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      I shouldn't have to say this, but any code, unless otherwise stated, is untested

        Ahh! I see. I don't know why I was thinking you meant nand !(P and Q). I misunderstood your notation I guess.

        The student's teacher would say ...

        1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 but 1 * 1 != 2

        ... which could be written as ...

        1 + 1 = 2 and 2 + 2 = 4 and 2 * 2 = 4 and not (1 * 1 = 2)

        I get it now.

        Plankton: 1% Evil, 99% Hot Gas.
Re^4: A "but" operator.
by Velaki (Chaplain) on Sep 28, 2004 at 02:37 UTC

    Since "A but B" is really a conjunctive inversion, discursively it should be equivalent to "A and not B".

    And since "A and not B" is equivalent to "not (if A then B)", or in other words, "not (B if A)", couldn't this be said thusly, to be perly, "B unless A"?

    Thoughts?
    -v
    "Perl. There is no substitute."
      This is where predicate logic doesn't work as well as set theory. "A but B" is actually more akin to "A minus B", where A and B are both sets. Or, in Perl,
      my @A = ( ... ); my @B = ( ... ); my %B = map { $_ => !!1 } @B; # "A but B" grep { !$B{$_} } @A;

      Which is very close to the mixin concept that Perl6 will apply to the term "but".

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-08-02 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (53 votes), past polls