Professional Documents
Culture Documents
Propositional logic
^ Conjunction 2
V Disjunction 3
=> Conditional 4
Biconditional 5
A B ^ V ~A => NOR NAND XOR EX-
NOR
T T T T F T T F F F T
T F F T F F F F T T F
F T F T T T F F T T F
F F F F T T T T T F T
TAUTOLOGY
P Q PVQ ~P ~Q (P v Q)^(~P)^(~Q)
T T T F F F
T F T F T F
F T T T F F
F F F T T F
Continge
ncy
It is a preposition which is either true or false
depending on the truth value of its components or
preposition..
FOR EXAMPLE
~p ^ ~q
p q ~p ~q ~p ^ ~q
T T F F F
T F F T F
F T T F F
F F T T T
Logical equivalence
For example:
If we take two statements p=>q and ~q =>~p , then there
truth table values must be equal to satisfy the condition
of logical equivalence..
p q ~p ~q p=>q ~q=>~p
T T F F T T
T F F T F F
F T T F T T
F F T T T T
1. pVpp
2. p^pp
T T T T T T
F F F F F F
Commutative law
• pvq=qvp
• p^q=q^p
p q pvq qvp p^q q^p
T T T T T T
T F T T F F
F T T T F F
F F F F F F
Associative law
• (p v q) v r p v (q v r)
• (p ^ q) ^ r p ^ (q ^ r)
p q r pvq ( p v q) v r qVr p v (q v r)
T T T T T T T
T T F T T T T
T F T T T T T
T F F T T F T
F T T T T T T
F T F T T T T
F F T F T T T
F F F F F F F
Distributive law
• p ^ (q v r) (p ^ q) v (p ^ r)
• p ^ (q v r) (p ^ q) v (p ^ r)
p q r qvr p^(q v r) p^q p^r (p^q)v(p^r)
T T T T T T T T
T T F T T T F T
T F T T T F T T
T F F F F F F F
F T T T F F F F
F T F T F F F F
F F T T F F F F
F F F F F F F F
De Morgan’s law
• ~(p v q) ~p ^ ~q
• ~(p ^ q) ~p v ~q
p q (p v q) ~(p v q) ~p ~q ~p ^ ~q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
Identity law
1) p ^ T p 2) T ^ p p
3) p v F p 4) F v p p
P T P^T
P F P v F
T T T
T F T
F T F
F F F
TRANSITIVE
RULE
pq
qr
pr
Rule of detachment
P
Pq
q
EXAMPLE
(a premise) qr
(a premise)
pr
p q r pq qr pr pq ^ qr (pq) ^ (qr)
=> pr
T T T T T T T T
T T F T F F F T
T F T F T T F T
T F F F T F F T
F T T T T T T T
F T F T F T F T
F F T T T T T T
F F F T T T T T
Set Operations
26
Set operations
Set OperatiOnS
Intersection
Union Disjoint sets
27
Set OperatiOnS
AB A A
B B
Ac or A
28
Set operations: Union
U
B
A B
A
29
Set operations: Union
A
32
Set operations: Intersection
• Formal definition for the intersection of two
AB
sets: x A x B}
{x AB x A and x
{x B}
• Further examples
{2, 3, 5, 7,11,13} {1, 3, 5, 7, 9} {3,
5, 7}
{2, 3, 5, 7,11,13}
Set operations: Intersection 4
33
A B
35
Disjoint sets
• Formal definition for disjoint sets: two sets
are disjoint if their intersection is the empty
set.
• i.e. A B
examples
• Further
{1, 2, 3} and {3, 4, 5} are not disjoint
{1, 2} and are disjoint
• Their intersection is the empty set
and are disjoint!
• Their intersection is the empty set
Set operations: Difference 36
U
B
AB
A B A
Set operations: Difference 37
• Formal definition for the difference of two
sets:
AB x A x B}
A{
xB x A and x
{x B}
A A A U A
c
• Further examples
{2, 3, 5, 7,11,13} {1, 3, 5, 7, 9}
{2,11,13}
c
Set operations: Symmetric 38
Difference
• Formal definition for the symmetric difference of
two sets:
AB{x xABx
A B}
A B ( A B) ( A B)
A B ( A B) (B A)
Further examples
{2, 3, 5, 7,11,13} {1, 3, 5, 7, 9} {2,11,13,1,
9}
39
B
AB BA
A
Complement sets 40
c U
B
B
A
Ac
Complement sets
• Formal definition for the complement of a
set
A c A U
A U {1, 2,
3, ...,10}
A 3,
Ac U A {1, 2, 4,
{2,5,3,
6, 7, 8, 9,10} {2, 3,
5, 7} c5, 7}
A {1, 4, 6, 8, 16
Exp.:
U {1, 2, 3, ...,10} 42
A {2, 3, 5, 7}
B {2, 4, 5, 6, 8,10}
A B {3, 7}
B A {4, 6, 8,10}
A B {2, 3, 4, 5, 6, 7,
8,10}
A B {2, 5}
Formal Methods
REHMAT ULLAH
Formal Methods
CICS provides
1. Data access
2. Communications
3. Integrity
4. Security services
Abstract.
Concise.
Complete
Unambiguous.
Cost-effective.
Maintainable.
Comprehensible.
Propositional logic
true
false,
but not both
Example
• A tomato is a fruit.
• An orange is a fruit.
&
If we know that
Christmas Day = 25thDecember,
and that
25thDecember falls on a Sunday this year
Then we may apply the [eq-sub] rule and conclude that
Christmas Day falls on a Sunday this year
We have to learn,
Quantifier
Negation Of Quantifier
Quantifier
The use of phrases like ‘ there exists ’ and ‘ for all ’
or ‘ for every’ is abundant in mathematics .
These phrases are called as Quantifiers .
Example:
1. For every x R, x 0 0 x
x 2 1
2. There exists x R such
that
Answer:
2. For every x R , x2
1st-order predicate logic
Every boy who loves Mary hates every boy who Mary loves.
Z,
Object-Z,
VDM,
Larch
Specification Language Z
1. Schema Name
2. Variable Declarations
3. Predicate
Z Schema
state spaces
operations.
Identifiers in Z
Set Membership:
Set Equality:
{ 3, 6, 7 } = { 7, 6, 3, 6 }
SETS
• Correctness
• Completeness
• Unambiguous (one interpretation)
• Precision (unnecessary detail suppressed)
• Verifiable and traceable
• Independent from design
• Consistent (no conflicting features)
• Concise (lack of noise, irrelevant features)
Z schema
Z schema Inclusion
Z schema Inclusion
Types
Types
Types
(∀x : T •A)
This is true when A holds for all values x of type T. Here x is a said to be a
quantified or bound variable.
Existential Quantification
(∃x : T •A)
Relations
Phone Directory Specification
Add Number
Get & Remove Entry
Combining Schemas
• The set of users of the system is exactly the union of those who
are in and those who are out.
Example Specification:
Check-In/Check-Out
Example Specification:
Check-In/Check-Out
Robust Operations
Example Specification:
Check-In/Check-Out