x404.co.uk
http://www.x404.co.uk/forum/

Semantics
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=13059
Page 1 of 1

Author:  Fogmeister [ Thu Mar 17, 2011 10:46 am ]
Post subject:  Semantics

Just trying to work out what I think a logical/boolean expression should result in.

If a, b, c and d are all boolean values/expressions and I had an expression...

(a AND b) OR (c AND d)

then the expression is true if either a and b are both true or c and d are both true.

If I had the expression...

a AND (b OR c) AND d

then this would be true only if a and d are true and either of b or c (or both) is true.

But what if I had the expression...

a AND b OR c AND d

How would the expression work? Or would it depend on the language being used?

Purely a semantics question just out of interest.

Author:  forquare1 [ Thu Mar 17, 2011 11:16 am ]
Post subject:  Re: Semantics

From the Boolean logic page on Wikipedia:
Quote:
Mathematicians and engineers often use plus (+) for OR and a product sign (.) for AND. OR and AND are somewhat analogous to addition and multiplication in other algebraic structures, and this notation makes it very easy to get sum of products form for normal algebra. NOT may be represented by a line drawn above the expression being negated. It also commonly leads to . giving a higher precedence than +, removing the need for parenthesis in some cases.


So, would it be:
(a AND b) or (c AND d)

The expression is true if both a and b are true, OR if c and d are true.

Author:  Fogmeister [ Thu Mar 17, 2011 12:05 pm ]
Post subject:  Re: Semantics

forquare1 wrote:
From the Boolean logic page on Wikipedia:
Quote:
Mathematicians and engineers often use plus (+) for OR and a product sign (.) for AND. OR and AND are somewhat analogous to addition and multiplication in other algebraic structures, and this notation makes it very easy to get sum of products form for normal algebra. NOT may be represented by a line drawn above the expression being negated. It also commonly leads to . giving a higher precedence than +, removing the need for parenthesis in some cases.


So, would it be:
(a AND b) or (c AND d)

The expression is true if both a and b are true, OR if c and d are true.

Ah, cool!

Thank you!

Author:  finlay666 [ Thu Mar 17, 2011 1:32 pm ]
Post subject:  Re: Semantics

Easiest way is to use parenthesis as there is no penalty on excessive parenthesis usage (as it's stripped out during compilation anyway) and it aids in readability :)

Author:  Fogmeister [ Thu Mar 17, 2011 2:15 pm ]
Post subject:  Re: Semantics

finlay666 wrote:
Easiest way is to use parenthesis as there is no penalty on excessive parenthesis usage (as it's stripped out during compilation anyway) and it aids in readability :)

(((That)(')(s)) (my) (usual) (approach)(.))

:D

But just came across a bit that didn't have any and wondered how it would work. I wrote a bit of code to try some values but just thought I'd ask aswell :D

Author:  John_Vella [ Mon Mar 21, 2011 3:31 pm ]
Post subject:  Re: Semantics

Fogmeister wrote:
finlay666 wrote:
Easiest way is to use parenthesis as there is no penalty on excessive parenthesis usage (as it's stripped out during compilation anyway) and it aids in readability :)

(((That)(')(s)) (my) (usual) (approach)(.))

:D

But just came across a bit that didn't have any and wondered how it would work. I wrote a bit of code to try some values but just thought I'd ask aswell :D

I agree!

(.)(.) <-- For JJ :lol: :D

</Totally pointless post>

Author:  Fogmeister [ Mon Mar 21, 2011 3:41 pm ]
Post subject:  Re: Semantics

John_Vella wrote:
Fogmeister wrote:
finlay666 wrote:
Easiest way is to use parenthesis as there is no penalty on excessive parenthesis usage (as it's stripped out during compilation anyway) and it aids in readability :)

(((That)(')(s)) (my) (usual) (approach)(.))

:D

But just came across a bit that didn't have any and wondered how it would work. I wrote a bit of code to try some values but just thought I'd ask aswell :D

I agree!

(.)(.) <-- For JJ :lol: :D

</Totally pointless post>

ROFL!

I was wondering who would be the first person to do that :D

:lol:

Author:  EddArmitage [ Mon Mar 21, 2011 4:31 pm ]
Post subject:  Re: Semantics

John_Vella wrote:
(.)(.) <-- For JJ :lol: :D

Yoshi peering through a letter box!

Author:  finlay666 [ Mon Mar 21, 2011 4:44 pm ]
Post subject:  Re: Semantics

John_Vella wrote:
(.)(.) <-- For JJ :lol: :D



I prefer

( , )( , ) <-- tassels/pasties ;)

Author:  Fogmeister [ Mon Mar 21, 2011 10:52 pm ]
Post subject:  Re: Semantics

Was trying to think of another one and discovered this version of Yoshi peering through a letter box...

( .Y. )

:D

Author:  EddArmitage [ Mon Mar 21, 2011 11:03 pm ]
Post subject:  Re: Semantics

Fogmeister wrote:
Was trying to think of another one and discovered this version of Yoshi peering through a letter box...

( .Y. )

:D

Yeah. Me and Nick (Miners) have found quite a number. He's got a dirtier mind than me, though.

Author:  John_Vella [ Wed Mar 23, 2011 3:18 pm ]
Post subject:  Re: Semantics

finlay666 wrote:
John_Vella wrote:
(.)(.) <-- For JJ :lol: :D



I prefer

( , )( , ) <-- tassels/pasties ;)


Leaking...? :lol: :roll:

Author:  finlay666 [ Wed Mar 23, 2011 3:21 pm ]
Post subject:  Re: Semantics

John_Vella wrote:
Leaking...? :lol: :roll:


That would be

Code:
( . ) ( . )
  .     .
  .     .

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/