Relational Algebra & Calculus

Size: px
Start display at page:

Download "Relational Algebra & Calculus"

Transcription

1 Relational Algebra & Calculus Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1

2 Outline v Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data Practical language: SQL Declarative: say what you want, not how to get it Formal languages: Relational Algebra and Calculus Mathematical foundation for query processing 2

3 What is an Algebra? v A mathematical system consisting of: Operands: variables or values from which new values can be constructed. Operators: symbols denoting procedures that construct new values from given values. 3

4 What is Relational Algebra v Relational Algebra: Operands are relations. Each operator takes 1 or 2 relations and produces a relation. v Closure property: relational algebra is closed under the relational model. Relational operators can be arbitrarily composed! 4

5 Relational Algebra v Basic operations: Selection ( σ ) Selects a subset of rows from a relation. Projection ( π ) Deletes unwanted columns from a relation. Cross-product ( ) Allows us to combine two relations. Set-difference ( - ) Tuples in reln. 1, but not in reln. 2. Union ( ) Tuples in reln. 1 or in reln. 2. v Additional operations: Join ( ), Intersection ( ), Division ( / ), Renaming ( ρ ) Can be derived from basic operators. Not essential, but useful for writing simpler queries. 5

6 Example Instances Sailors S1 S2 22 dustin lubber yuppy lubber guppy R1 Reserves sid bid day /10/ /12/96 6

7 Projection v Retain only attributes in the projection list; delete others. v Schema of result contains exactly the fields in projection list. S2 28 yuppy lubber guppy sname yuppy 9 lubber 8 guppy 5 rusty 10 rating π ( S2) sname, rating 7

8 Projection (contd.) S2 28 yuppy lubber guppy age π age ( S2) v Projection operator has to eliminate duplicates! Real systems typically don t do duplicate elimination unless the user explicitly asks for it. (Why not?) 8

9 Selection v Select rows that satisfy the selection condition; discard others. v Schema of result identical to schema of input. S2 28 yuppy lubber guppy yuppy σ rating S >8 ( 2) 9

10 Selection (contd.) S2 28 yuppy lubber guppy σ (rating > 5 rating < 5) age < 50 (S2) 10

11 A Simple Example of Composition v Composition: result relation of an operator can be the input to another operator. 28 yuppy σ rating S >8 ( 2) sname rating yuppy 9 rusty 10 π σ ( ( S )) sname, rating rating>8 2 11

12 Union, Intersection, Set-Difference v v v Set operations: Union ( ) Intersection ( ) Set difference ( - ) Take two input relations, which must be union-compatible: Same number of fields. Corresponding fields have the the same type. What is the schema of result? S1 22 dustin lubber S2 28 yuppy lubber guppy

13 Example Set Operations S1 22 dustin lubber S2 28 yuppy lubber guppy dustin lubber guppy yuppy S1 S2 Duplicate elimination: remove tuples that have same values in all attributes. 13

14 Example Set Operations S1 22 dustin lubber S2 28 yuppy lubber guppy dustin S1 S2 31 lubber S1 S2 Duplicates? 14

15 Cross (Cartesian) Product v S1 R1: Each row of S1 is paired with each row of R1. S1 22 dustin lubber R1 sid bid day /10/ /12/96 S1 R1 (sid) sname rating age (sid) bid day 22 dustin /10/96 22 dustin /12/96 31 lubber /10/96 31 lubber /12/ /10/ /12/96 15

16 Cross-Product (contd.) (sid) sname rating age (sid) bid day 22 dustin /10/96 22 dustin /12/96 31 lubber /10/96 31 lubber /12/ /10/ /12/96 v Result schema inherits all fields of S1 and R1. Conflict: Both S1 and R1 have a field called sid. Renaming operator: ρ ( C( 1 sid1, 5 sid2), S1 R1) What if we want to find pairs s.t. S1.sid = S2.sid? 16

17 Join v Condition (theta) Join: R θ S = σ θ (R S) (sid) sname rating age (sid) bid day 22 dustin /12/96 31 lubber /12/96 S 1 R 1 S1. sid < R1. sid Result schema same as that of cross-product. But often fewer tuples, more efficient for computation. 17

18 Join v Equi-Join: A special case of condition join where the condition θ contains only equalities. bid day 22 dustin /10/ /12/96 S1 R1 sid Result schema contains only one copy of fields for which equality is specified. v Natural Join ( R w v S ): equi-join on all common fields. 18

19 Self-Join S1 22 dustin lubber S2 22 dustin lubber ρ(s1,s) ρ(s2,s) S1.rating>S2.rating S1.age<S2.age 19

20 Example Schema v Sailors(sid: integer, sname: string, rating: integer, age: integer) v Boats(bid: integer, color: string) v Reserves(sid: integer, bid: integer, day: date) 20

21 Find names of sailors who ve reserved boat #103 v Sailors(sid: integer, sname: string, rating: integer, age: integer) v Boats(bid: integer, color: string) v Reserves(sid: integer, bid: integer, day: date) v How many relations do we need to access? If more than 1, use cross-products or joins. v Filtering condition? Use selection. v Attributes to return? Use projection. 21

22 Find names of sailors who ve reserved boat #103 v Solution 1: π (( σ Re serves ) Sailors ) sname bid =103 v Solution 2: ρ ( Temp1, σ Re serves) bid =103 ρ ( Temp2, Temp1 Sailors) π sname ( Temp2) v Solution 3: π sname( σ (Re serves Sailors)) bid =103 Algebraic equivalence! 22

23 Find names of sailors who ve reserved a red boat v Sailors(sid: integer, sname: string, rating: integer, age: integer) v Boats(bid: integer, color: string) v Reserves(sid: integer, bid: integer, day: date) v Boat color is only available in Boats; so need an extra join: π sname (( σ color = ' red ' Boats) Re serves Sailors) 23

24 Find names of sailors who ve reserved a red or a green boat v Sailors(sid: integer, sname: string, rating: integer, age: integer) v Boats(bid: integer, color: string) v Reserves(sid: integer, bid: integer, day: date) 24

25 Find names of sailors who ve reserved a red or a green boat v Can identify all red or green boats, then find sailors who ve reserved one of these boats: ρ ( Tempboats, ( σ )) color = ' red ' color = ' green' Boats π sname ( Tempboats Re serves Sailors) v Can also define Tempboats using union. How? 25

26 Find names of sailors who ve reserved a red boat and a green boat v A single selection won t work. Why? v Instead, intersect sailors who ve reserved red boats and sailors who ve reserved green boats. sid is a key for Sailors ρ ( Tempred, π (( σ sid color = ' red ' ρ ( Tempgreen, π (( σ sid color = ' green' Boats) Re serves)) Boats) Re serves)) π sname (( Tempred Tempgreen) Sailors) Can we project onto name and then do the intersection? 26

27 Find the names of sailors who ve reserved all boats 27

28 Relational Calculus v Query has the form: ' ) ( ) *! # x1, x2,..., xn p x1, x2,..., xn # " $ + & ), & % ) - domain variables, or constants formula v Answer includes all tuples x1, x2,..., xn that make the formula! # p x1, x2,..., xn # " $ & & % be true. 28

29 Formulas v Formula is recursively defined: Atomic formulas: retrieving tuples from relations, or making comparisons of values Logical connectives:,, Quantifiers:, (optional) o x F(x) is equivalent to x F(x) 29

30 Find names of sailors rated > 7 who have reserved boat #103 Relational Algebra: π (( σ Reserves) ( σ sname bid = 103 rating> 7 Sailors)) Relational Calculus: {X sname X sid, X rating, X age Sailors(X sid, X sname, X rating, X age ) X rating > 7 X bid, X day Reserves(X sid, X bid, X day ) X bid =103 } v Where is the join? Use to find a tuple in Reserves that `joins with the Sailors tuple under consideration. 30

31 Find names of sailors who ve reserved all boats Sailors(sid: integer, sname: string, rating: integer, age: integer) Boats(bid: integer, color: string) Reserves(sid: integer, bid: integer, day: date) {X sname X sid, X rating, X age X sid, X sname, X rating, X age Sailors X bid, X color Boats ( X day X sid, X bid, X day Reserves) } v To find sailors who ve reserved all red boats: {X sname X sid, X rating, X age X sid, X sname, X rating, X age Sailors X bid, X color Boats (X color ʹ redʹ X day X sid, X bid, X day Reserves) } 31

32 Unsafe Queries, Expressive Power v Some syntactically correct calculus queries can have an infinite number of answers! Such queries are called unsafe. ( " %, * e.g., S $ S Sailors' * ) - * + $ # v Equivalence result: every query that can be expressed in relational algebra can be expressed as a safe query in relational calculus; the converse is also true. ' & *. v Query language (e.g., SQL) can express every query that is expressible in relational algebra/calculus. 32

33 Find names of sailors who ve reserved all boats {X sname X sid, X rating, X age X sid, X sname, X rating, X age Sailors X bid, X color Boats ( X day X sid, X bid, X day Reserves) } {X sname X sid, X rating, X age X sid, X sname, X rating, X age Sailors X bid, X color Boats ( X day X sid, X bid, X day Reserves) } 33

34 Find the names of sailors who ve reserved all boats v Step 1: for each sailor, check if there exists a boat that he has not reserved (called formula F). ρ(s _ neg, π sid ( (π sid Re serves) (π bid Boats) (π sid,bid Re serves))) v Step 2: find sailors for which F is not true and retrieve their names π sname ( (π sid Re serves S _ neg) Sailors ) - : the only way to express negation in relational algebra! 34

Relational Algebra and Calculus

Relational Algebra and Calculus Topics Relational Algebra and Calculus Linda Wu Formal query languages Preliminaries Relational algebra Relational calculus Expressive power of algebra and calculus (CMPT 354 2004-2) Chapter 4 CMPT 354

More information

Introduction to Data Management. Lecture #12 (Relational Algebra II)

Introduction to Data Management. Lecture #12 (Relational Algebra II) Introduction to Data Management Lecture #12 (Relational Algebra II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and exams:

More information

Relational Algebra 2. Week 5

Relational Algebra 2. Week 5 Relational Algebra 2 Week 5 Relational Algebra (So far) Basic operations: Selection ( σ ) Selects a subset of rows from relation. Projection ( π ) Deletes unwanted columns from relation. Cross-product

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) Relational Calculus Lecture 5, January 27, 2014 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational algebra The division operator and summary

More information

Database Systems Relational Algebra. A.R. Hurson 323 CS Building

Database Systems Relational Algebra. A.R. Hurson 323 CS Building Relational Algebra A.R. Hurson 323 CS Building Relational Algebra Relational model is based on set theory. A relation is simply a set. The relational algebra is a set of high level operators that operate

More information

CS5300 Database Systems

CS5300 Database Systems CS5300 Database Systems Relational Algebra A.R. Hurson 323 CS Building hurson@mst.edu This module is intended to introduce: relational algebra as the backbone of relational model, and set of operations

More information

Database Systems SQL. A.R. Hurson 323 CS Building

Database Systems SQL. A.R. Hurson 323 CS Building SQL A.R. Hurson 323 CS Building Structured Query Language (SQL) The SQL language has the following features as well: Embedded and Dynamic facilities to allow SQL code to be called from a host language

More information

Databases 2011 The Relational Algebra

Databases 2011 The Relational Algebra Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is an Algebra? An algebra consists of values operators rules Closure: operations yield values Examples integers with +,, sets

More information

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated

More information

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke Schema Refinement Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Revisit a Previous Example ssn name Lot Employees rating hourly_wages hours_worked ISA contractid Hourly_Emps

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms UMass Amherst Feb 14, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke, Dan Suciu 1 Relational Schema Design Conceptual Design name Product buys Person price name

More information

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst November 1 & 6, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 2. More operations: renaming. Previous lecture. Renaming.

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 2. More operations: renaming. Previous lecture. Renaming. Plan of the lecture G53RDB: Theory of Relational Lecture 2 Natasha Alechina chool of Computer cience & IT nza@cs.nott.ac.uk Renaming Joins Definability of intersection Division ome properties of relational

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10 & 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) Relational Calculus Lecture 6, January 26, 2016 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational calculus Relational tuple calculus Announcements:

More information

CAS CS 460/660 Introduction to Database Systems. Functional Dependencies and Normal Forms 1.1

CAS CS 460/660 Introduction to Database Systems. Functional Dependencies and Normal Forms 1.1 CAS CS 460/660 Introduction to Database Systems Functional Dependencies and Normal Forms 1.1 Review: Database Design Requirements Analysis user needs; what must database do? Conceptual Design high level

More information

Chapter 3 Relational Model

Chapter 3 Relational Model Chapter 3 Relational Model Table of Contents 1. Structure of Relational Databases 2. Relational Algebra 3. Tuple Relational Calculus 4. Domain Relational Calculus Chapter 3-1 1 1. Structure of Relational

More information

Query Processing. 3 steps: Parsing & Translation Optimization Evaluation

Query Processing. 3 steps: Parsing & Translation Optimization Evaluation rela%onal algebra Query Processing 3 steps: Parsing & Translation Optimization Evaluation 30 Simple set of algebraic operations on relations Journey of a query SQL select from where Rela%onal algebra π

More information

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and 7 RC Simulates RA. We now show that DRC (and hence TRC) is at least as expressive as RA. That is, given an RA expression E that mentions at most C, there is an equivalent DRC expression E that mentions

More information

INTRODUCTION TO RELATIONAL DATABASE SYSTEMS

INTRODUCTION TO RELATIONAL DATABASE SYSTEMS INTRODUCTION TO RELATIONAL DATABASE SYSTEMS DATENBANKSYSTEME 1 (INF 3131) Torsten Grust Universität Tübingen Winter 2017/18 1 THE RELATIONAL ALGEBRA The Relational Algebra (RA) is a query language for

More information

General Overview - rel. model. Carnegie Mellon Univ. Dept. of Computer Science /615 DB Applications. Motivation. Overview - detailed

General Overview - rel. model. Carnegie Mellon Univ. Dept. of Computer Science /615 DB Applications. Motivation. Overview - detailed Carnegie Mellon Univ. Dep of Computer Science 15-415/615 DB Applications C. Faloutsos & A. Pavlo Lecture#5: Relational calculus General Overview - rel. model history concepts Formal query languages relational

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL---Part 1

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL---Part 1 CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #3: SQL---Part 1 Announcements---Project Goal: design a database system applica=on with a web front-end Project Assignment

More information

Relational Algebra on Bags. Why Bags? Operations on Bags. Example: Bag Selection. σ A+B < 5 (R) = A B

Relational Algebra on Bags. Why Bags? Operations on Bags. Example: Bag Selection. σ A+B < 5 (R) = A B Relational Algebra on Bags Why Bags? 13 14 A bag (or multiset ) is like a set, but an element may appear more than once. Example: {1,2,1,3} is a bag. Example: {1,2,3} is also a bag that happens to be a

More information

Relational Algebra Part 1. Definitions.

Relational Algebra Part 1. Definitions. .. Cal Poly pring 2016 CPE/CC 365 Introduction to Database ystems Alexander Dekhtyar Eriq Augustine.. elational Algebra Notation, T,,... relations. t, t 1, t 2,... tuples of relations. t (n tuple with

More information

CS632 Notes on Relational Query Languages I

CS632 Notes on Relational Query Languages I CS632 Notes on Relational Query Languages I A. Demers 6 Feb 2003 1 Introduction Here we define relations, and introduce our notational conventions, which are taken almost directly from [AD93]. We begin

More information

Introduction to Data Management. Lecture #6 (Relational Design Theory)

Introduction to Data Management. Lecture #6 (Relational Design Theory) Introduction to Data Management Lecture #6 (Relational Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW#2 is

More information

CSE 562 Database Systems

CSE 562 Database Systems Outline Query Optimization CSE 562 Database Systems Query Processing: Algebraic Optimization Some slides are based or modified from originals by Database Systems: The Complete Book, Pearson Prentice Hall

More information

Computational Logic. Relational Query Languages with Negation. Free University of Bozen-Bolzano, Werner Nutt

Computational Logic. Relational Query Languages with Negation. Free University of Bozen-Bolzano, Werner Nutt Computational Logic Free University of Bozen-Bolzano, 2010 Werner Nutt (Slides adapted from Thomas Eiter and Leonid Libkin) Computational Logic 1 Queries with All Who are the directors whose movies are

More information

Introduction to Data Management. Lecture #6 (Relational DB Design Theory)

Introduction to Data Management. Lecture #6 (Relational DB Design Theory) Introduction to Data Management Lecture #6 (Relational DB Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Homework

More information

CS54100: Database Systems

CS54100: Database Systems CS54100: Database Systems Relational Algebra 3 February 2012 Prof. Walid Aref Core Relational Algebra A small set of operators that allow us to manipulate relations in limited but useful ways. The operators

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Section 2.1 Introduction Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Important for counting. Programming languages have set operations. Set theory

More information

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd. The Evils of Redundancy Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 Redundancy is at the root of several problems associated with relational

More information

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram Schema Refinement and Normal Forms Chapter 19 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Query answering using views

Query answering using views Query answering using views General setting: database relations R 1,...,R n. Several views V 1,...,V k are defined as results of queries over the R i s. We have a query Q over R 1,...,R n. Question: Can

More information

GAV-sound with conjunctive queries

GAV-sound with conjunctive queries GAV-sound with conjunctive queries Source and global schema as before: source R 1 (A, B),R 2 (B,C) Global schema: T 1 (A, C), T 2 (B,C) GAV mappings become sound: T 1 {x, y, z R 1 (x,y) R 2 (y,z)} T 2

More information

Proving simple set properties...

Proving simple set properties... Proving simple set properties... Part 1: Some examples of proofs over sets Fall 2013 Proving simple set properties... Fall 2013 1 / 17 Introduction Overview: Learning outcomes In this session we will...

More information

Schedule. Today: Jan. 17 (TH) Jan. 24 (TH) Jan. 29 (T) Jan. 22 (T) Read Sections Assignment 2 due. Read Sections Assignment 3 due.

Schedule. Today: Jan. 17 (TH) Jan. 24 (TH) Jan. 29 (T) Jan. 22 (T) Read Sections Assignment 2 due. Read Sections Assignment 3 due. Schedule Today: Jan. 17 (TH) Relational Algebra. Read Chapter 5. Project Part 1 due. Jan. 22 (T) SQL Queries. Read Sections 6.1-6.2. Assignment 2 due. Jan. 24 (TH) Subqueries, Grouping and Aggregation.

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) First-Order Theorem Proving and Vampire Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) Outline Introduction First-Order Logic and TPTP Inference Systems

More information

Languages. Theory I: Database Foundations. Relational Algebra. Paradigms. Projection. Basic Operators. Jan-Georg Smaus (Georg Lausen)

Languages. Theory I: Database Foundations. Relational Algebra. Paradigms. Projection. Basic Operators. Jan-Georg Smaus (Georg Lausen) Languages Theory I: Database Foundations Jan-Georg Smaus (Georg Lausen) Paradigms 1. Languages: Relational Algebra Projection Union and Difference Summary 26.7.2011 Relational algebra Relational calculus

More information

Background for Discrete Mathematics

Background for Discrete Mathematics Background for Discrete Mathematics Huck Bennett Northwestern University These notes give a terse summary of basic notation and definitions related to three topics in discrete mathematics: logic, sets,

More information

Equivalence Relations and Partitions, Normal Subgroups, Quotient Groups, and Homomorphisms

Equivalence Relations and Partitions, Normal Subgroups, Quotient Groups, and Homomorphisms Equivalence Relations and Partitions, Normal Subgroups, Quotient Groups, and Homomorphisms Math 356 Abstract We sum up the main features of our last three class sessions, which list of topics are given

More information

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes These notes form a brief summary of what has been covered during the lectures. All the definitions must be memorized and understood. Statements

More information

CAIM: Cerca i Anàlisi d Informació Massiva

CAIM: Cerca i Anàlisi d Informació Massiva 1 / 21 CAIM: Cerca i Anàlisi d Informació Massiva FIB, Grau en Enginyeria Informàtica Slides by Marta Arias, José Balcázar, Ricard Gavaldá Department of Computer Science, UPC Fall 2016 http://www.cs.upc.edu/~caim

More information

Mathematics Review for Business PhD Students Lecture Notes

Mathematics Review for Business PhD Students Lecture Notes Mathematics Review for Business PhD Students Lecture Notes Anthony M. Marino Department of Finance and Business Economics Marshall School of Business University of Southern California Los Angeles, CA 90089-0804

More information

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic: x NOT ~x x y AND x /\ y x y OR x \/ y Figure 1: Types of gates in a digital circuit. CS2742 midterm test 2 study sheet Boolean circuits: Boolean circuits is a generalization of Boolean formulas in which

More information

Handout 2 (Correction of Handout 1 plus continued discussion/hw) Comments and Homework in Chapter 1

Handout 2 (Correction of Handout 1 plus continued discussion/hw) Comments and Homework in Chapter 1 22M:132 Fall 07 J. Simon Handout 2 (Correction of Handout 1 plus continued discussion/hw) Comments and Homework in Chapter 1 Chapter 1 contains material on sets, functions, relations, and cardinality that

More information

CS 186, Fall 2002, Lecture 6 R&G Chapter 15

CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Schema Refinement and Normalization CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Functional Dependencies (Review)

More information

Database Design and Normalization

Database Design and Normalization Database Design and Normalization Chapter 11 (Week 12) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 1 1NF FIRST S# Status City P# Qty S1 20 London P1 300 S1 20 London

More information

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December Points Possible

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December Points Possible Name: CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December 2016 Question Points Possible Points Received 1 12 2 14 3 14 4 12 5 16 6 16 7 16 Total 100 Instructions: 1. This exam

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

Relational Calculus. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

Relational Calculus. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016 Relational Calculus Dr Paolo Guagliardo University of Edinburgh Fall 2016 First-order logic term t := x (variable) c (constant) f(t 1,..., t n ) (function application) formula ϕ := P (t 1,..., t n ) t

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 1 Course Web Page www3.cs.stonybrook.edu/ cse303 The webpage contains: lectures notes slides; very detailed solutions to

More information

Relational completeness of query languages for annotated databases

Relational completeness of query languages for annotated databases Relational completeness of query languages for annotated databases Floris Geerts 1,2 and Jan Van den Bussche 1 1 Hasselt University/Transnational University Limburg 2 University of Edinburgh Abstract.

More information

Structural Induction

Structural Induction Structural Induction In this lecture we ll extend the applicability of induction to many universes, ones where we can define certain kinds of objects by induction, in addition to proving their properties

More information

Mathematics Review for Business PhD Students

Mathematics Review for Business PhD Students Mathematics Review for Business PhD Students Anthony M. Marino Department of Finance and Business Economics Marshall School of Business Lecture 1: Introductory Material Sets The Real Number System Functions,

More information

Notes on Sets for Math 10850, fall 2017

Notes on Sets for Math 10850, fall 2017 Notes on Sets for Math 10850, fall 2017 David Galvin, University of Notre Dame September 14, 2017 Somewhat informal definition Formally defining what a set is is one of the concerns of logic, and goes

More information

2.2 Lowenheim-Skolem-Tarski theorems

2.2 Lowenheim-Skolem-Tarski theorems Logic SEP: Day 1 July 15, 2013 1 Some references Syllabus: http://www.math.wisc.edu/graduate/guide-qe Previous years qualifying exams: http://www.math.wisc.edu/ miller/old/qual/index.html Miller s Moore

More information

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M001: Green) 6 December Points Possible

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M001: Green) 6 December Points Possible Name: CIS 375 Intro to Discrete Mathematics Exam 3 (Section M001: Green) 6 December 2016 Question Points Possible Points Received 1 12 2 14 3 14 4 12 5 16 6 16 7 16 Total 100 Instructions: 1. This exam

More information

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics CSC 224/226 Notes Packet #2: Set Theory & Predicate Calculus Barnes Packet #2: Set Theory & Predicate Calculus Applied Discrete Mathematics Table of Contents Full Adder Information Page 1 Predicate Calculus

More information

Learning Goals. Relational Query Languages. Formal Relational Query Languages. Formal Query Languages: Relational Algebra and Relational Calculus

Learning Goals. Relational Query Languages. Formal Relational Query Languages. Formal Query Languages: Relational Algebra and Relational Calculus Forml Query Lnguges: Reltionl Alger nd Reltionl Clculus Chpter 4 Lerning Gols Given dtse ( set of tles ) you will e le to express dtse query in Reltionl Alger (RA), involving the sic opertors (selection,

More information

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland Discrete Mathematics W. Ethan Duckworth Fall 2017, Loyola University Maryland Contents 1 Introduction 4 1.1 Statements......................................... 4 1.2 Constructing Direct Proofs................................

More information

Database Normaliza/on. Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Database Normaliza/on. Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Database Normaliza/on Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Problems with redundancy Data (attributes) being present in multiple tables Potential problems Increase of storage

More information

Math 541 Fall 2008 Connectivity Transition from Math 453/503 to Math 541 Ross E. Staffeldt-August 2008

Math 541 Fall 2008 Connectivity Transition from Math 453/503 to Math 541 Ross E. Staffeldt-August 2008 Math 541 Fall 2008 Connectivity Transition from Math 453/503 to Math 541 Ross E. Staffeldt-August 2008 Closed sets We have been operating at a fundamental level at which a topological space is a set together

More information

Lecture 2: Syntax. January 24, 2018

Lecture 2: Syntax. January 24, 2018 Lecture 2: Syntax January 24, 2018 We now review the basic definitions of first-order logic in more detail. Recall that a language consists of a collection of symbols {P i }, each of which has some specified

More information

Introduction to Metalogic

Introduction to Metalogic Introduction to Metalogic Hans Halvorson September 21, 2016 Logical grammar Definition. A propositional signature Σ is a collection of items, which we call propositional constants. Sometimes these propositional

More information

CHAPTER 1: Functions

CHAPTER 1: Functions CHAPTER 1: Functions 1.1: Functions 1.2: Graphs of Functions 1.3: Basic Graphs and Symmetry 1.4: Transformations 1.5: Piecewise-Defined Functions; Limits and Continuity in Calculus 1.6: Combining Functions

More information

6c Lecture 14: May 14, 2014

6c Lecture 14: May 14, 2014 6c Lecture 14: May 14, 2014 11 Compactness We begin with a consequence of the completeness theorem. Suppose T is a theory. Recall that T is satisfiable if there is a model M T of T. Recall that T is consistent

More information

Incomplete Information in RDF

Incomplete Information in RDF Incomplete Information in RDF Charalampos Nikolaou and Manolis Koubarakis charnik@di.uoa.gr koubarak@di.uoa.gr Department of Informatics and Telecommunications National and Kapodistrian University of Athens

More information

Study sheet for Final CS1100 by Matt in Wed night class

Study sheet for Final CS1100 by Matt in Wed night class Study sheet for Final CS1100 by Matt in Wed night class Licensed under the GNU Free Documentation License (GFDL) http://www.gnu.org/copyleft/fdl.html Sequences have patterns; possible patterns are: 1.

More information

With Question/Answer Animations. Chapter 2

With Question/Answer Animations. Chapter 2 With Question/Answer Animations Chapter 2 Chapter Summary Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Sequences and Summations Types of

More information

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

About the relationship between formal logic and complexity classes

About the relationship between formal logic and complexity classes About the relationship between formal logic and complexity classes Working paper Comments welcome; my email: armandobcm@yahoo.com Armando B. Matos October 20, 2013 1 Introduction We analyze a particular

More information

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

BOOLEAN ALGEBRA INTRODUCTION SUBSETS BOOLEAN ALGEBRA M. Ragheb 1/294/2018 INTRODUCTION Modern algebra is centered around the concept of an algebraic system: A, consisting of a set of elements: ai, i=1, 2,, which are combined by a set of operations

More information

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R. 2. Basic Structures 2.1 Sets Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R. Definition 2 Objects in a set are called elements or members of the set. A set is

More information

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions Today s Topics Set identities Methods of proof Relationships to logical equivalences Functions Important definitions Relationships to sets, relations Special functions Set identities help us manipulate

More information

Lecture 11: Measuring the Complexity of Proofs

Lecture 11: Measuring the Complexity of Proofs IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 11: Measuring the Complexity of Proofs David Mix Barrington and Alexis Maciel July

More information

2 Metric Spaces Definitions Exotic Examples... 3

2 Metric Spaces Definitions Exotic Examples... 3 Contents 1 Vector Spaces and Norms 1 2 Metric Spaces 2 2.1 Definitions.......................................... 2 2.2 Exotic Examples...................................... 3 3 Topologies 4 3.1 Open Sets..........................................

More information

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams Contents : basic definitions and notation A set is an unordered collection of its elements (or members). The set is fully specified by its elements. Usually capital letters are used to name sets and lowercase

More information

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications What is discrete math? Propositional Logic The real numbers are continuous in the senses that: between any two real numbers there is a real number The integers do not share this property. In this sense

More information

Discrete Basic Structure: Sets

Discrete Basic Structure: Sets KS091201 MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) Discrete Basic Structure: Sets Discrete Math Team 2 -- KS091201 MD W-07 Outline What is a set? Set properties Specifying a set Often used sets The universal

More information

arxiv: v1 [cs.pl] 19 May 2016

arxiv: v1 [cs.pl] 19 May 2016 arxiv:1605.05858v1 [cs.pl] 19 May 2016 Domain Theory: An Introduction Robert Cartwright Rice University Rebecca Parsons ThoughtWorks, Inc. Moez AbdelGawad SRTA-City Hunan University This monograph is an

More information

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research Almaden. Lecture 4 Part 1

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research Almaden. Lecture 4 Part 1 Logic and Databases Phokion G. Kolaitis UC Santa Cruz & IBM Research Almaden Lecture 4 Part 1 1 Thematic Roadmap Logic and Database Query Languages Relational Algebra and Relational Calculus Conjunctive

More information

Hyperreal Numbers: An Elementary Inquiry-Based Introduction. Handouts for a course from Canada/USA Mathcamp Don Laackman

Hyperreal Numbers: An Elementary Inquiry-Based Introduction. Handouts for a course from Canada/USA Mathcamp Don Laackman Hyperreal Numbers: An Elementary Inquiry-Based Introduction Handouts for a course from Canada/USA Mathcamp 2017 Don Laackman MATHCAMP, WEEK 3: HYPERREAL NUMBERS DAY 1: BIG AND LITTLE DON & TIM! Problem

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Fall 2017 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 42 Schema Design When we get a relational

More information

ALTER TABLE Employee ADD ( Mname VARCHAR2(20), Birthday DATE );

ALTER TABLE Employee ADD ( Mname VARCHAR2(20), Birthday DATE ); !! "# $ % & '( ) # * +, - # $ "# $ % & '( ) # *.! / 0 "# "1 "& # 2 3 & 4 4 "# $ % & '( ) # *!! "# $ % & # * 1 3 - "# 1 * #! ) & 3 / 5 6 7 8 9 ALTER ; ? @ A B C D E F G H I A = @ A J > K L ; ?

More information

Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007 Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 1 / 42 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 2.1, 2.2 of Rosen Introduction I Introduction

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta CSE 2001: Introduction to Theory of Computation Fall 2013 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.eecs.yorku.ca/course/2001 9/10/2013

More information

From Constructibility and Absoluteness to Computability and Domain Independence

From Constructibility and Absoluteness to Computability and Domain Independence From Constructibility and Absoluteness to Computability and Domain Independence Arnon Avron School of Computer Science Tel Aviv University, Tel Aviv 69978, Israel aa@math.tau.ac.il Abstract. Gödel s main

More information

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 1 Introduction Foundations of Computing Science Pallab Dasgupta Professor, Dept. of Computer Sc & Engg 2 Comments on Alan Turing s Paper "On Computable Numbers, with an Application to the Entscheidungs

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 32 Schema Design When we get a relational

More information

CHAPTER 1. Preliminaries. 1 Set Theory

CHAPTER 1. Preliminaries. 1 Set Theory CHAPTER 1 Preliminaries 1 et Theory We assume that the reader is familiar with basic set theory. In this paragraph, we want to recall the relevant definitions and fix the notation. Our approach to set

More information

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook) Relations Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations Reading (Epp s textbook) 8.-8.3. Cartesian Products The symbol (a, b) denotes the ordered

More information

Exercises for Unit VI (Infinite constructions in set theory)

Exercises for Unit VI (Infinite constructions in set theory) Exercises for Unit VI (Infinite constructions in set theory) VI.1 : Indexed families and set theoretic operations (Halmos, 4, 8 9; Lipschutz, 5.3 5.4) Lipschutz : 5.3 5.6, 5.29 5.32, 9.14 1. Generalize

More information

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19 Schema Refinement and Normal Forms [R&G] Chapter 19 CS432 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational schemas: redundant storage, insert/delete/update

More information

Part II. Logic and Set Theory. Year

Part II. Logic and Set Theory. Year Part II Year 2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2018 60 Paper 4, Section II 16G State and prove the ǫ-recursion Theorem. [You may assume the Principle of ǫ- Induction.]

More information

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014 Automata Theory 2 of 22 Automata theory deals

More information