P, q and r are not connected anyhow there. If you read on, later you will find out the other side of truth table, and that is an expression that makes a truth table make sense. For example, this is a truth table of `and` operator:
p q |p ∧ q
----------------
1 1 | 1
1 0 | 0
0 1 | 0
0 0 | 0
Truth table can be constructed for any operator combination. In chapter 5.2, page 5, they put `x` where `p ∨ q ⇒ q ∧ r` is false (instead of making new column containing values of `p ∨ q ⇒ q ∧ r`).
on some of the results shown (click show results), it implies it is OK if p & q => r I.E p & q = 0 and then 0 => 1 wtf? Only 1 => 1 no? How does a false imply a true?
This is the story about implication: It is possible for cause not to happen, but consequence still to be true (due to some other possible causes). In fact any truth assignment is possible except cause to be true and consequence to be false. If cause is there, consequence must be also there.
False can imply true, here is the proof:
False -> True
---------------------
(¬False) ∨ True
---------------------
True ∨ True
---------------------
True
The interpretation could be: within lies could be anything, including a truth.
Let's try the other way around:
True -> False
---------------------
(¬True) ∨ False
---------------------
False ∨ False
---------------------
False
The interpretation would be that within truth there can't be lies.
used rules of inference are:
A -> B ⊢ ¬A ∨ B
¬True ⊢ False
¬False ⊢ True
It's like saying if you are alive and smoke then you won't make it. Both conditions must be true - "AND"
YouSmoke -> YouDontMakeIt
The interpretation is as you read IF you smoke THEN you won't make it. But it is also possible not to smoke, and not to make it anyway because i.e. you regularly run across a highway, or you regularly swim with sharks.
Thank you Ivan.
I am starting by converting the simplest logic to source code.
When it works with the simplest logic as source code, then I think
there is a point in building upon that foundation.
Per your request...
<script language="JavaScript">
function learn(there) {
var light=Math.floor(Math.random() * Math.floor(2));
return (there=light ? "day" : "night");
}
var there;
console.log(learn(there));
</script>
Console log displays "day" or "night" at random.