PREDICATES AND QUANTIFIERS
Lecture # 7
1
TERMINOLOGY REVIEW
Proposition:
- A statement that is either true or false
- Must always be one or the other!
Example:
The sky is red
Not a proposition: x + 3 > 4
Boolean variable:
- A variable (usually p, q, r,

SET THEORY
Lecture # 09
SETS
A well defined collection of cfw_distinct objects is
called a set.
The
objects are called the elements or
members of the set.
Sets are denoted by capital letters A, B,
C , X, Y, Z.
The elements of a set are represented by
low

ARGUMENTS
Lecture # 05
In Todays Lecture
Logic:
Logic rules and principles is to distinguish an
argument is valid or invalid.
Examples of Arguments:
You have a intuitive idea about argument. When you are
talking with you friend you give argument.
Sometime

NESTED QUANTIFIERS
Lecture # 8
1
NESTED QUANTIFIER
Nested Quantifier, where one quantifier is
within the scope of another, such as:
xy (x + y = 0).
Note:
Everything within the scope of a quantifier can be
thought of as a propositional function.
2
Example:

Discrete Structures/Mathematics
BSCS (3 Credit Hour)
Lecture # 01
Introduction
Discrete structures/mathematics has special
relevance to computer science.
Computer is a binary machine and all the
algorithms in computer science are based on
binary digits 0

RULES OF INFERENCE
Lecture # 06
RULES OF INFERENCE &
PROPOSITIONAL LOGIC
We always use a truth table to show that an
argument form is valid.
We do this by showing that whenever the
premises are true, the conclusion must also be
true. This can be a tedious

LAWS OF LOGIC
Lecture # 03
Applying Laws of Logic
Using laws of logic simplify the statement
form.
p [~(~p q)]
Solution:
p [~(~p) (~q)]
DeMorgans Law
p [p(~q)]
Double Negative Law
[p p](~q)
Associative Law for
p (~q)
Indempotent Law
This is the simpl

SET IDENTITIES
Lecture # 10
SETS IDENTITIES
Let A, B, C be subsets of a universal set U.
Idempotent Laws
a. A A = A b. A A = A
Commutative Laws
a. A B = B A b. A B = B A
Associative Laws
a. A (B C) = (A B) C
b. A (B C) = (A B) C
Distributive Laws
a. A (B

DOUBLE IMPLICATION/BICONDITIONAL
Lecture # 04
Truth table for EXCLUSIVE OR
(p q) ~ (p q)
T
p
q
T
p
q
T
~
(pq)
F
(p q) ~ (p
q)
F
T
F
T
F
T
T
F
T
T
F
T
T
F
F
F
F
T
F
p
q
T
EXCLUSIVE OR
In English when we use OR in this sense, when we say
p or q. It means e

Discrete Structures
BSCS (3 Credit Hour)
Lecture # 02
Truth tables
Truth
tables for:
~pq
~ p (q ~ r)
(p q) ~ (p q)
Truth table for the statement form ~ p q
~p ~ p q
F
F
p
T
q
T
T
F
F
F
F
T
T
T
F
F
T
F
Truth table for ~ p (q ~ r)
p q r
T
T
T
T
F
F
F
F
T
T

import java.util.Scanner;
public class Overloading cfw_
public void add(Time t,String c,int x)
cfw_
switch(c)
cfw_
case "h":
cfw_
int a,b;
b=t.hour+x;
if(b>24)cfw_
a=b%24;
System.out.println("Hours:Minutes:Seconds\n"+" "+a+":"+t.min+":"+t.sec

Syntax Analyzer
CHAPTER#4
Syntax Analyzer
Parsing methods that are typically used in compilers
By design, every programming language has precise rules that
prescribe the syntactic structure of well-formed programs
The syntax of programming language constr

Lexical Analyzer
CH # 3
Instructor : Afifa Wajid
Course: Compiler Construction
Role of Lexical Analyzer
Specifying the lexeme patterns to a lexical-analyzer generator and
compiling those patterns into code that functions as a lexical analyzer.
This appr

Asymptotic
Asymptotic Notation,
Notation,
Review
Review of
of Functions
Functions &
&
Summations
Summations
November 3, 2016
Comp 122, Spring 2004
Asymptotic Complexity
Running time of an algorithm as a function of
input size n for large n.
Expressed us

Important Insructions:
Assignment will be done individually.
Each student will submit this assignment to the relevant lab instructor.
Label the folder with the name of student , reg # and section.
Any kind of cheating will awarded negative 5 marks.
A

LAB 12 (Dynamic Memory Allocation)
1) Write a function that reverses the elements of an array in place. In other words, the last
element must become the first; the second from the last become the second, and so on.
The function must accept only ne pointer