15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

all possible substitutions to it. Thus rules represent ground constructor subterm replacement<br />

actions in a computations, where we are allowed to replace all ground instances of the left hand<br />

side of the rule by the corresponding ground instance of the right hand side.<br />

A Second Abstract Interpreter<br />

Unfortunately, constructor terms are still not enough to write down rules, as rules also contain<br />

the symbols from the abstract procedures.<br />

Are Constructor Terms Really Enough for Rules?<br />

Example 155 ρ(cons(n, l)) @(ρ(l), cons(n, nil)). (ρ is not a constructor)<br />

Idea: need to include defined procedures.<br />

Definition 156 Let A := 〈S 0 , D〉 be an abstract data type with A ∈ S, f ∈ D be a symbol,<br />

then we call a pair [f : A] a procedure declaration for f over S.<br />

We call a finite set Σ of procedure declarations a signature over A, if Σ is a partial function.<br />

(unique sorts)<br />

add the following rules to the definition of constructor terms<br />

T ∈ S 0 and [p: T] ∈ Σ, or<br />

t is of the form f(a), where a is a term of sort A and there is a procedure declaration<br />

[f : A → T] ∈ Σ.<br />

we call the the resulting structures simply “terms” over A, Σ, and V (the set of variables we<br />

use). We denote the set of terms of sort A with TA(A, Σ; V).<br />

c○: Michael Kohlhase 96<br />

Again, we combine all of the rules for the inductive construction of the set of terms in one slide<br />

for convenience.<br />

Terms: The Complete Definition<br />

Idea: treat procedures (from Σ) and constructors (from D) at the same time.<br />

Definition 157 Let 〈S 0 , D〉 be an abstract data type, and Σ a signature over A, then we<br />

call a representation t a term of sort T (over A and Σ), iff<br />

T ∈ S 0 and [t: T] ∈ D or [t: T] ∈ Σ, or<br />

t ∈ VT and T ∈ S 0 , or<br />

T = A × B and t is of the form 〈a, b〉, where a and b are terms of sorts A and B, or<br />

t is of the form c(a), where a is a term of sort A and there is a constructor declaration<br />

[c: A → T] ∈ D or a procedure declaration [c: A → T] ∈ Σ.<br />

Subterms<br />

c○: Michael Kohlhase 97<br />

53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!