## Goal:

In this assignment, we want to implement the operational semantics of rst order languages and get a feeling for their importance for databases.## Problem Statement:

For this goal, you write an interpreter for formulae of the rst order language. The formulae used here have a free variable and are used to query a database that is given as part of the input. The query result is comprised of those values for the free variable that make the formula true.In order to make the interpretation of the formulae easier, we represent formulae in this assignment not in the in x notation that we use otherwise but in Polish notation, which eliminates parentheses and the need for operator precedence, and also makes the processing of the expression tree easier. As Boolean operators we use only & ; _;:. To make it possible to use predicates without parentheses, we furthermore require that every predicate name is used only for a single arity, i.e. if "mail" is used for a ternary predicate, it must not be used for a unary predicate as well. Polish notation works as follows: the dyadic operators & ;_ are written before their arguments, just like the predicate names, followed by their arguments without separation except whitespaces. For example for the formula (:P(x) _ Q(y)) & 8z R(x; y; z) in in x notation, the corresponding formula in Polish notation is & _ :P x Q y 8 z R x y z. We allow objects from the universe as constants in the formulae; the universe consists of exactly all those objects named in the ground atoms in the database.

In order to restrict ourselves to ASCII, we represent the negation with a minus sign ô€€€, and the _ with the lowercase letter v; we represent the four rallcannti er with an uppercase A and the exists quanti er with an uppercase E. We use always x as the free variable. Therefore we disallow v, A and E as names for the predicates.

## No comments:

## Post a Comment