# HG changeset patch # User huffman # Date 1119554246 -7200 # Node ID 7abf8a713613ec448985689af49ed7bc095e9905 # Parent e14b89d6ef1356d9b2da08466778debfbfe80c57 added match functions for spair, sinl, sinr diff -r e14b89d6ef13 -r 7abf8a713613 src/HOLCF/Fixrec.thy --- a/src/HOLCF/Fixrec.thy Thu Jun 23 19:40:03 2005 +0200 +++ b/src/HOLCF/Fixrec.thy Thu Jun 23 21:17:26 2005 +0200 @@ -6,7 +6,7 @@ header "Package for defining recursive functions in HOLCF" theory Fixrec -imports Ssum One Up Fix Tr +imports Sprod Ssum Up One Tr Fix uses ("fixrec_package.ML") begin @@ -119,12 +119,19 @@ subsection {* Match functions for built-in types *} -text {* Currently the package only supports lazy constructors *} - constdefs match_cpair :: "'a \ 'b \ ('a \ 'b) maybe" "match_cpair \ csplit\(\ x y. return\)" + match_spair :: "'a \ 'b \ ('a \ 'b) maybe" + "match_spair \ ssplit\(\ x y. return\)" + + match_sinl :: "'a \ 'b \ 'a maybe" + "match_sinl \ sscase\return\(\ y. fail)" + + match_sinr :: "'a \ 'b \ 'b maybe" + "match_sinr \ sscase\(\ x. fail)\return" + match_up :: "'a u \ 'a maybe" "match_up \ fup\return" @@ -141,6 +148,23 @@ "match_cpair\ = return\" by (simp add: match_cpair_def) +lemma match_spair_simps [simp]: + "\x \ \; y \ \\ \ match_spair\(:x,y:) = return\" + "match_spair\\ = \" +by (simp_all add: match_spair_def) + +lemma match_sinl_simps [simp]: + "x \ \ \ match_sinl\(sinl\x) = return\x" + "x \ \ \ match_sinl\(sinr\x) = fail" + "match_sinl\\ = \" +by (simp_all add: match_sinl_def) + +lemma match_sinr_simps [simp]: + "x \ \ \ match_sinr\(sinr\x) = return\x" + "x \ \ \ match_sinr\(sinl\x) = fail" + "match_sinr\\ = \" +by (simp_all add: match_sinr_def) + lemma match_up_simps [simp]: "match_up\(up\x) = return\x" "match_up\\ = \"