theory week11A_demo2 imports "~~/src/HOL/Hoare_Parallel/RG_Syntax" begin text\ We look at an example of Hoare_Parallel/RG_Examples. We don't focus on the proof but on finding the assertions. \ lemmas definitions [simp]= stable_def Pre_def Rely_def Guar_def Post_def Com_def subsection \Set Elements of an Array to Zero\ record Example1 = A :: "nat list" (* Try to find *) lemma Example1: "\ COBEGIN SCHEME [0 \ i < n] (\A := \A [i := 0], \ TODOPrecond \, \ TODORely \, \ TODOGuarantee \, \ TODOPostcond \) COEND SAT [\ n < length \A \, \ \A = \A \, \ True \, \ \i < n. \A ! i = 0 \]" apply(rule Parallel) apply (auto intro!: Basic) oops lemma Example1: "\ COBEGIN SCHEME [0 \ i < n] (\A := \A [i := 0], \ n < length \A \, \ length \A = length \A \ \A ! i = \A ! i \, \ length \A = length \A \ (\j j \ \A ! j = \A ! j) \, \ \A ! i = 0 \) COEND SAT [\ n < length \A \, \ \A = \A \, \ True \, \ \i < n. \A ! i = 0 \]" apply(rule Parallel) apply (auto intro!: Basic) done end