next up previous
Next: While Up: Control Previous: Skip

Conditionals

Given a Boolean expression B and two commands tex2html_wrap_inline1442 and tex2html_wrap_inline1444 , the command

displaymath1468

will be the same as tex2html_wrap_inline1442 when started in a state where B is true and tex2html_wrap_inline1444 otherwise, that is :

displaymath1456

A (complex) command built from assignments using only sequencing and conditionals is called a ``straight line program''. Note, that in the case of a finite set A every map tex2html_wrap_inline1484 , (more generally, every operation on A) can be realized with a straight-line program P : If tex2html_wrap_inline1490 , and the desired map is given as tex2html_wrap_inline1492 , let P be the straight line program

displaymath1457

With straight line programs we therefore go beyond evaluation of terms, i.e. the computational mechanism afforded by Universal Algebra, unless there is an ``if-then-else'' at the term level. Such algebras are well studied, they are called functionally complete. A term simulating the if-then-else is usually introduced as

displaymath1458



H.Peter Gumm