513 functions @{ML RL} and @{ML MRL}. For example in the code below, |
513 functions @{ML RL} and @{ML MRL}. For example in the code below, |
514 every theorem in the second list is instantiated with every |
514 every theorem in the second list is instantiated with every |
515 theorem in the first. |
515 theorem in the first. |
516 |
516 |
517 @{ML_response_fake [display,gray] |
517 @{ML_response_fake [display,gray] |
518 "[@{thm impI}, @{thm disjI2}] RL [@{thm conjI}, @{thm disjI1}]" |
518 "map (no_vars @{context}) |
|
519 ([@{thm impI}, @{thm disjI2}] RL [@{thm conjI}, @{thm disjI1}])" |
519 "[\<lbrakk>P \<Longrightarrow> Q; Qa\<rbrakk> \<Longrightarrow> (P \<longrightarrow> Q) \<and> Qa, |
520 "[\<lbrakk>P \<Longrightarrow> Q; Qa\<rbrakk> \<Longrightarrow> (P \<longrightarrow> Q) \<and> Qa, |
520 \<lbrakk>Q; Qa\<rbrakk> \<Longrightarrow> (P \<or> Q) \<and> Qa, |
521 \<lbrakk>Q; Qa\<rbrakk> \<Longrightarrow> (P \<or> Q) \<and> Qa, |
521 (P \<Longrightarrow> Q) \<Longrightarrow> (P \<longrightarrow> Q) \<or> Qa, |
522 (P \<Longrightarrow> Q) \<Longrightarrow> (P \<longrightarrow> Q) \<or> Qa, |
522 Q \<Longrightarrow> (P \<or> Q) \<or> Qa]"} |
523 Q \<Longrightarrow> (P \<or> Q) \<or> Qa]"} |
523 |
524 |
1065 apply(tactic {* asm_full_simp_tac @{simpset} 1 *}) |
1066 apply(tactic {* asm_full_simp_tac @{simpset} 1 *}) |
1066 done |
1067 done |
1067 |
1068 |
1068 text {* |
1069 text {* |
1069 If the simplifier cannot make any progress, then it leaves the goal unchanged, |
1070 If the simplifier cannot make any progress, then it leaves the goal unchanged, |
1070 i.e.~does not raise any error message. That means if you use it to unfold a |
1071 i.e., does not raise any error message. That means if you use it to unfold a |
1071 definition for a constant and this constant is not present in the goal state, |
1072 definition for a constant and this constant is not present in the goal state, |
1072 you can still safely apply the simplifier. |
1073 you can still safely apply the simplifier. |
1073 |
1074 |
1074 When using the simplifier, the crucial information you have to provide is |
1075 When using the simplifier, the crucial information you have to provide is |
1075 the simpset. If this information is not handled with care, then the |
1076 the simpset. If this information is not handled with care, then the |
1115 @{ML_file "HOL/Tools/simpdata.ML"}. Generic splitters are implemented in |
1116 @{ML_file "HOL/Tools/simpdata.ML"}. Generic splitters are implemented in |
1116 @{ML_file "Provers/splitter.ML"}. |
1117 @{ML_file "Provers/splitter.ML"}. |
1117 \end{readmore} |
1118 \end{readmore} |
1118 |
1119 |
1119 \begin{readmore} |
1120 \begin{readmore} |
1120 FIXME: Find the right place Discrimination nets are implemented |
1121 FIXME: Find the right place: Discrimination nets are implemented |
1121 in @{ML_file "Pure/net.ML"}. |
1122 in @{ML_file "Pure/net.ML"}. |
1122 \end{readmore} |
1123 \end{readmore} |
1123 |
1124 |
1124 The most common combinators to modify simpsets are |
1125 The most common combinators to modify simpsets are: |
1125 |
1126 |
1126 \begin{isabelle} |
1127 \begin{isabelle} |
1127 \begin{tabular}{ll} |
1128 \begin{tabular}{ll} |
1128 @{ML addsimps} & @{ML delsimps}\\ |
1129 @{ML addsimps} & @{ML delsimps}\\ |
1129 @{ML addcongs} & @{ML delcongs}\\ |
1130 @{ML addcongs} & @{ML delcongs}\\ |
1168 \end{figure} *} |
1169 \end{figure} *} |
1169 |
1170 |
1170 text {* |
1171 text {* |
1171 To see how they work, consider the function in Figure~\ref{fig:printss}, which |
1172 To see how they work, consider the function in Figure~\ref{fig:printss}, which |
1172 prints out some parts of a simpset. If you use it to print out the components of the |
1173 prints out some parts of a simpset. If you use it to print out the components of the |
1173 empty simpset, i.e.~ @{ML empty_ss} |
1174 empty simpset, i.e., @{ML empty_ss} |
1174 |
1175 |
1175 @{ML_response_fake [display,gray] |
1176 @{ML_response_fake [display,gray] |
1176 "print_ss @{context} empty_ss" |
1177 "print_ss @{context} empty_ss" |
1177 "Simplification rules: |
1178 "Simplification rules: |
1178 Congruences rules: |
1179 Congruences rules: |
1349 push permutations as far inside as possible, where they might disappear by |
1350 push permutations as far inside as possible, where they might disappear by |
1350 Lemma @{thm [source] perm_rev}. However, to fully normalise all instances, |
1351 Lemma @{thm [source] perm_rev}. However, to fully normalise all instances, |
1351 it would be desirable to add also the lemma @{thm [source] perm_compose} to |
1352 it would be desirable to add also the lemma @{thm [source] perm_compose} to |
1352 the simplifier for pushing permutations over other permutations. Unfortunately, |
1353 the simplifier for pushing permutations over other permutations. Unfortunately, |
1353 the right-hand side of this lemma is again an instance of the left-hand side |
1354 the right-hand side of this lemma is again an instance of the left-hand side |
1354 and so causes an infinite loop. The seems to be no easy way to reformulate |
1355 and so causes an infinite loop. There seems to be no easy way to reformulate |
1355 this rule and so one ends up with clunky proofs like: |
1356 this rule and so one ends up with clunky proofs like: |
1356 *} |
1357 *} |
1357 |
1358 |
1358 lemma |
1359 lemma |
1359 fixes c d::"nat" and pi\<^isub>1 pi\<^isub>2::"prm" |
1360 fixes c d::"nat" and pi\<^isub>1 pi\<^isub>2::"prm" |
1415 THEN' simp_tac (HOL_basic_ss addsimps thms2) |
1416 THEN' simp_tac (HOL_basic_ss addsimps thms2) |
1416 THEN' simp_tac (HOL_basic_ss addsimps thms3) |
1417 THEN' simp_tac (HOL_basic_ss addsimps thms3) |
1417 end*} |
1418 end*} |
1418 |
1419 |
1419 text {* |
1420 text {* |
1420 For all three phases we have to build simpsets addig specific lemmas. As is sufficient |
1421 For all three phases we have to build simpsets adding specific lemmas. As is sufficient |
1421 for our purposes here, we can add these lemma to @{ML HOL_basic_ss} in order to obtain |
1422 for our purposes here, we can add these lemma to @{ML HOL_basic_ss} in order to obtain |
1422 the desired results. Now we can solve the following lemma |
1423 the desired results. Now we can solve the following lemma |
1423 *} |
1424 *} |
1424 |
1425 |
1425 lemma |
1426 lemma |
1428 apply(tactic {* perm_simp_tac 1 *}) |
1429 apply(tactic {* perm_simp_tac 1 *}) |
1429 done |
1430 done |
1430 |
1431 |
1431 |
1432 |
1432 text {* |
1433 text {* |
1433 in one step. This tactic can deal with most instances of normalising permutations; |
1434 in one step. This tactic can deal with most instances of normalising permutations. |
1434 in order to solve all cases we have to deal with corner-cases such as the |
1435 In order to solve all cases we have to deal with corner-cases such as the |
1435 lemma being an exact instance of the permutation composition lemma. This can |
1436 lemma being an exact instance of the permutation composition lemma. This can |
1436 often be done easier by implementing a simproc or a conversion. Both will be |
1437 often be done easier by implementing a simproc or a conversion. Both will be |
1437 explained in the next two chapters. |
1438 explained in the next two chapters. |
1438 |
1439 |
1439 (FIXME: Is it interesting to say something about @{term "op =simp=>"}?) |
1440 (FIXME: Is it interesting to say something about @{term "op =simp=>"}?) |