1044 |
1044 |
1045 lemma Collect_conv_if2: "{x. a=x & P x} = (if P a then {a} else {})" |
1045 lemma Collect_conv_if2: "{x. a=x & P x} = (if P a then {a} else {})" |
1046 by auto |
1046 by auto |
1047 |
1047 |
1048 text \<open> |
1048 text \<open> |
1049 Rewrite rules for boolean case-splitting: faster than \<open>split_if [split]\<close>. |
1049 Rewrite rules for boolean case-splitting: faster than \<open>if_split [split]\<close>. |
1050 \<close> |
1050 \<close> |
1051 |
1051 |
1052 lemma split_if_eq1: "((if Q then x else y) = b) = ((Q --> x = b) & (~ Q --> y = b))" |
1052 lemma if_split_eq1: "((if Q then x else y) = b) = ((Q --> x = b) & (~ Q --> y = b))" |
1053 by (rule split_if) |
1053 by (rule if_split) |
1054 |
1054 |
1055 lemma split_if_eq2: "(a = (if Q then x else y)) = ((Q --> a = x) & (~ Q --> a = y))" |
1055 lemma if_split_eq2: "(a = (if Q then x else y)) = ((Q --> a = x) & (~ Q --> a = y))" |
1056 by (rule split_if) |
1056 by (rule if_split) |
1057 |
1057 |
1058 text \<open> |
1058 text \<open> |
1059 Split ifs on either side of the membership relation. Not for \<open>[simp]\<close> -- can cause goals to blow up! |
1059 Split ifs on either side of the membership relation. Not for \<open>[simp]\<close> -- can cause goals to blow up! |
1060 \<close> |
1060 \<close> |
1061 |
1061 |
1062 lemma split_if_mem1: "((if Q then x else y) : b) = ((Q --> x : b) & (~ Q --> y : b))" |
1062 lemma if_split_mem1: "((if Q then x else y) : b) = ((Q --> x : b) & (~ Q --> y : b))" |
1063 by (rule split_if) |
1063 by (rule if_split) |
1064 |
1064 |
1065 lemma split_if_mem2: "(a : (if Q then x else y)) = ((Q --> a : x) & (~ Q --> a : y))" |
1065 lemma if_split_mem2: "(a : (if Q then x else y)) = ((Q --> a : x) & (~ Q --> a : y))" |
1066 by (rule split_if [where P="%S. a : S"]) |
1066 by (rule if_split [where P="%S. a : S"]) |
1067 |
1067 |
1068 lemmas split_ifs = if_bool_eq_conj split_if_eq1 split_if_eq2 split_if_mem1 split_if_mem2 |
1068 lemmas split_ifs = if_bool_eq_conj if_split_eq1 if_split_eq2 if_split_mem1 if_split_mem2 |
1069 |
1069 |
1070 (*Would like to add these, but the existing code only searches for the |
1070 (*Would like to add these, but the existing code only searches for the |
1071 outer-level constant, which in this case is just Set.member; we instead need |
1071 outer-level constant, which in this case is just Set.member; we instead need |
1072 to use term-nets to associate patterns with rules. Also, if a rule fails to |
1072 to use term-nets to associate patterns with rules. Also, if a rule fails to |
1073 apply, then the formula should be kept. |
1073 apply, then the formula should be kept. |