{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# ln031 - Semantic Equivalence How would we deal with...

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

Semantic Equivalence The semantic definition of a language can also be used to establish the semantic equivalence between syntactic statements. For example, are the Language THREE statements 3+3 and 2*3 semantically equivalent? We can use our semantic definition written in Prolog to prove this ?- val3(plus(const(3),const(3)),[ ],V1), val3(times(const(2),const(3)),[ ],V2), V1 = V2. We show semantic equivalence of two syntactic expression by proving that they each evaluate to the same semantic value.

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

View Full Document
Semantic Equivalence Here is the same proof in natural semantics: const (3), C " 3 const (3), C " 3 plus ( const (3), const (3)), C " 6 = 3 + 3 const (2), C " 2 const (3), C " 3 times ( const (2), const (3)), C " 6 = 2 # 3 The semantic values for both sentences is the same, therefore they are semantically equivalent.
Semantic Equivalence

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Semantic Equivalence How would we deal with variables? Proposition : Show that the sentences x+x and 2*x are semantically equivalent. Proof : From elementary algebra we know that given any integer value i we have i + i = 2 × i . Assume that we are given some arbitrary context C. Also assume that lookup(C,x)=k. Semantic Equivalence Here is the proof in natural semantics: The semantic value for both sentences is the same, therefore they are semantically equivalent. Semantic Equivalence A surprising result, variable substitution and function application are semantically equivalent! Consider, let x = 3 in x+1 end (fn x => x+1) 3 The proof is left as an exercise....
View Full Document

{[ snackBarMessage ]}