Ln031 - Semantic Equivalence How would we deal with variables Proposition Show that the sentences x x and 2*x are semantically equivalent Proof

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
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

This note was uploaded on 10/03/2011 for the course CSC 301 taught by Professor Hamel during the Spring '08 term at Rhode Island.

Page1 / 5

Ln031 - Semantic Equivalence How would we deal with variables Proposition Show that the sentences x x and 2*x are semantically equivalent Proof

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