diff -r 722bf1319be5 -r fd1be45b64bf IOA/example/Multiset.ML --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IOA/example/Multiset.ML Wed Nov 02 11:50:09 1994 +0100 @@ -0,0 +1,75 @@ +goalw Multiset.thy [Multiset.count_def, Multiset.countm_empty_def] + "count({|},x) = 0"; + by (rtac refl 1); +val count_empty = result(); + +goal Multiset.thy + "count(addm(M,x),y) = if(y=x,Suc(count(M,y)),count(M,y))"; + by (asm_simp_tac (arith_ss addsimps + [Multiset.count_def,Multiset.countm_nonempty_def] + setloop (split_tac [expand_if])) 1); +val count_addm_simp = result(); + +goal Multiset.thy "count(M,y) <= count(addm(M,x),y)"; + by (simp_tac (arith_ss addsimps [count_addm_simp] + setloop (split_tac [expand_if])) 1); + by (rtac impI 1); + by (rtac (le_refl RS (leq_suc RS mp)) 1); +val count_leq_addm = result(); + +goalw Multiset.thy [Multiset.count_def] + "count(delm(M,x),y) = if(y=x,pred(count(M,y)),count(M,y))"; + by (res_inst_tac [("M","M")] Multiset.induction 1); + by (asm_simp_tac (arith_ss + addsimps [Multiset.delm_empty_def,Multiset.countm_empty_def] + setloop (split_tac [expand_if])) 1); + by (asm_full_simp_tac (arith_ss + addsimps [Multiset.delm_nonempty_def, + Multiset.countm_nonempty_def] + setloop (split_tac [expand_if])) 1); + by (safe_tac HOL_cs); + by (asm_full_simp_tac HOL_ss 1); +val count_delm_simp = result(); + +goal Multiset.thy "!!M. (!x. P(x) --> Q(x)) ==> (countm(M,P) <= countm(M,Q))"; + by (res_inst_tac [("M","M")] Multiset.induction 1); + by (simp_tac (arith_ss addsimps [Multiset.countm_empty_def]) 1); + by (simp_tac (arith_ss addsimps[Multiset.countm_nonempty_def]) 1); + by (etac (less_eq_add_cong RS mp RS mp) 1); + by (asm_full_simp_tac (arith_ss addsimps [le_eq_less_or_eq] + setloop (split_tac [expand_if])) 1); +val countm_props = result(); + +goal Multiset.thy "!!P. ~P(obj) ==> countm(M,P) = countm(delm(M,obj),P)"; + by (res_inst_tac [("M","M")] Multiset.induction 1); + by (simp_tac (arith_ss addsimps [Multiset.delm_empty_def, + Multiset.countm_empty_def]) 1); + by (asm_simp_tac (arith_ss addsimps[Multiset.countm_nonempty_def, + Multiset.delm_nonempty_def] + setloop (split_tac [expand_if])) 1); +val countm_spurious_delm = result(); + + +goal Multiset.thy "!!P. P(x) ==> 0 0 0 countm(delm(M,x),P) = pred(countm(M,P))"; + by (res_inst_tac [("M","M")] Multiset.induction 1); + by (simp_tac (arith_ss addsimps + [Multiset.delm_empty_def, + Multiset.countm_empty_def]) 1); + by (asm_simp_tac (arith_ss addsimps + [eq_sym_conv,count_addm_simp,Multiset.delm_nonempty_def, + Multiset.countm_nonempty_def,pos_count_imp_pos_countm, + suc_pred_id] + setloop (split_tac [expand_if])) 1); +val countm_done_delm = result();