# HG changeset patch # User paulson # Date 959078066 -7200 # Node ID cb419b8498e5477251d596d1f0b2126772b52058 # Parent 4829556a56f898dfcc0f3d4daf84c003949a75b8 removal of lessThan; use of AllocBase diff -r 4829556a56f8 -r cb419b8498e5 src/HOL/UNITY/Alloc.ML --- a/src/HOL/UNITY/Alloc.ML Tue May 23 12:32:24 2000 +0200 +++ b/src/HOL/UNITY/Alloc.ML Tue May 23 12:34:26 2000 +0200 @@ -40,23 +40,6 @@ handle THM _ => th; -Goal "(ALL i: lessThan n. f i <= g i) --> sum f n <= sum g n"; -by (induct_tac "n" 1); -by Auto_tac; -by (dres_inst_tac [("x","n")] bspec 1); -by Auto_tac; -by (arith_tac 1); -qed_spec_mp "sum_mono"; - -Goal "ALL xs. xs <= ys --> tokens xs <= tokens ys"; -by (induct_tac "ys" 1); -by (auto_tac (claset(), simpset() addsimps [prefix_Cons])); -qed_spec_mp "tokens_mono_prefix"; - -Goalw [mono_def] "mono tokens"; -by (blast_tac (claset() addIs [tokens_mono_prefix]) 1); -qed "mono_tokens"; - (*** bijectivity of sysOfAlloc [MUST BE AUTOMATED] ***) @@ -274,20 +257,20 @@ Goal "Network Join \ \ ((rename sysOfClient \ -\ (plam x: lessThan Nclients. rename client_map Client)) Join \ +\ (plam x: {x. x simplify (simpset() addsimps [o_def]); (*safety (1), step 3*) -Goal "System : Always {s. sum (%i. (tokens o sub i o allocGiv) s) Nclients \ -\ <= NbT + sum (%i. (tokens o sub i o allocRel) s) Nclients}"; +Goal + "System : Always {s. sum_below (%i. (tokens o sub i o allocGiv) s) Nclients \ +\ <= NbT + sum_below (%i. (tokens o sub i o allocRel) s) Nclients}"; by (simp_tac (simpset() addsimps [o_apply]) 1); by (rtac (rename_Alloc_Safety RS component_guaranteesD) 1); by (auto_tac (claset(), @@ -444,7 +428,7 @@ (** Follows reasoning **) -Goal "System : Always (INT i: lessThan Nclients. \ +Goal "System : Always (INT i: {x. x Q x y} = (INT y: {y. P y}. {x. Q x y})"; +by (Blast_tac 1); +qed "Collect_all_imp_eq"; + (*progress (2), step 4*) -Goal "System : Always {s. ALL i : lessThan Nclients. \ -\ ALL elt : set ((sub i o allocAsk) s). elt <= NbT}"; +Goal "System : Always {s. ALL i. i \ +\ (ALL elt : set ((sub i o allocAsk) s). elt <= NbT)}"; by (auto_tac (claset(), - simpset() addsimps [Collect_ball_eq])); + simpset() addsimps [Collect_all_imp_eq])); by (rtac (Always_Int_rule [Always_allocAsk_le_ask, System_Bounded_ask] RS Always_weaken) 1); by (auto_tac (claset() addDs [set_mono], simpset())); @@ -537,7 +525,7 @@ (*progress (2), step 7*) Goal - "System : (INT i : lessThan Nclients. \ + "System : (INT i : {x. xint, nat] => int**) -consts sum :: [nat=>nat, nat] => nat -primrec - "sum f 0 = 0" - "sum f (Suc n) = f(n) + sum f n" - - -(*This function merely sums the elements of a list*) -consts tokens :: nat list => nat -primrec - "tokens [] = 0" - "tokens (x#xs) = x + tokens xs" - - -consts - NbT :: nat (*Number of tokens in system*) - Nclients :: nat (*Number of clients*) - +Alloc = AllocBase + PPROD + (** State definitions. OUTPUT variables are locals **) @@ -76,12 +52,12 @@ (*spec (1)*) system_safety :: 'a systemState program set "system_safety == - Always {s. sum (%i. (tokens o giv o sub i o client) s) Nclients - <= NbT + sum (%i. (tokens o rel o sub i o client) s) Nclients}" + Always {s. sum_below (%i. (tokens o giv o sub i o client) s) Nclients + <= NbT + sum_below (%i. (tokens o rel o sub i o client) s) Nclients}" (*spec (2)*) system_progress :: 'a systemState program set - "system_progress == INT i : lessThan Nclients. + "system_progress == INT i : {x. x + (ALL elt : set ((sub i o allocAsk) s). elt <= NbT)} Int - (INT i : lessThan Nclients. + (INT i : {x. x