# HG changeset patch # User nipkow # Date 797785541 -7200 # Node ID e044350bfa524865a808e61c955148da1565f804 # Parent 4fcd0638e61d99f935bca237aba822549eeb2907 Olafs new version. diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/Asig.ML --- a/src/HOL/IOA/meta_theory/Asig.ML Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/Asig.ML Thu Apr 13 17:05:41 1995 +0200 @@ -9,3 +9,11 @@ open Asig; val asig_projections = [asig_inputs_def, asig_outputs_def, asig_internals_def]; + +goal Asig.thy "!!a.[| a~:internals(S) ;a~:externals(S)|] ==> a~:actions(S)"; +by (asm_full_simp_tac (list_ss addsimps [externals_def,actions_def]) 1); +qed"int_and_ext_is_act"; + +goal Asig.thy "!!a.[|a:externals(S)|] ==> a:actions(S)"; +by (asm_full_simp_tac (list_ss addsimps [externals_def,actions_def]) 1); +qed"ext_is_act"; \ No newline at end of file diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/IOA.ML --- a/src/HOL/IOA/meta_theory/IOA.ML Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/IOA.ML Thu Apr 13 17:05:41 1995 +0200 @@ -33,16 +33,16 @@ by (simp_tac (SS setloop (split_tac [expand_if])) 1); qed "filter_oseq_idemp"; -goalw IOA.thy [mk_behaviour_def,filter_oseq_def] -"(mk_behaviour A s n = None) = \ +goalw IOA.thy [mk_trace_def,filter_oseq_def] +"(mk_trace A s n = None) = \ \ (s(n)=None | (? a. s(n)=Some(a) & a ~: externals(asig_of(A)))) \ \ & \ -\ (mk_behaviour A s n = Some(a)) = \ +\ (mk_trace A s n = Some(a)) = \ \ (s(n)=Some(a) & a : externals(asig_of(A)))"; by (Option.option.induct_tac "s(n)" 1); by (ALLGOALS (simp_tac (SS setloop (split_tac [expand_if])))); by (fast_tac HOL_cs 1); -qed "mk_behaviour_thm"; +qed "mk_trace_thm"; goalw IOA.thy [reachable_def] "!!A. s:starts_of(A) ==> reachable A s"; by (res_inst_tac [("x","(%i.None,%i.s)")] bexI 1); @@ -149,3 +149,27 @@ goal IOA.thy "asig_of(A || B) = asig_comp (asig_of A) (asig_of B)"; by(simp_tac (SS addsimps (par_def::ioa_projections)) 1); qed "asig_of_par"; + + +goal IOA.thy "externals(asig_of(A1||A2)) = \ +\ (externals(asig_of(A1)) Un externals(asig_of(A2)))"; +by (asm_full_simp_tac (SS addsimps [externals_def,asig_of_par,asig_comp_def,asig_inputs_def,asig_outputs_def,Un_def,set_diff_def]) 1); +by (rtac set_ext 1); +by (fast_tac set_cs 1); +qed"externals_of_par"; + +goalw IOA.thy [externals_def,actions_def,compat_ioas_def,compat_asigs_def] + "!! a. [| compat_ioas A1 A2; a:externals(asig_of(A1))|] ==> a~:internals(asig_of(A2))"; +by (asm_full_simp_tac SS 1); +by (best_tac (set_cs addEs [equalityCE]) 1); +qed"ext1_is_not_int2"; + +goalw IOA.thy [externals_def,actions_def,compat_ioas_def,compat_asigs_def] + "!! a. [| compat_ioas A2 A1 ; a:externals(asig_of(A1))|] ==> a~:internals(asig_of(A2))"; +by (asm_full_simp_tac SS 1); +by (best_tac (set_cs addEs [equalityCE]) 1); +qed"ext2_is_not_int1"; + +val ext1_ext2_is_not_act2 = ext1_is_not_int2 RS int_and_ext_is_act; +val ext1_ext2_is_not_act1 = ext2_is_not_int1 RS int_and_ext_is_act; + diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/IOA.thy --- a/src/HOL/IOA/meta_theory/IOA.thy Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/IOA.thy Thu Apr 13 17:05:41 1995 +0200 @@ -24,16 +24,17 @@ trans_of ::"('action,'state)ioa => ('action,'state)transition set" IOA ::"('action,'state)ioa => bool" - (* Executions, schedules, and behaviours *) + (* Executions, schedules, and traces *) is_execution_fragment, has_execution ::"[('action,'state)ioa, ('action,'state)execution] => bool" executions :: "('action,'state)ioa => ('action,'state)execution set" - mk_behaviour :: "[('action,'state)ioa, 'action oseq] => 'action oseq" + mk_trace :: "[('action,'state)ioa, 'action oseq] => 'action oseq" reachable :: "[('action,'state)ioa, 'state] => bool" invariant :: "[('action,'state)ioa, 'state=>bool] => bool" - has_behaviour :: "[('action,'state)ioa, 'action oseq] => bool" - behaviours :: "('action,'state)ioa => 'action oseq set" + has_trace :: "[('action,'state)ioa, 'action oseq] => bool" + traces :: "('action,'state)ioa => 'action oseq set" + NF :: "'a oseq => 'a oseq" (* Composition of action signatures and automata *) compatible_asigs ::"('a => 'action signature) => bool" @@ -44,7 +45,7 @@ (* binary composition of action signatures and automata *) compat_asigs ::"['action signature, 'action signature] => bool" asig_comp ::"['action signature, 'action signature] => 'action signature" - compat_ioas ::"[('action,'state)ioa, ('action,'state)ioa] => bool" + compat_ioas ::"[('action,'s)ioa, ('action,'t)ioa] => bool" "||" ::"[('a,'s)ioa, ('a,'t)ioa] => ('a,'s*'t)ioa" (infixr 10) (* Filtering and hiding *) @@ -56,6 +57,8 @@ (* Notions of correctness *) ioa_implements :: "[('action,'state1)ioa, ('action,'state2)ioa] => bool" + (* Instantiation of abstract IOA by concrete actions *) + rename:: "('a, 'b)ioa => ('c => 'a option) => ('c,'b)ioa" defs @@ -90,20 +93,7 @@ "executions(ioa) == {e. snd e 0:starts_of(ioa) & \ \ is_execution_fragment ioa e}" - -(* Is a state reachable. Using an inductive definition, this could be defined - * by the following 2 rules - * - * x:starts_of(ioa) - * ---------------- - * reachable(ioa,x) - * - * reachable(ioa,s) & ? (s,a,s'):trans_of(ioa) - * ------------------------------------------- - * reachable(ioa,s') - * - * A direkt definition follows. - *******************************) + reachable_def "reachable ioa s == (? ex:executions(ioa). ? n. (snd ex n) = s)" @@ -119,21 +109,30 @@ \ | Some(x) => if p x then Some x else None)" -mk_behaviour_def - "mk_behaviour(ioa) == filter_oseq(%a.a:externals(asig_of(ioa)))" +mk_trace_def + "mk_trace(ioa) == filter_oseq(%a.a:externals(asig_of(ioa)))" -(* Does an ioa have an execution with the given behaviour *) -has_behaviour_def - "has_behaviour ioa b == \ -\ (? ex:executions(ioa). b = mk_behaviour ioa (fst ex))" - +(* Does an ioa have an execution with the given trace *) +has_trace_def + "has_trace ioa b == \ +\ (? ex:executions(ioa). b = mk_trace ioa (fst ex))" -(* All the behaviours of an ioa *) -behaviours_def - "behaviours(ioa) == {b. has_behaviour ioa b}" +normal_form_def + "NF(tr) == @nf. ? f. mono(f) & (!i. nf(i)=tr(f(i))) & \ +\ (!j. j ~: range(f) --> nf(j)= None) & \ +\ (!i. nf(i)=None --> (nf (Suc i)) = None) " + +(* All the traces of an ioa *) + traces_def + "traces(ioa) == {trace. ? tr. trace=NF(tr) & has_trace ioa tr}" +(* + traces_def + "traces(ioa) == {tr. has_trace ioa tr}" +*) + compat_asigs_def "compat_asigs a1 a2 == \ \ (((outputs(a1) Int outputs(a2)) = {}) & \ @@ -179,8 +178,19 @@ ioa_implements_def - "ioa_implements ioa1 ioa2 == \ -\ (externals(asig_of(ioa1)) = externals(asig_of(ioa2)) & \ -\ behaviours(ioa1) <= behaviours(ioa2))" + "ioa_implements ioa1 ioa2 == \ +\ ((inputs(asig_of(ioa1)) = inputs(asig_of(ioa2))) & \ +\ (outputs(asig_of(ioa1)) = outputs(asig_of(ioa2))) & \ +\ traces(ioa1) <= traces(ioa2))" + +rename_def +"rename ioa ren == \ +\ (({b. ? x. Some(x)= ren(b) & x : inputs(asig_of(ioa))}, \ +\ {b. ? x. Some(x)= ren(b) & x : outputs(asig_of(ioa))}, \ +\ {b. ? x. Some(x)= ren(b) & x : internals(asig_of(ioa))}), \ +\ starts_of(ioa) , \ +\ {tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) \ +\ in \ +\ ? x. Some(x) = ren(a) & (s,x,t):trans_of(ioa)})" end diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/Option.ML --- a/src/HOL/IOA/meta_theory/Option.ML Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/Option.ML Thu Apr 13 17:05:41 1995 +0200 @@ -14,3 +14,11 @@ by (Option.option.induct_tac "opt" 1); by (ALLGOALS(fast_tac HOL_cs)); val optE = store_thm("optE", standard(result() RS disjE)); + +goal Option.thy "x=None | (? y.x=Some(y))"; +by (Option.option.induct_tac "x" 1); +by (asm_full_simp_tac list_ss 1); +by (rtac disjI2 1); +by (rtac exI 1); +by (asm_full_simp_tac list_ss 1); +qed"opt_cases"; \ No newline at end of file diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/Option.thy --- a/src/HOL/IOA/meta_theory/Option.thy Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/Option.thy Thu Apr 13 17:05:41 1995 +0200 @@ -7,5 +7,5 @@ *) Option = Arith + -datatype 'a option = None | Some('a) +datatype 'a option = None | Some ('a) end diff -r 4fcd0638e61d -r e044350bfa52 src/HOL/IOA/meta_theory/Solve.ML --- a/src/HOL/IOA/meta_theory/Solve.ML Thu Apr 13 16:57:18 1995 +0200 +++ b/src/HOL/IOA/meta_theory/Solve.ML Thu Apr 13 17:05:41 1995 +0200 @@ -6,22 +6,26 @@ Weak possibilities mapping (abstraction) *) -open Solve; +open Solve; -val SS = SS addsimps [mk_behaviour_thm,trans_in_actions]; +val SS = SS addsimps [mk_trace_thm,trans_in_actions]; -goalw Solve.thy [is_weak_pmap_def,behaviours_def] +goalw Solve.thy [is_weak_pmap_def,traces_def] "!!f. [| IOA(C); IOA(A); externals(asig_of(C)) = externals(asig_of(A)); \ -\ is_weak_pmap f C A |] ==> behaviours(C) <= behaviours(A)"; +\ is_weak_pmap f C A |] ==> traces(C) <= traces(A)"; - by (simp_tac(SS addsimps [has_behaviour_def])1); + by (simp_tac(SS addsimps [has_trace_def])1); by (safe_tac set_cs); - (* give execution of abstract automata *) - by (res_inst_tac[("x","(mk_behaviour A (fst ex),%i.f(snd ex i))")] bexI 1); + (* choose same trace, therefore same NF *) + by (res_inst_tac[("x","mk_trace C (fst ex)")] exI 1); + by (asm_full_simp_tac set_ss 1); - (* Behaviours coincide *) - by (asm_simp_tac (SS addsimps [mk_behaviour_def,filter_oseq_idemp])1); + (* give execution of abstract automata *) + by (res_inst_tac[("x","(mk_trace A (fst ex),%i.f(snd ex i))")] bexI 1); + + (* Traces coincide *) + by (asm_simp_tac (SS addsimps [mk_trace_def,filter_oseq_idemp])1); (* Use lemma *) by (forward_tac [states_of_exec_reachable] 1); @@ -43,3 +47,224 @@ by (eres_inst_tac [("x","a")] allE 1); by (asm_full_simp_tac SS 1); qed "trace_inclusion"; + +(* Lemmata *) + +val prems = goal HOL.thy "(P ==> Q-->R) ==> P&Q --> R"; + by(fast_tac (HOL_cs addDs prems) 1); +val imp_conj_lemma = result(); + + +(* fist_order_tautology of externals_of_par *) +goal IOA.thy "a:externals(asig_of(A1||A2)) = \ +\ (a:externals(asig_of(A1)) & a:externals(asig_of(A2)) | \ +\ a:externals(asig_of(A1)) & a~:externals(asig_of(A2)) | \ +\ a~:externals(asig_of(A1)) & a:externals(asig_of(A2)))"; +by (asm_full_simp_tac (SS addsimps [externals_def,asig_of_par,asig_comp_def,asig_inputs_def,asig_outputs_def]) 1); + by (fast_tac set_cs 1); +val externals_of_par_extra = result(); + +goal Solve.thy "!!s.[| reachable (C1||C2) s |] ==> reachable C1 (fst s)"; +by (asm_full_simp_tac (SS addsimps [reachable_def]) 1); +by (etac bexE 1); +by (res_inst_tac [("x", + "(filter_oseq (%a.a:actions(asig_of(C1))) \ +\ (fst ex), \ +\ %i.fst (snd ex i))")] bexI 1); +(* fst(s) is in projected execution *) + by (simp_tac SS 1); + by (fast_tac HOL_cs 1); +(* projected execution is indeed an execution *) +by (asm_full_simp_tac (SS addsimps [executions_def,is_execution_fragment_def, + par_def, starts_of_def,trans_of_def]) 1); +by (simp_tac (SS addsimps [filter_oseq_def]) 1); + by (REPEAT(rtac allI 1)); + by (cut_inst_tac [("x","fst ex n")] opt_cases 1); + by (etac disjE 1); +(* case 1: action sequence of || had already a None *) +by (asm_full_simp_tac SS 1); + by (REPEAT(etac exE 1)); + by (case_tac "y:actions(asig_of(C1))" 1); +(* case 2: action sequence of || had Some(a) and + filtered sequence also *) +by (asm_full_simp_tac SS 1); + by (rtac impI 1); + by (REPEAT(hyp_subst_tac 1)); + by (asm_full_simp_tac SS 1); +(* case 3: action sequence pf || had Some(a) but + filtered sequence has None *) + by (asm_full_simp_tac SS 1); +qed"comp1_reachable"; + + +(* Exact copy of proof of comp1_reachable for the second + component of a parallel composition. *) +goal Solve.thy "!!s.[| reachable (C1||C2) s|] ==> reachable C2 (snd s)"; +by (asm_full_simp_tac (SS addsimps [reachable_def]) 1); +by (etac bexE 1); +by (res_inst_tac [("x", + "(filter_oseq (%a.a:actions(asig_of(C2)))\ +\ (fst ex), \ +\ %i.snd (snd ex i))")] bexI 1); +(* fst(s) is in projected execution *) + by (simp_tac list_ss 1); + by (fast_tac HOL_cs 1); +(* projected execution is indeed an execution *) + by (asm_full_simp_tac (SS addsimps [executions_def,is_execution_fragment_def, + par_def, starts_of_def,trans_of_def]) 1); + by (simp_tac (SS addsimps [filter_oseq_def]) 1); + by (REPEAT(rtac allI 1)); + by (cut_inst_tac [("x","fst ex n")] opt_cases 1); + by (etac disjE 1); + by (asm_full_simp_tac SS 1); + by (REPEAT(etac exE 1)); + by (case_tac "y:actions(asig_of(C2))" 1); + by (asm_full_simp_tac SS 1); + by (rtac impI 1); + by (REPEAT(hyp_subst_tac 1)); + by (asm_full_simp_tac SS 1); + by (asm_full_simp_tac SS 1); +qed"comp2_reachable"; + + +(* Composition of possibility-mappings *) + +goalw Solve.thy [is_weak_pmap_def] "!!f g.[| is_weak_pmap f C1 A1 & \ +\ externals(asig_of(A1))=externals(asig_of(C1)) &\ +\ is_weak_pmap g C2 A2 & \ +\ externals(asig_of(A2))=externals(asig_of(C2)) & \ +\ compat_ioas C1 C2 & compat_ioas A1 A2 |] \ +\ ==> is_weak_pmap (%p.(f(fst(p)),g(snd(p)))) (C1||C2) (A1||A2)"; + by (rtac conjI 1); +(* start_states *) + by (asm_full_simp_tac (SS addsimps [par_def, starts_of_def]) 1); + by (fast_tac set_cs 1); +(* transitions *) +by (REPEAT (rtac allI 1)); +by (rtac imp_conj_lemma 1); +by (REPEAT(etac conjE 1)); +by (simp_tac (SS addsimps [externals_of_par_extra]) 1); +by (simp_tac (SS addsimps [par_def]) 1); +by (asm_full_simp_tac (SS addsimps [trans_of_def]) 1); +by (rtac (expand_if RS ssubst) 1); +by (rtac conjI 1); +by (rtac impI 1); +by (etac disjE 1); +(* case 1 a:e(A1) | a:e(A2) *) +by (asm_full_simp_tac (SS addsimps [comp1_reachable,comp2_reachable, + ext_is_act]) 1); +by (etac disjE 1); +(* case 2 a:e(A1) | a~:e(A2) *) +by (asm_full_simp_tac (SS addsimps [comp1_reachable,comp2_reachable, + ext_is_act,ext1_ext2_is_not_act2]) 1); +(* case 3 a:~e(A1) | a:e(A2) *) +by (asm_full_simp_tac (SS addsimps [comp1_reachable,comp2_reachable, + ext_is_act,ext1_ext2_is_not_act1]) 1); +(* case 4 a:~e(A1) | a~:e(A2) *) +by (rtac impI 1); +by (subgoal_tac "a~:externals(asig_of(A1)) & a~:externals(asig_of(A2))" 1); +(* delete auxiliary subgoal *) +by (asm_full_simp_tac SS 2); +by (fast_tac HOL_cs 2); +by (simp_tac (SS addsimps [conj_disj_distribR] addcongs [conj_cong] + setloop (split_tac [expand_if])) 1); +by(REPEAT((resolve_tac [conjI,impI] 1 ORELSE etac conjE 1) THEN + asm_full_simp_tac(SS addsimps[comp1_reachable, + comp2_reachable])1)); +qed"fxg_is_weak_pmap_of_product_IOA"; + + +goal Solve.thy "!!s.[| reachable (rename C g) s |] ==> reachable C s"; +by (asm_full_simp_tac (SS addsimps [reachable_def]) 1); +by (etac bexE 1); +by (res_inst_tac [("x", + "((%i. case (fst ex i) \ +\ of None => None\ +\ | Some(x) => g x) ,snd ex)")] bexI 1); +by (simp_tac SS 1); +(* execution is indeed an execution of C *) +by (asm_full_simp_tac (SS addsimps [executions_def,is_execution_fragment_def, + par_def, starts_of_def,trans_of_def,rename_def]) 1); +by (REPEAT(rtac allI 1)); +by (cut_inst_tac [("x","fst ex n")] opt_cases 1); + by (etac disjE 1); +(* case 1: action sequence of rename C had already a None *) +by (asm_full_simp_tac SS 1); +(* case 2 *) +by (REPEAT(etac exE 1)); +by (etac conjE 1); +by (eres_inst_tac [("x","n")] allE 1); +by (eres_inst_tac [("x","y")] allE 1); +by (asm_full_simp_tac SS 1); +by (etac exE 1); +by (etac conjE 1); +by (dtac sym 1); +by (dtac sym 1); +by (dtac sym 1); +by (asm_full_simp_tac SS 1); +by (safe_tac HOL_cs); +qed"reachable_rename_ioa"; + + +(* HOL Lemmata - must already exist ! *) +goal HOL.thy "(~(A|B)) =(~A&~B)"; + by (fast_tac HOL_cs 1); +val disj_demorgan = result(); +goal HOL.thy "(~(A&B)) =(~A|~B)"; + by (fast_tac HOL_cs 1); +val conj_demorgan = result(); +goal HOL.thy "(~(? x.P x)) =(! x. (~ (P x)))"; + by (fast_tac HOL_cs 1); +val neg_ex = result(); + + +goal Solve.thy "!!f.[| is_weak_pmap f C A |]\ +\ ==> (is_weak_pmap f (rename C g) (rename A g))"; +by (asm_full_simp_tac (SS addsimps [is_weak_pmap_def]) 1); +by (rtac conjI 1); +by (asm_full_simp_tac (SS addsimps [rename_def,starts_of_def]) 1); +by (fast_tac set_cs 1); +by (REPEAT (rtac allI 1)); +by (rtac imp_conj_lemma 1); +by (simp_tac (SS addsimps [rename_def]) 1); +by (asm_full_simp_tac (SS addsimps [externals_def,asig_inputs_def,asig_outputs_def,asig_of_def,trans_of_def]) 1); +by (safe_tac set_cs); +by (rtac (expand_if RS ssubst) 1); + by (rtac conjI 1); + by (rtac impI 1); + by (etac disjE 1); + by (etac exE 1); +by (etac conjE 1); +(* x is input *) + by (dtac sym 1); + by (dtac sym 1); +by (asm_full_simp_tac SS 1); +by (REPEAT (hyp_subst_tac 1)); +by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1); +by (assume_tac 1); +by (asm_full_simp_tac SS 1); +(* x is output *) + by (etac exE 1); +by (etac conjE 1); + by (dtac sym 1); + by (dtac sym 1); +by (asm_full_simp_tac SS 1); +by (REPEAT (hyp_subst_tac 1)); +by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1); +by (assume_tac 1); +by (asm_full_simp_tac SS 1); +(* x is internal *) +by (simp_tac (SS addsimps [disj_demorgan,neg_ex,conj_demorgan] addcongs [conj_cong]) 1); +by (rtac impI 1); +by (etac conjE 1); +by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1); +by (assume_tac 1); +by (eres_inst_tac [("x","s")] allE 1); +by (eres_inst_tac [("x","t")] allE 1); +by (eres_inst_tac [("x","x")] allE 1); +by (eres_inst_tac [("x","x")] allE 1); +by (asm_full_simp_tac SS 1); +qed"rename_through_pmap"; + + +