QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Dimster on August 23, 2020, 11:16:57 pm

Title: Implied
Post by: Dimster on August 23, 2020, 11:16:57 pm
Has anyone worked with the relational operator "IMP"? The wiki doesn't give an example of it in a code. Wondering what the limits are to Implications in formulas. For example will it take a resultant value and imply a color ( a<= 13 IMP color Red) or is there a way for it to take a string value (Blue$ IMP Boys$ AND Pink$ IMP Girls$)??
Title: Re: Implied
Post by: SpriggsySpriggs on August 23, 2020, 11:58:56 pm
From the help page in the IDE:

Quote
The IMP logical operator converts the result of two comparative values and returns a bit result.

Syntax:
     result = firstValue IMP secondValue

Description:
  • Returns a different result from AND, OR or XOR.
  • Evaluates if firstValue implies secondValue.
  • If firstValue is true then secondValue must also be true.
  • So if firstValue is true, and secondValue false, then the condition is false, otherwise it is true.
I don't know what it is saying. "Different result". How is it different? I have no clue what they are IMPlying.
Here is a Microsoft Doc on the IMP operator. Still confused.
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/imp-operator (https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/imp-operator)
Title: Re: Implied
Post by: luke on August 24, 2020, 02:04:15 am
It's just another bitwise logical operator like AND, OR or XOR.

A truth table for all the logical operators is given on http://www.qb64.org/wiki/Boolean

IMP corrrsponds to the formal logic concept of implication, but if you're not familiar with that just stick with the truth table.

I've never found a use for it.
Title: Re: Implied
Post by: bplus on August 24, 2020, 02:18:01 am
Yeah it's for bit manipulations:
Code: QB64: [Select]
  1. _TITLE "IMP versus AND OR XOR" 'b+ 2020-08-24
  2. ' ref: http://qb64.org/wiki/IMP
  3. SCREEN _NEWIMAGE(900, 120, 32)
  4. _DELAY .25
  5. PRINT " A", " B", "NOT B", "A AND B", "A or B", "A XOR B", "A EQV B", "A IMP B"
  6. A = -1: B = -1: PRINT A, B, NOT B, A AND B, A OR B, A XOR B, A EQV B, A IMP B
  7. A = -1: B = 0: PRINT A, B, NOT B, A AND B, A OR B, A XOR B, A EQV B, A IMP B
  8. A = 0: B = -1: PRINT A, B, NOT B, A AND B, A OR B, A XOR B, A EQV B, A IMP B
  9. A = 0: B = 0: PRINT A, B, NOT B, A AND B, A OR B, A XOR B, A EQV B, A IMP B
  10.  

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

The one application I can think of is wiring / coding connections with x amount of pins in your robot or printer but that may have changed since USB.
Title: Re: Implied
Post by: Dimster on August 24, 2020, 09:30:28 am
Thanks. I appreciate the comments of this unloved relational operator.
Title: Re: Implied
Post by: TempodiBasic on August 24, 2020, 12:57:07 pm
Thanks for the lesson to Dimster, luke, SpriggysSpriggs and Bplus!

So IMP implies and it works giving TRUE if the second item is TRUE or if it is Equal to the first!
You can get TRUE using IMP if the 2 items are the same or if you pass from FALSE to TRUE but not vice versa.

Thanks to Bplus for the immediate comparative table:
 so we can see that  XOR and EQV are complementar,
NOT is selfcomplementary
while AND, OR and IMP have no complementar operator.
The complementar operator is that can revert, bringing back to the original state, the result tha has been got using the initial operator.

Ah logic, you conquer our brains!

@Dimster
about
Quote
I appreciate the comments of this unloved relational operator
another not so used operator is XOR, but often we use OR at the place of XOR with no problem because we use it (OR) evaluating conditions that are mutual self-excludent (conditions that if the first  is TRUE the second cannot be TRUE and so we avoid the answer TRUE if all the two conditions are TRUE:  think about the X of a sprite that moves itself into a square form 10 to 200 as X axis. We often type code like this.... if x+Xacceleration <= 10 OR x+Xacceleration >=200 then Xacceleration = - Xacceleration to change direction of the sprite... but the logical correct operator is XOR because if for a magic wonder X is in the same time <=0 and >=200 we change continuosely Xacceleration ( the direction of movement) getting a stuck sprite on the screen. But we are lucky that the two conditions are mutual excludent.

Thanks also to read my long post!
Title: Re: Implied
Post by: Dimster on August 24, 2020, 01:42:15 pm
Here's an attempt to apply IMP. Hoping to input a color which is then to imply a gender but I'm missing something. Perhap the assignment of what implies what is more complicated.

Code: QB64: [Select]
  1. a = 1 ' Male
  2. b = 2 ' Female
  3. c = 3 'Blue
  4. d = 4 'Pink
  5.  
  6.  
  7.  
  8. Resultm = c IMP a
  9. Resultm2 = a IMP c
  10. Resultf = d IMP b
  11. Resultf2 = b IMP d
  12.  
  13. INPUT " 3 or 4   ", x
  14.  
  15. IF x = 3 THEN x$ = "Blue"
  16. IF x = 4 THEN x$ = "Pink"
  17.  
  18. ' Given the Color what is the Gender
  19.  
  20.  
  21.     CASE IS = a
  22.         PRINT "Case a = "; a
  23.         PRINT "Color of x$ is "; x$
  24.         PRINT "Value of Resultm$ is "; Resultm$
  25.         PRINT "Value of Resultm2$ is "; Resultm2$
  26.         SLEEP
  27.  
  28.     CASE IS = b
  29.         PRINT "Case b = "; b
  30.         PRINT "Color of x$ is "; x$
  31.         PRINT "Value of Resultm$ is "; Resultm$
  32.         PRINT "Value of Resultm2$ is "; Resultm2$
  33.         SLEEP
  34.  
  35.     CASE IS = c
  36.         PRINT "Case c = "; c
  37.         PRINT "Color of x$ is "; x$
  38.         IF Resultm = -1 THEN Resultm$ = "Male"
  39.         IF Resultm2 = -1 THEN Resultm2$ = "Male"
  40.         IF Resultm <> -1 XOR Resultm2 <> -1 THEN
  41.             Resultm$ = "Unknown"
  42.             Resultm2$ = "Unknown"
  43.         END IF
  44.         PRINT "Value of Resultm$ is "; Resultm$
  45.         PRINT "Value of Resultm2$ is "; Resultm2$
  46.         SLEEP
  47.  
  48.     CASE IS = d
  49.         PRINT "Case d = "; d
  50.         PRINT "Color of x$ is "; x$
  51.         IF Resultf = -1 THEN Resultf$ = "Female"
  52.         IF Resultf2 = -1 THEN Resultf2$ = "Female"
  53.         IF Resultf <> -1 XOR Resultf2 <> -1 THEN
  54.             Resultf$ = "Unknown"
  55.             Resultf2$ = "Unknown"
  56.         END IF
  57.         PRINT "Value of Resultf$ is "; Resultf$
  58.         PRINT "Value of Resultf2$ is "; Resultf2$
  59.         SLEEP
  60.  
  61.  
  62.  
Title: Re: Implied
Post by: Gets on August 24, 2020, 10:25:22 pm
With IMP, 0 always turns a bit on and 1 always leaves it alone, so it works kind of like a bit mask where you can turn on a set of bits without effecting the rest:&B11101110 IMP X would be used to flip on the first and fifth bit in a byte, for instance.

so if a=1 and c=3 then, assuming they're unsigned bytes

c IMP a would equal 253. Only the second bit would be off.
Likewise a IMP c would equal 255, just flipping everything on

If you're not looking for those kinds of values,IMP won't help you form an association between a and c. You want to introduce some kind of unique change that you can then identify later.

Quote
Hoping to input a color which is then to imply a gender but I'm missing something.

This doesn't use IMP, but it does tag colors with gender values:

Code: [Select]


TYPE ColorType

    val AS INTEGER 'holds color value and gender tags
    title AS STRING 'name for the color

END TYPE

CONST Male = 1 'first bit
CONST Female = 2 'second bit

'A color with both bits off has no assignment, only the first bit is on is for males, only the second bit is on is for females, and both on would count as unisex

DIM Colors(10) AS ColorType

RESTORE colors
FOR i = 1 TO 10

    'since the first two bits are used to identify sex, the base color values are multiples of 4; then a random sex assignment value is added to them

    Colors(i).val = (4 * i) + INT(RND * 4)
    READ Colors(i).title

    PRINT "Color #";i; " is "; Colors(i).title; ", a color for "; GetGender$(Colors(i).val); " as can be seen by the color assignment value which is "; Colors(i).val MOD 4

NEXT i




colors:

DATA "RED","GREEN","BLUE","PURPLE","ORANGE","BROWN","BLACK","HEART","ATTACK","JACK"



FUNCTION GetGender$ (v)


    IF v AND Male THEN m = 1
    IF v AND Female THEN f = 2

    'v MOD 4 would have worked too, but only because everything in this example program is neatly arranged with multiples of 4.

    SELECT CASE m + f

        CASE 0

            GetGender$ = "which there are currently no assignments"

        CASE 1

            GetGender$ = "males!"

        CASE 2

            GetGender$ = "females!"

        CASE 3

            GetGender$ = "everyone!"



    END SELECT


END FUNCTION


Title: Re: Implied
Post by: Dimster on August 25, 2020, 08:36:58 am
Thanks Gets

I am more looking to use IMP as an association between two values. There is so little info on this relational operator and yet it appears (at least on literal english meaning of IMPLIED) to offer some useful purpose in AI. Manipulating bits and bytes doesn't appear to be referenced in the wiki, so thanks for that insight.
Title: Re: Implied
Post by: Dimster on August 25, 2020, 09:38:04 am
Here is my latest attempt at association using IMP. The result isn't what I'm looking for but Gender does go from a -1 to a zero.

Code: QB64: [Select]
  1. DIM Male
  2. DIM Female
  3. DIM Blue
  4. DIM Pink
  5. DIM Gender
  6.  
  7. Gender = Blue IMP Male AND Gender$ = "Male"
  8. Gender = Pink IMP Female AND Gender$ = "Female"
  9. PRINT "Value of Gender is "; Gender; " and the Value of Gender$ is "; Gender$
  10.  
  11.  
  12. INPUT "Type  either Pink or Blue"; Gender
  13. PRINT "Value of Gender is now "; Gender; " and the value of Gender$ is "; Gender$  
Title: Re: Implied
Post by: SMcNeill on August 25, 2020, 10:28:22 am
It goes from -1 to 0, due to this line:

INPUT "Type  either Pink or Blue"; Gender

Gender is defined as a SINGLE variable type, so hitting "Pink" on the keyboard gives you a value of 0....
Title: Re: Implied
Post by: SMcNeill on August 25, 2020, 10:44:23 am
I have a feeling you're doing something completely wrong here.

Gender = Blue IMP Male AND Gender$ = "Male"
Gender = Pink IMP Female AND Gender$ = "Female"

AND, in both these instances are binary operators.   When evaluating the results, what you'd have is basically:

Gender = Blue IMP (Male AND (Gender$ = "Male"))  -- IMP seems to evaluate last in this order of operations.  Personally, I find this odd, as I expected it to evaluate at the same precedence level as AND does.  I would've solved this problem as Gender = (Blue IMP Male) AND (Gender$ = "Male"), which would give completely different results.  Does anyone with more experience with these commands know which is the proper sequence?  Is QB64 bugged here, or is my thinking just off, and it's something which might need expanding upon in the wiki a little more?

Since Gender$ = "", when we evaluate Gender$ = "Male", we get a value of 0, which gives us:

Gender = Blue IMP (Male AND 0)

Now, since Male is 0, we can evaluate 0 AND 0, which gives us a value of 0.  We now have:

Gender = Blue IMP 0.  Since Blue is 0, we're basically doing a 0 IMP 0 calculation, which gives us a value of -1.

Gender = -1

And the same process occurs with the second statement, since all the values we substitute into the formula stays the same.



IMP is a math operation, much like addition.  It simply compares two binary values and then returns a result based on that comparison.  It's definitely not used the way you're attempting to use it.

Title: Re: Implied
Post by: luke on August 25, 2020, 11:28:41 am
I don't have the QB manual handy because I'm lying in bed, but the precedence should be something like (from lowest to highest):
Code: [Select]
IMP
EQV
XOR
OR
AND
NOT
=, <>, <, >, <=, >=
+, - (subtraction)
MOD
\
*, /
- (negation)
^
Title: Re: Implied
Post by: Dimster on August 25, 2020, 04:09:04 pm
Took me a minute Mr. Gets - Jack gets all the girls and everyone else gets a heart attack. I'm trying to study your code to see if I can make more sense of "bit" manipulation and I total over looked the message being printed. Loved it.
Title: Re: Implied
Post by: TempodiBasic on August 26, 2020, 07:10:48 am
for Italian users that are not so strong in English language I find this webpage
https://www.olderprogram.com/numeri/numeri6.htm#:~:text=Gli%20operatori%20logici%20vengono%20impiegati,ossatura%20di%20tutti%20i%20programmi.&text=IMP%20restituisce%200%20solo%20se,ambedue%20gli%20operatori%20sono%20uguali. (https://www.olderprogram.com/numeri/numeri6.htm#:~:text=Gli%20operatori%20logici%20vengono%20impiegati,ossatura%20di%20tutti%20i%20programmi.&text=IMP%20restituisce%200%20solo%20se,ambedue%20gli%20operatori%20sono%20uguali.)

and this article about IMP
http://forum.masterdrive.it/visual-basic-6-17/lha-visto-loperatore-logico-imp-41456/ (http://forum.masterdrive.it/visual-basic-6-17/lha-visto-loperatore-logico-imp-41456/)
Title: Re: Implied
Post by: TempodiBasic on August 26, 2020, 08:55:54 am
an extensive talking is here
https://en.wikipedia.org/wiki/Material_conditional (https://en.wikipedia.org/wiki/Material_conditional) (EN)
https://it.wikipedia.org/wiki/Implicazione_logica (https://it.wikipedia.org/wiki/Implicazione_logica) (IT)

here we can read that A implies B has the meaning  A is condition to be B and B is neccessary condition for A
for example A = rain  B = clouds,
 so the rain is  the condition to (be) the clouds (it doesn't rain without clouds) 
and B is necessary to A (clouds are necessary to rain)
 but not A is necessary to B (it can be clouds without rain).

Logic is very impressive!
Title: Re: Implied
Post by: Dimster on August 26, 2020, 09:47:55 am
Thanks for those articles Tempodi - Feels the word "Implies" is the wrong descriptor for IMP. I've taken implication to be much less definitive, or a weaker connection than a "material" connection. So the statement "Blue implies Male" can be universally understood as a weak connection, the reverse "Male implies Blue" is not so well received unversally. Your example of "clouds" and "rain" do have the same material connection whether it's expressed "Rain implies Clouds" or "Clouds implies Rain"

IMP should be MIMP ie Material Implication.

I'm thinking - to use IMP then I would need at least 2 variables which are defined as material to each other

       DIM Rain
       DIM Clouds
       DIM Life

      Rain IMP Clouds
      Rain IMP Life
     Clouds IMP Rain
 
     RainStorm = Rain IMP Clouds
     NewGrowth = Rain IMP Life

Is more along the lines of assignment by associations if IMP could be used in an associative type of way. Seems I will need to GETS me to a library and learn a lot more on bits and bytes and the math of relational operators before I can force my computer to let me assign by my layout above.

Title: Re: Implied
Post by: bplus on August 26, 2020, 12:27:21 pm
@Dimster

You might be interested in this:
https://link.springer.com/chapter/10.1007/978-3-319-64021-1_6#:~:text=Propositional%20logic%20is%20the%20study,is%20either%20true%20or%20false.&text=Predicate%20calculus%20includes%20predicates%2C%20variables,of%20a%20statement%20can%20have.
You can see Table 6.4 Implication TF Table matches exactly the pattern for QB64 IMP bit math operator. But your attempts to use bit math for Logical Implication requires some more background knowledge.

It would be interesting to see Logic problems or puzzles solved with QB64.
Title: Re: Implied
Post by: Dimster on August 26, 2020, 01:45:07 pm
Thanks bplus - i'll definitely look into it. A lot of interesting subjects in that Concise Guide to Formal Methods.
Title: Re: Implied
Post by: bplus on August 26, 2020, 03:07:47 pm
Thanks bplus - i'll definitely look into it. A lot of interesting subjects in that Concise Guide to Formal Methods.

Oh hey, I didn't even notice the title, yeah I think I will check out more of the book as well :)

Update: Shoot I was thinking there was more access, but it's gone now.
Title: Re: Implied
Post by: Dimster on August 28, 2020, 02:15:14 pm
Ok, Here's my latest attempt - I'm moving in on it. This time I forced materialty (i think) by making blue = male and pink = female, but as you can see the results are not yet correct.

Code: QB64: [Select]
  1. Female = 100
  2. Male = 101
  3. Pink = 100
  4. Blue = 101
  5.  
  6. 'Kolor = Female IMP Male
  7. 'IF Kolor = 0 THEN Kolor$ = "Pink"
  8. 'IF Kolor = -1 THEN Kolor$ = "Blue"
  9. 'PRINT Kolor; " Kolor = 0 then false : Kolor <> 0 then true"
  10. 'PRINT Kolor$
  11. 'PRINT
  12.  
  13.  
  14. 'SLEEP
  15. PRINT "If Gender = 0 then Implication is False :  Gender <> 0 then Implication is True"
  16. Gender1 = Pink IMP Female
  17. IF Gender1 = 0 THEN Gender1$ = "Male"
  18. IF Gender1 <> 0 THEN Gender1$ = "Female"
  19. PRINT "Gender1 value is "; Gender1
  20. PRINT "Pink implies "; Gender1$
  21. Gender2 = Blue IMP Female
  22. IF Gender2 = 0 THEN Gender2$ = "Gender Unknown"
  23. IF Gender2 <> 0 THEN Gender2$ = "Female"
  24. PRINT "Gender2 value is "; Gender2
  25. PRINT "Blue implies "; Gender2$
  26. Gender3 = Pink IMP Male
  27. IF Gender3 = 0 THEN Gender3$ = "Gender Unknown"
  28. IF Gender3 <> 0 THEN Gender3$ = "Male"
  29. PRINT "Gender3 value is "; Gender3
  30. PRINT "Pink implies "; Gender3$
  31. Gender4 = Blue IMP Male
  32. IF Gender4 = 0 THEN Gender4$ = "Male"
  33. IF Gender4 <> 0 THEN Gender4$ = "Female"
  34. PRINT "Gender4 value is "; Gender4
  35. PRINT "Blue implies "; Gender4$

So Back to the F'n M'n drawing board.
Title: Re: Implied
Post by: Gets on August 28, 2020, 04:35:24 pm
Because the topic was about the IMP operator there was a focus on bit manipulation in the replies, but you don't need to worry about that if you just want to associate colors with gender.

I had something similar in the example I posted earlier, but

Code: [Select]

Type Colordata

Col as string
gender as string

End type

Dim Colors(10) as Colordata

Colors(1).Col="Blue"
Colors(1).gender="Male"



That's the simplest form. The array will keep the associated colors and gender together, so you can just manually enter them.

If you really want to have a color *imply* a gender, then you don't need the IMP operator, you  can just create a function that checks each color for qualities that determine what gender to associate it with:


Code: [Select]

Function AssignGender(col as _unsigned long)

Male=1
Female=2

    IF _BLUE32(col) > 200 AND _RED32(col) < 200 THEN AssignGender = Male

    IF _RED32(col) > 200 AND _BLUE32(col) < 200 THEN AssignGender = Female

END FUNCTION



If you send a 32-bit color value to that function(using RGB32 (https://www.qb64.org/wiki/RGB32)), then it will perform a simple check and return a result that's either Male(1), Female(2) or neither(0). In this example, a comparatively large amount of blue implies that the color is for males while red implies that it's for females. But you can create  whatever conditions you want, and based on what you tell it it will return the appropriate gender for every single 32 bit color.


It's definitely worth looking into how bits work and will help your understanding of what's actually happening in your programs;variable limits, how things work in memory, etc. But for the actual problem in front of you, you should focus on getting it to *work* in the simplest form possible. Once  you've done that, you can save the program and slowly improve it to be more efficient, dynamic, procedural etc. See if you can get the program to work using what you already understand, and then do the experimenting safely on top of that or separately.
Title: Re: Implied
Post by: Dimster on August 28, 2020, 05:19:33 pm
You are absolute right - I don't need IMP - you have provided a couple of excellent workarounds.

But we have IMP and it seems to stand for "implied". The other relational operators - And, Or, Xor - all appear to be logical in their application - if I AND something I know the two go together - if I OR something, it's one or the other - Xor'ing something gets me it could be the one, or it could be the other.  IMP however has logic in that I understand that one value could IMPly another value but it somehow doesn't work LOGICALLY. It really doesn't seem to imply the other value at all. At least I haven't been able to make a formula where A IMP B to my logical understanding of the result.

As you pointed out in an earlier post, it simply turns a bit on or off and if that's the case , then we are more into machine language than Basic.

Just read where IMP performs the same way as NOT(A) OR B. I'm going to play with this idea.

Thanks Gets. I think I will eventually need to adapt your two excellent work arounds. And if I can't make Basic logical use of IMP then perhaps I'll start a petion to remove it from the Basic lexigon as a Relational Operator as one that doesn't really IMPLY anything.

Title: Re: Implied
Post by: SMcNeill on August 28, 2020, 06:31:07 pm
Logically, we can use IMP to decide if you're a recognized sentintent creature.

Are you living?
Are you dead?

Yes, Yes --> you are a zombie.
Yes, no --> you are a valid sentintent creature.
No, yes --> you are a corpse.
No, no --> you are a non-living object, like a rock.

In QB64, this would be:

INPUT "ARE YOU LIVING (-1 FOR YES, 0 FOR NO)"; living
INPUT "ARE YOU DEAD (-1 FOR YES, 0 FOR NO); dead
Result = living IMP dead
IF result = 0 THEN
   PRINT "YOU ARE A SENTIENT CREATURE"
ELSE
    PRINT  "YOU ARE SOMETHING NON-SENTIENT."
END IF

It's IMPlied that if you're living, and not dead, then you're a sentient creature.
Title: Re: Implied
Post by: SMcNeill on August 28, 2020, 06:51:15 pm
Another logic exercise on IMP:

Do you have a sandwich?
Are you hungry?

With IMP, we can determine ARE YOU LIKELY TO HAVE A SANDWICH LATER?

Yes, Yes = No.  You have a sandwich, but you're hungry.  You'll eat it and not have one later.
Yes, no = yes.  You have a sandwich, you're not hungry.  No reason you won't still have it later.
No, no = no.  You're not hungry, but have no sandwich.  One won't magically appear for you.
No, yes = no.  You're hungry, but have no sandwich.  One won't magically appear for you, and you're just going to get hungrier.

Title: Re: Implied
Post by: Dimster on August 29, 2020, 08:50:13 am
Ah, thanks Steve - so that is how I would assign values and use IMP. Very much appreciated. Would love to see your example in the wiki. I hereby withdraw my petition for removal of IMP, it clearly does work.
Title: Re: Implied
Post by: SMcNeill on August 29, 2020, 10:23:42 am
Honestly, I've never found any real use for IMP.  Basically it's a shortcut for:

IF NOT (condition1 AND NOT condition2) THEN...


Can't say I've ever needed something so convoluted in my programs before.  I suppose, if I ever do, I'll probably just write out the long form, as above, as IMP simply isn't part of my common-use toolset and I'd never remember it to make use of it.  ;)
Title: Re: Implied
Post by: bplus on August 29, 2020, 10:36:43 am
It just hit me, if A implies B then A is a subset of B or equivalent to B, no subset of A is outside B (thinking Venn Diagrams).


And NOT A could be in B or in NOT B.
Title: Re: Implied
Post by: Dimster on August 29, 2020, 10:39:09 am
I heard ya Steve. I'm interested in trying to use it with a data base of Elastic/Inelastic relationships between 2 seperate events. At the moment AND, OR, XOR have very singular hard connecting results as in Yes or No. Whereas the IMPLIED, thanks to you, I can now use YES,YES = NO. Suttle but a little less binary. Stringing IMP's or Nesting IMP's may have my program thinking more like a human than a computer. Anyway, just a thought I had and most often gets abandoned as the failures to compute rise.
Title: Re: Implied
Post by: Dimster on August 29, 2020, 11:04:20 am
I guess that's right bplus = if A = 1,2,3,4,5 and it Implies the next number will be 6, then B must be 1,2,3,4,5,6 which does make A a subset of B.
And the number 6 is NOT in A, it could be in B ... however "or in NOT B" ... NOT B would in fact be A and we know 6 is not in A, so would that last part actually read

And NOT A could be in B or NOT(in NOT B) ???

Title: Re: Implied
Post by: luke on August 29, 2020, 11:35:46 am
Basically it's a shortcut for:

IF NOT (condition1 AND NOT condition2) THEN...
Or even just IF NOT condition1 OR condition2 THEN :)
Title: Re: Implied
Post by: bplus on August 29, 2020, 12:01:37 pm
Quote
And NOT A could be in B or NOT(in NOT B) ???

Well NOT (NOT B) gets us back to B again ;-))

Just saying if A implies B in Venn diagram then A must be a subset of B.
Title: Re: Implied
Post by: SMcNeill on August 29, 2020, 12:05:09 pm
Or even just IF NOT condition1 OR condition2 THEN :)

Good catch.  Your syntax is probably one we'd actually see more often than mine would be.  :D
Title: Re: Implied
Post by: Dimster on August 29, 2020, 01:34:10 pm
Ya Luke that was one expression I was about to explore and it works. Here's Steve test with your syntax

Code: QB64: [Select]
  1. INPUT "ARE YOU LIVING (-1 FOR YES, 0 FOR NO)"; living
  2. INPUT "ARE YOU DEAD (-1 FOR YES, 0 FOR NO)"; dead
  3. Result = NOT (living) OR dead
  4. IF Result = 0 THEN
  5.     PRINT "YOU ARE A SENTIENT CREATURE"
  6.     PRINT "YOU ARE SOMETHING NON-SENTIENT."