src/HOL/HoareParallel/RG_Tran.thy
author berghofe
Wed, 11 Jul 2007 11:14:51 +0200
changeset 23746 a455e69c31cc
parent 15425 6356d2523f73
permissions -rw-r--r--
Adapted to new inductive definition package.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     1
header {* \section{Operational Semantics} *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     2
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
     3
theory RG_Tran
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
     4
imports RG_Com
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
     5
begin
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     6
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     7
subsection {* Semantics of Component Programs *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     8
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     9
subsubsection {* Environment transitions *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    10
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    11
types 'a conf = "(('a com) option) \<times> 'a"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    12
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    13
inductive_set
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    14
  etran :: "('a conf \<times> 'a conf) set" 
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    15
  and etran' :: "'a conf \<Rightarrow> 'a conf \<Rightarrow> bool"  ("_ -e\<rightarrow> _" [81,81] 80)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    16
where
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    17
  "P -e\<rightarrow> Q \<equiv> (P,Q) \<in> etran"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    18
| Env: "(P, s) -e\<rightarrow> (P, t)"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    19
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    20
lemma etranE: "c -e\<rightarrow> c' \<Longrightarrow> (\<And>P s t. c = (P, s) \<Longrightarrow> c' = (P, t) \<Longrightarrow> Q) \<Longrightarrow> Q"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    21
  by (induct c, induct c', erule etran.cases, blast)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    22
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    23
subsubsection {* Component transitions *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    24
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    25
inductive_set
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    26
  ctran :: "('a conf \<times> 'a conf) set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    27
  and ctran' :: "'a conf \<Rightarrow> 'a conf \<Rightarrow> bool"   ("_ -c\<rightarrow> _" [81,81] 80)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    28
  and ctrans :: "'a conf \<Rightarrow> 'a conf \<Rightarrow> bool"   ("_ -c*\<rightarrow> _" [81,81] 80)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    29
where
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    30
  "P -c\<rightarrow> Q \<equiv> (P,Q) \<in> ctran"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    31
| "P -c*\<rightarrow> Q \<equiv> (P,Q) \<in> ctran^*"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    32
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    33
| Basic:  "(Some(Basic f), s) -c\<rightarrow> (None, f s)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    34
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    35
| Seq1:   "(Some P0, s) -c\<rightarrow> (None, t) \<Longrightarrow> (Some(Seq P0 P1), s) -c\<rightarrow> (Some P1, t)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    36
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    37
| Seq2:   "(Some P0, s) -c\<rightarrow> (Some P2, t) \<Longrightarrow> (Some(Seq P0 P1), s) -c\<rightarrow> (Some(Seq P2 P1), t)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    38
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    39
| CondT: "s\<in>b  \<Longrightarrow> (Some(Cond b P1 P2), s) -c\<rightarrow> (Some P1, s)"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    40
| CondF: "s\<notin>b \<Longrightarrow> (Some(Cond b P1 P2), s) -c\<rightarrow> (Some P2, s)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    41
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    42
| WhileF: "s\<notin>b \<Longrightarrow> (Some(While b P), s) -c\<rightarrow> (None, s)"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    43
| WhileT: "s\<in>b  \<Longrightarrow> (Some(While b P), s) -c\<rightarrow> (Some(Seq P (While b P)), s)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    44
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    45
| Await:  "\<lbrakk>s\<in>b; (Some P, s) -c*\<rightarrow> (None, t)\<rbrakk> \<Longrightarrow> (Some(Await b P), s) -c\<rightarrow> (None, t)" 
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    46
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    47
monos "rtrancl_mono"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    48
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    49
subsection {* Semantics of Parallel Programs *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    50
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    51
types 'a par_conf = "('a par_com) \<times> 'a"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    52
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    53
inductive_set
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    54
  par_etran :: "('a par_conf \<times> 'a par_conf) set"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    55
  and par_etran' :: "['a par_conf,'a par_conf] \<Rightarrow> bool" ("_ -pe\<rightarrow> _" [81,81] 80)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    56
where
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    57
  "P -pe\<rightarrow> Q \<equiv> (P,Q) \<in> par_etran"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    58
| ParEnv:  "(Ps, s) -pe\<rightarrow> (Ps, t)"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    59
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    60
inductive_set
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    61
  par_ctran :: "('a par_conf \<times> 'a par_conf) set"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    62
  and par_ctran' :: "['a par_conf,'a par_conf] \<Rightarrow> bool" ("_ -pc\<rightarrow> _" [81,81] 80)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    63
where
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    64
  "P -pc\<rightarrow> Q \<equiv> (P,Q) \<in> par_ctran"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    65
| ParComp: "\<lbrakk>i<length Ps; (Ps!i, s) -c\<rightarrow> (r, t)\<rbrakk> \<Longrightarrow> (Ps, s) -pc\<rightarrow> (Ps[i:=r], t)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    66
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    67
lemma par_ctranE: "c -pc\<rightarrow> c' \<Longrightarrow>
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    68
  (\<And>i Ps s r t. c = (Ps, s) \<Longrightarrow> c' = (Ps[i := r], t) \<Longrightarrow> i < length Ps \<Longrightarrow>
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    69
     (Ps ! i, s) -c\<rightarrow> (r, t) \<Longrightarrow> P) \<Longrightarrow> P"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    70
  by (induct c, induct c', erule par_ctran.cases, blast)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    71
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    72
subsection {* Computations *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    73
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    74
subsubsection {* Sequential computations *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    75
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    76
types 'a confs = "('a conf) list"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    77
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    78
inductive_set cptn :: "('a confs) set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    79
where
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    80
  CptnOne: "[(P,s)] \<in> cptn"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    81
| CptnEnv: "(P, t)#xs \<in> cptn \<Longrightarrow> (P,s)#(P,t)#xs \<in> cptn"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    82
| CptnComp: "\<lbrakk>(P,s) -c\<rightarrow> (Q,t); (Q, t)#xs \<in> cptn \<rbrakk> \<Longrightarrow> (P,s)#(Q,t)#xs \<in> cptn"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    83
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    84
constdefs
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    85
  cp :: "('a com) option \<Rightarrow> 'a \<Rightarrow> ('a confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    86
  "cp P s \<equiv> {l. l!0=(P,s) \<and> l \<in> cptn}"  
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    87
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    88
subsubsection {* Parallel computations *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    89
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    90
types  'a par_confs = "('a par_conf) list"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    91
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    92
inductive_set par_cptn :: "('a par_confs) set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    93
where
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    94
  ParCptnOne: "[(P,s)] \<in> par_cptn"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    95
| ParCptnEnv: "(P,t)#xs \<in> par_cptn \<Longrightarrow> (P,s)#(P,t)#xs \<in> par_cptn"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
    96
| ParCptnComp: "\<lbrakk> (P,s) -pc\<rightarrow> (Q,t); (Q,t)#xs \<in> par_cptn \<rbrakk> \<Longrightarrow> (P,s)#(Q,t)#xs \<in> par_cptn"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    97
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    98
constdefs
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    99
  par_cp :: "'a par_com \<Rightarrow> 'a \<Rightarrow> ('a par_confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   100
  "par_cp P s \<equiv> {l. l!0=(P,s) \<and> l \<in> par_cptn}"  
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   101
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   102
subsection{* Modular Definition of Computation *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   103
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   104
constdefs 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   105
  lift :: "'a com \<Rightarrow> 'a conf \<Rightarrow> 'a conf"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   106
  "lift Q \<equiv> \<lambda>(P, s). (if P=None then (Some Q,s) else (Some(Seq (the P) Q), s))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   107
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   108
inductive_set cptn_mod :: "('a confs) set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   109
where
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   110
  CptnModOne: "[(P, s)] \<in> cptn_mod"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   111
| CptnModEnv: "(P, t)#xs \<in> cptn_mod \<Longrightarrow> (P, s)#(P, t)#xs \<in> cptn_mod"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   112
| CptnModNone: "\<lbrakk>(Some P, s) -c\<rightarrow> (None, t); (None, t)#xs \<in> cptn_mod \<rbrakk> \<Longrightarrow> (Some P,s)#(None, t)#xs \<in>cptn_mod"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   113
| CptnModCondT: "\<lbrakk>(Some P0, s)#ys \<in> cptn_mod; s \<in> b \<rbrakk> \<Longrightarrow> (Some(Cond b P0 P1), s)#(Some P0, s)#ys \<in> cptn_mod"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   114
| CptnModCondF: "\<lbrakk>(Some P1, s)#ys \<in> cptn_mod; s \<notin> b \<rbrakk> \<Longrightarrow> (Some(Cond b P0 P1), s)#(Some P1, s)#ys \<in> cptn_mod"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   115
| CptnModSeq1: "\<lbrakk>(Some P0, s)#xs \<in> cptn_mod; zs=map (lift P1) xs \<rbrakk>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   116
                 \<Longrightarrow> (Some(Seq P0 P1), s)#zs \<in> cptn_mod"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   117
| CptnModSeq2: 
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   118
  "\<lbrakk>(Some P0, s)#xs \<in> cptn_mod; fst(last ((Some P0, s)#xs)) = None; 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   119
  (Some P1, snd(last ((Some P0, s)#xs)))#ys \<in> cptn_mod; 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   120
  zs=(map (lift P1) xs)@ys \<rbrakk> \<Longrightarrow> (Some(Seq P0 P1), s)#zs \<in> cptn_mod"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   121
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   122
| CptnModWhile1: 
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   123
  "\<lbrakk> (Some P, s)#xs \<in> cptn_mod; s \<in> b; zs=map (lift (While b P)) xs \<rbrakk> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   124
  \<Longrightarrow> (Some(While b P), s)#(Some(Seq P (While b P)), s)#zs \<in> cptn_mod"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   125
| CptnModWhile2: 
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   126
  "\<lbrakk> (Some P, s)#xs \<in> cptn_mod; fst(last ((Some P, s)#xs))=None; s \<in> b; 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   127
  zs=(map (lift (While b P)) xs)@ys; 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   128
  (Some(While b P), snd(last ((Some P, s)#xs)))#ys \<in> cptn_mod\<rbrakk> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   129
  \<Longrightarrow> (Some(While b P), s)#(Some(Seq P (While b P)), s)#zs \<in> cptn_mod"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   130
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   131
subsection {* Equivalence of Both Definitions.*}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   132
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   133
lemma last_length: "((a#xs)!(length xs))=last (a#xs)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   134
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   135
apply(induct xs,simp+)
15236
f289e8ba2bb3 Proofs needed to be updated because induction now preserves name of
nipkow
parents: 13601
diff changeset
   136
apply(case_tac xs)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   137
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   138
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   139
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   140
lemma div_seq [rule_format]: "list \<in> cptn_mod \<Longrightarrow>
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   141
 (\<forall>s P Q zs. list=(Some (Seq P Q), s)#zs \<longrightarrow>
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   142
  (\<exists>xs. (Some P, s)#xs \<in> cptn_mod  \<and> (zs=(map (lift Q) xs) \<or>
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   143
  ( fst(((Some P, s)#xs)!length xs)=None \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   144
  (\<exists>ys. (Some Q, snd(((Some P, s)#xs)!length xs))#ys \<in> cptn_mod  
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   145
  \<and> zs=(map (lift (Q)) xs)@ys)))))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   146
apply(erule cptn_mod.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   147
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   148
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   149
    apply(force intro:CptnModOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   150
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   151
   apply(erule_tac x=Pa in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   152
   apply(erule_tac x=Q in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   153
   apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   154
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   155
   apply(erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   156
    apply(rule_tac x="(Some Pa,t)#xsa" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   157
    apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   158
     apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   159
     apply(erule CptnModEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   160
    apply(rule disjI1)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   161
    apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   162
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   163
   apply(rule_tac x="(Some Pa,t)#xsa" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   164
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   165
    apply(erule CptnModEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   166
   apply(rule disjI2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   167
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   168
    apply(case_tac xsa,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   169
   apply(rule_tac x="ys" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   170
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   171
    apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   172
   apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   173
  apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   174
  apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   175
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   176
 apply(rule_tac x="xs" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   177
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   178
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   179
apply(rule_tac x="xs" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   180
apply(simp add: last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   181
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   182
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   183
lemma cptn_onlyif_cptn_mod_aux [rule_format]:
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   184
  "\<forall>s Q t xs.((Some a, s), Q, t) \<in> ctran \<longrightarrow> (Q, t) # xs \<in> cptn_mod 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   185
  \<longrightarrow> (Some a, s) # (Q, t) # xs \<in> cptn_mod"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   186
apply(induct a)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   187
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   188
--{* basic *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   189
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   190
apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   191
apply(rule CptnModNone,rule Basic,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   192
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   193
apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   194
--{* Seq1 *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   195
apply(rule_tac xs="[(None,ta)]" in CptnModSeq2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   196
  apply(erule CptnModNone)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   197
  apply(rule CptnModOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   198
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   199
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   200
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   201
--{* Seq2 *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   202
apply(erule_tac x=sa in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   203
apply(erule_tac x="Some P2" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   204
apply(erule allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   205
apply(drule div_seq,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   206
apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   207
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   208
apply(erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   209
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   210
 apply(erule allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   211
 apply(erule_tac CptnModSeq1)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   212
 apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   213
apply clarify 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   214
apply(erule allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   215
apply(erule_tac CptnModSeq2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   216
  apply (simp add:last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   217
 apply (simp add:last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   218
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   219
--{* Cond *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   220
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   221
apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   222
apply(force elim: CptnModCondT)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   223
apply(force elim: CptnModCondF)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   224
--{* While *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   225
apply  clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   226
apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   227
apply(rule CptnModNone,erule WhileF,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   228
apply(drule div_seq,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   229
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   230
apply (erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   231
 apply(force elim:CptnModWhile1)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   232
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   233
apply(force simp add:last_length elim:CptnModWhile2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   234
--{* await *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   235
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   236
apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   237
apply(rule CptnModNone,erule Await,simp+)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   238
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   239
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   240
lemma cptn_onlyif_cptn_mod [rule_format]: "c \<in> cptn \<Longrightarrow> c \<in> cptn_mod"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   241
apply(erule cptn.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   242
  apply(rule CptnModOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   243
 apply(erule CptnModEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   244
apply(case_tac P)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   245
 apply simp
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   246
 apply(erule ctran.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   247
apply(force elim:cptn_onlyif_cptn_mod_aux)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   248
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   249
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   250
lemma lift_is_cptn: "c\<in>cptn \<Longrightarrow> map (lift P) c \<in> cptn"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   251
apply(erule cptn.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   252
  apply(force simp add:lift_def CptnOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   253
 apply(force intro:CptnEnv simp add:lift_def)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   254
apply(force simp add:lift_def intro:CptnComp Seq2 Seq1 elim:ctran.cases)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   255
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   256
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   257
lemma cptn_append_is_cptn [rule_format]: 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   258
 "\<forall>b a. b#c1\<in>cptn \<longrightarrow>  a#c2\<in>cptn \<longrightarrow> (b#c1)!length c1=a \<longrightarrow> b#c1@c2\<in>cptn"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   259
apply(induct c1)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   260
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   261
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   262
apply(erule cptn.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   263
 apply(force intro:CptnEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   264
apply(force elim:CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   265
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   266
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   267
lemma last_lift: "\<lbrakk>xs\<noteq>[]; fst(xs!(length xs - (Suc 0)))=None\<rbrakk> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   268
 \<Longrightarrow> fst((map (lift P) xs)!(length (map (lift P) xs)- (Suc 0)))=(Some P)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   269
apply(case_tac "(xs ! (length xs - (Suc 0)))")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   270
apply (simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   271
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   272
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   273
lemma last_fst [rule_format]: "P((a#x)!length x) \<longrightarrow> \<not>P a \<longrightarrow> P (x!(length x - (Suc 0)))" 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   274
apply(induct x,simp+)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   275
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   276
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   277
lemma last_fst_esp: 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   278
 "fst(((Some a,s)#xs)!(length xs))=None \<Longrightarrow> fst(xs!(length xs - (Suc 0)))=None" 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   279
apply(erule last_fst)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   280
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   281
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   282
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   283
lemma last_snd: "xs\<noteq>[] \<Longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   284
  snd(((map (lift P) xs))!(length (map (lift P) xs) - (Suc 0)))=snd(xs!(length xs - (Suc 0)))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   285
apply(case_tac "(xs ! (length xs - (Suc 0)))",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   286
apply (simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   287
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   288
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   289
lemma Cons_lift: "(Some (Seq P Q), s) # (map (lift Q) xs) = map (lift Q) ((Some P, s) # xs)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   290
by(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   291
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   292
lemma Cons_lift_append: 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   293
  "(Some (Seq P Q), s) # (map (lift Q) xs) @ ys = map (lift Q) ((Some P, s) # xs)@ ys "
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   294
by(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   295
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   296
lemma lift_nth: "i<length xs \<Longrightarrow> map (lift Q) xs ! i = lift Q  (xs! i)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   297
by (simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   298
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   299
lemma snd_lift: "i< length xs \<Longrightarrow> snd(lift Q (xs ! i))= snd (xs ! i)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   300
apply(case_tac "xs!i")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   301
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   302
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   303
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   304
lemma cptn_if_cptn_mod: "c \<in> cptn_mod \<Longrightarrow> c \<in> cptn"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   305
apply(erule cptn_mod.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   306
        apply(rule CptnOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   307
       apply(erule CptnEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   308
      apply(erule CptnComp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   309
     apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   310
     apply(erule CondT,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   311
    apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   312
    apply(erule CondF,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   313
--{* Seq1 *}   
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   314
apply(erule cptn.cases,simp_all)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   315
  apply(rule CptnOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   316
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   317
 apply(drule_tac P=P1 in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   318
 apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   319
 apply(rule CptnEnv,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   320
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   321
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   322
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   323
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   324
 apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   325
  apply(rule Seq1,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   326
 apply(drule_tac P=P1 in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   327
 apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   328
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   329
apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   330
 apply(rule Seq2,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   331
apply(drule_tac P=P1 in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   332
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   333
--{* Seq2 *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   334
apply(rule cptn_append_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   335
  apply(drule_tac P=P1 in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   336
  apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   337
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   338
apply(case_tac "xs\<noteq>[]")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   339
 apply(drule_tac P=P1 in last_lift)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   340
  apply(rule last_fst_esp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   341
  apply (simp add:last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   342
 apply(simp add:Cons_lift del:map.simps)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   343
 apply(rule conjI, clarify, simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   344
 apply(case_tac "(((Some P0, s) # xs) ! length xs)")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   345
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   346
 apply (simp add:lift_def last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   347
apply (simp add:last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   348
--{* While1 *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   349
apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   350
apply(rule WhileT,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   351
apply(drule_tac P="While b P" in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   352
apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   353
--{* While2 *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   354
apply(rule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   355
apply(rule WhileT,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   356
apply(rule cptn_append_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   357
apply(drule_tac P="While b P" in lift_is_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   358
  apply(simp add:lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   359
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   360
apply(case_tac "xs\<noteq>[]")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   361
 apply(drule_tac P="While b P" in last_lift)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   362
  apply(rule last_fst_esp,simp add:last_length)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   363
 apply(simp add:Cons_lift del:map.simps)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   364
 apply(rule conjI, clarify, simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   365
 apply(case_tac "(((Some P, s) # xs) ! length xs)")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   366
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   367
 apply (simp add:last_length lift_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   368
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   369
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   370
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   371
theorem cptn_iff_cptn_mod: "(c \<in> cptn) = (c \<in> cptn_mod)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   372
apply(rule iffI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   373
 apply(erule cptn_onlyif_cptn_mod)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   374
apply(erule cptn_if_cptn_mod)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   375
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   376
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   377
section {* Validity  of Correctness Formulas*}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   378
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   379
subsection {* Validity for Component Programs. *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   380
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   381
types 'a rgformula = "'a com \<times> 'a set \<times> ('a \<times> 'a) set \<times> ('a \<times> 'a) set \<times> 'a set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   382
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   383
constdefs
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   384
  assum :: "('a set \<times> ('a \<times> 'a) set) \<Rightarrow> ('a confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   385
  "assum \<equiv> \<lambda>(pre, rely). {c. snd(c!0) \<in> pre \<and> (\<forall>i. Suc i<length c \<longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   386
               c!i -e\<rightarrow> c!(Suc i) \<longrightarrow> (snd(c!i), snd(c!Suc i)) \<in> rely)}"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   387
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   388
  comm :: "(('a \<times> 'a) set \<times> 'a set) \<Rightarrow> ('a confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   389
  "comm \<equiv> \<lambda>(guar, post). {c. (\<forall>i. Suc i<length c \<longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   390
               c!i -c\<rightarrow> c!(Suc i) \<longrightarrow> (snd(c!i), snd(c!Suc i)) \<in> guar) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   391
               (fst (last c) = None \<longrightarrow> snd (last c) \<in> post)}"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   392
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   393
  com_validity :: "'a com \<Rightarrow> 'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set \<Rightarrow> bool" 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   394
                 ("\<Turnstile> _ sat [_, _, _, _]" [60,0,0,0,0] 45)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   395
  "\<Turnstile> P sat [pre, rely, guar, post] \<equiv> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   396
   \<forall>s. cp (Some P) s \<inter> assum(pre, rely) \<subseteq> comm(guar, post)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   397
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   398
subsection {* Validity for Parallel Programs. *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   399
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   400
constdefs
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   401
  All_None :: "(('a com) option) list \<Rightarrow> bool"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   402
  "All_None xs \<equiv> \<forall>c\<in>set xs. c=None"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   403
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   404
  par_assum :: "('a set \<times> ('a \<times> 'a) set) \<Rightarrow> ('a par_confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   405
  "par_assum \<equiv> \<lambda>(pre, rely). {c. snd(c!0) \<in> pre \<and> (\<forall>i. Suc i<length c \<longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   406
             c!i -pe\<rightarrow> c!Suc i \<longrightarrow> (snd(c!i), snd(c!Suc i)) \<in> rely)}"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   407
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   408
  par_comm :: "(('a \<times> 'a) set \<times> 'a set) \<Rightarrow> ('a par_confs) set"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   409
  "par_comm \<equiv> \<lambda>(guar, post). {c. (\<forall>i. Suc i<length c \<longrightarrow>   
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   410
        c!i -pc\<rightarrow> c!Suc i \<longrightarrow> (snd(c!i), snd(c!Suc i)) \<in> guar) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   411
         (All_None (fst (last c)) \<longrightarrow> snd( last c) \<in> post)}"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   412
13022
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   413
  par_com_validity :: "'a  par_com \<Rightarrow> 'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set 
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   414
\<Rightarrow> 'a set \<Rightarrow> bool"  ("\<Turnstile> _ SAT [_, _, _, _]" [60,0,0,0,0] 45)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   415
  "\<Turnstile> Ps SAT [pre, rely, guar, post] \<equiv> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   416
   \<forall>s. par_cp Ps s \<inter> par_assum(pre, rely) \<subseteq> par_comm(guar, post)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   417
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   418
subsection {* Compositionality of the Semantics *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   419
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   420
subsubsection {* Definition of the conjoin operator *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   421
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   422
constdefs
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   423
  same_length :: "'a par_confs \<Rightarrow> ('a confs) list \<Rightarrow> bool"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   424
  "same_length c clist \<equiv> (\<forall>i<length clist. length(clist!i)=length c)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   425
 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   426
  same_state :: "'a par_confs \<Rightarrow> ('a confs) list \<Rightarrow> bool"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   427
  "same_state c clist \<equiv> (\<forall>i <length clist. \<forall>j<length c. snd(c!j) = snd((clist!i)!j))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   428
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   429
  same_program :: "'a par_confs \<Rightarrow> ('a confs) list \<Rightarrow> bool"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   430
  "same_program c clist \<equiv> (\<forall>j<length c. fst(c!j) = map (\<lambda>x. fst(nth x j)) clist)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   431
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   432
  compat_label :: "'a par_confs \<Rightarrow> ('a confs) list \<Rightarrow> bool"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   433
  "compat_label c clist \<equiv> (\<forall>j. Suc j<length c \<longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   434
         (c!j -pc\<rightarrow> c!Suc j \<and> (\<exists>i<length clist. (clist!i)!j -c\<rightarrow> (clist!i)! Suc j \<and> 
13022
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   435
                       (\<forall>l<length clist. l\<noteq>i \<longrightarrow> (clist!l)!j -e\<rightarrow> (clist!l)! Suc j))) \<or> 
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   436
         (c!j -pe\<rightarrow> c!Suc j \<and> (\<forall>i<length clist. (clist!i)!j -e\<rightarrow> (clist!i)! Suc j)))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   437
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   438
  conjoin :: "'a par_confs \<Rightarrow> ('a confs) list \<Rightarrow> bool"  ("_ \<propto> _" [65,65] 64)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   439
  "c \<propto> clist \<equiv> (same_length c clist) \<and> (same_state c clist) \<and> (same_program c clist) \<and> (compat_label c clist)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   440
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   441
subsubsection {* Some previous lemmas *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   442
13022
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   443
lemma list_eq_if [rule_format]: 
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   444
  "\<forall>ys. xs=ys \<longrightarrow> (length xs = length ys) \<longrightarrow> (\<forall>i<length xs. xs!i=ys!i)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   445
apply (induct xs)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   446
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   447
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   448
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   449
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   450
lemma list_eq: "(length xs = length ys \<and> (\<forall>i<length xs. xs!i=ys!i)) = (xs=ys)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   451
apply(rule iffI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   452
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   453
 apply(erule nth_equalityI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   454
 apply simp+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   455
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   456
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   457
lemma nth_tl: "\<lbrakk> ys!0=a; ys\<noteq>[] \<rbrakk> \<Longrightarrow> ys=(a#(tl ys))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   458
apply(case_tac ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   459
 apply simp+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   460
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   461
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   462
lemma nth_tl_if [rule_format]: "ys\<noteq>[] \<longrightarrow> ys!0=a \<longrightarrow> P ys \<longrightarrow> P (a#(tl ys))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   463
apply(induct ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   464
 apply simp+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   465
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   466
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   467
lemma nth_tl_onlyif [rule_format]: "ys\<noteq>[] \<longrightarrow> ys!0=a \<longrightarrow> P (a#(tl ys)) \<longrightarrow> P ys"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   468
apply(induct ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   469
 apply simp+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   470
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   471
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   472
lemma seq_not_eq1: "Seq c1 c2\<noteq>c1"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   473
apply(rule com.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   474
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   475
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   476
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   477
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   478
lemma seq_not_eq2: "Seq c1 c2\<noteq>c2"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   479
apply(rule com.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   480
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   481
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   482
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   483
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   484
lemma if_not_eq1: "Cond b c1 c2 \<noteq>c1"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   485
apply(rule com.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   486
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   487
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   488
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   489
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   490
lemma if_not_eq2: "Cond b c1 c2\<noteq>c2"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   491
apply(rule com.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   492
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   493
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   494
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   495
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   496
lemmas seq_and_if_not_eq [simp] = seq_not_eq1 seq_not_eq2 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   497
seq_not_eq1 [THEN not_sym] seq_not_eq2 [THEN not_sym] 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   498
if_not_eq1 if_not_eq2 if_not_eq1 [THEN not_sym] if_not_eq2 [THEN not_sym]
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   499
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   500
lemma prog_not_eq_in_ctran_aux:
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   501
  assumes c: "(P,s) -c\<rightarrow> (Q,t)"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   502
  shows "P\<noteq>Q" using c
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   503
  by (induct x1 \<equiv> "(P,s)" x2 \<equiv> "(Q,t)" arbitrary: P s Q t) auto
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   504
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   505
lemma prog_not_eq_in_ctran [simp]: "\<not> (P,s) -c\<rightarrow> (P,t)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   506
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   507
apply(drule prog_not_eq_in_ctran_aux)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   508
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   509
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   510
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   511
lemma prog_not_eq_in_par_ctran_aux [rule_format]: "(P,s) -pc\<rightarrow> (Q,t) \<Longrightarrow> (P\<noteq>Q)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   512
apply(erule par_ctran.induct)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   513
apply(drule prog_not_eq_in_ctran_aux)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   514
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   515
apply(drule list_eq_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   516
 apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   517
apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   518
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   519
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   520
lemma prog_not_eq_in_par_ctran [simp]: "\<not> (P,s) -pc\<rightarrow> (P,t)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   521
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   522
apply(drule prog_not_eq_in_par_ctran_aux)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   523
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   524
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   525
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   526
lemma tl_in_cptn: "\<lbrakk> a#xs \<in>cptn; xs\<noteq>[] \<rbrakk> \<Longrightarrow> xs\<in>cptn"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   527
apply(force elim:cptn.cases)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   528
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   529
13022
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   530
lemma tl_zero[rule_format]: 
b115b305612f New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
prensani
parents: 13020
diff changeset
   531
  "P (ys!Suc j) \<longrightarrow> Suc j<length ys \<longrightarrow> ys\<noteq>[] \<longrightarrow> P (tl(ys)!j)"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   532
apply(induct ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   533
 apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   534
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   535
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   536
subsection {* The Semantics is Compositional *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   537
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   538
lemma aux_if [rule_format]: 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   539
  "\<forall>xs s clist. (length clist = length xs \<and> (\<forall>i<length xs. (xs!i,s)#clist!i \<in> cptn) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   540
  \<and> ((xs, s)#ys \<propto> map (\<lambda>i. (fst i,s)#snd i) (zip xs clist)) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   541
   \<longrightarrow> (xs, s)#ys \<in> par_cptn)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   542
apply(induct ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   543
 apply(clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   544
 apply(rule ParCptnOne)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   545
apply(clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   546
apply(simp add:conjoin_def compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   547
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   548
apply(erule_tac x="0" and P="\<lambda>j. ?H j \<longrightarrow> (?P j \<or> ?Q j)" in all_dupE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   549
apply(erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   550
--{* first step is a Component step *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   551
 apply clarify 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   552
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   553
 apply(subgoal_tac "a=(xs[i:=(fst(clist!i!0))])")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   554
  apply(subgoal_tac "b=snd(clist!i!0)",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   555
   prefer 2
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   556
   apply(simp add: same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   557
   apply(erule_tac x=i in allE,erule impE,assumption, 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   558
         erule_tac x=1 and P="\<lambda>j. (?H j) \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   559
  prefer 2
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   560
  apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   561
  apply(erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (fst (?s j))=(?t j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   562
  apply(rule nth_equalityI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   563
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   564
  apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   565
  apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   566
  apply(drule_tac t=i in not_sym,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   567
  apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   568
 apply(rule ParCptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   569
  apply(erule ParComp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   570
--{* applying the induction hypothesis *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   571
 apply(erule_tac x="xs[i := fst (clist ! i ! 0)]" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   572
 apply(erule_tac x="snd (clist ! i ! 0)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   573
 apply(erule mp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   574
 apply(rule_tac x="map tl clist" in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   575
 apply(rule conjI,clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   576
  apply(case_tac "i=ia",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   577
   apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   578
     apply(force simp add:same_length_def length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   579
    apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   580
   apply(erule allE,erule impE,assumption,erule tl_in_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   581
   apply(force simp add:same_length_def length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   582
  apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   583
    apply(force simp add:same_length_def length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   584
   apply(simp add:same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   585
   apply(erule_tac x=ia in allE, erule impE, assumption, 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   586
     erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   587
   apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   588
   apply(drule_tac t=i  in not_sym,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   589
   apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   590
  apply(erule allE,erule impE,assumption,erule tl_in_cptn)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   591
  apply(force simp add:same_length_def length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   592
 apply(simp add:same_length_def same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   593
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   594
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   595
  apply(case_tac j,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   596
  apply(erule_tac x=ia in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   597
        erule_tac x="Suc(Suc nat)" and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   598
  apply(force simp add:same_length_def length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   599
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   600
  apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   601
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   602
  apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   603
   apply(rule nth_equalityI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   604
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   605
   apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   606
  apply(erule_tac x="Suc(Suc nat)" and P="\<lambda>j. ?H j \<longrightarrow> (fst (?s j))=(?t j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   607
  apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   608
  apply(force simp add:length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   609
 apply(rule allI,rule impI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   610
 apply(erule_tac x="Suc j" and P="\<lambda>j. ?H j \<longrightarrow> (?I j \<or> ?J j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   611
 apply(erule disjE) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   612
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   613
  apply(rule_tac x=ia in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   614
  apply(case_tac "i=ia",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   615
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   616
    apply(force simp add: length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   617
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   618
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE,erule impE,assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   619
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE,erule impE,assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   620
   apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   621
   apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   622
    apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   623
      apply(erule_tac x=l in allE, erule impE, assumption, 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   624
            erule_tac x=1 and P="\<lambda>j.  (?H j) \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   625
      apply(force elim:etranE intro:Env)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   626
     apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   627
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   628
   apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   629
   apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   630
     apply(erule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   631
      apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   632
     apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   633
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   634
   apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   635
  apply(rule conjI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   636
   apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   637
     apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   638
    apply(erule_tac x=ia  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   639
          erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   640
    apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   641
    apply(drule_tac t=i  in not_sym,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   642
    apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   643
   apply(erule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   644
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   645
   apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   646
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   647
  apply(case_tac "i=l",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   648
   apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   649
     apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   650
    apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   651
   apply(erule_tac P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE,erule impE,assumption,erule impE,assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   652
   apply(erule tl_zero,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   653
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   654
   apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   655
     apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   656
    apply(erule_tac x=l  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   657
          erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   658
    apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE,erule impE, assumption,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   659
    apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   660
   apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   661
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   662
   apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   663
  apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   664
 apply(rule disjI2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   665
 apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   666
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   667
  apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   668
    apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> ?I j\<in>etran" in allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   669
    apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   670
    apply(erule_tac x=ia  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   671
    erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   672
    apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE,erule impE, assumption,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   673
    apply(force elim:etranE intro:Env)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   674
   apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   675
  apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   676
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   677
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   678
 apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   679
   apply(rule tl_zero,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   680
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   681
   apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   682
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   683
 apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   684
--{* first step is an environmental step *}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   685
apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   686
apply(erule par_etran.cases)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   687
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   688
apply(rule ParCptnEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   689
apply(erule_tac x="Ps" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   690
apply(erule_tac x="t" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   691
apply(erule mp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   692
apply(rule_tac x="map tl clist" in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   693
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   694
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   695
 apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (?I ?s j) \<in> cptn" in allE,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   696
 apply(erule cptn.cases)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   697
   apply(simp add:same_length_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   698
   apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   699
  apply(simp add:same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   700
  apply(erule_tac x=i  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   701
   erule_tac x=1 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   702
 apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> ?J j \<in>etran" in allE,simp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   703
 apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   704
apply(simp add:same_state_def same_length_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   705
apply(rule conjI,clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   706
 apply(case_tac j,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   707
 apply(erule_tac x=i  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   708
       erule_tac x="Suc(Suc nat)" and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   709
 apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   710
   apply(simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   711
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   712
 apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   713
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   714
 apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   715
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   716
 apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   717
  apply(rule nth_equalityI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   718
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   719
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   720
 apply(erule_tac x="Suc(Suc nat)" and P="\<lambda>j. ?H j \<longrightarrow> (fst (?s j))=(?t j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   721
 apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   722
 apply(force simp add:length_Suc_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   723
apply(rule allI,rule impI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   724
apply(erule_tac x="Suc j" and P="\<lambda>j. ?H j \<longrightarrow> (?I j \<or> ?J j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   725
apply(erule disjE) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   726
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   727
 apply(rule_tac x=i in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   728
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   729
  apply(erule_tac x=i and P="\<lambda>i. ?H i \<longrightarrow> ?J i \<in>etran" in allE, erule impE, assumption)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   730
  apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   731
  apply(erule_tac x=i  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   732
        erule_tac x=1 and P="\<lambda>j.  (?H j) \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   733
  apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   734
   apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   735
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   736
 apply(erule tl_zero,force) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   737
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   738
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   739
 apply(erule_tac x=l and P="\<lambda>i. ?H i \<longrightarrow> ?J i \<in>etran" in allE, erule impE, assumption)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   740
 apply(erule etranE,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   741
 apply(erule_tac x=l  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   742
       erule_tac x=1 and P="\<lambda>j.  (?H j) \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   743
 apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   744
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   745
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   746
  apply(rule tl_zero,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   747
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   748
 apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   749
apply(rule disjI2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   750
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   751
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   752
apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   753
 apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   754
   apply(erule_tac x=i and P="\<lambda>i. ?H i \<longrightarrow> ?J i \<in>etran" in allE, erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   755
   apply(erule_tac x=i and P="\<lambda>i. ?H i \<longrightarrow> ?J i \<in>etran" in allE, erule impE, assumption)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   756
   apply(force elim:etranE intro:Env)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   757
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   758
 apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   759
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   760
apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   761
  apply(rule tl_zero,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   762
   apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   763
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   764
 apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   765
apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   766
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   767
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   768
lemma less_Suc_0 [iff]: "(n < Suc 0) = (n = 0)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   769
by auto
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   770
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   771
lemma aux_onlyif [rule_format]: "\<forall>xs s. (xs, s)#ys \<in> par_cptn \<longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   772
  (\<exists>clist. (length clist = length xs) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   773
  (xs, s)#ys \<propto> map (\<lambda>i. (fst i,s)#(snd i)) (zip xs clist) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   774
  (\<forall>i<length xs. (xs!i,s)#(clist!i) \<in> cptn))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   775
apply(induct ys)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   776
 apply(clarify)
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
   777
 apply(rule_tac x="map (\<lambda>i. []) [0..<length xs]" in exI)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   778
 apply(simp add: conjoin_def same_length_def same_state_def same_program_def compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   779
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   780
  apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   781
 apply(force intro: cptn.intros)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   782
apply(clarify)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   783
apply(erule par_cptn.cases,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   784
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   785
 apply(erule_tac x="xs" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   786
 apply(erule_tac x="t" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   787
 apply clarify
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
   788
 apply(rule_tac x="(map (\<lambda>j. (P!j, t)#(clist!j)) [0..<length P])" in exI,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   789
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   790
  prefer 2
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   791
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   792
  apply(rule CptnEnv,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   793
 apply(simp add:conjoin_def same_length_def same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   794
 apply (rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   795
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   796
  apply(case_tac j,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   797
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   798
  apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   799
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   800
  apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   801
   apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   802
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   803
  apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   804
 apply(simp add:compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   805
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   806
 apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   807
  apply(simp add:ParEnv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   808
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   809
  apply(simp add:Env)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   810
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   811
 apply(erule_tac x=nat in allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   812
 apply(erule disjE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   813
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   814
  apply(rule_tac x=i in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   815
 apply force
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   816
apply(erule par_ctran.cases,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   817
apply(erule_tac x="Ps[i:=r]" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   818
apply(erule_tac x="ta" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   819
apply clarify
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 15236
diff changeset
   820
apply(rule_tac x="(map (\<lambda>j. (Ps!j, ta)#(clist!j)) [0..<length Ps]) [i:=((r, ta)#(clist!i))]" in exI,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   821
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   822
 prefer 2
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   823
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   824
 apply(case_tac "i=ia",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   825
  apply(erule CptnComp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   826
  apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> (?I j \<in> cptn)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   827
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   828
 apply(erule_tac x=ia in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   829
 apply(rule CptnEnv,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   830
apply(simp add:conjoin_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   831
apply (rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   832
 apply(simp add:same_length_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   833
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   834
 apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   835
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   836
 apply(simp add:same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   837
 apply clarify
13601
fd3e3d6b37b2 Adapted to new simplifier.
berghofe
parents: 13187
diff changeset
   838
 apply(case_tac j, simp, simp (no_asm_simp))
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   839
 apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   840
apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   841
 apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   842
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   843
 apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   844
  apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   845
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   846
 apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   847
 apply(erule_tac x=nat and P="\<lambda>j. ?H j \<longrightarrow> (fst (?a j))=((?b j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   848
 apply(case_tac nat)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   849
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   850
  apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   851
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   852
 apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   853
apply(simp add:compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   854
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   855
apply(case_tac j)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   856
 apply(rule conjI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   857
  apply(erule ParComp,assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   858
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   859
  apply(rule_tac x=i in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   860
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   861
 apply(rule Env)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   862
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   863
apply(erule_tac x=nat and P="\<lambda>j. ?H j \<longrightarrow> (?P j \<or> ?Q j)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   864
apply(erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   865
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   866
 apply(rule_tac x=ia in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   867
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   868
  apply(case_tac "i=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   869
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   870
 apply(case_tac "i=l",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   871
  apply(case_tac "l=ia",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   872
  apply(erule_tac x=l in allE,erule impE,assumption,erule impE, assumption,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   873
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   874
 apply(erule_tac x=l in allE,erule impE,assumption,erule impE, assumption,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   875
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   876
apply(erule_tac x=ia and P="\<lambda>j. ?H j \<longrightarrow> (?P j)\<in>etran" in allE, erule impE, assumption)
13601
fd3e3d6b37b2 Adapted to new simplifier.
berghofe
parents: 13187
diff changeset
   877
apply(case_tac "i=ia",simp,simp)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   878
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   879
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   880
lemma one_iff_aux: "xs\<noteq>[] \<Longrightarrow> (\<forall>ys. ((xs, s)#ys \<in> par_cptn) = 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   881
 (\<exists>clist. length clist= length xs \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   882
 ((xs, s)#ys \<propto> map (\<lambda>i. (fst i,s)#(snd i)) (zip xs clist)) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   883
 (\<forall>i<length xs. (xs!i,s)#(clist!i) \<in> cptn))) = 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   884
 (par_cp (xs) s = {c. \<exists>clist. (length clist)=(length xs) \<and>
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   885
 (\<forall>i<length clist. (clist!i) \<in> cp(xs!i) s) \<and> c \<propto> clist})" 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   886
apply (rule iffI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   887
 apply(rule subset_antisym)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   888
  apply(rule subsetI) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   889
  apply(clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   890
  apply(simp add:par_cp_def cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   891
  apply(case_tac x)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   892
   apply(force elim:par_cptn.cases)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   893
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   894
  apply(erule_tac x="list" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   895
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   896
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   897
  apply(rule_tac x="map (\<lambda>i. (fst i, s) # snd i) (zip xs clist)" in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   898
 apply(rule subsetI) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   899
 apply(clarify)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   900
 apply(case_tac x)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   901
  apply(erule_tac x=0 in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   902
  apply(simp add:cp_def conjoin_def same_length_def same_program_def same_state_def compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   903
  apply clarify
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 15425
diff changeset
   904
  apply(erule cptn.cases,force,force,force)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   905
 apply(simp add:par_cp_def conjoin_def  same_length_def same_program_def same_state_def compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   906
 apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   907
 apply(erule_tac x=0 and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in all_dupE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   908
 apply(subgoal_tac "a = xs")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   909
  apply(subgoal_tac "b = s",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   910
   prefer 3
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   911
   apply(erule_tac x=0 and P="\<lambda>j. ?H j \<longrightarrow> (fst (?s j))=((?t j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   912
   apply (simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   913
   apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   914
  prefer 2
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   915
  apply(erule_tac x=0 in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   916
  apply (simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   917
  apply(erule_tac x=0 and P="\<lambda>j. ?H j \<longrightarrow> (\<forall>i. ?T i \<longrightarrow> (snd (?d j i))=(snd (?e j i)))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   918
  apply(erule_tac x=0 and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   919
 apply(erule_tac x=list in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   920
 apply(rule_tac x="map tl clist" in exI,simp) 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   921
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   922
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   923
  apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   924
   apply(erule_tac x=i  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   925
        erule_tac x="0" and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   926
  apply(erule_tac x=i  in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   927
        erule_tac x="Suc nat" and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   928
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   929
  apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   930
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   931
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   932
  apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   933
  apply(case_tac j)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   934
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   935
   apply(erule_tac x=i in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   936
   apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   937
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   938
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   939
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   940
  apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   941
 apply(thin_tac "?H = (\<exists>i. ?J i)")
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   942
 apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   943
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   944
  apply(erule_tac x=j in allE,erule impE, assumption,erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   945
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   946
   apply(rule_tac x=i in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   947
   apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   948
    apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   949
     apply(erule_tac x=i in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   950
     apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   951
     apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   952
     apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   953
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   954
    apply(erule_tac x=l in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   955
    apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   956
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   957
    apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   958
    apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   959
    apply(case_tac "clist!l",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   960
   apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   961
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   962
    apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   963
    apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   964
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   965
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   966
   apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   967
   apply(case_tac "clist!l",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   968
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   969
  apply(erule_tac x=i in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   970
  apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   971
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   972
  apply(case_tac "clist!i",simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   973
  apply(rule nth_tl_if,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   974
  apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (?P j)\<in>etran" in allE, erule impE, assumption,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   975
  apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   976
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   977
  apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   978
   apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   979
   apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   980
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   981
 apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   982
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   983
apply(rule iffI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   984
 apply(simp add:par_cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   985
 apply(erule_tac c="(xs, s) # ys" in equalityCE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   986
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   987
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   988
  apply(rule_tac x="map tl clist" in exI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   989
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   990
  apply (rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   991
   apply(simp add:conjoin_def cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   992
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   993
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   994
    apply(unfold same_length_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   995
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   996
    apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   997
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   998
    apply(simp add:same_state_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   999
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1000
    apply(erule_tac x=i in allE, erule impE, assumption,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1001
       erule_tac x=j and P="\<lambda>j. ?H j \<longrightarrow> (snd (?d j))=(snd (?e j))" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1002
    apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1003
    apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1004
    apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1005
   apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1006
    apply(simp add:same_program_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1007
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1008
    apply(rule nth_equalityI,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1009
    apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1010
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1011
    apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1012
    apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1013
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1014
   apply(simp add:compat_label_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1015
   apply(rule allI,rule impI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1016
   apply(erule_tac x=j in allE,erule impE, assumption)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1017
   apply(erule disjE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1018
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1019
    apply(rule_tac x=i in exI,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1020
    apply(rule conjI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1021
     apply(erule_tac x=i in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1022
     apply(case_tac j,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1023
      apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1024
      apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1025
     apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1026
     apply(case_tac "clist!i",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1027
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1028
    apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> ?I j \<longrightarrow> ?J j" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1029
    apply(erule_tac x=l and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1030
    apply(case_tac "clist!l",simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1031
    apply(erule_tac x=l in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1032
   apply(rule disjI2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1033
   apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1034
   apply(rule tl_zero)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1035
     apply(case_tac j,simp,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1036
     apply(rule tl_zero,force)   
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1037
      apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1038
     apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1039
    apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1040
   apply(erule_tac x=i and P="\<lambda>j. ?H j \<longrightarrow> (length (?s j) = ?t)" in allE,force)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1041
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1042
  apply(erule_tac x=i in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1043
  apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1044
  apply(rule nth_tl_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1045
    apply(simp add:conjoin_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1046
    apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1047
    apply(simp add:same_length_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1048
    apply(erule_tac x=i in allE,simp)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1049
   apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1050
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1051
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1052
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1053
apply(erule_tac c="(xs, s) # ys" in equalityCE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1054
 apply(simp add:par_cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1055
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1056
apply(erule_tac x="map (\<lambda>i. (fst i, s) # snd i) (zip xs clist)" in allE)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1057
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1058
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1059
apply(simp add:cp_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1060
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1061
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1062
theorem one: "xs\<noteq>[] \<Longrightarrow> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1063
 par_cp xs s = {c. \<exists>clist. (length clist)=(length xs) \<and> 
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1064
               (\<forall>i<length clist. (clist!i) \<in> cp(xs!i) s) \<and> c \<propto> clist}"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1065
apply(frule one_iff_aux)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1066
apply(drule sym)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1067
apply(erule iffD2)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1068
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1069
apply(rule iffI)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1070
 apply(erule aux_onlyif)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1071
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1072
apply(force intro:aux_if)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1073
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
  1074
13187
e5434b822a96 Modifications due to enhanced linear arithmetic.
nipkow
parents: 13022
diff changeset
  1075
end