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

Size: px
Start display at page:

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

Transcription

1 Carnegie Mellon Univ. Dep of Computer Science /615 DB Applications C. Faloutsos & A. Pavlo Lecture#5: Relational calculus General Overview - rel. model history concepts Formal query languages relational algebra rel. tuple calculus rel. domain calculus Faloutsos - Pavlo /615 #2 Overview - detailed rel. tuple calculus why? details examples equivalence with rel. algebra more examples; safety of expressions rel. domain calculus + QBE Motivation Q: weakness of rel. algebra? A: procedural describes the steps (ie., how ) (still useful, for query optimization) Faloutsos - Pavlo /615 #3 Faloutsos - Pavlo /615 #4 1

2 Solution: rel. calculus describes what we want two equivalent flavors: tuple and domain calculus basis for SQL and QBE, resp. Useful for proofs (see query optimizatio later) Rel. tuple calculus (RTC) first order logic { t P( t)} Give me tuples t, satisfying predicate P - eg: { t t STUDENT} Faloutsos - Pavlo /615 #5 Faloutsos - Pavlo /615 #6 Details Specifically symbols allowed:,,, >, <, =, (, ),,,, Atom t TABLE attr const attr s. attr' quantifiers, Faloutsos - Pavlo /615 #7 Faloutsos - Pavlo /615 #8 2

3 Specifically Formula: atom if P1, P2 are formulas, so are if P(s) is a formula, so are P1 P2; P1 P2... s( P( s)) s( P( s)) Specifically Reminders: DeMorgan P 1 P2 ( P1 P2) implication: P1 P2 P1 P2 double negation: s TABLE ( P( s)) s TABLE ( P( s)) every human is mortal : no human is immortal Faloutsos - Pavlo /615 #9 Faloutsos - Pavlo /615 #10 Reminder: our Mini-U db STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave CLASS c-id c-name units s.e o.s. 2 find all student records { t t STUDENT} TAKES SSN c-id grade A B output tuple of type STUDENT Faloutsos - Pavlo /615 #11 Faloutsos - Pavlo /615 #12 3

4 (Goal: evidence that RTC = RA) Full proof: complicated We ll just show examples of the 5 RA fundamental operators, and how RTC can handle them (Quiz: which are the 5 fundamental op s?) FUNDAMENTAL Relational operators selection projection cartesian product set union set difference σ condition π att list MALE x FEMALE R U S R - S (R) (R) Faloutsos - Pavlo /615 #13 Faloutsos - Pavlo /615 #14 (selection) find student record with ssn=123 σ selection π projection X cartesian product U set union - set difference (selection) find student record with ssn=123 { t t STUDENT ssn = 123} Faloutsos - Pavlo /615 #15 Faloutsos - Pavlo /615 #16 4

5 (projection) find name of student with ssn=123 { t t STUDENT ssn = 123} (projection) find name of student with ssn=123 { t s STUDENT ( s. ssn = 123 name = s. name)} σ selection π projection X cartesian product U set union - set difference t has only one column Faloutsos - Pavlo /615 #17 Faloutsos - Pavlo /615 #18 Tracing { t s STUDENT ( s. ssn = 123 name = s. name)} cont d (union) get records of both PT and FT students σ selection π projection X cartesian product U set union - set difference t Name aaaa. jones zzzz s STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave Faloutsos - Pavlo /615 #19 Faloutsos - Pavlo /615 #20 5

6 cont d (union) get records of both PT and FT students { t t FT _ STUDENT t PT _ STUDENT} difference: find students that are not staff σ selection π projection X cartesian product U set union - set difference (assuming that STUDENT and STAFF are union-compatible) Faloutsos - Pavlo /615 #21 Faloutsos - Pavlo /615 #22 difference: find students that are not staff { t t STUDENT t STAFF} Cartesian product eg., dog-breeding: MALE x FEMALE gives all possible couples MALE name spike spot FEMALE x name = lassie shiba M.name spike spike spot spot F.name lassie shiba lassie shiba Faloutsos - Pavlo /615 #23 Faloutsos - Pavlo /615 #24 6

7 Cartesian product find all the pairs of (male, female) { t m MALE f FEMALE m name = m. name f name = f. name} σ selection π projection X cartesian product U set union - set difference Proof of equivalence rel. algebra <-> rel. tuple calculus σ selection π projection X cartesian product U set union - set difference Faloutsos - Pavlo /615 #25 Faloutsos - Pavlo /615 #26 Overview - detailed rel. tuple calculus why? details examples equivalence with rel. algebra more examples; safety of expressions re. domain calculus + QBE More examples join: find names of students taking Faloutsos - Pavlo /615 #27 Faloutsos - Pavlo /615 #28 7

8 Reminder: our Mini-U db STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave TAKES SSN c-id grade A B CLASS c-id c-name units s.e o.s. 2 More examples join: find names of students taking { t s STUDENT e TAKES ( s. ssn = e. ssn name = s. name e. c id = )} Faloutsos - Pavlo /615 #29 Faloutsos - Pavlo /615 #30 More examples join: find names of students taking { t s STUDENT e TAKES ( s. ssn = e. ssn name = s. name e. c id = )} projection selection join More examples 3-way join: find names of students taking a 2-unit course (Remember: SPJ ) Faloutsos - Pavlo /615 #31 Faloutsos - Pavlo /615 #32 8

9 Reminder: our Mini-U db STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave TAKES SSN c-id grade A B CLASS c-id c-name units s.e o.s. 2 Faloutsos - Pavlo /615 #33 More examples 3-way join: find names of students taking a 2-unit course { t s STUDENT e TAKES c CLASS ( s. ssn = e. ssn e. c id = c. c id name = s. name c. units = 2)} projection selection join Faloutsos - Pavlo /615 #34 More examples 3-way join: find names of students taking a 2-unit course - in rel. algebra?? More examples 3-way join: find names of students taking a 2-unit course - in rel. algebra?? π name ( σ 2( STUDENT TAKES CLASS )) units = Faloutsos - Pavlo /615 #35 Faloutsos - Pavlo /615 #36 9

10 Even more examples: self -joins: find Tom s grandparent(s) Even more examples: self -joins: find Tom s grandparent(s) PC p-id Mary Peter John c-id Tom Mary Tom PC p-id Mary Peter John c-id Tom Mary Tom { t p PC q PC ( p. c id = q. p id p. p id = p id q. c id = " Tom")} Faloutsos - Pavlo /615 #37 Faloutsos - Pavlo /615 #38 Hard examples: DIVISION! Hard examples: DIVISION! find suppliers that shipped all the ABOMB parts SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 find suppliers that shipped all the ABOMB parts {t p(p ABOMB ( s SHIPMENT ( s# = s.s# s.p# = p.p#)))} Faloutsos - Pavlo /615 #39 Faloutsos - Pavlo /615 #40 10

11 General pattern! General pattern! three equivalent versions: 1) if it s bad, he shipped it { t p( p ABOMB ( P( t))} 2)either it was good, or he shipped it { t p( p ABOMB ( P( t))} 3) there is no bad shipment that he missed { t p( p ABOMB ( P( t))} three equivalent versions: 1) if it s bad, he shipped it { t p( p ABOMB ( P( t))} 2)either it was good, or he shipped it {t p(p ABOMB (P(t))} 3) there is no bad shipment that he missed { t p( p ABOMB ( P( t))} a b a b Faloutsos - Pavlo /615 #41 Faloutsos - Pavlo /615 #42 General pattern three equivalent versions: 1) if it s bad, he shipped it { t p( p ABOMB ( P( t))} 2)either it was good, or he shipped it {t p(p ABOMB (P(t))} 3) there is no bad shipment that he missed { t p( p ABOMB ( P( t))} Faloutsos - Pavlo /615 #43! x(p(x)) x( P(x)) a T F a b is the same as a b T T T b F T F If a is true, b must be true for the implication to be true. If a is true and b is false, the implication evaluates to false. If a is not true, we don t care about b, the expression is always true. Faloutsos - Pavlo /615 #44 11

12 More on division find (SSNs of) students that take all the courses that ssn=123 does (and maybe even more) find students s so that if 123 takes a course => so does s More on division find students that take all the courses that ssn=123 does (and maybe even more) { o t(( t TAKES ssn = 123) t1 TAKES( )} t1. c id = c id t1. ssn = o. ssn) Faloutsos - Pavlo /615 #45 Faloutsos - Pavlo /615 #46 FORBIDDEN: Safety of expressions It has infinite output!! Instead, always use { t t STUDENT} { t... t SOME TABLE} Overview - conclusions rel. tuple calculus: DECLARATIVE dfn details equivalence to rel. algebra rel. domain calculus + QBE Faloutsos - Pavlo /615 #47 Faloutsos - Pavlo /615 #48 12

13 General Overview relational model Formal query languages relational algebra rel. tuple calculus rel. domain calculus Rel. domain calculus (RDC) Q: why? A: slightly easier than RTC, although equivalent - basis for QBE. idea: domain variables (w/ F.O.L.) - eg: find STUDENT record with ssn=123 Faloutsos - Pavlo /615 #49 Faloutsos - Pavlo /615 #50 Rel. Dom. Calculus find STUDENT record with ssn=123 { < s, a >< s, a > STUDENT s = 123} Details Like R.T.C - symbols allowed:,,, >, <, =,,,, (, ), quantifiers, Faloutsos - Pavlo /615 #51 Faloutsos - Pavlo /615 #52 13

14 Details but: domain (= column) variables, as opposed to tuple variables, eg: ssn < s, a > STUDENT name address Reminder: our Mini-U db STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave TAKES SSN c-id grade A B CLASS c-id c-name units s.e o.s. 2 Faloutsos - Pavlo /615 #53 Faloutsos - Pavlo /615 #54 find all student records (selection) find student record with ssn=123 { < s, a >< s, a > STUDENT } RTC: { t t STUDENT} Faloutsos - Pavlo /615 #55 Faloutsos - Pavlo /615 #56 14

15 ( Proof of RDC = RA) Agai we show examples of the 5 fundamental operators, in RDC (selection) find student record with ssn=123 RTC: { t t STUDENT ssn = 123} Faloutsos - Pavlo /615 #57 Faloutsos - Pavlo /615 #58 (selection) find student record with ssn=123 { < 123, n, a >< 123, a > STUDENT } or { < s, a >< s, a > STUDENT s = 123} (projection) find name of student with ssn=123 { < n > < 123, a > STUDENT } RTC: { t t STUDENT ssn = 123} Faloutsos - Pavlo /615 #59 Faloutsos - Pavlo /615 #60 15

16 (projection) find name of student with ssn=123 { < n > a( < 123, a > STUDENT )} cont d (union) get records of both PT and FT students need to restrict a RTC: { t s STUDENT ( s. ssn = 123 name = s. name)} RTC: { t t FT _ STUDENT t PT _ STUDENT} Faloutsos - Pavlo /615 #61 Faloutsos - Pavlo /615 #62 cont d (union) get records of both PT and FT students difference: find students that are not staff { < s, a > < s, a > FT _ STUDENT < s, a > PT _ STUDENT} RTC: { t t STUDENT t STAFF} Faloutsos - Pavlo /615 #63 Faloutsos - Pavlo /615 #64 16

17 difference: find students that are not staff { < s, a > < s, a > STUDENT < s, a > STAFF} Cartesian product eg., dog-breeding: MALE x FEMALE gives all possible couples MALE name spike spot FEMALE x name = lassie shiba M.name spike spike spot spot F.name lassie shiba lassie shiba Faloutsos - Pavlo /615 #65 Faloutsos - Pavlo /615 #66 Cartesian product find all the pairs of (male, female) - RTC: Cartesian product find all the pairs of (male, female) - RDC: { t m MALE f FEMALE m name = m. name f name = f. name} Faloutsos - Pavlo /615 #67 Faloutsos - Pavlo /615 #68 17

18 Cartesian product find all the pairs of (male, female) - RDC: Proof of equivalence rel. algebra <-> rel. domain calculus <-> rel. tuple calculus {< m, f > < m > MALE < f > FEMALE } Faloutsos - Pavlo /615 #69 Faloutsos - Pavlo /615 #70 Overview - detailed rel. domain calculus why? details examples equivalence with rel. algebra more examples; safety of expressions More examples join: find names of students taking Faloutsos - Pavlo /615 #71 Faloutsos - Pavlo /615 #72 18

19 Reminder: our Mini-U db STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave TAKES SSN c-id grade A B CLASS c-id c-name units s.e o.s. 2 More examples join: find names of students taking in RTC { t s STUDENT e TAKES ( s. ssn = e. ssn name = s. name e. c id = )} Faloutsos - Pavlo /615 #73 Faloutsos - Pavlo /615 #74 More examples join: find names of students taking in RDC Sneak preview of QBE: { < n > s a g( < s, a > STUDENT < s,15 415, g > TAKES)} { < n > s a g( < s, a > STUDENT < s,15 415, g > TAKES)} STUDENT Ssn Name Address _x P. TAKES SSN c-id grade _x Faloutsos - Pavlo /615 #75 Faloutsos - Pavlo /615 #76 19

20 STUDENT Ssn Name Address _x P. Glimpse of QBE: very user friendly heavily based on RDC very similar to MS Access interface and pgadminiii TAKES SSN c-id grade _x Faloutsos - Pavlo /615 #77 More examples 3-way join: find names of students taking a 2-unit course - in RTC: { t s STUDENT e TAKES c CLASS ( s. ssn = e. ssn e. c id = c. c id name = s. name c. units = 2)} projection selection join Faloutsos - Pavlo /615 #78 Reminder: our Mini-U db _x.p STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave TAKES SSN c-id grade A B _x _y _y 2 CLASS c-id c-name units s.e o.s. 2 Faloutsos - Pavlo /615 #79 More examples 3-way join: find names of students taking a 2-unit course { < n >... < s, a > STUDENT < s, c, g > TAKES < c, c2 > CLASS} Faloutsos - Pavlo /615 #80 20

21 More examples 3-way join: find names of students taking a 2-unit course { < n > s, a, c, g, cn( < s, a > STUDENT < s, c, g > TAKES < c, c2 > CLASS )} Faloutsos - Pavlo /615 #81 Even more examples: self -joins: find Tom s grandparent(s) PC p-id c-id PC p-id c-id Mary Tom Mary Tom Peter Mary Peter Mary John Tom John Tom Faloutsos - Pavlo /615 #82 Even more examples: self -joins: find Tom s grandparent(s) Even more examples: self -joins: find Tom s grandparent(s) { t p PC q PC ( p. c id = q. p id p. p id = p id q. c id = " Tom")} { t p PC q PC ( p. c id = q. p id p. p id = p id q. c id = " Tom")} { < g > p( < g, p > PC < p," Tom" > PC)} Faloutsos - Pavlo /615 #83 Faloutsos - Pavlo /615 #84 21

22 Even more examples: self -joins: find Tom s grandparent(s) { < g > p( < g, p > PC < p," Tom" > PC)} Hard examples: DIVISION find suppliers that shipped all the ABOMB parts SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 Faloutsos - Pavlo /615 #85 Faloutsos - Pavlo /615 #86 Hard examples: DIVISION find suppliers that shipped all the ABOMB parts Hard examples: DIVISION find suppliers that shipped all the ABOMB parts {t p(p ABOMB ( s SHIPMENT ( s# = s.s# s.p# = p.p# )))} {t p(p ABOMB ( s SHIPMENT ( s# = s.s# s.p# = p.p# )))} {< s > p(< p > ABOMB < s, p > SHIPMENT )} Faloutsos - Pavlo /615 #87 Faloutsos - Pavlo /615 #88 22

23 More on division find students that take all the courses that ssn=123 does (and maybe even more) { o t(( t TAKES ssn = 123) t1 TAKES( )} t1. c id = c id t1. ssn = o. ssn) More on division find students that take all the courses that ssn=123 does (and maybe even more) { < s > c( g( < 123, c, g > TAKES ) g'( < s, c, g' > ) TAKES ))} Faloutsos - Pavlo /615 #89 Faloutsos - Pavlo /615 #90 similar to RTC FORBIDDEN: Safety of expressions {< s,a > < s,a > STUDENT } Overview - detailed rel. domain calculus + QBE dfn details equivalence to rel. algebra Faloutsos - Pavlo /615 #91 Faloutsos - Pavlo /615 #92 23

24 Fun Drill:Your turn Your turn Schema: Movie(title, year, studioname) ActsIn(movieTitle, starname) Star(name, gender, birthdate, salary) Queries to write in TRC: Find all movies by Paramount studio movies starring Kevin Bacon Find stars who have been in a film w/kevin Bacon Stars within six degrees of Kevin Bacon* Stars connected to K. Bacon via any number of films** * Try two degrees for starters ** Good luck with this one! Faloutsos - Pavlo /615 #93 Faloutsos - Pavlo /615 #94 Answers Answers Find all movies by Paramount studio Movies starring Kevin Bacon {M M Movie M.studioName = Paramount } {M M Movie A ActsIn(A.movieTitle = M.title A.starName = Bacon ))} Faloutsos - Pavlo /615 #95 Faloutsos - Pavlo /615 #96 24

25 Answers Stars who have been in a film w/kevin Bacon {S S Star A ActsIn(A.starName = S.name A2 ActsIn(A2.movieTitle = A.movieTitle A2.starName = Bacon ))} S: name A: A2: movie movie Faloutsos - Pavlo /615 #97 star star Bacon Answers two Stars within six degrees of Kevin Bacon {S S Star A ActsIn(A.starName = S.name A2 ActsIn(A2.movieTitle = A.movieTitle A3 ActsIn(A3.starName = A2.starName A4 ActsIn(A4.movieTitle = A3.movieTitle A4.starName = Bacon ))} Faloutsos - Pavlo /615 #98 Two degrees: Two degrees: S: name S: name A: movie star A2: movie star A3: movie star A3: movie star A4: movie star Bacon A4: movie star Bacon Faloutsos - Pavlo /615 #99 Faloutsos - Pavlo /615 #100 25

26 Answers Expressive Power Stars connected to K. Bacon via any number of films Sorry that was a trick question Not expressible in relational calculus!! What about in relational algebra? No RA, RTC, RDC are equivalent Faloutsos - Pavlo /615 #101 Expressive Power (Theorem due to Codd): Every query that can be expressed in relational algebra can be expressed as a safe query in RDC / RTC; the converse is also true. Relational Completeness: Query language (e.g., SQL) can express every query that is expressible in relational algebra/calculus. (actually, SQL is more powerful, as we will see ) Faloutsos - Pavlo /615 #102 Summary The relational model has rigorously defined query languages simple and powerful. Relational algebra is more operational/procedural useful as internal representation for query evaluation plans Relational calculus is declarative users define queries in terms of what they want, not in terms of how to compute i Summary - cnt d Several ways of expressing a given query a query optimizer chooses best plan. Algebra and safe calculus: same expressive power => relational completeness. Faloutsos - Pavlo /615 #103 Faloutsos - Pavlo /615 #104 26

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

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

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 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 & Calculus

Relational Algebra & Calculus Relational Algebra & Calculus Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Outline v Conceptual Design: ER model v Logical Design: ER to relational model v Querying and

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

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

Completeness for FOL

Completeness for FOL Completeness for FOL Overview Adding Witnessing Constants The Henkin Theory The Elimination Theorem The Henkin Construction Lemma 12 This lemma assures us that our construction of M h works for the atomic

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

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database CSE 303: Database Lecture 10 Chapter 3: Design Theory of Relational Database Outline 1st Normal Form = all tables attributes are atomic 2nd Normal Form = obsolete Boyce Codd Normal Form = will study 3rd

More information

Tuple Relational Calculus

Tuple Relational Calculus Tuple Relational Calculus Université de Mons (UMONS) May 14, 2018 Motivation S[S#, SNAME, STATUS, CITY] P[P#, PNAME, COLOR, WEIGHT, CITY] SP[S#, P#, QTY)] Get all pairs of city names such that a supplier

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

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

Advanced DB CHAPTER 5 DATALOG

Advanced DB CHAPTER 5 DATALOG Advanced DB CHAPTER 5 DATALOG Datalog Basic Structure Syntax of Datalog Rules Semantics of Nonrecursive Datalog Safety Relational Operations in Datalog Recursion in Datalog The Power of Recursion A More

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

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago COSC 430 Advanced Database Topics Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago Learning objectives and references You should be able to: define the elements of the relational

More information

ER Modelling: Summary

ER Modelling: Summary ER Modelling: Summary ER describes the world (the set of possible worlds) what it is and the laws of this world ER is static: it does not describe (legal) transitions Useful for two purposes build software

More information

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh Functional Dependencies and Normalization Instructor: Mohamed Eltabakh meltabakh@cs.wpi.edu 1 Goal Given a database schema, how do you judge whether or not the design is good? How do you ensure it does

More information

Exercise Sheet 1: Relational Algebra David Carral, Markus Krötzsch Database Theory, 17 April, Summer Term 2018

Exercise Sheet 1: Relational Algebra David Carral, Markus Krötzsch Database Theory, 17 April, Summer Term 2018 Exercise Sheet 1: Relational Algebra David Carral, Markus Krötzsch Database Theory, 17 April, Summer Term 2018 Exercise 1.1. Consider a cinema database with tables of the following form (adapted from a

More information

Predicate Calculus lecture 1

Predicate Calculus lecture 1 Predicate Calculus lecture 1 Section 1.3 Limitation of Propositional Logic Consider the following reasoning All cats have tails Gouchi is a cat Therefore, Gouchi has tail. MSU/CSE 260 Fall 2009 1 MSU/CSE

More information

Introduction to Database Systems CSE 414. Lecture 20: Design Theory

Introduction to Database Systems CSE 414. Lecture 20: Design Theory Introduction to Database Systems CSE 414 Lecture 20: Design Theory CSE 414 - Spring 2018 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data Unit

More information

Definite Logic Programs

Definite Logic Programs Chapter 2 Definite Logic Programs 2.1 Definite Clauses The idea of logic programming is to use a computer for drawing conclusions from declarative descriptions. Such descriptions called logic programs

More information

Solutions to Sample Problems for Midterm

Solutions to Sample Problems for Midterm Solutions to Sample Problems for Midterm Problem 1. The dual of a proposition is defined for which contains only,,. It is For a compound proposition that only uses,, as operators, we obtained the dual

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

AAA615: Formal Methods. Lecture 2 First-Order Logic

AAA615: Formal Methods. Lecture 2 First-Order Logic AAA615: Formal Methods Lecture 2 First-Order Logic Hakjoo Oh 2017 Fall Hakjoo Oh AAA615 2017 Fall, Lecture 2 September 24, 2017 1 / 29 First-Order Logic An extension of propositional logic with predicates,

More information

INF1383 -Bancos de Dados

INF1383 -Bancos de Dados INF1383 -Bancos de Dados Prof. Sérgio Lifschitz DI PUC-Rio Eng. Computação, Sistemas de Informação e Ciência da Computação Projeto de BD e Formas Normais Alguns slides são baseados ou modificados dos originais

More information

Tutorial on Axiomatic Set Theory. Javier R. Movellan

Tutorial on Axiomatic Set Theory. Javier R. Movellan Tutorial on Axiomatic Set Theory Javier R. Movellan Intuitively we think of sets as collections of elements. The crucial part of this intuitive concept is that we are willing to treat sets as entities

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

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

A Dichotomy. in in Probabilistic Databases. Joint work with Robert Fink. for Non-Repeating Queries with Negation Queries with Negation

A Dichotomy. in in Probabilistic Databases. Joint work with Robert Fink. for Non-Repeating Queries with Negation Queries with Negation Dichotomy for Non-Repeating Queries with Negation Queries with Negation in in Probabilistic Databases Robert Dan Olteanu Fink and Dan Olteanu Joint work with Robert Fink Uncertainty in Computation Simons

More information

2-4: The Use of Quantifiers

2-4: The Use of Quantifiers 2-4: The Use of Quantifiers The number x + 2 is an even integer is not a statement. When x is replaced by 1, 3 or 5 the resulting statement is false. However, when x is replaced by 2, 4 or 6 the resulting

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky Based on slides Dr. M. P. Frank and Dr. J.L. Gross

More information

COMP 2600: Formal Methods for Software Engineeing

COMP 2600: Formal Methods for Software Engineeing COMP 2600: Formal Methods for Software Engineeing Dirk Pattinson Semester 2, 2013 What do we mean by FORMAL? Oxford Dictionary in accordance with convention or etiquette or denoting a style of writing

More information

Instructor: Sudeepa Roy

Instructor: Sudeepa Roy CompSci 590.6 Understanding Data: Theory and Applications Lecture 13 Incomplete Databases Instructor: Sudeepa Roy Email: sudeepa@cs.duke.edu 1 Today s Reading Alice Book : Foundations of Databases Abiteboul-

More information

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1) Introduction to Predicate Logic Part 1 Professor Anita Wasilewska Lecture Notes (1) Introduction Lecture Notes (1) and (2) provide an OVERVIEW of a standard intuitive formalization and introduction to

More information

Proof by contrapositive, contradiction

Proof by contrapositive, contradiction Proof by contrapositive, contradiction Margaret M. Fleck 9 September 2009 This lecture covers proof by contradiction and proof by contrapositive (section 1.6 of Rosen). 1 Announcements The first quiz will

More information

Logic and Propositional Calculus

Logic and Propositional Calculus CHAPTER 4 Logic and Propositional Calculus 4.1 INTRODUCTION Many algorithms and proofs use logical expressions such as: IF p THEN q or If p 1 AND p 2, THEN q 1 OR q 2 Therefore it is necessary to know

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

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi Design Theory for Relational Databases Spring 2011 Instructor: Hassan Khosravi Chapter 3: Design Theory for Relational Database 3.1 Functional Dependencies 3.2 Rules About Functional Dependencies 3.3 Design

More information

Completeness for FOL

Completeness for FOL Completeness for FOL Completeness Theorem for F Theorem. Let T be a set of sentences of a firstorder language L and let S be a sentence of the same language. If S is a first-order consequence of T, then

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

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Background We started with schema design ER model translation into a relational schema Then we studied relational

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

Recitation 4: Quantifiers and basic proofs

Recitation 4: Quantifiers and basic proofs Math 299 Recitation 4: Quantifiers and basic proofs 1. Quantifiers in sentences are one of the linguistic constructs that are hard for computers to handle in general. Here is a nice pair of example dialogues:

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on Overview - detailed DB design and normaliza:on pi?alls of bad design decomposi:on normal forms

More information

Symbolising Quantified Arguments

Symbolising Quantified Arguments Symbolising Quantified Arguments 1. (i) Symbolise the following argument, given the universe of discourse is U = set of all animals. Animals are either male or female. Not all Cats are male, Therefore,

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

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

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

6 The Relational Data Model: Algebraic operations on tabular data

6 The Relational Data Model: Algebraic operations on tabular data 6 The Relational Data Model: Algebraic operations on tabular data 6.1 Basic idea of relational languages 6.2 Relational Algebra operations 6.3 Relational Algebra: Syntax and Semantics 6.4. More Operators

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

Math Real Analysis

Math Real Analysis 1 / 28 Math 370 - Real Analysis G.Pugh Sep 3 2013 Real Analysis 2 / 28 3 / 28 What is Real Analysis? Wikipedia: Real analysis... has its beginnings in the rigorous formulation of calculus. It is a branch

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

THE LOGIC OF QUANTIFIED STATEMENTS. Predicates and Quantified Statements I. Predicates and Quantified Statements I CHAPTER 3 SECTION 3.

THE LOGIC OF QUANTIFIED STATEMENTS. Predicates and Quantified Statements I. Predicates and Quantified Statements I CHAPTER 3 SECTION 3. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS SECTION 3.1 Predicates and Quantified Statements I Copyright Cengage Learning. All rights reserved. Copyright Cengage Learning. All rights reserved. Predicates

More information

Chapter 2. Logical Notation. Bahar Aameri. Department of Computer Science University of Toronto. Jan 09, Mathematical Expression and Reasoning 1

Chapter 2. Logical Notation. Bahar Aameri. Department of Computer Science University of Toronto. Jan 09, Mathematical Expression and Reasoning 1 Chapter 2 Logical Notation Bahar Aameri Department of Computer Science University of Toronto Jan 09, 2015 Mathematical Expression and Reasoning 1 Announcements Tutorials: Locations and times are posted

More information

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications Discrete Mathematics and Its Applications Lecture 1: The Foundations: Logic and Proofs (1.3-1.5) MING GAO DASE @ ECNU (for course related communications) mgao@dase.ecnu.edu.cn Sep. 19, 2017 Outline 1 Logical

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers

More information

Recall that the expression x > 3 is not a proposition. Why?

Recall that the expression x > 3 is not a proposition. Why? Predicates and Quantifiers Predicates and Quantifiers 1 Recall that the expression x > 3 is not a proposition. Why? Notation: We will use the propositional function notation to denote the expression "

More information

Artificial Intelligence Knowledge Representation I

Artificial Intelligence Knowledge Representation I rtificial Intelligence Knowledge Representation I Lecture 6 Issues in Knowledge Representation 1. How to represent knowledge 2. How to manipulate/process knowledge (2) Can be rephrased as: how to make

More information

Overview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions

Overview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions Note 01 Propositional Logic 1 / 10-1 Overview 1. Introduction to Propositional Logic 2. Operations on Propositions 3. Truth Tables 4. Translating Sentences into Logical Expressions 5. Preview: Propositional

More information

Database Design and Implementation

Database Design and Implementation Database Design and Implementation CS 645 Schema Refinement First Normal Form (1NF) A schema is in 1NF if all tables are flat Student Name GPA Course Student Name GPA Alice 3.8 Bob 3.7 Carol 3.9 Alice

More information

Logic. Quantifiers. (real numbers understood). x [x is rotten in Denmark]. x<x+x 2 +1

Logic. Quantifiers. (real numbers understood). x [x is rotten in Denmark]. x<x+x 2 +1 Logic One reason for studying logic is that we need a better notation than ordinary English for expressing relationships among various assertions or hypothetical states of affairs. A solid grounding in

More information

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies Design Theory BBM471 Database Management Systems Dr. Fuat Akal akal@hacettepe.edu.tr Design Theory I 2 Today s Lecture 1. Normal forms & functional dependencies 2. Finding functional dependencies 3. Closures,

More information

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1 Propositional Logic: Syntax and Natural Deduction 1 The Plot That Will Unfold I want to provide some key historical and intellectual context to the model theoretic approach to natural language semantics,

More information

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes: Logic Logic is a discipline that studies the principles and methods used in correct reasoning It includes: A formal language for expressing statements. An inference mechanism (a collection of rules) to

More information

Basic Logic and Proof Techniques

Basic Logic and Proof Techniques Chapter 3 Basic Logic and Proof Techniques Now that we have introduced a number of mathematical objects to study and have a few proof techniques at our disposal, we pause to look a little more closely

More information

Reasoning Under Uncertainty: Introduction to Probability

Reasoning Under Uncertainty: Introduction to Probability Reasoning Under Uncertainty: Introduction to Probability CPSC 322 Lecture 23 March 12, 2007 Textbook 9 Reasoning Under Uncertainty: Introduction to Probability CPSC 322 Lecture 23, Slide 1 Lecture Overview

More information

Section 3.1: Direct Proof and Counterexample 1

Section 3.1: Direct Proof and Counterexample 1 Section 3.1: Direct Proof and Counterexample 1 In this chapter, we introduce the notion of proof in mathematics. A mathematical proof is valid logical argument in mathematics which shows that a given conclusion

More information

Predicates and Quantifiers. Nested Quantifiers Discrete Mathematic. Chapter 1: Logic and Proof

Predicates and Quantifiers. Nested Quantifiers Discrete Mathematic. Chapter 1: Logic and Proof Discrete Mathematic Chapter 1: Logic and Proof 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers Dr Patrick Chan School of Computer Science and Engineering South China University of Technology http://125.216.243.100/dm/

More information

CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC

CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC 1 Motivation and History The origins of the classical propositional logic, classical propositional calculus, as it was, and still often is called,

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

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers

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

Mid-Semester Quiz Second Semester, 2012

Mid-Semester Quiz Second Semester, 2012 THE AUSTRALIAN NATIONAL UNIVERSITY Mid-Semester Quiz Second Semester, 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 1 hour duration Study Period: 10 minutes duration Permitted

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

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014 Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014 Notes for Lecture 9 Mathematical logic is the rigorous study of the way in which we prove the validity of mathematical

More information

First Order Logic (FOL) 1 znj/dm2017

First Order Logic (FOL) 1   znj/dm2017 First Order Logic (FOL) 1 http://lcs.ios.ac.cn/ znj/dm2017 Naijun Zhan March 19, 2017 1 Special thanks to Profs Hanpin Wang (PKU) and Lijun Zhang (ISCAS) for their courtesy of the slides on this course.

More information

Fuzzy and Rough Sets Part I

Fuzzy and Rough Sets Part I Fuzzy and Rough Sets Part I Decision Systems Group Brigham and Women s Hospital, Harvard Medical School Harvard-MIT Division of Health Sciences and Technology Aim Present aspects of fuzzy and rough sets.

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

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. Math 0413 Appendix A.0 Logic Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. This type of logic is called propositional.

More information

Chapter 2. Solving Linear Equation

Chapter 2. Solving Linear Equation Chapter 2 Solving Linear Equation 2.1 Square Roots and Comparing Real Numbers I can find square roots and compare real numbers. CC.9-12.N.Q.1 Square Root of a Number: Words: If b 2 = a, then b is a square

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky Based on slides Dr. M. P. Frank and Dr. J.L. Gross

More information

1 FUNDAMENTALS OF LOGIC NO.10 HERBRAND THEOREM Tatsuya Hagino hagino@sfc.keio.ac.jp lecture URL https://vu5.sfc.keio.ac.jp/slide/ 2 So Far Propositional Logic Logical connectives (,,, ) Truth table Tautology

More information

Knowledge-based systems

Knowledge-based systems CS 750 Foundations of I Lecture 6 Knowledge-based systems Milos Hauskrecht milos@cs.pitt.edu 539 Sennott Square dministration announcements Midterm: Thursda October 6, 07 In-class Closed book What does

More information

Logical Structures in Natural Language: First order Logic (FoL)

Logical Structures in Natural Language: First order Logic (FoL) Logical Structures in Natural Language: First order Logic (FoL) Raffaella Bernardi Università degli Studi di Trento e-mail: bernardi@disi.unitn.it Contents 1 How far can we go with PL?................................

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

Propositional Logic: Review

Propositional Logic: Review Propositional Logic: Review Propositional logic Logical constants: true, false Propositional symbols: P, Q, S,... (atomic sentences) Wrapping parentheses: ( ) Sentences are combined by connectives:...and...or

More information

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface. Course Announcements Bacon is due next Monday. Today s lecture will help thinking about your DB interface. Next lab is about drawing UIs. John Jannotti (cs32) ORMs Mar 9, 2017 1 / 24 ORMs John Jannotti

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods First-Order Logic Wolfgang Ahrendt 26th September 2013 SEFM: First-Order Logic 130926 1 / 53 Install the KeY-Tool... KeY used in Friday s exercise Requires: Java

More information

Topic #3 Predicate Logic. Predicate Logic

Topic #3 Predicate Logic. Predicate Logic Predicate Logic Predicate Logic Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional logic treats simple propositions (sentences)

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

Section 2.1: Introduction to the Logic of Quantified Statements

Section 2.1: Introduction to the Logic of Quantified Statements Section 2.1: Introduction to the Logic of Quantified Statements In the previous chapter, we studied a branch of logic called propositional logic or propositional calculus. Loosely speaking, propositional

More information

CS 173: Discrete Structures. Eric Shaffer Office Hour: Wed. 1-2, 2215 SC

CS 173: Discrete Structures. Eric Shaffer Office Hour: Wed. 1-2, 2215 SC CS 173: Discrete Structures Eric Shaffer Office Hour: Wed. 1-2, 2215 SC shaffer1@illinois.edu Agenda Sets (sections 2.1, 2.2) 2 Set Theory Sets you should know: Notation you should know: 3 Set Theory -

More information

Databases. Exercises on Relational Algebra

Databases. Exercises on Relational Algebra Databases Exercises on Relational Algebra The Lab Sessions Giacomo Bergami (giacomo.bergami2@unibo.it) bergami.co.nr 2016/10/07 Keys and Superkeys Relational Algebra (I) Negation Minimum 2016/10/14 Relational

More information

Propositional and First-Order Logic

Propositional and First-Order Logic Propositional and irst-order Logic 1 Propositional Logic 2 Propositional logic Proposition : A proposition is classified as a declarative sentence which is either true or false. eg: 1) It rained yesterday.

More information

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen LECTURE 4: DESIGN THEORIES (FUNCTIONAL DEPENDENCIES) Design theory E/R diagrams are high-level design Formal theory for

More information

Lecture 16: Relevance Lemma and Relational Databases

Lecture 16: Relevance Lemma and Relational Databases Lecture 16: Relevance Lemma and Relational Databases In the last lecture we saw an introduction to first order logic, discussing both its syntax and semantics. After defining semantics, the reader may

More information

Review of Lecture 1. Across records. Within records. Classification, Clustering, Outlier detection. Associations

Review of Lecture 1. Across records. Within records. Classification, Clustering, Outlier detection. Associations Review of Lecture 1 This course is about finding novel actionable patterns in data. We can divide data mining algorithms (and the patterns they find) into five groups Across records Classification, Clustering,

More information

Lecture 9 CS 1813 Discrete Mathematics. Predicate Calculus. Propositions Plus Plus

Lecture 9 CS 1813 Discrete Mathematics. Predicate Calculus. Propositions Plus Plus Lecture 9 CS 1813 Discrete Mathematics Predicate Calculus Propositions Plus Plus 1 Predicate What is a Predicate? Parameterized collection of propositions P(x) Typically a different proposition for each

More information