equal
deleted
inserted
replaced
412 Note that since HOL is a logic of total functions, @{term"hd []"} is defined, |
412 Note that since HOL is a logic of total functions, @{term"hd []"} is defined, |
413 but we do now know what the result is. That is, @{term"hd []"} is not undefined |
413 but we do now know what the result is. That is, @{term"hd []"} is not undefined |
414 but underdefined. |
414 but underdefined. |
415 \endsem |
415 \endsem |
416 % |
416 % |
|
417 |
|
418 \subsection{Exercises} |
|
419 |
|
420 \begin{exercise} |
|
421 Define your own addition, multiplication, and exponentiation functions on type |
|
422 @{typ nat}. Prove as many of the standard equational rules as possible, e.g.\ |
|
423 associativity, commutativity and distributivity. |
|
424 \end{exercise} |
|
425 \begin{exercise} |
|
426 Define your own sorting function on the predefined lists. |
|
427 Prove that the result is sorted and that every element occurs as many times |
|
428 in the output as in the input. |
|
429 \end{exercise} |
417 *} |
430 *} |
418 (*<*) |
431 (*<*) |
419 end |
432 end |
420 (*>*) |
433 (*>*) |