L04 - logic and queries

L04 - logic and queries - Recall from last time: First...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Recall from last time: First Order Logic Recall from last time: First Order Logic The semantics of first order logic is a ternary relation between a formula P, a database B, and an assignment or binding Notation: B, P what it means: P holds (or is true) in the database B with binding We observed that we can say: B, R(t 1 , t 2 , , t k ) if ( (t 1 ), (t 2 ), , (t k )) is in R intuitively, what this says is that the database satisfies the formula R whenever a tuple under the assignment is in the relation instance R The remainder of the inductive definition of semantics: The remainder of the inductive definition of semantics: Semantics of Composite Formulae B, ( P) iff B, P B, (P Q) iff B, P and B, Q B, (P Q) iff B, P or B, Q B, (P Q) iff B, P or B, Q B, (P Q) iff B, P and B, Q are simultaneously true or simultaneously false Semantics of quantified formulae B, ( x)P iff there exists a binding for which B, P holds B, ( x)P iff for all possible bindings B, P holds Free and Bound Variables Free and Bound Variables Suppose that we look at the following: Let bind x to 3. Then we can say B, x > 2 clearly holds What if the assignment also bound y to 35. This aspect of the binding is irrelevant! Why mention this in general, when a variable is quantified the previous value is not relevant. Why is this important? Well, we have to deal with situations in which variables are associated with (or bound ) to quantifiers. Rule of thumb: A variable is bound to the most local instance of a quantifier mentioning that variable A variable that is not bound is free . What does this have to do with databases and queries? What does this have to do with databases and queries? Formulas with free variables in them essentially define the set of assignments that satisfy them example: when we solve something like x 2 + 4x + 9 = 0 we are finding all values for which the equation is true so we can think of this as a query this means that we can define a function that well call satisfy Given a database B and a formula P, we define satisfy (P, B) as { | B, P} In other words, satisfy (P, B)...
View Full Document

Page1 / 18

L04 - logic and queries - Recall from last time: First...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online