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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

objects (unary arithmetic expressions) that we want to encode.<br />

The formal language Eun is constructed in stages, making explicit use of the respective roles of<br />

the characters in the alphabet. Constants and variables form the basic inventory in E 1 un, the<br />

respective next stage is built up using the function names and the structural characters to encode<br />

the applicative structure of the encoded terms.<br />

Note that with this construction E i un ⊆ E i+1<br />

un .<br />

A formal Language for Unary Arithmetics (Examples)<br />

Example 229 add(//////,mul(x1902,///)) ∈ Eun<br />

Proof: we proceed according to the definition<br />

P.1 We have ////// ∈ Cun, and x1902 ∈ V , and /// ∈ Cun by definition<br />

P.2 Thus ////// ∈ E 1 un, and x1902 ∈ E 1 un and /// ∈ E 1 un,<br />

P.3 Hence, ////// ∈ E 2 un and mul(x1902,///) ∈ E 2 un<br />

P.4 Thus add(//////,mul(x1902,///)) ∈ E 3 un<br />

P.5 And finally add(//////,mul(x1902,///)) ∈ Eun<br />

other examples:<br />

div(x201,add(////,x12))<br />

sub(mul(///,div(x23,///)),///)<br />

what does it all mean? (nothing, Eun is just a set of strings!)<br />

c○: Michael Kohlhase 131<br />

To show that a string is an expression s of unary arithmetics, we have to show that it is in the<br />

formal language Eun. As Eun is the union over all the E i un, the string s must already be a member<br />

of a set E j un for some j ∈ N. So we reason by the definintion establising set membership.<br />

Of course, computer science has better methods for defining languages than the ones used here<br />

(context free grammars), but the simple methods used here will already suffice to make the relevant<br />

points for this course.<br />

Syntax and Semantics (a first glimpse)<br />

Definition 230 A formal language is also called a syntax, since it only concerns the “form”<br />

of strings.<br />

to give meaning to these strings, we need a semantics, i.e. a way to interpret these.<br />

Idea (Tarski Semantics): A semantics is a mapping from strings to objects we already know<br />

and understand (e.g. arithmetics).<br />

e.g. add(//////,mul(x1902,///)) ↦→ 6 + (x1907 · 3) (but what does this mean?)<br />

looks like we have to give a meaning to the variables as well, e.g. x1902 ↦→ 3, then<br />

add(//////,mul(x1902,///)) ↦→ 6 + (3 · 3) = 15<br />

c○: Michael Kohlhase 132<br />

So formal languages do not mean anything by themselves, but a meaning has to be given to them<br />

via a mapping. We will explore that idea in more detail in the following.<br />

71

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

Saved successfully!

Ooh no, something went wrong!