L04 - logic and queries

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

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 Document Right Arrow Icon

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

View Full Document Right 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 we’ll 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

{[ snackBarMessage ]}

Page1 / 18

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

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