src/HOL/UNITY/Comp/Alloc.thy
changeset 56199 8e8d28ed7529
parent 52089 6ce832f71bdd
child 58963 26bf09b95dda
equal deleted inserted replaced
56198:21dd034523e5 56199:8e8d28ed7529
   423 lemma fst_o_client_map: "fst o client_map = non_dummy"
   423 lemma fst_o_client_map: "fst o client_map = non_dummy"
   424   apply (unfold client_map_def)
   424   apply (unfold client_map_def)
   425   apply (rule fst_o_funPair)
   425   apply (rule fst_o_funPair)
   426   done
   426   done
   427 
   427 
   428 ML {* bind_thms ("fst_o_client_map'", make_o_equivs @{context} @{thm fst_o_client_map}) *}
   428 ML {* ML_Thms.bind_thms ("fst_o_client_map'", make_o_equivs @{context} @{thm fst_o_client_map}) *}
   429 declare fst_o_client_map' [simp]
   429 declare fst_o_client_map' [simp]
   430 
   430 
   431 lemma snd_o_client_map: "snd o client_map = clientState_d.dummy"
   431 lemma snd_o_client_map: "snd o client_map = clientState_d.dummy"
   432   apply (unfold client_map_def)
   432   apply (unfold client_map_def)
   433   apply (rule snd_o_funPair)
   433   apply (rule snd_o_funPair)
   434   done
   434   done
   435 
   435 
   436 ML {* bind_thms ("snd_o_client_map'", make_o_equivs @{context} @{thm snd_o_client_map}) *}
   436 ML {* ML_Thms.bind_thms ("snd_o_client_map'", make_o_equivs @{context} @{thm snd_o_client_map}) *}
   437 declare snd_o_client_map' [simp]
   437 declare snd_o_client_map' [simp]
   438 
   438 
   439 
   439 
   440 subsection{*o-simprules for @{term sysOfAlloc} [MUST BE AUTOMATED]*}
   440 subsection{*o-simprules for @{term sysOfAlloc} [MUST BE AUTOMATED]*}
   441 
   441 
   442 lemma client_o_sysOfAlloc: "client o sysOfAlloc = fst o allocState_d.dummy "
   442 lemma client_o_sysOfAlloc: "client o sysOfAlloc = fst o allocState_d.dummy "
   443   apply record_auto
   443   apply record_auto
   444   done
   444   done
   445 
   445 
   446 ML {* bind_thms ("client_o_sysOfAlloc'", make_o_equivs @{context} @{thm client_o_sysOfAlloc}) *}
   446 ML {* ML_Thms.bind_thms ("client_o_sysOfAlloc'", make_o_equivs @{context} @{thm client_o_sysOfAlloc}) *}
   447 declare client_o_sysOfAlloc' [simp]
   447 declare client_o_sysOfAlloc' [simp]
   448 
   448 
   449 lemma allocGiv_o_sysOfAlloc_eq: "allocGiv o sysOfAlloc = allocGiv"
   449 lemma allocGiv_o_sysOfAlloc_eq: "allocGiv o sysOfAlloc = allocGiv"
   450   apply record_auto
   450   apply record_auto
   451   done
   451   done
   452 
   452 
   453 ML {* bind_thms ("allocGiv_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocGiv_o_sysOfAlloc_eq}) *}
   453 ML {* ML_Thms.bind_thms ("allocGiv_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocGiv_o_sysOfAlloc_eq}) *}
   454 declare allocGiv_o_sysOfAlloc_eq' [simp]
   454 declare allocGiv_o_sysOfAlloc_eq' [simp]
   455 
   455 
   456 lemma allocAsk_o_sysOfAlloc_eq: "allocAsk o sysOfAlloc = allocAsk"
   456 lemma allocAsk_o_sysOfAlloc_eq: "allocAsk o sysOfAlloc = allocAsk"
   457   apply record_auto
   457   apply record_auto
   458   done
   458   done
   459 
   459 
   460 ML {* bind_thms ("allocAsk_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocAsk_o_sysOfAlloc_eq}) *}
   460 ML {* ML_Thms.bind_thms ("allocAsk_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocAsk_o_sysOfAlloc_eq}) *}
   461 declare allocAsk_o_sysOfAlloc_eq' [simp]
   461 declare allocAsk_o_sysOfAlloc_eq' [simp]
   462 
   462 
   463 lemma allocRel_o_sysOfAlloc_eq: "allocRel o sysOfAlloc = allocRel"
   463 lemma allocRel_o_sysOfAlloc_eq: "allocRel o sysOfAlloc = allocRel"
   464   apply record_auto
   464   apply record_auto
   465   done
   465   done
   466 
   466 
   467 ML {* bind_thms ("allocRel_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocRel_o_sysOfAlloc_eq}) *}
   467 ML {* ML_Thms.bind_thms ("allocRel_o_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocRel_o_sysOfAlloc_eq}) *}
   468 declare allocRel_o_sysOfAlloc_eq' [simp]
   468 declare allocRel_o_sysOfAlloc_eq' [simp]
   469 
   469 
   470 
   470 
   471 subsection{* o-simprules for @{term sysOfClient} [MUST BE AUTOMATED]*}
   471 subsection{* o-simprules for @{term sysOfClient} [MUST BE AUTOMATED]*}
   472 
   472 
   473 lemma client_o_sysOfClient: "client o sysOfClient = fst"
   473 lemma client_o_sysOfClient: "client o sysOfClient = fst"
   474   apply record_auto
   474   apply record_auto
   475   done
   475   done
   476 
   476 
   477 ML {* bind_thms ("client_o_sysOfClient'", make_o_equivs @{context} @{thm client_o_sysOfClient}) *}
   477 ML {* ML_Thms.bind_thms ("client_o_sysOfClient'", make_o_equivs @{context} @{thm client_o_sysOfClient}) *}
   478 declare client_o_sysOfClient' [simp]
   478 declare client_o_sysOfClient' [simp]
   479 
   479 
   480 lemma allocGiv_o_sysOfClient_eq: "allocGiv o sysOfClient = allocGiv o snd "
   480 lemma allocGiv_o_sysOfClient_eq: "allocGiv o sysOfClient = allocGiv o snd "
   481   apply record_auto
   481   apply record_auto
   482   done
   482   done
   483 
   483 
   484 ML {* bind_thms ("allocGiv_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocGiv_o_sysOfClient_eq}) *}
   484 ML {* ML_Thms.bind_thms ("allocGiv_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocGiv_o_sysOfClient_eq}) *}
   485 declare allocGiv_o_sysOfClient_eq' [simp]
   485 declare allocGiv_o_sysOfClient_eq' [simp]
   486 
   486 
   487 lemma allocAsk_o_sysOfClient_eq: "allocAsk o sysOfClient = allocAsk o snd "
   487 lemma allocAsk_o_sysOfClient_eq: "allocAsk o sysOfClient = allocAsk o snd "
   488   apply record_auto
   488   apply record_auto
   489   done
   489   done
   490 
   490 
   491 ML {* bind_thms ("allocAsk_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocAsk_o_sysOfClient_eq}) *}
   491 ML {* ML_Thms.bind_thms ("allocAsk_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocAsk_o_sysOfClient_eq}) *}
   492 declare allocAsk_o_sysOfClient_eq' [simp]
   492 declare allocAsk_o_sysOfClient_eq' [simp]
   493 
   493 
   494 lemma allocRel_o_sysOfClient_eq: "allocRel o sysOfClient = allocRel o snd "
   494 lemma allocRel_o_sysOfClient_eq: "allocRel o sysOfClient = allocRel o snd "
   495   apply record_auto
   495   apply record_auto
   496   done
   496   done
   497 
   497 
   498 ML {* bind_thms ("allocRel_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocRel_o_sysOfClient_eq}) *}
   498 ML {* ML_Thms.bind_thms ("allocRel_o_sysOfClient_eq'", make_o_equivs @{context} @{thm allocRel_o_sysOfClient_eq}) *}
   499 declare allocRel_o_sysOfClient_eq' [simp]
   499 declare allocRel_o_sysOfClient_eq' [simp]
   500 
   500 
   501 lemma allocGiv_o_inv_sysOfAlloc_eq: "allocGiv o inv sysOfAlloc = allocGiv"
   501 lemma allocGiv_o_inv_sysOfAlloc_eq: "allocGiv o inv sysOfAlloc = allocGiv"
   502   apply (simp add: o_def)
   502   apply (simp add: o_def)
   503   done
   503   done
   504 
   504 
   505 ML {* bind_thms ("allocGiv_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocGiv_o_inv_sysOfAlloc_eq}) *}
   505 ML {* ML_Thms.bind_thms ("allocGiv_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocGiv_o_inv_sysOfAlloc_eq}) *}
   506 declare allocGiv_o_inv_sysOfAlloc_eq' [simp]
   506 declare allocGiv_o_inv_sysOfAlloc_eq' [simp]
   507 
   507 
   508 lemma allocAsk_o_inv_sysOfAlloc_eq: "allocAsk o inv sysOfAlloc = allocAsk"
   508 lemma allocAsk_o_inv_sysOfAlloc_eq: "allocAsk o inv sysOfAlloc = allocAsk"
   509   apply (simp add: o_def)
   509   apply (simp add: o_def)
   510   done
   510   done
   511 
   511 
   512 ML {* bind_thms ("allocAsk_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocAsk_o_inv_sysOfAlloc_eq}) *}
   512 ML {* ML_Thms.bind_thms ("allocAsk_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocAsk_o_inv_sysOfAlloc_eq}) *}
   513 declare allocAsk_o_inv_sysOfAlloc_eq' [simp]
   513 declare allocAsk_o_inv_sysOfAlloc_eq' [simp]
   514 
   514 
   515 lemma allocRel_o_inv_sysOfAlloc_eq: "allocRel o inv sysOfAlloc = allocRel"
   515 lemma allocRel_o_inv_sysOfAlloc_eq: "allocRel o inv sysOfAlloc = allocRel"
   516   apply (simp add: o_def)
   516   apply (simp add: o_def)
   517   done
   517   done
   518 
   518 
   519 ML {* bind_thms ("allocRel_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocRel_o_inv_sysOfAlloc_eq}) *}
   519 ML {* ML_Thms.bind_thms ("allocRel_o_inv_sysOfAlloc_eq'", make_o_equivs @{context} @{thm allocRel_o_inv_sysOfAlloc_eq}) *}
   520 declare allocRel_o_inv_sysOfAlloc_eq' [simp]
   520 declare allocRel_o_inv_sysOfAlloc_eq' [simp]
   521 
   521 
   522 lemma rel_inv_client_map_drop_map: "(rel o inv client_map o drop_map i o inv sysOfClient) =
   522 lemma rel_inv_client_map_drop_map: "(rel o inv client_map o drop_map i o inv sysOfClient) =
   523       rel o sub i o client"
   523       rel o sub i o client"
   524   apply (simp add: o_def drop_map_def)
   524   apply (simp add: o_def drop_map_def)
   525   done
   525   done
   526 
   526 
   527 ML {* bind_thms ("rel_inv_client_map_drop_map'", make_o_equivs @{context} @{thm rel_inv_client_map_drop_map}) *}
   527 ML {* ML_Thms.bind_thms ("rel_inv_client_map_drop_map'", make_o_equivs @{context} @{thm rel_inv_client_map_drop_map}) *}
   528 declare rel_inv_client_map_drop_map [simp]
   528 declare rel_inv_client_map_drop_map [simp]
   529 
   529 
   530 lemma ask_inv_client_map_drop_map: "(ask o inv client_map o drop_map i o inv sysOfClient) =
   530 lemma ask_inv_client_map_drop_map: "(ask o inv client_map o drop_map i o inv sysOfClient) =
   531       ask o sub i o client"
   531       ask o sub i o client"
   532   apply (simp add: o_def drop_map_def)
   532   apply (simp add: o_def drop_map_def)
   533   done
   533   done
   534 
   534 
   535 ML {* bind_thms ("ask_inv_client_map_drop_map'", make_o_equivs @{context} @{thm ask_inv_client_map_drop_map}) *}
   535 ML {* ML_Thms.bind_thms ("ask_inv_client_map_drop_map'", make_o_equivs @{context} @{thm ask_inv_client_map_drop_map}) *}
   536 declare ask_inv_client_map_drop_map [simp]
   536 declare ask_inv_client_map_drop_map [simp]
   537 
   537 
   538 
   538 
   539 text{*Client : <unfolded specification> *}
   539 text{*Client : <unfolded specification> *}
   540 lemmas client_spec_simps =
   540 lemmas client_spec_simps =
   547      Client_Bounded, Client_Progress, Client_AllowedActs,
   547      Client_Bounded, Client_Progress, Client_AllowedActs,
   548      Client_preserves_giv, Client_preserves_dummy] =
   548      Client_preserves_giv, Client_preserves_dummy] =
   549         @{thm Client} |> simplify (@{context} addsimps @{thms client_spec_simps})
   549         @{thm Client} |> simplify (@{context} addsimps @{thms client_spec_simps})
   550                |> list_of_Int;
   550                |> list_of_Int;
   551 
   551 
   552 bind_thm ("Client_Increasing_ask", Client_Increasing_ask);
   552 ML_Thms.bind_thm ("Client_Increasing_ask", Client_Increasing_ask);
   553 bind_thm ("Client_Increasing_rel", Client_Increasing_rel);
   553 ML_Thms.bind_thm ("Client_Increasing_rel", Client_Increasing_rel);
   554 bind_thm ("Client_Bounded", Client_Bounded);
   554 ML_Thms.bind_thm ("Client_Bounded", Client_Bounded);
   555 bind_thm ("Client_Progress", Client_Progress);
   555 ML_Thms.bind_thm ("Client_Progress", Client_Progress);
   556 bind_thm ("Client_AllowedActs", Client_AllowedActs);
   556 ML_Thms.bind_thm ("Client_AllowedActs", Client_AllowedActs);
   557 bind_thm ("Client_preserves_giv", Client_preserves_giv);
   557 ML_Thms.bind_thm ("Client_preserves_giv", Client_preserves_giv);
   558 bind_thm ("Client_preserves_dummy", Client_preserves_dummy);
   558 ML_Thms.bind_thm ("Client_preserves_dummy", Client_preserves_dummy);
   559 *}
   559 *}
   560 
   560 
   561 declare
   561 declare
   562   Client_Increasing_ask [iff]
   562   Client_Increasing_ask [iff]
   563   Client_Increasing_rel [iff]
   563   Client_Increasing_rel [iff]
   577      Network_preserves_allocGiv, Network_preserves_rel,
   577      Network_preserves_allocGiv, Network_preserves_rel,
   578      Network_preserves_ask]  =
   578      Network_preserves_ask]  =
   579         @{thm Network} |> simplify (@{context} addsimps @{thms network_spec_simps})
   579         @{thm Network} |> simplify (@{context} addsimps @{thms network_spec_simps})
   580                 |> list_of_Int;
   580                 |> list_of_Int;
   581 
   581 
   582 bind_thm ("Network_Ask", Network_Ask);
   582 ML_Thms.bind_thm ("Network_Ask", Network_Ask);
   583 bind_thm ("Network_Giv", Network_Giv);
   583 ML_Thms.bind_thm ("Network_Giv", Network_Giv);
   584 bind_thm ("Network_Rel", Network_Rel);
   584 ML_Thms.bind_thm ("Network_Rel", Network_Rel);
   585 bind_thm ("Network_AllowedActs", Network_AllowedActs);
   585 ML_Thms.bind_thm ("Network_AllowedActs", Network_AllowedActs);
   586 bind_thm ("Network_preserves_allocGiv", Network_preserves_allocGiv);
   586 ML_Thms.bind_thm ("Network_preserves_allocGiv", Network_preserves_allocGiv);
   587 bind_thm ("Network_preserves_rel", Network_preserves_rel);
   587 ML_Thms.bind_thm ("Network_preserves_rel", Network_preserves_rel);
   588 bind_thm ("Network_preserves_ask", Network_preserves_ask);
   588 ML_Thms.bind_thm ("Network_preserves_ask", Network_preserves_ask);
   589 *}
   589 *}
   590 
   590 
   591 declare Network_preserves_allocGiv [iff]
   591 declare Network_preserves_allocGiv [iff]
   592 
   592 
   593 declare
   593 declare
   608      Alloc_preserves_allocRel, Alloc_preserves_allocAsk,
   608      Alloc_preserves_allocRel, Alloc_preserves_allocAsk,
   609      Alloc_preserves_dummy] =
   609      Alloc_preserves_dummy] =
   610         @{thm Alloc} |> simplify (@{context} addsimps @{thms alloc_spec_simps})
   610         @{thm Alloc} |> simplify (@{context} addsimps @{thms alloc_spec_simps})
   611               |> list_of_Int;
   611               |> list_of_Int;
   612 
   612 
   613 bind_thm ("Alloc_Increasing_0", Alloc_Increasing_0);
   613 ML_Thms.bind_thm ("Alloc_Increasing_0", Alloc_Increasing_0);
   614 bind_thm ("Alloc_Safety", Alloc_Safety);
   614 ML_Thms.bind_thm ("Alloc_Safety", Alloc_Safety);
   615 bind_thm ("Alloc_Progress", Alloc_Progress);
   615 ML_Thms.bind_thm ("Alloc_Progress", Alloc_Progress);
   616 bind_thm ("Alloc_AllowedActs", Alloc_AllowedActs);
   616 ML_Thms.bind_thm ("Alloc_AllowedActs", Alloc_AllowedActs);
   617 bind_thm ("Alloc_preserves_allocRel", Alloc_preserves_allocRel);
   617 ML_Thms.bind_thm ("Alloc_preserves_allocRel", Alloc_preserves_allocRel);
   618 bind_thm ("Alloc_preserves_allocAsk", Alloc_preserves_allocAsk);
   618 ML_Thms.bind_thm ("Alloc_preserves_allocAsk", Alloc_preserves_allocAsk);
   619 bind_thm ("Alloc_preserves_dummy", Alloc_preserves_dummy);
   619 ML_Thms.bind_thm ("Alloc_preserves_dummy", Alloc_preserves_dummy);
   620 *}
   620 *}
   621 
   621 
   622 text{*Strip off the INT in the guarantees postcondition*}
   622 text{*Strip off the INT in the guarantees postcondition*}
   623 
   623 
   624 lemmas Alloc_Increasing = Alloc_Increasing_0 [normalized]
   624 lemmas Alloc_Increasing = Alloc_Increasing_0 [normalized]
   806   apply auto
   806   apply auto
   807   done
   807   done
   808 
   808 
   809 
   809 
   810 ML {*
   810 ML {*
   811 bind_thms ("System_Increasing'", list_of_Int @{thm System_Increasing})
   811 ML_Thms.bind_thms ("System_Increasing'", list_of_Int @{thm System_Increasing})
   812 *}
   812 *}
   813 
   813 
   814 declare System_Increasing' [intro!]
   814 declare System_Increasing' [intro!]
   815 
   815 
   816 text{* Follows consequences.
   816 text{* Follows consequences.