# HG changeset patch # User huffman # Date 1257301976 28800 # Node ID 70ed971a79d1f4a569787978e041a2b06d0717a5 # Parent 3182812d33ed2baf831bd665e4e7d5a7e2bd2442 fixrec examples use fixrec_simp instead of fixpat diff -r 3182812d33ed -r 70ed971a79d1 src/HOLCF/ex/Fixrec_ex.thy --- a/src/HOLCF/ex/Fixrec_ex.thy Tue Nov 03 18:32:30 2009 -0800 +++ b/src/HOLCF/ex/Fixrec_ex.thy Tue Nov 03 18:32:56 2009 -0800 @@ -37,7 +37,7 @@ where "down2\(up\x, up\y) = (x, y)" -subsection {* Examples using @{text fixpat} *} +subsection {* Examples using @{text fixrec_simp} *} text {* A type of lazy lists. *} @@ -53,28 +53,30 @@ "lzip\(lCons\x\xs)\(lCons\y\ys) = lCons\\(lzip\xs\ys)" | "lzip\lNil\lNil = lNil" -text {* @{text fixpat} is useful for producing strictness theorems. *} +text {* @{text fixrec_simp} is useful for producing strictness theorems. *} text {* Note that pattern matching is done in left-to-right order. *} -fixpat lzip_stricts [simp]: - "lzip\\\ys" - "lzip\lNil\\" - "lzip\(lCons\x\xs)\\" +lemma lzip_stricts [simp]: + "lzip\\\ys = \" + "lzip\lNil\\ = \" + "lzip\(lCons\x\xs)\\ = \" +by fixrec_simp+ -text {* @{text fixpat} can also produce rules for missing cases. *} +text {* @{text fixrec_simp} can also produce rules for missing cases. *} -fixpat lzip_undefs [simp]: - "lzip\lNil\(lCons\y\ys)" - "lzip\(lCons\x\xs)\lNil" +lemma lzip_undefs [simp]: + "lzip\lNil\(lCons\y\ys) = \" + "lzip\(lCons\x\xs)\lNil = \" +by fixrec_simp+ subsection {* Pattern matching with bottoms *} text {* - As an alternative to using @{text fixpat}, it is also possible to - use bottom as a constructor pattern. When using a bottom pattern, - the right-hand-side must also be bottom; otherwise, @{text fixrec} - will not be able to prove the equation. + As an alternative to using @{text fixrec_simp}, it is also possible + to use bottom as a constructor pattern. When using a bottom + pattern, the right-hand-side must also be bottom; otherwise, @{text + fixrec} will not be able to prove the equation. *} fixrec @@ -88,7 +90,7 @@ pattern does not change the meaning of the function. For example, in the definition of @{term from_sinr_up}, the first equation is actually redundant, and could have been proven separately by - @{text fixpat}. + @{text fixrec_simp}. *} text {* @@ -125,17 +127,19 @@ does not produce any simp rules. *} -text {* Simp rules can be generated later using @{text fixpat}. *} +text {* Simp rules can be generated later using @{text fixrec_simp}. *} -fixpat lzip2_simps [simp]: - "lzip2\(lCons\x\xs)\(lCons\y\ys)" - "lzip2\(lCons\x\xs)\lNil" - "lzip2\lNil\(lCons\y\ys)" - "lzip2\lNil\lNil" +lemma lzip2_simps [simp]: + "lzip2\(lCons\x\xs)\(lCons\y\ys) = lCons\\(lzip\xs\ys)" + "lzip2\(lCons\x\xs)\lNil = lNil" + "lzip2\lNil\(lCons\y\ys) = lNil" + "lzip2\lNil\lNil = lNil" +by fixrec_simp+ -fixpat lzip2_stricts [simp]: - "lzip2\\\ys" - "lzip2\(lCons\x\xs)\\" +lemma lzip2_stricts [simp]: + "lzip2\\\ys = \" + "lzip2\(lCons\x\xs)\\ = \" +by fixrec_simp+ subsection {* Mutual recursion with @{text fixrec} *} @@ -161,8 +165,11 @@ | "ts \ \ \ map_forest\f\(Trees\t\ts) = Trees\(map_tree\f\t)\(map_forest\f\ts)" -fixpat map_tree_strict [simp]: "map_tree\f\\" -fixpat map_forest_strict [simp]: "map_forest\f\\" +lemma map_tree_strict [simp]: "map_tree\f\\ = \" +by fixrec_simp + +lemma map_forest_strict [simp]: "map_forest\f\\ = \" +by fixrec_simp text {* Theorems generated: