next up previous
Next: Equational Theories Up: No Title Previous: Semantics

Equational Proofs

The substitution of equals for equals rule gives us a method for showing that two expressions are equal:

 ¯e[a/x]

= % a = b

tex2html_wrap_inline259

where I wrote the rationalization for the proof step after the % character.

Here is an application of the substitution rule for the rotten apple problem [GS]:

 ¯ tex2html_wrap_inline149 

= % tex2html_wrap_inline267

tex2html_wrap_inline269

where e is tex2html_wrap_inline273 , a is m, and b is tex2html_wrap_inline281 . (Notice here that the (boolean) expression e itself is an equation between two integer expressions.)

More generally, suppose you want to prove two expressions, tex2html_wrap_inline285 and tex2html_wrap_inline287 , are equal, then an equational style proof would typically look like:

 ¯ tex2html_wrap_inline291 =				% explanation of why  tex2html_wrap_inline293 

tex2html_wrap_inline171

= % explanation of why tex2html_wrap_inline169

tex2html_wrap_inline173

tex2html_wrap_inline301

= % explanation of why tex2html_wrap_inline303

tex2html_wrap_inline305

= % explanation of why tex2html_wrap_inline307

tex2html_wrap_inline287

Then we appeal to the transitivity property of = to conclude that tex2html_wrap_inline285 equals tex2html_wrap_inline287 .gif The ``explanations'' often appeal to the substitution of equals for equals rule, but sometimes they appeal to the algebraic properties of operators that appear in tex2html_wrap_inline321 . For example, in the rotten apple problem, you might find it useful to appeal to the algebraic property from arithmetic that relates tex2html_wrap_inline165 and /: tex2html_wrap_inline325 .

Some people prefer to put the explanation on the same line as the ``righthand'' side of the = symbol to save space:

  tex2html_wrap_inline285 

= tex2html_wrap_inline329 ¯% explanation of why tex2html_wrap_inline293

= tex2html_wrap_inline287 % explanation of why tex2html_wrap_inline307

Finally, some people prefer to work with both sides of the equation at the same time. At each step in the proof you find some subexpression of either the lefthand or righthand side of the equation and replace it with an equivalent one; you can keep rewriting both sides of the equation, justifying each step as before. gif You can stop when the expressions on the left and right hand sides of the equation are identical (syntactically the same).


next up previous
Next: Equational Theories Up: No Title Previous: Semantics

Norman Papernick
Fri Mar 15 12:00:46 EST 1996