# Logical Information Programming by yudypur

VIEWS: 10 PAGES: 17

• pg 1
```									   LOGIC
INFORMATION

LOGIC INFORMATION
Proportional LOGIC

Propositional logic is the basic sciences to study the
algorithms and logic, a very important role in
programming.
The process of computer work can not be separated from
programs which will be translated by the system logic.
With proportional logic methods, we will be able to
determine the truth value (true or false) of many real
sentences simply by testing or observing its forms.
Proposition

. Is the composition of the basic logic
denoted by small letters (p, q, r, ....) which
has a truth value (true) and error (false)
can be represented by a declarative sentence

Declarative sentence is the sentence that contains
truth value true or false but it is not possible
have the score.
Example:
p: London is the capital of British-True
q: 9 plus 2 is 12 - False
Proposition

The opposite of declarative sentences is open, ie
sentences were correct value can not be determined.
Example:
Who's Where did he go?
Whether in the year 2100 there will be a doomsday?
Is today the rain?
Proportional RELATIONSHIP

To combine two or more propositions
required so-called propositional connectives
connectives are not, and, or, if-then, if-and-only-if, if-
then-else.

Proposition + propositional connectives =
Sentences

To combine the propositions with
liaison is needed syntactics rule is rule
necessary to combine between propositions and
Propositional connectives to generate sentences
SYNTACTICS RULE

Each proporsisi are sentences without any propositional connectives
a. If p is a negation sentences, the sentences also note p
b. If p and q is the conjunction of his sentences so that p and q are also
some sentences
c. If p and q is the disjunction of his sentences is p or q is also a
sentences
d. If p and q are sentences then the implication was that if p then q also
sentences
e. If p and q are sentences then it is equivalent to p if and only if q is the
sentences
f. If p, q and r is its conditional sentences so that if p then q else r is the
sentences
INTERPRETATION

Is giving the truth value (true or false) on each
symbolic logic proposition of a sentence
.
Semantic Rule (Rule Semantics) is a rule that
used to determine the "truth value" of a sentence
from the interpretation of Proposition
SEMANTIC RULE

Negative Rule (Rule of NOT)            Conjunction Rule (Rule of AND)

P           q         p and q
P             NOT p
True       True         True
True             False
True      False         False
False            True               False       True         False
False     False         False

"Negation is true if the proposition       "Conjunction is true if every
is false, and vice versa negation is        proposition is true, if one
false if the proposition is true. "        proposition is false then the
conjunction is false"
SEMANTIC RULE

Disjunction Rule (Rule of OR)

P            q          p OR q
True        True           True
True        False          True
False       True           True
False       False         False

"disjunction is true if either
proposition is true, if every
proposition is false then the
disjunction is false
NATURE OF LOGIC ALGEBRA ^ and v

   Idempotent law            Distributive Law
p p=p
p p=p                    p(qr)= ( pq)  (pr)
Legal cumulative           p(q r)= (pq)  (pr)
p p q=q
p q p=q                   Legal Identity
Associative law            pFalse= p
(p q) r = p (q
r)                       pTrue = p
(p q) r = p (q            pTrue = True
r)
pFalse= False
SIFAT LOGIKA ALJABAR ^ dan v

   Complement Law
p no t p= False
not(not p)= p
   De Morgan Law
Negation of the conjunction
and disjunction
not (pq)= not p  not q
not (pq)= not p  not q
SEMANTIC RULE

        Implication Rule                Equivalence Rule
        (Rule IF-THEN)               (Rule IF –AND ONLY IF - )

P         q      If p then q     p         q       If and only if
True      True       True        True     True           True
True      False      False       True     False         False
False        True       True        False    True          False
False        False      True        False   False           True
"The implication is false when the   "Evaluates to true if all the same
antecedent true and the                 value proposition”
consequent false"
SEMANTIC RULE

Conditional Rule
(Rule of IF-THEN-ELSE)

p        q        r     If p then q else r
True     True    True          True
True     True    False         True
True     False   True          False          "If p is true then q is true, if p is
True     False   False         False             false then the applicable r”
False    True    True          True
False    True    False         False
False    False   True          True
False    False   False         False
Example

• If (p and (not q)) then ((not p) or r), which is when the value
p = true, q = false and r = false then set the value
truth of the above sentence
.
The value q = false, then not q = true
The p-value = true and not q = true then
Value (p and (not q)) = true
The p-value = true, then not p = false
The value r = false then ((not p) or r) = false

Result : (p and (not q)) = true
((not p) or r)  false
so If (p and (not q)) then ((not p) or r) false
Metode Truth Tabel:
P   q    r   ~p      ~q   p ^ (~ q)   (~ p) or r   If A Then B
|A|         |B|

T   T    T       F   F       F            T                T

T   T    F       F   F       F            F                T

T   F    T       F   T       T            T                T

T   F    F       F   T       T            F        False
F   T    T       T   F       F            T        T

F   T    F   T       F       F            T                T

F   F    T       T   T       F            T                T

F   F    F       T   T       F            T                T
QUIZ

Determine the truth value of logic about the first sentence the
following note p = T, q = T, r = F, s = F if

1. ((if p then q) and (if q then p)) if and only if (q or not
p)

Use a truth table for about two :

2. (p and (if r then s)) if and only if ((if r then (not s))
and p)
TO .…. BE ..... CONTINUE

```
To top