# HG changeset patch # User huffman # Date 1213977781 -7200 # Node ID c11e716fafeb99caa12a077014ef8766af19efda # Parent de9a2fd0eab448144a5478bfb957194f91021dc9 added some lemmas; reorganized into sections; tuned proofs diff -r de9a2fd0eab4 -r c11e716fafeb src/HOLCF/Tr.thy --- a/src/HOLCF/Tr.thy Fri Jun 20 18:00:55 2008 +0200 +++ b/src/HOLCF/Tr.thy Fri Jun 20 18:03:01 2008 +0200 @@ -11,7 +11,7 @@ imports Lift begin -defaultsort pcpo +subsection {* Type definition and constructors *} types tr = "bool lift" @@ -27,6 +27,44 @@ FF :: "tr" where "FF = Def False" +text {* Exhaustion and Elimination for type @{typ tr} *} + +lemma Exh_tr: "t = \ \ t = TT \ t = FF" +unfolding FF_def TT_def by (induct t) auto + +lemma trE: "\p = \ \ Q; p = TT \ Q; p = FF \ Q\ \ Q" +unfolding FF_def TT_def by (induct p) auto + +lemma tr_induct: "\P \; P TT; P FF\ \ P x" +by (cases x rule: trE) simp_all + +text {* distinctness for type @{typ tr} *} + +lemma dist_less_tr [simp]: + "\ TT \ \" "\ FF \ \" "\ TT \ FF" "\ FF \ TT" +unfolding TT_def FF_def by simp_all + +lemma dist_eq_tr [simp]: + "TT \ \" "FF \ \" "TT \ FF" "\ \ TT" "\ \ FF" "FF \ TT" +unfolding TT_def FF_def by simp_all + +lemma TT_less_iff [simp]: "TT \ x \ x = TT" +by (induct x rule: tr_induct) simp_all + +lemma FF_less_iff [simp]: "FF \ x \ x = FF" +by (induct x rule: tr_induct) simp_all + +lemma not_less_TT_iff [simp]: "\ (x \ TT) \ x = FF" +by (induct x rule: tr_induct) simp_all + +lemma not_less_FF_iff [simp]: "\ (x \ FF) \ x = TT" +by (induct x rule: tr_induct) simp_all + + +subsection {* Case analysis *} + +defaultsort pcpo + definition trifte :: "'c \ 'c \ tr \ 'c" where ifte_def: "trifte = (\ t e. FLIFT b. if b then t else e)" @@ -34,6 +72,19 @@ cifte_syn :: "[tr, 'c, 'c] \ 'c" ("(3If _/ (then _/ else _) fi)" 60) where "If b then e1 else e2 fi == trifte\e1\e2\b" +translations + "\ (XCONST TT). t" == "CONST trifte\t\\" + "\ (XCONST FF). t" == "CONST trifte\\\t" + +lemma ifte_thms [simp]: + "If \ then e1 else e2 fi = \" + "If FF then e1 else e2 fi = e2" + "If TT then e1 else e2 fi = e1" +by (simp_all add: ifte_def TT_def FF_def) + + +subsection {* Boolean connectives *} + definition trand :: "tr \ tr \ tr" where andalso_def: "trand = (\ x y. If x then y else FF fi)" @@ -56,51 +107,12 @@ If2 :: "[tr, 'c, 'c] \ 'c" where "If2 Q x y = (If Q then x else y fi)" -translations - "\ (CONST TT). t" == "CONST trifte\t\\" - "\ (CONST FF). t" == "CONST trifte\\\t" - - -text {* Exhaustion and Elimination for type @{typ tr} *} - -lemma Exh_tr: "t = \ \ t = TT \ t = FF" -apply (unfold FF_def TT_def) -apply (induct t) -apply fast -apply fast -done - -lemma trE: "\p = \ \ Q; p = TT \ Q; p = FF \ Q\ \ Q" -apply (rule Exh_tr [THEN disjE]) -apply fast -apply (erule disjE) -apply fast -apply fast -done - text {* tactic for tr-thms with case split *} lemmas tr_defs = andalso_def orelse_def neg_def ifte_def TT_def FF_def - -text {* distinctness for type @{typ tr} *} - -lemma dist_less_tr [simp]: - "\ TT \ \" "\ FF \ \" "\ TT \ FF" "\ FF \ TT" -by (simp_all add: tr_defs) - -lemma dist_eq_tr [simp]: - "TT \ \" "FF \ \" "TT \ FF" "\ \ TT" "\ \ FF" "FF \ TT" -by (simp_all add: tr_defs) - text {* lemmas about andalso, orelse, neg and if *} -lemma ifte_thms [simp]: - "If \ then e1 else e2 fi = \" - "If FF then e1 else e2 fi = e2" - "If TT then e1 else e2 fi = e1" -by (simp_all add: ifte_def TT_def FF_def) - lemma andalso_thms [simp]: "(TT andalso y) = y" "(FF andalso y) = FF" @@ -108,8 +120,8 @@ "(y andalso TT) = y" "(y andalso y) = y" apply (unfold andalso_def, simp_all) -apply (rule_tac p=y in trE, simp_all) -apply (rule_tac p=y in trE, simp_all) +apply (cases y rule: trE, simp_all) +apply (cases y rule: trE, simp_all) done lemma orelse_thms [simp]: @@ -119,8 +131,8 @@ "(y orelse FF) = y" "(y orelse y) = y" apply (unfold orelse_def, simp_all) -apply (rule_tac p=y in trE, simp_all) -apply (rule_tac p=y in trE, simp_all) +apply (cases y rule: trE, simp_all) +apply (cases y rule: trE, simp_all) done lemma neg_thms [simp]: @@ -178,10 +190,10 @@ subsection {* Compactness *} -lemma compact_TT [simp]: "compact TT" +lemma compact_TT: "compact TT" by (rule compact_chfin) -lemma compact_FF [simp]: "compact FF" +lemma compact_FF: "compact FF" by (rule compact_chfin) end