definition stable :: "'a set ==> ('a × 'a) set ==> bool"where "stable ≡ λf g. (∀x y. x ∈ f ⟶ (x, y) ∈ g ⟶ y ∈ f)"
inductive
rghoare :: "['a com, 'a set, ('a × 'a) set, ('a × 'a) set, 'a set] ==> bool"
(‹⊨ _ sat [_, _, _, _]› [60,0,0,0,0] 45) where
Basic: "[ pre ⊆ {s. f s ∈ post}; {(s,t). s ∈ pre ∧ (t=f s ∨ t=s)} ⊆ guar; stable pre rely; stable post rely ] ==>⊨ Basic f sat [pre, rely, guar, post]"
| Seq: "[⊨ P sat [pre, rely, guar, mid]; ⊨ Q sat [mid, rely, guar, post] ] ==>⊨ Seq P Q sat [pre, rely, guar, post]"
| Cond: "[ stable pre rely; ⊨ P1 sat [pre ∩ b, rely, guar, post]; ⊨ P2 sat [pre ∩ -b, rely, guar, post]; ∀s. (s,s)∈guar ] ==>⊨ Cond b P1 P2 sat [pre, rely, guar, post]"
| While: "[ stable pre rely; (pre ∩ -b) ⊆ post; stable post rely; ⊨ P sat [pre ∩ b, rely, guar, pre]; ∀s. (s,s)∈guar ] ==>⊨ While b P sat [pre, rely, guar, post]"
| Await: "[ stable pre rely; stable post rely; ∀V. ⊨ P sat [pre ∩ b ∩ {V}, {(s, t). s = t}, UNIV, {s. (V, s) ∈ guar} ∩ post] ] ==>⊨ Await b P sat [pre, rely, guar, post]"
| Conseq: "[ pre ⊆ pre'; rely ⊆ rely'; guar' ⊆ guar; post' ⊆ post; ⊨ P sat [pre', rely', guar', post'] ] ==>⊨ P sat [pre, rely, guar, post]"
definitionPre :: "'a rgformula ==> 'a set"where "Pre x ≡ fst(snd x)"
definitionPost :: "'a rgformula ==> 'a set"where "Post x ≡ snd(snd(snd(snd x)))"
lemma Ex_first_occurrence [rule_format]: "P (n::nat) ⟶ (∃m. P m ∧ (∀i¬ P i))" apply(rule nat_less_induct) apply clarify apply(case_tac "∀m. m⟶¬ P m") apply auto done
lemma stability [rule_format]: "∀j k. x ∈ cptn ⟶ stable p rely ⟶ j≤k ⟶ k⟶ snd(x!j)∈p ⟶ (∀i. (Suc i)⟶ (x!i -e→ x!(Suc i)) ⟶ (snd(x!i), snd(x!(Suc i))) ∈ rely) ⟶ (∀i. j≤i ∧ i⟶ x!i -e→ x!Suc i) ⟶ snd(x!k)∈p ∧ fst(x!j)=fst(x!k)"
supply [[simproc del: defined_all]] apply(induct x) apply clarify apply(force elim:cptn.cases) apply clarify apply(erule cptn.cases,simp) apply simp apply(case_tac k,simp,simp) apply(case_tac j,simp) apply(erule_tac x=0 in allE) apply(erule_tac x="nat"and P="λj. (0≤j) ⟶ (J j)"for J in allE,simp) apply(subgoal_tac "t∈p") apply(subgoal_tac "(∀i. i < length xs ⟶ ((P, t) # xs) ! i -e→ xs ! i ⟶ (snd (((P, t) # xs) ! i), snd (xs ! i)) ∈ rely)") apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j)∈etran"for H J in allE,simp) apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j) ⟶ (T j)∈rely"for H J T in allE,simp) apply(erule_tac x=0 and P="λj. (H j) ⟶ (J j)∈etran ⟶ T j"for H J T in allE,simp) apply(simp(no_asm_use) only:stable_def) apply(erule_tac x=s in allE) apply(erule_tac x=t in allE) apply simp apply(erule mp) apply(erule mp) apply(rule Env) apply simp apply(erule_tac x="nata"in allE) apply(erule_tac x="nat"and P="λj. (s≤j) ⟶ (J j)"for s J in allE,simp) apply(subgoal_tac "(∀i. i < length xs ⟶ ((P, t) # xs) ! i -e→ xs ! i ⟶ (snd (((P, t) # xs) ! i), snd (xs ! i)) ∈ rely)") apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j)∈etran"for H J in allE,simp) apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j) ⟶ (T j)∈rely"for H J T in allE,simp) apply(case_tac k,simp,simp) apply(case_tac j) apply(erule_tac x=0 and P="λj. (H j) ⟶ (J j)∈etran"for H J in allE,simp) apply(erule etran.cases,simp) apply(erule_tac x="nata"in allE) apply(erule_tac x="nat"and P="λj. (s≤j) ⟶ (J j)"for s J in allE,simp) apply(subgoal_tac "(∀i. i < length xs ⟶ ((Q, t) # xs) ! i -e→ xs ! i ⟶ (snd (((Q, t) # xs) ! i), snd (xs ! i)) ∈ rely)") apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j)∈etran"for H J in allE,simp) apply clarify apply(erule_tac x="Suc i"and P="λj. (H j) ⟶ (J j) ⟶ (T j)∈rely"for H J T in allE,simp) done
subsection‹Soundness of the System for Component Programs›
lemma While_sound: "[stable pre rely; pre ∩ - b ⊆ post; stable post rely; ⊨ P sat [pre ∩ b, rely, guar, pre]; ∀s. (s,s)∈guar] ==>⊨ While b P sat [pre, rely, guar, post]" apply(unfold com_validity_def) apply clarify apply(erule_tac xs="tl x"in While_sound_aux) apply(simp add:com_validity_def) apply force apply simp_all apply(simp add:cptn_iff_cptn_mod cp_def) apply(simp add:cp_def) apply clarify apply(rule nth_equalityI) apply simp_all apply(case_tac x,simp+) apply(case_tac i,simp+) apply(case_tac x,simp+) done
subsubsection‹Soundness of the Rule of Consequence›
lemma Conseq_sound: "[pre ⊆ pre'; rely ⊆ rely'; guar' ⊆ guar; post' ⊆ post; ⊨ P sat [pre', rely', guar', post']] ==>⊨ P sat [pre, rely, guar, post]" apply(simp add:com_validity_def assum_def comm_def) apply clarify apply(erule_tac x=s in allE) apply(drule_tac c=x in subsetD) apply force apply force done
subsubsection ‹Soundness of the system for sequential component programs›
theorem rgsound: "⊨ P sat [pre, rely, guar, post] ==>⊨ P sat [pre, rely, guar, post]" apply(erule rghoare.induct) apply(force elim:Basic_sound) apply(force elim:Seq_sound) apply(force elim:Cond_sound) apply(force elim:While_sound) apply(force elim:Await_sound) apply(erule Conseq_sound,simp+) done
subsection‹Soundness of the System for Parallel Programs›
definition ParallelCom :: "('a rgformula) list ==> 'a par_com"where "ParallelCom Ps ≡ map (Some ∘ fst) Ps"
lemma two: "[∀i∪ (∪j∈{j. j < length xs ∧ j ≠ i}. Guar (xs ! j)) ⊆ Rely (xs ! i); pre ⊆ (∩i∈{i. i < length xs}. Pre (xs ! i)); ∀i ⊨ Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)]; length xs=length clist; x ∈ par_cp (ParallelCom xs) s; x∈par_assum(pre, rely); ∀i∈cp (Some(Com(xs!i))) s; x ∝ clist ] ==>∀j i. i∧ Suc j⟶ (clist!i!j) -c→ (clist!i!Suc j) ⟶ (snd(clist!i!j), snd(clist!i!Suc j)) ∈ Guar(xs!i)" apply(unfold par_cp_def) apply (rule ccontr) 🍋‹By contradiction:› apply simp apply(erule exE) 🍋‹the first c-tran that does not satisfy the guarantee-condition is from ‹σ_i›at step ‹m›.› apply(drule_tac n=j and P="λj. ∃i. H i j"for H in Ex_first_occurrence) apply(erule exE) apply clarify 🍋‹‹σ_i ∈ A(pre, rely_1)›\› apply(subgoal_tac "take (Suc (Suc m)) (clist!i) ∈ assum(Pre(xs!i), Rely(xs!i))") 🍋‹but this contradicts ‹⊨ σ_i sat [pre_i,rely_i,guar_i,post_i]›\› apply(erule_tac x=i and P="λi. H i ⟶⊨ (J i) sat [I i,K i,M i,N i]"for H J I K M N in allE,erule impE,assumption) apply(simp add:com_validity_def) apply(erule_tac x=s in allE) apply(simp add:cp_def comm_def) apply(drule_tac c="take (Suc (Suc m)) (clist ! i)"in subsetD) apply simp apply (blast intro: takecptn_is_cptn) apply simp apply clarify apply(erule_tac x=m and P="λj. I j ∧ J j ⟶ H j"for I J H in allE) apply (simp add:conjoin_def same_length_def) apply(simp add:assum_def) apply(rule conjI) apply(erule_tac x=i and P="λj. H j ⟶ I j ∈cp (K j) (J j)"for H I K J in allE) apply(simp add:cp_def par_assum_def) apply(drule_tac c="s"in subsetD,simp) apply simp apply clarify apply(erule_tac x=i and P="λj. H j ⟶ M ∪∪((T j) ` (S j)) ⊆ (L j)"for H M S T L in allE) apply simp apply(erule subsetD) apply simp apply(simp add:conjoin_def compat_label_def) apply clarify apply(erule_tac x=ia and P="λj. H j ⟶ (P j) ∨ Q j"for H P Q in allE,simp) 🍋‹each etran in ‹σ_1[0…m]›corresponds to› apply(erule disjE) 🍋‹a c-tran in some ‹σ_{ib}›\› apply clarify apply(case_tac "i=ib",simp) apply(erule etranE,simp) apply(erule_tac x="ib"and P="λi. H i ⟶ (I i) ∨ (J i)"for H I J in allE) apply (erule etranE) apply(case_tac "ia=m",simp) apply simp apply(erule_tac x=ia and P="λj. H j ⟶ (∀i. P i j)"for H P in allE) apply(subgoal_tac "ia,simp) prefer 2 apply arith apply(erule_tac x=ib and P="λj. (I j, H j) ∈ ctran ⟶ P i j"for I H P in allE,simp) apply(simp add:same_state_def) apply(erule_tac x=i and P="λj. (T j) ⟶ (∀i. (H j i) ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in all_dupE) apply(erule_tac x=ib and P="λj. (T j) ⟶ (∀i. (H j i) ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in allE,simp) 🍋‹or an e-tran in ‹σ›, therefore it satisfies ‹rely ∨ guar_{ib}›\› apply (force simp add:par_assum_def same_state_def) done
lemma three [rule_format]: "[ xs≠[]; ∀i∪ (∪j∈{j. j < length xs ∧ j ≠ i}. Guar (xs ! j)) ⊆ Rely (xs ! i); pre ⊆ (∩i∈{i. i < length xs}. Pre (xs ! i)); ∀i ⊨ Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)]; length xs=length clist; x ∈ par_cp (ParallelCom xs) s; x ∈ par_assum(pre, rely); ∀i∈cp (Some(Com(xs!i))) s; x ∝ clist ] ==>∀j i. i∧ Suc j⟶ (clist!i!j) -e→ (clist!i!Suc j) ⟶ (snd(clist!i!j), snd(clist!i!Suc j)) ∈ rely ∪ (∪j∈{j. j < length xs ∧ j ≠ i}. Guar (xs ! j))" apply(drule two) apply simp_all apply clarify apply(simp add:conjoin_def compat_label_def) apply clarify apply(erule_tac x=j and P="λj. H j ⟶ (J j ∧ (∃i. P i j)) ∨ I j"for H J P I in allE,simp) apply(erule disjE) prefer 2 apply(force simp add:same_state_def par_assum_def) apply clarify apply(case_tac "i=ia",simp) apply(erule etranE,simp) apply(erule_tac x="ia"and P="λi. H i ⟶ (I i) ∨ (J i)"for H I J in allE,simp) apply(erule_tac x=j and P="λj. ∀i. S j i ⟶ (I j i, H j i) ∈ ctran ⟶ P i j"for S I H P in allE) apply(erule_tac x=ia and P="λj. S j ⟶ (I j, H j) ∈ ctran ⟶ P j"for S I H P in allE) apply(simp add:same_state_def) apply(erule_tac x=i and P="λj. T j ⟶ (∀i. H j i ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in all_dupE) apply(erule_tac x=ia and P="λj. T j ⟶ (∀i. H j i ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in allE,simp) done
lemma four: "[xs≠[]; ∀i < length xs. rely ∪ (∪j∈{j. j < length xs ∧ j ≠ i}. Guar (xs ! j)) ⊆ Rely (xs ! i); (∪j∈{j. j < length xs}. Guar (xs ! j)) ⊆ guar; pre ⊆ (∩i∈{i. i < length xs}. Pre (xs ! i)); ∀i < length xs. ⊨ Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)]; x ∈ par_cp (ParallelCom xs) s; x ∈ par_assum (pre, rely); Suc i < length x; x ! i -pc→ x ! Suc i] ==> (snd (x ! i), snd (x ! Suc i)) ∈ guar" apply(simp add: ParallelCom_def) apply(subgoal_tac "(map (Some ∘ fst) xs)≠[]") prefer 2 apply simp apply(frule rev_subsetD) apply(erule one [THEN equalityD1]) apply(erule subsetD) apply simp apply clarify apply(drule_tac pre=preand rely=rely and x=x and s=s and xs=xs and clist=clist in two) apply(assumption+) apply(erule sym) apply(simp add:ParallelCom_def) apply assumption apply(simp add:Com_def) apply assumption apply(simp add:conjoin_def same_program_def) apply clarify apply(erule_tac x=i and P="λj. H j ⟶ fst(I j)=(J j)"for H I J in all_dupE) apply(erule_tac x="Suc i"and P="λj. H j ⟶ fst(I j)=(J j)"for H I J in allE) apply(erule par_ctranE,simp) apply(erule_tac x=i and P="λj. ∀i. S j i ⟶ (I j i, H j i) ∈ ctran ⟶ P i j"for S I H P in allE) apply(erule_tac x=ia and P="λj. S j ⟶ (I j, H j) ∈ ctran ⟶ P j"for S I H P in allE) apply(rule_tac x=ia in exI) apply(simp add:same_state_def) apply(erule_tac x=ia and P="λj. T j ⟶ (∀i. H j i ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in all_dupE,simp) apply(erule_tac x=ia and P="λj. T j ⟶ (∀i. H j i ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in allE,simp) apply(erule_tac x=i and P="λj. H j ⟶ (snd (d j))=(snd (e j))"for H d e in all_dupE) apply(erule_tac x=i and P="λj. H j ⟶ (snd (d j))=(snd (e j))"for H d e in all_dupE,simp) apply(erule_tac x="Suc i"and P="λj. H j ⟶ (snd (d j))=(snd (e j))"for H d e in allE,simp) apply(erule mp) apply(subgoal_tac "r=fst(clist ! ia ! Suc i)",simp) apply(drule_tac i=ia in list_eq_if) back apply simp_all done
lemma five: "[xs≠[]; ∀i∪ (∪j∈{j. j < length xs ∧ j ≠ i}. Guar (xs ! j)) ⊆ Rely (xs ! i); pre ⊆ (∩i∈{i. i < length xs}. Pre (xs ! i)); (∩i∈{i. i < length xs}. Post (xs ! i)) ⊆ post; ∀i < length xs. ⊨ Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)]; x ∈ par_cp (ParallelCom xs) s; x ∈ par_assum (pre, rely); All_None (fst (last x)) ]==> snd (last x) ∈ post" apply(simp add: ParallelCom_def) apply(subgoal_tac "(map (Some ∘ fst) xs)≠[]") prefer 2 apply simp apply(frule rev_subsetD) apply(erule one [THEN equalityD1]) apply(erule subsetD) apply simp apply clarify apply(subgoal_tac "∀i∈assum(Pre(xs!i), Rely(xs!i))") apply(erule_tac x=xa and P="λi. H i ⟶⊨ (J i) sat [I i,K i,M i,N i]"for H J I K M N in allE,erule impE,assumption) apply(simp add:com_validity_def) apply(erule_tac x=s in allE) apply(erule_tac x=xa and P="λj. H j ⟶ (I j) ∈ cp (J j) s"for H I J in allE,simp) apply(drule_tac c="clist!xa"in subsetD) apply (force simp add:Com_def) apply(simp add:comm_def conjoin_def same_program_def del:last.simps) apply clarify apply(erule_tac x="length x - 1"and P="λj. H j ⟶ fst(I j)=(J j)"for H I J in allE) apply (simp add:All_None_def same_length_def) apply(erule_tac x=xa and P="λj. H j ⟶ length(J j)=(K j)"for H J K in allE) apply(subgoal_tac "length x - 1 < length x",simp) apply(case_tac "x≠[]") apply(simp add: last_conv_nth) apply(erule_tac x="clist!xa"in ballE) apply(simp add:same_state_def) apply(subgoal_tac "clist!xa≠[]") apply(simp add: last_conv_nth) apply(case_tac x) apply (force simp add:par_cp_def) apply (force simp add:par_cp_def) apply force apply (force simp add:par_cp_def) apply(case_tac x) apply (force simp add:par_cp_def) apply (force simp add:par_cp_def) apply clarify apply(simp add:assum_def) apply(rule conjI) apply(simp add:conjoin_def same_state_def par_cp_def) apply clarify apply(erule_tac x=i and P="λj. T j ⟶ (∀i. H j i ⟶ (snd (d j i))=(snd (e j i)))"for T H d e in allE,simp) apply(erule_tac x=0 and P="λj. H j ⟶ (snd (d j))=(snd (e j))"for H d e in allE) apply(case_tac x,simp+) apply (simp add:par_assum_def) apply clarify apply(drule_tac c="snd (clist ! i ! 0)"in subsetD) apply assumption apply simp apply clarify apply(erule_tac x=i in all_dupE) apply(rule subsetD, erule mp, assumption) apply(erule_tac pre=preand rely=rely and x=x and s=s in three) apply(erule_tac x=ib in allE,erule mp) apply simp_all apply(simp add:ParallelCom_def) apply(force simp add:Com_def) apply(simp add:conjoin_def same_length_def) done
lemma ParallelEmpty [rule_format]: "∀i s. x ∈ par_cp (ParallelCom []) s ⟶ Suc i < length x ⟶ (x ! i, x ! Suc i) ∉ par_ctran" apply(induct_tac x) apply(simp add:par_cp_def ParallelCom_def) apply clarify apply(case_tac list,simp,simp) apply(case_tac i) apply(simp add:par_cp_def ParallelCom_def) apply(erule par_ctranE,simp) apply(simp add:par_cp_def ParallelCom_def) apply clarify apply(erule par_cptn.cases,simp) apply simp apply(erule par_ctranE) back apply simp done
theorem par_rgsound: "⊨ c SAT [pre, rely, guar, post] ==> ⊨ (ParallelCom c) SAT [pre, rely, guar, post]" apply(erule par_rghoare.induct) apply(case_tac xs,simp) apply(simp add:par_com_validity_def par_comm_def) apply clarify apply(case_tac "post=UNIV",simp) apply clarify apply(drule ParallelEmpty) apply assumption apply simp apply clarify apply simp apply(subgoal_tac "xs≠[]") prefer 2 apply simp apply(rename_tac a list) apply(thin_tac "xs = a # list") apply(simp add:par_com_validity_def par_comm_def) apply clarify apply(rule conjI) apply clarify apply(erule_tac pre=preand rely=rely and guar=guar and x=x and s=s and xs=xs in four) apply(assumption+) apply clarify apply (erule allE, erule impE, assumption,erule rgsound) apply(assumption+) apply clarify apply(erule_tac pre=preand rely=rely andpost=postand x=x and s=s and xs=xs in five) apply(assumption+) apply clarify apply (erule allE, erule impE, assumption,erule rgsound) apply(assumption+) done
end
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.22Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-05-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.