×

Close

Type:
**Note**Institute:
**
Guru govind Singh indraprastha university
**Course:
**
B.Tech
**Specialization:
**Computer Science Engineering**Downloads:
**172**Views:
**2388**Uploaded:
**10 months ago**Add to Favourite

Touch here to read

Page-1

Topic:

UNIT-I: Propositional Logic
1. Introduction to Logic:
Logic: logic comprises a (formal) language for making statements about objects and reasoning about
properties of these objects. Statements in a logical language are constructed according to a predefined set
of formation rules (depending on the language) called syntax rules. Logic languages are used instead of
natural languages as natural languages are very vast so cannot be formally described. Also, natural
languages are ambiguous, context sensitive and verbose.
A logical system , or a “logic” for short, typically consists of three things (but may consist of only the first
two, or the first and third)
1. A syntax , or set of rules specifying what expressions are part of the language of the system, and how
they may be combined to form more complex expressions/statements (often called “formulæ)”.
2. A semantics , or set of rules governing the meanings or possible meanings of expressions, and how
the meaning, interpretation, evaluation and truth value of complex expressions depend on the meaning
or interpretation of the parts.
3. A deductive system , or set of rules governing what makes for an acceptable or endorsed pattern of
reasoning within in the system
1.1. Propositional Logic:
•
•
•
•
•
•
•
•
Propositional logic is the system of logic with the simplest semantics.
Many of the concepts and techniques used for studying propositional logic generalize to first -order
logic.
In propositional logic, there are atomic assertions (or atoms, or propositional letters) and compound
assertions built up from the atoms and the logical connectives, and, or, not, implication and
equivalence.
The atomic facts are interpreted as being either true or false.
In propositional logic, once the atoms in a proposition have received an interpretation, the truth value
of the proposition can be computed. Technically, this is a consequence of the fact that the set of
propositions is a freely generated inductive closure.
Certain propositions are true for all possible interpretations. They are called tautologies. Intuitively
speaking, a tautology is a universal truth. Hence, tautologies play an important role.
A proposition is a statement that can be either true or false o “The sky is blue” o “I is a English
major” o “x == y”
Not propositions:
o “Are you Bob?” o
“x = 7”
1.1.1. Syntax and Semantic of Propositional Logic
Here we will give a purely syntactic definition of propositional logic.
• Statements of this language are propositional formulas.
HIMANSHU GULATI- Foundation of Computer Science

•
Propositional formulas are built from atoms (also known as propositional variables or elementary
propositions) , which are basic propositions, that are either true or false. For example o p = “Today is
Friday” o q = “Today is my birthday”
• Atoms are combined using logic connectives (operator) into complex formulas. For example o p q
=“Today is Friday and today is my birthday” Formally:
Propositional formula: the propositional formula is inductively defined as o Every
atom is a formula o If α and β are two formulas then o α is also formula
(Negation / logical ‘not’ denoted by or ~) o α β is also a formula
(Conjunction / logical ‘and’ denoted by ) o α β is also a formula
(Disjunction / logical ‘or’ denoted by )
o occasional we also find other connectives such as implication or conditional (→) ,
double implication or bi-conditional or equivalence( ).
Logical operators: Not( or ~)
• A not operation switches (negates) the truth value
• Symbol: or ~
•
p = “Today is not Friday” Truth table is shown is fig-
Logical operators: And( )
• An and operation is true if both operands are true
• Symbol:
• p q = “Today is Friday and today is my birthday”
• truth table is given in figure
Logical operators: Or ( )
• An or operation is true if either operands are true
• Symbol:
• p q = “Today is Friday or today is my birthday (or possibly
both)”
• truth table is given in figure
Logical operators: Conditional( )
• A conditional means “if p then q”
• Symbol:
• p q = “If today is Friday, then today is my birthday”
• p→q=¬p q
HIMANSHU GULATI- Foundation of Computer Science

•
•
•
•
Let p = “I am elected” and q = “I will lower taxes”
I state: p q = “If I am elected, then I will lower taxes”
Consider all possibilities
Note that if p is false, then the conditional is true regardless of whether q is true or false
•
Alternate ways of stating a conditional:
o
p implies q o If p, q o
p only if q o
p is sufficient for q o q if p o q whenever p
o
q is necessary for p o p only if q
Logical operators: Bi-conditional( )
• A bi-conditional means “p if and only if q”
• Symbol:
• Alternatively, it means “(if p then q) and (if q then p)”
• Note that a bi-conditional has the opposite truth values
of the ‘exclusive
or’.
• Let p = “You take this class” and q = “You get a grade”
• Then p q means
“You take this class if and only if you get a grade”
• Alternatively, it means “If you take this class, then you get a grade and if you get a grade then
you take (took) this class”
Logical operators: Nand and Nor
• The negation of And and Or,
respectively
• Symbols: | and ↓, respectively o
Nand: p|q ¬(p q)
o Nor: p↓q ¬(p q)
Precedence of Operator
•
Precedence order (from highest to lowest): ¬
→↔ o
The first three are the most
important
•
This means that p q
(q (¬r))) ↔ (s → t)
¬r → s ↔ t yields: (p
HIMANSHU GULATI- Foundation of Computer Science

•
Not is always performed before any other
operation Translating English Sentences
Example1:
p = “It is below freezing” q
= “It is snowing”
• It is below freezing and it is snowing : p q
•
•
•
•
•
It is below freezing but not snowing: p ¬q
It is not below freezing and it is not snowing: ¬p ¬q
It is either snowing or below freezing (or both): p q
If it is below freezing, it is also snowing: p→q
It is either below freezing or it is snowing, but it is not snowing if it is below freezing:
(p q) (p→¬q)
That it is below freezing is necessary and sufficient for it to be snowing: p↔q
Example2:
A study showed that there was a correlation between the more children ate dinners with their families and
lower rate of substance abuse by those children.
Conclusion:
• If children eat more meals with their family, they will have lower substance abuse
• If they have a higher substance abuse rate, then they did not eat more meals with their family
Let p = “Child eats more meals with family” Let
q = “Child has less substance abuse
Conclusions:
• If children eat more meals with their family, they will have lower substance abuse: p q
If they have a higher substance abuse rate, then they did not eat more meals with
their family:
q
p
• Note that p q and q
p are logically equivalent Example 3:
• “I have neither given nor received help on this exam”
Rephrased: “I have not given nor received …”
Let p = “I have given help on this exam”
Let q = “I have received help on this exam”
Translation is: p q
Bit Operations:
• Boolean values can be represented as 1 (true) and 0 (false)
• A bit string is a series of Boolean values o
10110100 is eight Boolean values in one
string
• We can then do operations on these Boolean strings o Each column is its own Boolean
operation
•
Evaluate the following:
HIMANSHU GULATI- Foundation of Computer Science

## Leave your Comments