CpsG_2.thy
author zhangx
Thu, 28 Jan 2016 16:33:49 +0800
changeset 88 83dd5345d5d0
parent 81 c495eb16beb6
permissions -rw-r--r--
Merged back ExtGG.thy and PrioG.thy.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
81
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     1
theory CpsG
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     2
imports PIPDefs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     3
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     4
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     5
lemma Max_fg_mono:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     6
  assumes "finite A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     7
  and "\<forall> a \<in> A. f a \<le> g a"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     8
  shows "Max (f ` A) \<le> Max (g ` A)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
     9
proof(cases "A = {}")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    10
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    11
  thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    12
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    13
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    14
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    15
  proof(rule Max.boundedI)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    16
    from assms show "finite (f ` A)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    17
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    18
    from False show "f ` A \<noteq> {}" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    19
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    20
    fix fa
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    21
    assume "fa \<in> f ` A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    22
    then obtain a where h_fa: "a \<in> A" "fa = f a" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    23
    show "fa \<le> Max (g ` A)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    24
    proof(rule Max_ge_iff[THEN iffD2])
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    25
      from assms show "finite (g ` A)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    26
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    27
      from False show "g ` A \<noteq> {}" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    28
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    29
      from h_fa have "g a \<in> g ` A" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    30
      moreover have "fa \<le> g a" using h_fa assms(2) by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    31
      ultimately show "\<exists>a\<in>g ` A. fa \<le> a" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    32
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    33
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    34
qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    35
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    36
lemma Max_f_mono:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    37
  assumes seq: "A \<subseteq> B"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    38
  and np: "A \<noteq> {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    39
  and fnt: "finite B"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    40
  shows "Max (f ` A) \<le> Max (f ` B)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    41
proof(rule Max_mono)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    42
  from seq show "f ` A \<subseteq> f ` B" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    43
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    44
  from np show "f ` A \<noteq> {}" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    45
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    46
  from fnt and seq show "finite (f ` B)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    47
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    48
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    49
lemma eq_RAG: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    50
  "RAG (wq s) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    51
  by (unfold cs_RAG_def s_RAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    52
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    53
lemma waiting_holding:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    54
  assumes "waiting (s::state) th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    55
  obtains th' where "holding s th' cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    56
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    57
  from assms[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    58
  obtain th' where "th' \<in> set (wq s cs)" "th' = hd (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    59
    by (metis empty_iff hd_in_set list.set(1))
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    60
  hence "holding s th' cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    61
    by (unfold s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    62
  from that[OF this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    63
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    64
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    65
lemma cp_eq_cpreced: "cp s th = cpreced (wq s) s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    66
unfolding cp_def wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    67
apply(induct s rule: schs.induct)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    68
apply(simp add: Let_def cpreced_initial)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    69
apply(simp add: Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    70
apply(simp add: Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    71
apply(simp add: Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    72
apply(subst (2) schs.simps)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    73
apply(simp add: Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    74
apply(subst (2) schs.simps)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    75
apply(simp add: Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    76
done
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    77
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    78
lemma cp_alt_def:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    79
  "cp s th =  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    80
           Max ((the_preced s) ` {th'. Th th' \<in> (subtree (RAG s) (Th th))})"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    81
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    82
  have "Max (the_preced s ` ({th} \<union> dependants (wq s) th)) =
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    83
        Max (the_preced s ` {th'. Th th' \<in> subtree (RAG s) (Th th)})" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    84
          (is "Max (_ ` ?L) = Max (_ ` ?R)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    85
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    86
    have "?L = ?R" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    87
    by (auto dest:rtranclD simp:cs_dependants_def cs_RAG_def s_RAG_def subtree_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    88
    thus ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    89
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    90
  thus ?thesis by (unfold cp_eq_cpreced cpreced_def, fold the_preced_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    91
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    92
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    93
(* ccc *)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    94
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    95
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    96
locale valid_trace = 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    97
  fixes s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    98
  assumes vt : "vt s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
    99
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   100
locale valid_trace_e = valid_trace +
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   101
  fixes e
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   102
  assumes vt_e: "vt (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   103
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   104
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   105
lemma pip_e: "PIP s e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   106
  using vt_e by (cases, simp)  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   107
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   108
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   109
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   110
locale valid_trace_create = valid_trace_e + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   111
  fixes th prio
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   112
  assumes is_create: "e = Create th prio"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   113
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   114
locale valid_trace_exit = valid_trace_e + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   115
  fixes th
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   116
  assumes is_exit: "e = Exit th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   117
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   118
locale valid_trace_p = valid_trace_e + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   119
  fixes th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   120
  assumes is_p: "e = P th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   121
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   122
locale valid_trace_v = valid_trace_e + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   123
  fixes th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   124
  assumes is_v: "e = V th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   125
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   126
  definition "rest = tl (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   127
  definition "wq' = (SOME q. distinct q \<and> set q = set rest)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   128
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   129
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   130
locale valid_trace_v_n = valid_trace_v +
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   131
  assumes rest_nnl: "rest \<noteq> []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   132
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   133
locale valid_trace_v_e = valid_trace_v +
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   134
  assumes rest_nil: "rest = []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   135
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   136
locale valid_trace_set= valid_trace_e + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   137
  fixes th prio
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   138
  assumes is_set: "e = Set th prio"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   139
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   140
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   141
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   142
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   143
lemma ind [consumes 0, case_names Nil Cons, induct type]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   144
  assumes "PP []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   145
     and "(\<And>s e. valid_trace_e s e \<Longrightarrow>
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   146
                   PP s \<Longrightarrow> PIP s e \<Longrightarrow> PP (e # s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   147
     shows "PP s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   148
proof(induct rule:vt.induct[OF vt, case_names Init Step])
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   149
  case Init
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   150
  from assms(1) show ?case .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   151
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   152
  case (Step s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   153
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   154
  proof(rule assms(2))
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   155
    show "valid_trace_e s e" using Step by (unfold_locales, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   156
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   157
    show "PP s" using Step by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   158
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   159
    show "PIP s e" using Step by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   160
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   161
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   162
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   163
lemma  vt_moment: "\<And> t. vt (moment t s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   164
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   165
  case Nil
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   166
  thus ?case by (simp add:vt_nil)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   167
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   168
  case (Cons s e t)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   169
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   170
  proof(cases "t \<ge> length (e#s)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   171
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   172
    from True have "moment t (e#s) = e#s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   173
    thus ?thesis using Cons
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   174
      by (simp add:valid_trace_def valid_trace_e_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   175
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   176
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   177
    from Cons have "vt (moment t s)" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   178
    moreover have "moment t (e#s) = moment t s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   179
    proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   180
      from False have "t \<le> length s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   181
      from moment_app [OF this, of "[e]"] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   182
      show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   183
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   184
    ultimately show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   185
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   186
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   187
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   188
lemma finite_threads:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   189
  shows "finite (threads s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   190
using vt by (induct) (auto elim: step.cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   191
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   192
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   193
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   194
lemma RAG_target_th: "(Th th, x) \<in> RAG (s::state) \<Longrightarrow> \<exists> cs. x = Cs cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   195
  by (unfold s_RAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   196
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   197
locale valid_moment = valid_trace + 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   198
  fixes i :: nat
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   199
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   200
sublocale valid_moment < vat_moment: valid_trace "(moment i s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   201
  by (unfold_locales, insert vt_moment, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   202
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   203
lemma waiting_eq: "waiting s th cs = waiting (wq s) th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   204
  by  (unfold s_waiting_def cs_waiting_def wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   205
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   206
lemma holding_eq: "holding (s::state) th cs = holding (wq s) th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   207
  by (unfold s_holding_def wq_def cs_holding_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   208
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   209
lemma runing_ready: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   210
  shows "runing s \<subseteq> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   211
  unfolding runing_def readys_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   212
  by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   213
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   214
lemma readys_threads:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   215
  shows "readys s \<subseteq> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   216
  unfolding readys_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   217
  by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   218
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   219
lemma wq_v_neq [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   220
   "cs \<noteq> cs' \<Longrightarrow> wq (V thread cs#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   221
  by (auto simp:wq_def Let_def cp_def split:list.splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   222
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   223
lemma runing_head:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   224
  assumes "th \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   225
  and "th \<in> set (wq_fun (schs s) cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   226
  shows "th = hd (wq_fun (schs s) cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   227
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   228
  by (simp add:runing_def readys_def s_waiting_def wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   229
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   230
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   231
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   232
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   233
lemma runing_wqE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   234
  assumes "th \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   235
  and "th \<in> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   236
  obtains rest where "wq s cs = th#rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   237
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   238
  from assms(2) obtain th' rest where eq_wq: "wq s cs = th'#rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   239
    by (meson list.set_cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   240
  have "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   241
  proof(rule ccontr)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   242
    assume "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   243
    hence "th \<noteq> hd (wq s cs)" using eq_wq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   244
    with assms(2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   245
    have "waiting s th cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   246
      by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   247
    with assms show False 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   248
      by (unfold runing_def readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   249
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   250
  with eq_wq that show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   251
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   252
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   253
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   254
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   255
context valid_trace_create
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   256
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   257
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   258
lemma wq_neq_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   259
  shows "wq (e#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   260
    using assms unfolding is_create wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   261
  by (auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   262
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   263
lemma wq_distinct_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   264
  assumes "distinct (wq s cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   265
  shows "distinct (wq (e#s) cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   266
  using assms by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   267
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   268
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   269
context valid_trace_exit
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   270
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   271
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   272
lemma wq_neq_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   273
  shows "wq (e#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   274
    using assms unfolding is_exit wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   275
  by (auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   276
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   277
lemma wq_distinct_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   278
  assumes "distinct (wq s cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   279
  shows "distinct (wq (e#s) cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   280
  using assms by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   281
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   282
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   283
context valid_trace_p
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   284
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   285
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   286
lemma wq_neq_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   287
  assumes "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   288
  shows "wq (e#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   289
    using assms unfolding is_p wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   290
  by (auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   291
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   292
lemma runing_th_s:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   293
  shows "th \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   294
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   295
  from pip_e[unfolded is_p]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   296
  show ?thesis by (cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   297
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   298
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   299
lemma ready_th_s: "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   300
  using runing_th_s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   301
  by (unfold runing_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   302
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   303
lemma live_th_s: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   304
  using readys_threads ready_th_s by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   305
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   306
lemma live_th_es: "th \<in> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   307
  using live_th_s 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   308
  by (unfold is_p, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   309
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   310
lemma th_not_waiting: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   311
  "\<not> waiting s th c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   312
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   313
  have "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   314
    using runing_ready runing_th_s by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   315
  thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   316
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   317
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   318
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   319
lemma waiting_neq_th: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   320
  assumes "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   321
  shows "t \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   322
  using assms using th_not_waiting by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   323
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   324
lemma th_not_in_wq: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   325
  shows "th \<notin> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   326
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   327
  assume otherwise: "th \<in> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   328
  from runing_wqE[OF runing_th_s this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   329
  obtain rest where eq_wq: "wq s cs = th#rest" by blast
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   330
  with otherwise
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   331
  have "holding s th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   332
    by (unfold s_holding_def, fold wq_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   333
  hence cs_th_RAG: "(Cs cs, Th th) \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   334
    by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   335
  from pip_e[unfolded is_p]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   336
  show False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   337
  proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   338
    case (thread_P)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   339
    with cs_th_RAG show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   340
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   341
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   342
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   343
lemma wq_es_cs: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   344
  "wq (e#s) cs =  wq s cs @ [th]"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   345
  by (unfold is_p wq_def, auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   346
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   347
lemma wq_distinct_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   348
  assumes "distinct (wq s cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   349
  shows "distinct (wq (e#s) cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   350
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   351
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   352
  show ?thesis using True assms th_not_in_wq
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   353
    by (unfold True wq_es_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   354
qed (insert assms, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   355
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   356
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   357
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   358
context valid_trace_v
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   359
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   360
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   361
lemma wq_neq_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   362
  assumes "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   363
  shows "wq (e#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   364
    using assms unfolding is_v wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   365
  by (auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   366
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   367
lemma runing_th_s:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   368
  shows "th \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   369
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   370
  from pip_e[unfolded is_v]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   371
  show ?thesis by (cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   372
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   373
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   374
lemma th_not_waiting: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   375
  "\<not> waiting s th c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   376
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   377
  have "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   378
    using runing_ready runing_th_s by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   379
  thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   380
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   381
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   382
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   383
lemma waiting_neq_th: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   384
  assumes "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   385
  shows "t \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   386
  using assms using th_not_waiting by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   387
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   388
lemma wq_s_cs:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   389
  "wq s cs = th#rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   390
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   391
  from pip_e[unfolded is_v]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   392
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   393
  proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   394
    case (thread_V)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   395
    from this(2) show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   396
      by (unfold rest_def s_holding_def, fold wq_def,
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   397
                 metis empty_iff list.collapse list.set(1))
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   398
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   399
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   400
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   401
lemma wq_es_cs:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   402
  "wq (e#s) cs = wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   403
 using wq_s_cs[unfolded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   404
 by (auto simp:Let_def wq_def rest_def wq'_def is_v, simp) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   405
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   406
lemma wq_distinct_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   407
  assumes "distinct (wq s cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   408
  shows "distinct (wq (e#s) cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   409
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   410
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   411
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   412
  proof(unfold True wq_es_cs wq'_def, rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   413
    show "distinct rest \<and> set rest = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   414
        using assms[unfolded True wq_s_cs] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   415
  qed simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   416
qed (insert assms, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   417
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   418
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   419
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   420
context valid_trace_set
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   421
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   422
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   423
lemma wq_neq_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   424
  shows "wq (e#s) cs' = wq s cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   425
    using assms unfolding is_set wq_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   426
  by (auto simp:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   427
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   428
lemma wq_distinct_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   429
  assumes "distinct (wq s cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   430
  shows "distinct (wq (e#s) cs')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   431
  using assms by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   432
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   433
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   434
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   435
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   436
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   437
lemma actor_inv: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   438
  assumes "PIP s e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   439
  and "\<not> isCreate e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   440
  shows "actor e \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   441
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   442
  by (induct, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   443
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   444
lemma isP_E:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   445
  assumes "isP e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   446
  obtains cs where "e = P (actor e) cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   447
  using assms by (cases e, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   448
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   449
lemma isV_E:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   450
  assumes "isV e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   451
  obtains cs where "e = V (actor e) cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   452
  using assms by (cases e, auto) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   453
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   454
lemma wq_distinct: "distinct (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   455
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   456
  case (Cons s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   457
  interpret vt_e: valid_trace_e s e using Cons by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   458
  show ?case 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   459
  proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   460
    case (Create th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   461
    interpret vt_create: valid_trace_create s e th prio 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   462
      using Create by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   463
    show ?thesis using Cons by (simp add: vt_create.wq_distinct_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   464
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   465
    case (Exit th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   466
    interpret vt_exit: valid_trace_exit s e th  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   467
        using Exit by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   468
    show ?thesis using Cons by (simp add: vt_exit.wq_distinct_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   469
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   470
    case (P th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   471
    interpret vt_p: valid_trace_p s e th cs using P by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   472
    show ?thesis using Cons by (simp add: vt_p.wq_distinct_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   473
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   474
    case (V th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   475
    interpret vt_v: valid_trace_v s e th cs using V by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   476
    show ?thesis using Cons by (simp add: vt_v.wq_distinct_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   477
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   478
    case (Set th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   479
    interpret vt_set: valid_trace_set s e th prio
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   480
        using Set by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   481
    show ?thesis using Cons by (simp add: vt_set.wq_distinct_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   482
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   483
qed (unfold wq_def Let_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   484
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   485
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   486
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   487
context valid_trace_e
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   488
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   489
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   490
text {*
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   491
  The following lemma shows that only the @{text "P"}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   492
  operation can add new thread into waiting queues. 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   493
  Such kind of lemmas are very obvious, but need to be checked formally.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   494
  This is a kind of confirmation that our modelling is correct.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   495
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   496
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   497
lemma wq_in_inv: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   498
  assumes s_ni: "thread \<notin> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   499
  and s_i: "thread \<in> set (wq (e#s) cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   500
  shows "e = P thread cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   501
proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   502
  -- {* This is the only non-trivial case: *}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   503
  case (V th cs1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   504
  have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   505
  proof(cases "cs1 = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   506
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   507
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   508
    proof(cases "(wq s cs1)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   509
      case (Cons w_hd w_tl)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   510
      have "set (wq (e#s) cs) \<subseteq> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   511
      proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   512
        have "(wq (e#s) cs) = (SOME q. distinct q \<and> set q = set w_tl)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   513
          using  Cons V by (auto simp:wq_def Let_def True split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   514
        moreover have "set ... \<subseteq> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   515
        proof(rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   516
          show "distinct w_tl \<and> set w_tl = set w_tl"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   517
            by (metis distinct.simps(2) local.Cons wq_distinct)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   518
        qed (insert Cons True, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   519
        ultimately show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   520
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   521
      with assms show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   522
    qed (insert assms V True, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   523
  qed (insert assms V, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   524
  thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   525
qed (insert assms, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   526
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   527
lemma wq_out_inv: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   528
  assumes s_in: "thread \<in> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   529
  and s_hd: "thread = hd (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   530
  and s_i: "thread \<noteq> hd (wq (e#s) cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   531
  shows "e = V thread cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   532
proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   533
-- {* There are only two non-trivial cases: *}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   534
  case (V th cs1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   535
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   536
  proof(cases "cs1 = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   537
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   538
    have "PIP s (V th cs)" using pip_e[unfolded V[unfolded True]] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   539
    thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   540
    proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   541
      case (thread_V)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   542
      moreover have "th = thread" using thread_V(2) s_hd
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   543
          by (unfold s_holding_def wq_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   544
      ultimately show ?thesis using V True by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   545
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   546
  qed (insert assms V, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   547
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   548
  case (P th cs1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   549
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   550
  proof(cases "cs1 = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   551
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   552
    with P have "wq (e#s) cs = wq_fun (schs s) cs @ [th]"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   553
      by (auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   554
    with s_i s_hd s_in have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   555
      by (metis empty_iff hd_append2 list.set(1) wq_def) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   556
    thus ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   557
  qed (insert assms P, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   558
qed (insert assms, auto simp:wq_def Let_def split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   559
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   560
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   561
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   562
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   563
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   564
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   565
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   566
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   567
text {* (* ddd *)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   568
  The nature of the work is like this: since it starts from a very simple and basic 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   569
  model, even intuitively very `basic` and `obvious` properties need to derived from scratch.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   570
  For instance, the fact 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   571
  that one thread can not be blocked by two critical resources at the same time
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   572
  is obvious, because only running threads can make new requests, if one is waiting for 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   573
  a critical resource and get blocked, it can not make another resource request and get 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   574
  blocked the second time (because it is not running). 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   575
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   576
  To derive this fact, one needs to prove by contraction and 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   577
  reason about time (or @{text "moement"}). The reasoning is based on a generic theorem
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   578
  named @{text "p_split"}, which is about status changing along the time axis. It says if 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   579
  a condition @{text "Q"} is @{text "True"} at a state @{text "s"},
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   580
  but it was @{text "False"} at the very beginning, then there must exits a moment @{text "t"} 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   581
  in the history of @{text "s"} (notice that @{text "s"} itself is essentially the history 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   582
  of events leading to it), such that @{text "Q"} switched 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   583
  from being @{text "False"} to @{text "True"} and kept being @{text "True"}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   584
  till the last moment of @{text "s"}.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   585
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   586
  Suppose a thread @{text "th"} is blocked
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   587
  on @{text "cs1"} and @{text "cs2"} in some state @{text "s"}, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   588
  since no thread is blocked at the very beginning, by applying 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   589
  @{text "p_split"} to these two blocking facts, there exist 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   590
  two moments @{text "t1"} and @{text "t2"}  in @{text "s"}, such that 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   591
  @{text "th"} got blocked on @{text "cs1"} and @{text "cs2"} 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   592
  and kept on blocked on them respectively ever since.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   593
 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   594
  Without lost of generality, we assume @{text "t1"} is earlier than @{text "t2"}.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   595
  However, since @{text "th"} was blocked ever since memonent @{text "t1"}, so it was still
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   596
  in blocked state at moment @{text "t2"} and could not
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   597
  make any request and get blocked the second time: Contradiction.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   598
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   599
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   600
lemma waiting_unique_pre: (* ddd *)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   601
  assumes h11: "thread \<in> set (wq s cs1)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   602
  and h12: "thread \<noteq> hd (wq s cs1)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   603
  assumes h21: "thread \<in> set (wq s cs2)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   604
  and h22: "thread \<noteq> hd (wq s cs2)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   605
  and neq12: "cs1 \<noteq> cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   606
  shows "False"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   607
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   608
  let "?Q" = "\<lambda> cs s. thread \<in> set (wq s cs) \<and> thread \<noteq> hd (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   609
  from h11 and h12 have q1: "?Q cs1 s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   610
  from h21 and h22 have q2: "?Q cs2 s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   611
  have nq1: "\<not> ?Q cs1 []" by (simp add:wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   612
  have nq2: "\<not> ?Q cs2 []" by (simp add:wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   613
  from p_split [of "?Q cs1", OF q1 nq1]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   614
  obtain t1 where lt1: "t1 < length s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   615
    and np1: "\<not> ?Q cs1 (moment t1 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   616
    and nn1: "(\<forall>i'>t1. ?Q cs1 (moment i' s))" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   617
  from p_split [of "?Q cs2", OF q2 nq2]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   618
  obtain t2 where lt2: "t2 < length s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   619
    and np2: "\<not> ?Q cs2 (moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   620
    and nn2: "(\<forall>i'>t2. ?Q cs2 (moment i' s))" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   621
  { fix s cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   622
    assume q: "?Q cs s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   623
    have "thread \<notin> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   624
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   625
      assume "thread \<in> runing s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   626
      hence " \<forall>cs. \<not> (thread \<in> set (wq_fun (schs s) cs) \<and> 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   627
                 thread \<noteq> hd (wq_fun (schs s) cs))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   628
        by (unfold runing_def s_waiting_def readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   629
      from this[rule_format, of cs] q 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   630
      show False by (simp add: wq_def) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   631
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   632
  } note q_not_runing = this
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   633
  { fix t1 t2 cs1 cs2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   634
    assume  lt1: "t1 < length s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   635
    and np1: "\<not> ?Q cs1 (moment t1 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   636
    and nn1: "(\<forall>i'>t1. ?Q cs1 (moment i' s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   637
    and lt2: "t2 < length s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   638
    and np2: "\<not> ?Q cs2 (moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   639
    and nn2: "(\<forall>i'>t2. ?Q cs2 (moment i' s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   640
    and lt12: "t1 < t2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   641
    let ?t3 = "Suc t2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   642
    from lt2 have le_t3: "?t3 \<le> length s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   643
    from moment_plus [OF this] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   644
    obtain e where eq_m: "moment ?t3 s = e#moment t2 s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   645
    have "t2 < ?t3" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   646
    from nn2 [rule_format, OF this] and eq_m
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   647
    have h1: "thread \<in> set (wq (e#moment t2 s) cs2)" and
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   648
         h2: "thread \<noteq> hd (wq (e#moment t2 s) cs2)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   649
    have "vt (e#moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   650
    proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   651
      from vt_moment 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   652
      have "vt (moment ?t3 s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   653
      with eq_m show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   654
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   655
    then interpret vt_e: valid_trace_e "moment t2 s" "e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   656
        by (unfold_locales, auto, cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   657
    have ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   658
    proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   659
      have "thread \<in> runing (moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   660
      proof(cases "thread \<in> set (wq (moment t2 s) cs2)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   661
        case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   662
        have "e = V thread cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   663
        proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   664
          have eq_th: "thread = hd (wq (moment t2 s) cs2)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   665
              using True and np2  by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   666
          from vt_e.wq_out_inv[OF True this h2]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   667
          show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   668
        qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   669
        thus ?thesis using vt_e.actor_inv[OF vt_e.pip_e] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   670
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   671
        case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   672
        have "e = P thread cs2" using vt_e.wq_in_inv[OF False h1] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   673
        with vt_e.actor_inv[OF vt_e.pip_e]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   674
        show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   675
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   676
      moreover have "thread \<notin> runing (moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   677
        by (rule q_not_runing[OF nn1[rule_format, OF lt12]])
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   678
      ultimately show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   679
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   680
  } note lt_case = this
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   681
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   682
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   683
    { assume "t1 < t2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   684
      from lt_case[OF lt1 np1 nn1 lt2 np2 nn2 this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   685
      have ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   686
    } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   687
      assume "t2 < t1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   688
      from lt_case[OF lt2 np2 nn2 lt1 np1 nn1 this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   689
      have ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   690
    } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   691
      assume eq_12: "t1 = t2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   692
      let ?t3 = "Suc t2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   693
      from lt2 have le_t3: "?t3 \<le> length s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   694
      from moment_plus [OF this] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   695
      obtain e where eq_m: "moment ?t3 s = e#moment t2 s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   696
      have lt_2: "t2 < ?t3" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   697
      from nn2 [rule_format, OF this] and eq_m
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   698
      have h1: "thread \<in> set (wq (e#moment t2 s) cs2)" and
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   699
           h2: "thread \<noteq> hd (wq (e#moment t2 s) cs2)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   700
      from nn1[rule_format, OF lt_2[folded eq_12]] eq_m[folded eq_12]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   701
      have g1: "thread \<in> set (wq (e#moment t1 s) cs1)" and
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   702
           g2: "thread \<noteq> hd (wq (e#moment t1 s) cs1)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   703
      have "vt (e#moment t2 s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   704
      proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   705
        from vt_moment 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   706
        have "vt (moment ?t3 s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   707
        with eq_m show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   708
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   709
      then interpret vt_e: valid_trace_e "moment t2 s" "e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   710
          by (unfold_locales, auto, cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   711
      have "e = V thread cs2 \<or> e = P thread cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   712
      proof(cases "thread \<in> set (wq (moment t2 s) cs2)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   713
        case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   714
        have "e = V thread cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   715
        proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   716
          have eq_th: "thread = hd (wq (moment t2 s) cs2)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   717
              using True and np2  by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   718
          from vt_e.wq_out_inv[OF True this h2]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   719
          show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   720
        qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   721
        thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   722
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   723
        case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   724
        have "e = P thread cs2" using vt_e.wq_in_inv[OF False h1] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   725
        thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   726
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   727
      moreover have "e = V thread cs1 \<or> e = P thread cs1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   728
      proof(cases "thread \<in> set (wq (moment t1 s) cs1)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   729
        case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   730
        have eq_th: "thread = hd (wq (moment t1 s) cs1)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   731
              using True and np1  by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   732
        from vt_e.wq_out_inv[folded eq_12, OF True this g2]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   733
        have "e = V thread cs1" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   734
        thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   735
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   736
        case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   737
        have "e = P thread cs1" using vt_e.wq_in_inv[folded eq_12, OF False g1] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   738
        thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   739
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   740
      ultimately have ?thesis using neq12 by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   741
    } ultimately show ?thesis using nat_neq_iff by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   742
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   743
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   744
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   745
text {*
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   746
  This lemma is a simple corrolary of @{text "waiting_unique_pre"}.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   747
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   748
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   749
lemma waiting_unique:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   750
  assumes "waiting s th cs1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   751
  and "waiting s th cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   752
  shows "cs1 = cs2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   753
  using waiting_unique_pre assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   754
  unfolding wq_def s_waiting_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   755
  by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   756
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   757
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   758
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   759
(* not used *)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   760
text {*
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   761
  Every thread can only be blocked on one critical resource, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   762
  symmetrically, every critical resource can only be held by one thread. 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   763
  This fact is much more easier according to our definition. 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   764
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   765
lemma held_unique:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   766
  assumes "holding (s::event list) th1 cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   767
  and "holding s th2 cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   768
  shows "th1 = th2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   769
 by (insert assms, unfold s_holding_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   770
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   771
lemma last_set_lt: "th \<in> threads s \<Longrightarrow> last_set th s < length s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   772
  apply (induct s, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   773
  by (case_tac a, auto split:if_splits)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   774
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   775
lemma last_set_unique: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   776
  "\<lbrakk>last_set th1 s = last_set th2 s; th1 \<in> threads s; th2 \<in> threads s\<rbrakk>
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   777
          \<Longrightarrow> th1 = th2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   778
  apply (induct s, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   779
  by (case_tac a, auto split:if_splits dest:last_set_lt)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   780
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   781
lemma preced_unique : 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   782
  assumes pcd_eq: "preced th1 s = preced th2 s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   783
  and th_in1: "th1 \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   784
  and th_in2: " th2 \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   785
  shows "th1 = th2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   786
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   787
  from pcd_eq have "last_set th1 s = last_set th2 s" by (simp add:preced_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   788
  from last_set_unique [OF this th_in1 th_in2]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   789
  show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   790
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   791
                      
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   792
lemma preced_linorder: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   793
  assumes neq_12: "th1 \<noteq> th2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   794
  and th_in1: "th1 \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   795
  and th_in2: " th2 \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   796
  shows "preced th1 s < preced th2 s \<or> preced th1 s > preced th2 s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   797
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   798
  from preced_unique [OF _ th_in1 th_in2] and neq_12 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   799
  have "preced th1 s \<noteq> preced th2 s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   800
  thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   801
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   802
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   803
text {*
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   804
  The following three lemmas show that @{text "RAG"} does not change
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   805
  by the happening of @{text "Set"}, @{text "Create"} and @{text "Exit"}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   806
  events, respectively.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   807
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   808
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   809
lemma RAG_set_unchanged: "(RAG (Set th prio # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   810
apply (unfold s_RAG_def s_waiting_def wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   811
by (simp add:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   812
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   813
lemma (in valid_trace_set)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   814
   RAG_unchanged: "(RAG (e # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   815
   by (unfold is_set RAG_set_unchanged, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   816
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   817
lemma RAG_create_unchanged: "(RAG (Create th prio # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   818
apply (unfold s_RAG_def s_waiting_def wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   819
by (simp add:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   820
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   821
lemma (in valid_trace_create)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   822
   RAG_unchanged: "(RAG (e # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   823
   by (unfold is_create RAG_create_unchanged, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   824
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   825
lemma RAG_exit_unchanged: "(RAG (Exit th # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   826
apply (unfold s_RAG_def s_waiting_def wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   827
by (simp add:Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   828
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   829
lemma (in valid_trace_exit)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   830
   RAG_unchanged: "(RAG (e # s)) = RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   831
   by (unfold is_exit RAG_exit_unchanged, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   832
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   833
context valid_trace_v
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   834
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   835
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   836
lemma distinct_rest: "distinct rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   837
  by (simp add: distinct_tl rest_def wq_distinct)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   838
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   839
lemma holding_cs_eq_th:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   840
  assumes "holding s t cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   841
  shows "t = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   842
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   843
  from pip_e[unfolded is_v]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   844
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   845
  proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   846
    case (thread_V)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   847
    from held_unique[OF this(2) assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   848
    show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   849
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   850
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   851
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   852
lemma distinct_wq': "distinct wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   853
  by (metis (mono_tags, lifting) distinct_rest  some_eq_ex wq'_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   854
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   855
lemma set_wq': "set wq' = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   856
  by (metis (mono_tags, lifting) distinct_rest rest_def 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   857
      some_eq_ex wq'_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   858
    
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   859
lemma th'_in_inv:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   860
  assumes "th' \<in> set wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   861
  shows "th' \<in> set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   862
  using assms set_wq' by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   863
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   864
lemma neq_t_th: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   865
  assumes "waiting (e#s) t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   866
  shows "t \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   867
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   868
  assume otherwise: "t = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   869
  show False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   870
  proof(cases "c = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   871
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   872
    have "t \<in> set wq'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   873
     using assms[unfolded True s_waiting_def, folded wq_def, unfolded wq_es_cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   874
     by simp 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   875
    from th'_in_inv[OF this] have "t \<in> set rest" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   876
    with wq_s_cs[folded otherwise] wq_distinct[of cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   877
    show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   878
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   879
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   880
    have "wq (e#s) c = wq s c" using False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   881
        by (unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   882
    hence "waiting s t c" using assms 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   883
        by (simp add: cs_waiting_def waiting_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   884
    hence "t \<notin> readys s" by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   885
    hence "t \<notin> runing s" using runing_ready by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   886
    with runing_th_s[folded otherwise] show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   887
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   888
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   889
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   890
lemma waiting_esI1:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   891
  assumes "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   892
      and "c \<noteq> cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   893
  shows "waiting (e#s) t c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   894
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   895
  have "wq (e#s) c = wq s c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   896
    using assms(2) is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   897
  with assms(1) show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   898
    using cs_waiting_def waiting_eq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   899
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   900
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   901
lemma holding_esI2:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   902
  assumes "c \<noteq> cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   903
  and "holding s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   904
  shows "holding (e#s) t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   905
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   906
  from assms(1) have "wq (e#s) c = wq s c" using is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   907
  from assms(2)[unfolded s_holding_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   908
                folded this, unfolded wq_def, folded s_holding_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   909
  show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   910
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   911
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   912
lemma holding_esI1:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   913
  assumes "holding s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   914
  and "t \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   915
  shows "holding (e#s) t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   916
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   917
  have "c \<noteq> cs" using assms using holding_cs_eq_th by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   918
  from holding_esI2[OF this assms(1)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   919
  show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   920
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   921
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   922
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   923
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   924
context valid_trace_v_n
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   925
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   926
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   927
lemma neq_wq': "wq' \<noteq> []" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   928
proof (unfold wq'_def, rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   929
  show "distinct rest \<and> set rest = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   930
    by (simp add: distinct_rest) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   931
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   932
  fix x
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   933
  assume " distinct x \<and> set x = set rest" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   934
  thus "x \<noteq> []" using rest_nnl by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   935
qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   936
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   937
definition "taker = hd wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   938
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   939
definition "rest' = tl wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   940
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   941
lemma eq_wq': "wq' = taker # rest'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   942
  by (simp add: neq_wq' rest'_def taker_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   943
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   944
lemma next_th_taker: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   945
  shows "next_th s th cs taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   946
  using rest_nnl taker_def wq'_def wq_s_cs 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   947
  by (auto simp:next_th_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   948
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   949
lemma taker_unique: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   950
  assumes "next_th s th cs taker'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   951
  shows "taker' = taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   952
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   953
  from assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   954
  obtain rest' where 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   955
    h: "wq s cs = th # rest'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   956
       "taker' = hd (SOME q. distinct q \<and> set q = set rest')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   957
          by (unfold next_th_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   958
  with wq_s_cs have "rest' = rest" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   959
  thus ?thesis using h(2) taker_def wq'_def by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   960
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   961
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   962
lemma waiting_set_eq:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   963
  "{(Th th', Cs cs) |th'. next_th s th cs th'} = {(Th taker, Cs cs)}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   964
  by (smt all_not_in_conv bot.extremum insertI1 insert_subset 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   965
      mem_Collect_eq next_th_taker subsetI subset_antisym taker_def taker_unique)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   966
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   967
lemma holding_set_eq:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   968
  "{(Cs cs, Th th') |th'.  next_th s th cs th'} = {(Cs cs, Th taker)}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   969
  using next_th_taker taker_def waiting_set_eq 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   970
  by fastforce
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   971
   
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   972
lemma holding_taker:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   973
  shows "holding (e#s) taker cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   974
    by (unfold s_holding_def, fold wq_def, unfold wq_es_cs, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   975
        auto simp:neq_wq' taker_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   976
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   977
lemma waiting_esI2:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   978
  assumes "waiting s t cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   979
      and "t \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   980
  shows "waiting (e#s) t cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   981
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   982
  have "t \<in> set wq'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   983
  proof(unfold wq'_def, rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   984
    show "distinct rest \<and> set rest = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   985
          by (simp add: distinct_rest)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   986
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   987
    fix x
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   988
    assume "distinct x \<and> set x = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   989
    moreover have "t \<in> set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   990
        using assms(1) cs_waiting_def waiting_eq wq_s_cs by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   991
    ultimately show "t \<in> set x" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   992
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   993
  moreover have "t \<noteq> hd wq'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   994
    using assms(2) taker_def by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   995
  ultimately show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   996
    by (unfold s_waiting_def, fold wq_def, unfold wq_es_cs, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   997
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   998
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
   999
lemma waiting_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1000
  assumes "waiting (e#s) t c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1001
  obtains "c \<noteq> cs" "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1002
     |    "c = cs" "t \<noteq> taker" "waiting s t cs" "t \<in> set rest'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1003
proof(cases "c = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1004
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1005
  hence "wq (e#s) c = wq s c" using is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1006
  with assms have "waiting s t c" using cs_waiting_def waiting_eq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1007
  from that(1)[OF False this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1008
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1009
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1010
  from assms[unfolded s_waiting_def True, folded wq_def, unfolded wq_es_cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1011
  have "t \<noteq> hd wq'" "t \<in> set wq'" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1012
  hence "t \<noteq> taker" by (simp add: taker_def) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1013
  moreover hence "t \<noteq> th" using assms neq_t_th by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1014
  moreover have "t \<in> set rest" by (simp add: `t \<in> set wq'` th'_in_inv) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1015
  ultimately have "waiting s t cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1016
    by (metis cs_waiting_def list.distinct(2) list.sel(1) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1017
                list.set_sel(2) rest_def waiting_eq wq_s_cs)  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1018
  show ?thesis using that(2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1019
  using True `t \<in> set wq'` `t \<noteq> taker` `waiting s t cs` eq_wq' by auto   
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1020
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1021
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1022
lemma holding_esI1:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1023
  assumes "c = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1024
  and "t = taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1025
  shows "holding (e#s) t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1026
  by (unfold assms, simp add: holding_taker)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1027
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1028
lemma holding_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1029
  assumes "holding (e#s) t c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1030
  obtains "c = cs" "t = taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1031
      | "c \<noteq> cs" "holding s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1032
proof(cases "c = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1033
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1034
  from assms[unfolded True, unfolded s_holding_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1035
             folded wq_def, unfolded wq_es_cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1036
  have "t = taker" by (simp add: taker_def) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1037
  from that(1)[OF True this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1038
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1039
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1040
  hence "wq (e#s) c = wq s c" using is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1041
  from assms[unfolded s_holding_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1042
             unfolded this, unfolded wq_def, folded s_holding_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1043
  have "holding s t c"  .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1044
  from that(2)[OF False this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1045
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1046
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1047
end 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1048
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1049
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1050
context valid_trace_v_e
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1051
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1052
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1053
lemma nil_wq': "wq' = []" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1054
proof (unfold wq'_def, rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1055
  show "distinct rest \<and> set rest = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1056
    by (simp add: distinct_rest) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1057
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1058
  fix x
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1059
  assume " distinct x \<and> set x = set rest" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1060
  thus "x = []" using rest_nil by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1061
qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1062
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1063
lemma no_taker: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1064
  assumes "next_th s th cs taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1065
  shows "False"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1066
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1067
  from assms[unfolded next_th_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1068
  obtain rest' where "wq s cs = th # rest'" "rest' \<noteq> []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1069
    by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1070
  thus ?thesis using rest_def rest_nil by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1071
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1072
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1073
lemma waiting_set_eq:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1074
  "{(Th th', Cs cs) |th'. next_th s th cs th'} = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1075
  using no_taker by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1076
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1077
lemma holding_set_eq:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1078
  "{(Cs cs, Th th') |th'.  next_th s th cs th'} = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1079
  using no_taker by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1080
   
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1081
lemma no_holding:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1082
  assumes "holding (e#s) taker cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1083
  shows False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1084
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1085
  from wq_es_cs[unfolded nil_wq']
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1086
  have " wq (e # s) cs = []" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1087
  from assms[unfolded s_holding_def, folded wq_def, unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1088
  show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1089
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1090
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1091
lemma no_waiting:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1092
  assumes "waiting (e#s) t cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1093
  shows False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1094
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1095
  from wq_es_cs[unfolded nil_wq']
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1096
  have " wq (e # s) cs = []" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1097
  from assms[unfolded s_waiting_def, folded wq_def, unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1098
  show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1099
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1100
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1101
lemma waiting_esI2:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1102
  assumes "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1103
  shows "waiting (e#s) t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1104
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1105
  have "c \<noteq> cs" using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1106
    using cs_waiting_def rest_nil waiting_eq wq_s_cs by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1107
  from waiting_esI1[OF assms this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1108
  show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1109
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1110
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1111
lemma waiting_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1112
  assumes "waiting (e#s) t c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1113
  obtains "c \<noteq> cs" "waiting s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1114
proof(cases "c = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1115
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1116
  hence "wq (e#s) c = wq s c" using is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1117
  with assms have "waiting s t c" using cs_waiting_def waiting_eq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1118
  from that(1)[OF False this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1119
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1120
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1121
  from no_waiting[OF assms[unfolded True]]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1122
  show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1123
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1124
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1125
lemma holding_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1126
  assumes "holding (e#s) t c" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1127
  obtains "c \<noteq> cs" "holding s t c"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1128
proof(cases "c = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1129
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1130
  from no_holding[OF assms[unfolded True]] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1131
  show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1132
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1133
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1134
  hence "wq (e#s) c = wq s c" using is_v by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1135
  from assms[unfolded s_holding_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1136
             unfolded this, unfolded wq_def, folded s_holding_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1137
  have "holding s t c"  .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1138
  from that[OF False this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1139
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1140
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1141
end 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1142
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1143
lemma rel_eqI:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1144
  assumes "\<And> x y. (x,y) \<in> A \<Longrightarrow> (x,y) \<in> B"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1145
  and "\<And> x y. (x,y) \<in> B \<Longrightarrow> (x, y) \<in> A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1146
  shows "A = B"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1147
  using assms by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1148
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1149
lemma in_RAG_E:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1150
  assumes "(n1, n2) \<in> RAG (s::state)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1151
  obtains (waiting) th cs where "n1 = Th th" "n2 = Cs cs" "waiting s th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1152
      | (holding) th cs where "n1 = Cs cs" "n2 = Th th" "holding s th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1153
  using assms[unfolded s_RAG_def, folded waiting_eq holding_eq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1154
  by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1155
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1156
context valid_trace_v
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1157
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1158
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1159
lemma RAG_es:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1160
  "RAG (e # s) =
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1161
   RAG s - {(Cs cs, Th th)} -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1162
     {(Th th', Cs cs) |th'. next_th s th cs th'} \<union>
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1163
     {(Cs cs, Th th') |th'.  next_th s th cs th'}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1164
proof(rule rel_eqI)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1165
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1166
  assume "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1167
  thus "(n1, n2) \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1168
  proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1169
    case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1170
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1171
    proof(cases "rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1172
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1173
      interpret h_n: valid_trace_v_n s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1174
        by (unfold_locales, insert False, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1175
      from waiting(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1176
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1177
      proof(cases rule:h_n.waiting_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1178
        case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1179
        with waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1180
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1181
        by (unfold h_n.waiting_set_eq h_n.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1182
             fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1183
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1184
        case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1185
        with waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1186
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1187
         by (unfold h_n.waiting_set_eq h_n.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1188
             fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1189
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1190
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1191
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1192
      interpret h_e: valid_trace_v_e s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1193
        by (unfold_locales, insert True, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1194
      from waiting(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1195
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1196
      proof(cases rule:h_e.waiting_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1197
        case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1198
        with waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1199
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1200
        by (unfold h_e.waiting_set_eq h_e.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1201
             fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1202
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1203
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1204
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1205
    case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1206
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1207
    proof(cases "rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1208
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1209
      interpret h_n: valid_trace_v_n s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1210
        by (unfold_locales, insert False, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1211
      from holding(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1212
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1213
      proof(cases rule:h_n.holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1214
        case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1215
        with holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1216
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1217
        by (unfold h_n.waiting_set_eq h_n.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1218
             fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1219
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1220
        case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1221
        with holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1222
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1223
         by (unfold h_n.waiting_set_eq h_n.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1224
             fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1225
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1226
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1227
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1228
      interpret h_e: valid_trace_v_e s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1229
        by (unfold_locales, insert True, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1230
      from holding(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1231
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1232
      proof(cases rule:h_e.holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1233
        case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1234
        with holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1235
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1236
        by (unfold h_e.waiting_set_eq h_e.holding_set_eq s_RAG_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1237
             fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1238
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1239
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1240
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1241
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1242
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1243
  assume h: "(n1, n2) \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1244
  show "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1245
  proof(cases "rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1246
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1247
    interpret h_n: valid_trace_v_n s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1248
        by (unfold_locales, insert False, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1249
    from h[unfolded h_n.waiting_set_eq h_n.holding_set_eq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1250
    have "((n1, n2) \<in> RAG s \<and> (n1 \<noteq> Cs cs \<or> n2 \<noteq> Th th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1251
                            \<and> (n1 \<noteq> Th h_n.taker \<or> n2 \<noteq> Cs cs)) \<or> 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1252
          (n2 = Th h_n.taker \<and> n1 = Cs cs)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1253
      by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1254
   thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1255
   proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1256
      assume "n2 = Th h_n.taker \<and> n1 = Cs cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1257
      with h_n.holding_taker
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1258
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1259
        by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1260
   next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1261
    assume h: "(n1, n2) \<in> RAG s \<and>
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1262
        (n1 \<noteq> Cs cs \<or> n2 \<noteq> Th th) \<and> (n1 \<noteq> Th h_n.taker \<or> n2 \<noteq> Cs cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1263
    hence "(n1, n2) \<in> RAG s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1264
    thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1265
    proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1266
      case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1267
      from h and this(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1268
      have "th' \<noteq> h_n.taker \<or> cs' \<noteq> cs" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1269
      hence "waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1270
      proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1271
        assume "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1272
        from waiting_esI1[OF waiting(3) this] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1273
        show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1274
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1275
        assume neq_th': "th' \<noteq> h_n.taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1276
        show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1277
        proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1278
          case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1279
          from waiting_esI1[OF waiting(3) this] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1280
          show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1281
        next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1282
          case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1283
          from h_n.waiting_esI2[OF waiting(3)[unfolded True] neq_th', folded True]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1284
          show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1285
        qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1286
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1287
      thus ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1288
        by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1289
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1290
      case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1291
      from h this(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1292
      have "cs' \<noteq> cs \<or> th' \<noteq> th" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1293
      hence "holding (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1294
      proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1295
        assume "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1296
        from holding_esI2[OF this holding(3)] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1297
        show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1298
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1299
        assume "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1300
        from holding_esI1[OF holding(3) this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1301
        show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1302
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1303
      thus ?thesis using holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1304
        by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1305
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1306
   qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1307
 next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1308
   case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1309
   interpret h_e: valid_trace_v_e s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1310
        by (unfold_locales, insert True, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1311
   from h[unfolded h_e.waiting_set_eq h_e.holding_set_eq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1312
   have h_s: "(n1, n2) \<in> RAG s" "(n1, n2) \<noteq> (Cs cs, Th th)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1313
      by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1314
   from h_s(1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1315
   show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1316
   proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1317
    case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1318
    from h_e.waiting_esI2[OF this(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1319
    show ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1320
      by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1321
   next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1322
    case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1323
    with h_s(2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1324
    have "cs' \<noteq> cs \<or> th' \<noteq> th" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1325
    thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1326
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1327
      assume neq_cs: "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1328
      from holding_esI2[OF this holding(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1329
      show ?thesis using holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1330
        by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1331
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1332
      assume "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1333
      from holding_esI1[OF holding(3) this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1334
      show ?thesis using holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1335
        by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1336
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1337
   qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1338
 qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1339
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1340
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1341
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1342
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1343
lemma step_RAG_v: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1344
assumes vt:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1345
  "vt (V th cs#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1346
shows "
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1347
  RAG (V th cs # s) =
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1348
  RAG s - {(Cs cs, Th th)} -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1349
  {(Th th', Cs cs) |th'. next_th s th cs th'} \<union>
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1350
  {(Cs cs, Th th') |th'.  next_th s th cs th'}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1351
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1352
  interpret vt_v: valid_trace_v s "V th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1353
    using assms step_back_vt by (unfold_locales, auto) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1354
  show ?thesis using vt_v.RAG_es .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1355
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1356
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1357
lemma (in valid_trace_create)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1358
  th_not_in_threads: "th \<notin> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1359
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1360
  from pip_e[unfolded is_create]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1361
  show ?thesis by (cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1362
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1363
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1364
lemma (in valid_trace_create)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1365
  threads_es [simp]: "threads (e#s) = threads s \<union> {th}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1366
  by (unfold is_create, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1367
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1368
lemma (in valid_trace_exit)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1369
  threads_es [simp]: "threads (e#s) = threads s - {th}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1370
  by (unfold is_exit, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1371
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1372
lemma (in valid_trace_p)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1373
  threads_es [simp]: "threads (e#s) = threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1374
  by (unfold is_p, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1375
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1376
lemma (in valid_trace_v)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1377
  threads_es [simp]: "threads (e#s) = threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1378
  by (unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1379
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1380
lemma (in valid_trace_v)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1381
  th_not_in_rest[simp]: "th \<notin> set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1382
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1383
  assume otherwise: "th \<in> set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1384
  have "distinct (wq s cs)" by (simp add: wq_distinct)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1385
  from this[unfolded wq_s_cs] and otherwise
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1386
  show False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1387
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1388
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1389
lemma (in valid_trace_v)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1390
  set_wq_es_cs [simp]: "set (wq (e#s) cs) = set (wq s cs) - {th}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1391
proof(unfold wq_es_cs wq'_def, rule someI2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1392
  show "distinct rest \<and> set rest = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1393
    by (simp add: distinct_rest)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1394
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1395
  fix x
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1396
  assume "distinct x \<and> set x = set rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1397
  thus "set x = set (wq s cs) - {th}" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1398
      by (unfold wq_s_cs, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1399
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1400
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1401
lemma (in valid_trace_exit)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1402
  th_not_in_wq: "th \<notin> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1403
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1404
  from pip_e[unfolded is_exit]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1405
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1406
  by (cases, unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1407
             auto elim!:runing_wqE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1408
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1409
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1410
lemma (in valid_trace) wq_threads: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1411
  assumes "th \<in> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1412
  shows "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1413
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1414
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1415
  case (Nil)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1416
  thus ?case by (auto simp:wq_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1417
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1418
  case (Cons s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1419
  interpret vt_e: valid_trace_e s e using Cons by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1420
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1421
  proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1422
    case (Create th' prio')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1423
    interpret vt: valid_trace_create s e th' prio'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1424
      using Create by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1425
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1426
      using Cons.hyps(2) Cons.prems by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1427
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1428
    case (Exit th')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1429
    interpret vt: valid_trace_exit s e th'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1430
      using Exit by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1431
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1432
      using Cons.hyps(2) Cons.prems vt.th_not_in_wq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1433
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1434
    case (P th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1435
    interpret vt: valid_trace_p s e th' cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1436
      using P by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1437
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1438
      using Cons.hyps(2) Cons.prems readys_threads 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1439
        runing_ready vt.is_p vt.runing_th_s vt_e.wq_in_inv 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1440
        by fastforce 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1441
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1442
    case (V th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1443
    interpret vt: valid_trace_v s e th' cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1444
      using V by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1445
    show ?thesis using Cons
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1446
      using vt.is_v vt.threads_es vt_e.wq_in_inv by blast
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1447
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1448
    case (Set th' prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1449
    interpret vt: valid_trace_set s e th' prio
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1450
      using Set by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1451
    show ?thesis using Cons.hyps(2) Cons.prems vt.is_set 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1452
        by (auto simp:wq_def Let_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1453
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1454
qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1455
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1456
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1457
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1458
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1459
lemma  dm_RAG_threads:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1460
  assumes in_dom: "(Th th) \<in> Domain (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1461
  shows "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1462
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1463
  from in_dom obtain n where "(Th th, n) \<in> RAG s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1464
  moreover from RAG_target_th[OF this] obtain cs where "n = Cs cs" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1465
  ultimately have "(Th th, Cs cs) \<in> RAG s" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1466
  hence "th \<in> set (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1467
    by (unfold s_RAG_def, auto simp:cs_waiting_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1468
  from wq_threads [OF this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1469
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1470
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1471
lemma rg_RAG_threads: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1472
  assumes "(Th th) \<in> Range (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1473
  shows "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1474
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1475
  by (unfold s_RAG_def cs_waiting_def cs_holding_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1476
       auto intro:wq_threads)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1477
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1478
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1479
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1480
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1481
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1482
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1483
lemma preced_v [simp]: "preced th' (V th cs#s) = preced th' s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1484
  by (unfold preced_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1485
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1486
lemma (in valid_trace_v)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1487
  preced_es: "preced th (e#s) = preced th s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1488
  by (unfold is_v preced_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1489
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1490
lemma the_preced_v[simp]: "the_preced (V th cs#s) = the_preced s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1491
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1492
  fix th'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1493
  show "the_preced (V th cs # s) th' = the_preced s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1494
    by (unfold the_preced_def preced_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1495
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1496
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1497
lemma (in valid_trace_v)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1498
  the_preced_es: "the_preced (e#s) = the_preced s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1499
  by (unfold is_v preced_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1500
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1501
context valid_trace_p
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1502
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1503
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1504
lemma not_holding_s_th_cs: "\<not> holding s th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1505
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1506
  assume otherwise: "holding s th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1507
  from pip_e[unfolded is_p]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1508
  show False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1509
  proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1510
    case (thread_P)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1511
    moreover have "(Cs cs, Th th) \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1512
      using otherwise cs_holding_def 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1513
            holding_eq th_not_in_wq by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1514
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1515
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1516
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1517
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1518
lemma waiting_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1519
  assumes "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1520
  shows "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1521
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1522
  by (metis cs_waiting_def hd_append2 list.sel(1) list.set_intros(2) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1523
      rotate1.simps(2) self_append_conv2 set_rotate1 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1524
        th_not_in_wq waiting_eq wq_es_cs wq_neq_simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1525
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1526
lemma holding_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1527
  assumes "holding s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1528
  shows "holding (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1529
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1530
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1531
  hence "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1532
  with assms show ?thesis using cs_holding_def holding_eq by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1533
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1534
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1535
  from assms[unfolded s_holding_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1536
  obtain rest where eq_wq: "wq s cs' = th'#rest"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1537
    by (metis empty_iff list.collapse list.set(1)) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1538
  hence "wq (e#s) cs' = th'#(rest@[th])"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1539
    by (simp add: True wq_es_cs) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1540
  thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1541
    by (simp add: cs_holding_def holding_eq) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1542
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1543
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1544
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1545
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1546
locale valid_trace_p_h = valid_trace_p +
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1547
  assumes we: "wq s cs = []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1548
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1549
locale valid_trace_p_w = valid_trace_p +
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1550
  assumes wne: "wq s cs \<noteq> []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1551
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1552
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1553
definition "holder = hd (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1554
definition "waiters = tl (wq s cs)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1555
definition "waiters' = waiters @ [th]"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1556
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1557
lemma wq_s_cs: "wq s cs = holder#waiters"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1558
    by (simp add: holder_def waiters_def wne)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1559
    
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1560
lemma wq_es_cs': "wq (e#s) cs = holder#waiters@[th]"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1561
  by (simp add: wq_es_cs wq_s_cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1562
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1563
lemma waiting_es_th_cs: "waiting (e#s) th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1564
  using cs_waiting_def th_not_in_wq waiting_eq wq_es_cs' wq_s_cs by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1565
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1566
lemma RAG_edge: "(Th th, Cs cs) \<in> RAG (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1567
   by (unfold s_RAG_def, fold waiting_eq, insert waiting_es_th_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1568
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1569
lemma holding_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1570
  assumes "holding (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1571
  obtains "holding s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1572
  using assms 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1573
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1574
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1575
  hence "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1576
  with assms show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1577
    using cs_holding_def holding_eq that by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1578
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1579
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1580
  with assms show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1581
  by (metis cs_holding_def holding_eq list.sel(1) list.set_intros(1) that 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1582
        wq_es_cs' wq_s_cs) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1583
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1584
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1585
lemma waiting_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1586
  assumes "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1587
  obtains "th' \<noteq> th" "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1588
     |  "th' = th" "cs' = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1589
proof(cases "waiting s th' cs'")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1590
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1591
  have "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1592
  proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1593
    assume otherwise: "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1594
    from True[unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1595
    show False by (simp add: th_not_waiting) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1596
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1597
  from that(1)[OF this True] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1598
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1599
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1600
  hence "th' = th \<and> cs' = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1601
      by (metis assms cs_waiting_def holder_def list.sel(1) rotate1.simps(2) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1602
        set_ConsD set_rotate1 waiting_eq wq_es_cs wq_es_cs' wq_neq_simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1603
  with that(2) show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1604
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1605
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1606
lemma RAG_es: "RAG (e # s) =  RAG s \<union> {(Th th, Cs cs)}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1607
proof(rule rel_eqI)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1608
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1609
  assume "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1610
  thus "(n1, n2) \<in> ?R" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1611
  proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1612
    case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1613
    from this(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1614
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1615
    proof(cases rule:waiting_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1616
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1617
      thus ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1618
        by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1619
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1620
      case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1621
      thus ?thesis using waiting(1,2) by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1622
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1623
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1624
    case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1625
    from this(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1626
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1627
    proof(cases rule:holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1628
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1629
      with holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1630
      show ?thesis by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1631
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1632
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1633
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1634
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1635
  assume "(n1, n2) \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1636
  hence "(n1, n2) \<in> RAG s \<or> (n1 = Th th \<and> n2 = Cs cs)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1637
  thus "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1638
  proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1639
    assume "(n1, n2) \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1640
    thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1641
    proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1642
      case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1643
      from waiting_kept[OF this(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1644
      show ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1645
         by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1646
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1647
      case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1648
      from holding_kept[OF this(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1649
      show ?thesis using holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1650
         by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1651
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1652
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1653
    assume "n1 = Th th \<and> n2 = Cs cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1654
    thus ?thesis using RAG_edge by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1655
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1656
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1657
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1658
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1659
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1660
context valid_trace_p_h
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1661
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1662
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1663
lemma wq_es_cs': "wq (e#s) cs = [th]"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1664
  using wq_es_cs[unfolded we] by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1665
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1666
lemma holding_es_th_cs: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1667
  shows "holding (e#s) th cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1668
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1669
  from wq_es_cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1670
  have "th \<in> set (wq (e#s) cs)" "th = hd (wq (e#s) cs)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1671
  thus ?thesis using cs_holding_def holding_eq by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1672
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1673
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1674
lemma RAG_edge: "(Cs cs, Th th) \<in> RAG (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1675
  by (unfold s_RAG_def, fold holding_eq, insert holding_es_th_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1676
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1677
lemma waiting_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1678
  assumes "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1679
  obtains "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1680
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1681
  by (metis cs_waiting_def event.distinct(15) is_p list.sel(1) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1682
        set_ConsD waiting_eq we wq_es_cs' wq_neq_simp wq_out_inv)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1683
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1684
lemma holding_esE:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1685
  assumes "holding (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1686
  obtains "cs' \<noteq> cs" "holding s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1687
    | "cs' = cs" "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1688
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1689
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1690
  from held_unique[OF holding_es_th_cs assms[unfolded True]]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1691
  have "th' = th" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1692
  from that(2)[OF True this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1693
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1694
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1695
  have "holding s th' cs'" using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1696
    using False cs_holding_def holding_eq by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1697
  from that(1)[OF False this] show ?thesis .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1698
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1699
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1700
lemma RAG_es: "RAG (e # s) =  RAG s \<union> {(Cs cs, Th th)}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1701
proof(rule rel_eqI)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1702
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1703
  assume "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1704
  thus "(n1, n2) \<in> ?R" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1705
  proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1706
    case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1707
    from this(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1708
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1709
    proof(cases rule:waiting_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1710
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1711
      thus ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1712
        by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1713
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1714
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1715
    case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1716
    from this(3)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1717
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1718
    proof(cases rule:holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1719
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1720
      with holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1721
      show ?thesis by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1722
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1723
      case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1724
      with holding(1,2) show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1725
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1726
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1727
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1728
  fix n1 n2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1729
  assume "(n1, n2) \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1730
  hence "(n1, n2) \<in> RAG s \<or> (n1 = Cs cs \<and> n2 = Th th)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1731
  thus "(n1, n2) \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1732
  proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1733
    assume "(n1, n2) \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1734
    thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1735
    proof(cases rule:in_RAG_E)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1736
      case (waiting th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1737
      from waiting_kept[OF this(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1738
      show ?thesis using waiting(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1739
         by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1740
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1741
      case (holding th' cs')
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1742
      from holding_kept[OF this(3)]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1743
      show ?thesis using holding(1,2)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1744
         by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1745
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1746
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1747
    assume "n1 = Cs cs \<and> n2 = Th th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1748
    with holding_es_th_cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1749
    show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1750
      by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1751
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1752
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1753
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1754
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1755
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1756
context valid_trace_p
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1757
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1758
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1759
lemma RAG_es': "RAG (e # s) =  (if (wq s cs = []) then RAG s \<union> {(Cs cs, Th th)}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1760
                                                  else RAG s \<union> {(Th th, Cs cs)})"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1761
proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1762
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1763
  interpret vt_p: valid_trace_p_h using True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1764
    by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1765
  show ?thesis by (simp add: vt_p.RAG_es vt_p.we) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1766
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1767
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1768
  interpret vt_p: valid_trace_p_w using False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1769
    by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1770
  show ?thesis by (simp add: vt_p.RAG_es vt_p.wne) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1771
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1772
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1773
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1774
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1775
lemma (in valid_trace_v_n) finite_waiting_set:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1776
  "finite {(Th th', Cs cs) |th'. next_th s th cs th'}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1777
    by (simp add: waiting_set_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1778
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1779
lemma (in valid_trace_v_n) finite_holding_set:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1780
  "finite {(Cs cs, Th th') |th'. next_th s th cs th'}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1781
    by (simp add: holding_set_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1782
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1783
lemma (in valid_trace_v_e) finite_waiting_set:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1784
  "finite {(Th th', Cs cs) |th'. next_th s th cs th'}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1785
    by (simp add: waiting_set_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1786
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1787
lemma (in valid_trace_v_e) finite_holding_set:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1788
  "finite {(Cs cs, Th th') |th'. next_th s th cs th'}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1789
    by (simp add: holding_set_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1790
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1791
context valid_trace_v
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1792
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1793
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1794
lemma 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1795
  finite_RAG_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1796
  assumes "finite (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1797
  shows "finite (RAG (e#s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1798
proof(cases "rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1799
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1800
  interpret vt: valid_trace_v_e using True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1801
    by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1802
  show ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1803
    by  (unfold RAG_es vt.waiting_set_eq vt.holding_set_eq, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1804
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1805
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1806
  interpret vt: valid_trace_v_n using False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1807
    by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1808
  show ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1809
    by  (unfold RAG_es vt.waiting_set_eq vt.holding_set_eq, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1810
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1811
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1812
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1813
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1814
context valid_trace_v_e
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1815
begin 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1816
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1817
lemma 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1818
  acylic_RAG_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1819
  assumes "acyclic (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1820
  shows "acyclic (RAG (e#s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1821
proof(rule acyclic_subset[OF assms])
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1822
  show "RAG (e # s) \<subseteq> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1823
      by (unfold RAG_es waiting_set_eq holding_set_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1824
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1825
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1826
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1827
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1828
context valid_trace_v_n
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1829
begin 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1830
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1831
lemma waiting_taker: "waiting s taker cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1832
  apply (unfold s_waiting_def, fold wq_def, unfold wq_s_cs taker_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1833
  using eq_wq' th'_in_inv wq'_def by fastforce
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1834
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1835
lemma 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1836
  acylic_RAG_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1837
  assumes "acyclic (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1838
  shows "acyclic (RAG (e#s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1839
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1840
  have "acyclic ((RAG s - {(Cs cs, Th th)} - {(Th taker, Cs cs)}) \<union> 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1841
                 {(Cs cs, Th taker)})" (is "acyclic (?A \<union> _)")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1842
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1843
    from assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1844
    have "acyclic ?A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1845
       by (rule acyclic_subset, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1846
    moreover have "(Th taker, Cs cs) \<notin> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1847
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1848
      assume otherwise: "(Th taker, Cs cs) \<in> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1849
      hence "(Th taker, Cs cs) \<in> ?A^+"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1850
        by (unfold rtrancl_eq_or_trancl, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1851
      from tranclD[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1852
      obtain cs' where h: "(Th taker, Cs cs') \<in> ?A" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1853
                          "(Th taker, Cs cs') \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1854
        by (unfold s_RAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1855
      from this(2) have "waiting s taker cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1856
        by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1857
      from waiting_unique[OF this waiting_taker]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1858
      have "cs' = cs" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1859
      from h(1)[unfolded this] show False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1860
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1861
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1862
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1863
  thus ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1864
    by (unfold RAG_es waiting_set_eq holding_set_eq, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1865
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1866
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1867
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1868
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1869
context valid_trace_p_h
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1870
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1871
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1872
lemma 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1873
  acylic_RAG_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1874
  assumes "acyclic (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1875
  shows "acyclic (RAG (e#s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1876
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1877
  have "acyclic (RAG s \<union> {(Cs cs, Th th)})" (is "acyclic (?A \<union> _)") 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1878
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1879
    from assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1880
    have "acyclic ?A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1881
       by (rule acyclic_subset, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1882
    moreover have "(Th th, Cs cs) \<notin> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1883
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1884
      assume otherwise: "(Th th, Cs cs) \<in> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1885
      hence "(Th th, Cs cs) \<in> ?A^+"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1886
        by (unfold rtrancl_eq_or_trancl, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1887
      from tranclD[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1888
      obtain cs' where h: "(Th th, Cs cs') \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1889
        by (unfold s_RAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1890
      hence "waiting s th cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1891
        by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1892
      with th_not_waiting show False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1893
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1894
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1895
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1896
  thus ?thesis by (unfold RAG_es, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1897
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1898
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1899
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1900
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1901
context valid_trace_p_w
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1902
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1903
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1904
lemma 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1905
  acylic_RAG_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1906
  assumes "acyclic (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1907
  shows "acyclic (RAG (e#s))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1908
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1909
  have "acyclic (RAG s \<union> {(Th th, Cs cs)})" (is "acyclic (?A \<union> _)") 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1910
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1911
    from assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1912
    have "acyclic ?A"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1913
       by (rule acyclic_subset, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1914
    moreover have "(Cs cs, Th th) \<notin> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1915
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1916
      assume otherwise: "(Cs cs, Th th) \<in> ?A^*"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1917
      from pip_e[unfolded is_p]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1918
      show False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1919
      proof(cases)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1920
        case (thread_P)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1921
        moreover from otherwise have "(Cs cs, Th th) \<in> ?A^+"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1922
            by (unfold rtrancl_eq_or_trancl, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1923
        ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1924
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1925
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1926
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1927
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1928
  thus ?thesis by (unfold RAG_es, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1929
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1930
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1931
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1932
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1933
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1934
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1935
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1936
lemma finite_RAG:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1937
  shows "finite (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1938
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1939
  case Nil
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1940
  show ?case 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1941
  by (auto simp: s_RAG_def cs_waiting_def 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1942
                   cs_holding_def wq_def acyclic_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1943
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1944
  case (Cons s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1945
  interpret vt_e: valid_trace_e s e using Cons by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1946
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1947
  proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1948
    case (Create th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1949
    interpret vt: valid_trace_create s e th prio using Create
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1950
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1951
    show ?thesis using Cons by (simp add: vt.RAG_unchanged) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1952
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1953
    case (Exit th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1954
    interpret vt: valid_trace_exit s e th using Exit
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1955
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1956
    show ?thesis using Cons by (simp add: vt.RAG_unchanged)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1957
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1958
    case (P th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1959
    interpret vt: valid_trace_p s e th cs using P
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1960
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1961
    show ?thesis using Cons using vt.RAG_es' by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1962
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1963
    case (V th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1964
    interpret vt: valid_trace_v s e th cs using V
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1965
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1966
    show ?thesis using Cons by (simp add: vt.finite_RAG_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1967
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1968
    case (Set th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1969
    interpret vt: valid_trace_set s e th prio using Set
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1970
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1971
    show ?thesis using Cons by (simp add: vt.RAG_unchanged) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1972
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1973
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1974
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1975
lemma acyclic_RAG:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1976
  shows "acyclic (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1977
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1978
  case Nil
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1979
  show ?case 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1980
  by (auto simp: s_RAG_def cs_waiting_def 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1981
                   cs_holding_def wq_def acyclic_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1982
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1983
  case (Cons s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1984
  interpret vt_e: valid_trace_e s e using Cons by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1985
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1986
  proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1987
    case (Create th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1988
    interpret vt: valid_trace_create s e th prio using Create
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1989
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1990
    show ?thesis using Cons by (simp add: vt.RAG_unchanged) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1991
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1992
    case (Exit th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1993
    interpret vt: valid_trace_exit s e th using Exit
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1994
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1995
    show ?thesis using Cons by (simp add: vt.RAG_unchanged)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1996
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1997
    case (P th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1998
    interpret vt: valid_trace_p s e th cs using P
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  1999
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2000
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2001
    proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2002
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2003
      then interpret vt_h: valid_trace_p_h s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2004
        by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2005
      show ?thesis using Cons by (simp add: vt_h.acylic_RAG_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2006
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2007
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2008
      then interpret vt_w: valid_trace_p_w s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2009
        by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2010
      show ?thesis using Cons by (simp add: vt_w.acylic_RAG_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2011
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2012
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2013
    case (V th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2014
    interpret vt: valid_trace_v s e th cs using V
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2015
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2016
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2017
    proof(cases "vt.rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2018
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2019
      then interpret vt_e: valid_trace_v_e s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2020
        by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2021
      show ?thesis by (simp add: Cons.hyps(2) vt_e.acylic_RAG_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2022
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2023
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2024
      then interpret vt_n: valid_trace_v_n s e th cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2025
        by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2026
      show ?thesis by (simp add: Cons.hyps(2) vt_n.acylic_RAG_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2027
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2028
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2029
    case (Set th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2030
    interpret vt: valid_trace_set s e th prio using Set
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2031
      by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2032
    show ?thesis using Cons by (simp add: vt.RAG_unchanged) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2033
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2034
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2035
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2036
lemma wf_RAG: "wf (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2037
proof(rule finite_acyclic_wf)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2038
  from finite_RAG show "finite (RAG s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2039
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2040
  from acyclic_RAG show "acyclic (RAG s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2041
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2042
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2043
lemma sgv_wRAG: "single_valued (wRAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2044
  using waiting_unique
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2045
  by (unfold single_valued_def wRAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2046
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2047
lemma sgv_hRAG: "single_valued (hRAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2048
  using held_unique 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2049
  by (unfold single_valued_def hRAG_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2050
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2051
lemma sgv_tRAG: "single_valued (tRAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2052
  by (unfold tRAG_def, rule single_valued_relcomp, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2053
              insert sgv_wRAG sgv_hRAG, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2054
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2055
lemma acyclic_tRAG: "acyclic (tRAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2056
proof(unfold tRAG_def, rule acyclic_compose)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2057
  show "acyclic (RAG s)" using acyclic_RAG .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2058
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2059
  show "wRAG s \<subseteq> RAG s" unfolding RAG_split by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2060
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2061
  show "hRAG s \<subseteq> RAG s" unfolding RAG_split by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2062
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2063
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2064
lemma unique_RAG: "\<lbrakk>(n, n1) \<in> RAG s; (n, n2) \<in> RAG s\<rbrakk> \<Longrightarrow> n1 = n2"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2065
  apply(unfold s_RAG_def, auto, fold waiting_eq holding_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2066
  by(auto elim:waiting_unique held_unique)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2067
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2068
lemma sgv_RAG: "single_valued (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2069
  using unique_RAG by (auto simp:single_valued_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2070
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2071
lemma rtree_RAG: "rtree (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2072
  using sgv_RAG acyclic_RAG
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2073
  by (unfold rtree_def rtree_axioms_def sgv_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2074
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2075
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2076
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2077
sublocale valid_trace < fsbtRAGs : fsubtree "RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2078
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2079
  show "fsubtree (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2080
  proof(intro_locales)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2081
    show "fbranch (RAG s)" using finite_fbranchI[OF finite_RAG] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2082
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2083
    show "fsubtree_axioms (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2084
    proof(unfold fsubtree_axioms_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2085
      from wf_RAG show "wf (RAG s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2086
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2087
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2088
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2089
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2090
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2091
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2092
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2093
lemma finite_subtree_threads:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2094
    "finite {th'. Th th' \<in> subtree (RAG s) (Th th)}" (is "finite ?A")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2095
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2096
  have "?A = the_thread ` {Th th' | th' . Th th' \<in> subtree (RAG s) (Th th)}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2097
        by (auto, insert image_iff, fastforce)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2098
  moreover have "finite {Th th' | th' . Th th' \<in> subtree (RAG s) (Th th)}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2099
        (is "finite ?B")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2100
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2101
     have "?B = (subtree (RAG s) (Th th)) \<inter> {Th th' | th'. True}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2102
      by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2103
     moreover have "... \<subseteq> (subtree (RAG s) (Th th))" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2104
     moreover have "finite ..." by (simp add: finite_subtree) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2105
     ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2106
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2107
  ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2108
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2109
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2110
lemma le_cp:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2111
  shows "preced th s \<le> cp s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2112
  proof(unfold cp_alt_def, rule Max_ge)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2113
    show "finite (the_preced s ` {th'. Th th' \<in> subtree (RAG s) (Th th)})"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2114
      by (simp add: finite_subtree_threads)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2115
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2116
    show "preced th s \<in> the_preced s ` {th'. Th th' \<in> subtree (RAG s) (Th th)}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2117
      by (simp add: subtree_def the_preced_def)   
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2118
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2119
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2120
lemma cp_le:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2121
  assumes th_in: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2122
  shows "cp s th \<le> Max (the_preced s ` threads s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2123
proof(unfold cp_alt_def, rule Max_f_mono)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2124
  show "finite (threads s)" by (simp add: finite_threads) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2125
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2126
  show " {th'. Th th' \<in> subtree (RAG s) (Th th)} \<noteq> {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2127
    using subtree_def by fastforce
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2128
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2129
  show "{th'. Th th' \<in> subtree (RAG s) (Th th)} \<subseteq> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2130
    using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2131
    by (smt Domain.DomainI dm_RAG_threads mem_Collect_eq 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2132
        node.inject(1) rtranclD subsetI subtree_def trancl_domain) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2133
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2134
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2135
lemma max_cp_eq: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2136
  shows "Max ((cp s) ` threads s) = Max (the_preced s ` threads s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2137
  (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2138
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2139
  have "?L \<le> ?R" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2140
  proof(cases "threads s = {}")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2141
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2142
    show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2143
      by (rule Max.boundedI, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2144
          insert cp_le, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2145
          auto simp:finite_threads False)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2146
  qed auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2147
  moreover have "?R \<le> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2148
    by (rule Max_fg_mono, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2149
        simp add: finite_threads,
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2150
        simp add: le_cp the_preced_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2151
  ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2152
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2153
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2154
lemma max_cp_eq_the_preced:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2155
  shows "Max ((cp s) ` threads s) = Max (the_preced s ` threads s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2156
  using max_cp_eq using the_preced_def by presburger 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2157
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2158
lemma wf_RAG_converse: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2159
  shows "wf ((RAG s)^-1)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2160
proof(rule finite_acyclic_wf_converse)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2161
  from finite_RAG 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2162
  show "finite (RAG s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2163
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2164
  from acyclic_RAG
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2165
  show "acyclic (RAG s)" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2166
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2167
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2168
lemma chain_building:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2169
  assumes "node \<in> Domain (RAG s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2170
  obtains th' where "th' \<in> readys s" "(node, Th th') \<in> (RAG s)^+"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2171
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2172
  from assms have "node \<in> Range ((RAG s)^-1)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2173
  from wf_base[OF wf_RAG_converse this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2174
  obtain b where h_b: "(b, node) \<in> ((RAG s)\<inverse>)\<^sup>+" "\<forall>c. (c, b) \<notin> (RAG s)\<inverse>" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2175
  obtain th' where eq_b: "b = Th th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2176
  proof(cases b)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2177
    case (Cs cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2178
    from h_b(1)[unfolded trancl_converse] 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2179
    have "(node, b) \<in> ((RAG s)\<^sup>+)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2180
    from tranclE[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2181
    obtain n where "(n, b) \<in> RAG s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2182
    from this[unfolded Cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2183
    obtain th1 where "waiting s th1 cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2184
      by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2185
    from waiting_holding[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2186
    obtain th2 where "holding s th2 cs" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2187
    hence "(Cs cs, Th th2) \<in> RAG s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2188
      by (unfold s_RAG_def, fold holding_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2189
    with h_b(2)[unfolded Cs, rule_format]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2190
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2191
    thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2192
  qed auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2193
  have "th' \<in> readys s" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2194
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2195
    from h_b(2)[unfolded eq_b]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2196
    have "\<forall>cs. \<not> waiting s th' cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2197
      by (unfold s_RAG_def, fold waiting_eq, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2198
    moreover have "th' \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2199
    proof(rule rg_RAG_threads)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2200
      from tranclD[OF h_b(1), unfolded eq_b]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2201
      obtain z where "(z, Th th') \<in> (RAG s)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2202
      thus "Th th' \<in> Range (RAG s)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2203
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2204
    ultimately show ?thesis by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2205
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2206
  moreover have "(node, Th th') \<in> (RAG s)^+" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2207
    using h_b(1)[unfolded trancl_converse] eq_b by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2208
  ultimately show ?thesis using that by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2209
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2210
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2211
text {* \noindent
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2212
  The following is just an instance of @{text "chain_building"}.
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2213
*}
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2214
lemma th_chain_to_ready:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2215
  assumes th_in: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2216
  shows "th \<in> readys s \<or> (\<exists> th'. th' \<in> readys s \<and> (Th th, Th th') \<in> (RAG s)^+)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2217
proof(cases "th \<in> readys s")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2218
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2219
  thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2220
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2221
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2222
  from False and th_in have "Th th \<in> Domain (RAG s)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2223
    by (auto simp:readys_def s_waiting_def s_RAG_def wq_def cs_waiting_def Domain_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2224
  from chain_building [rule_format, OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2225
  show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2226
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2227
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2228
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2229
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2230
lemma count_rec1 [simp]: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2231
  assumes "Q e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2232
  shows "count Q (e#es) = Suc (count Q es)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2233
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2234
  by (unfold count_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2235
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2236
lemma count_rec2 [simp]: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2237
  assumes "\<not>Q e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2238
  shows "count Q (e#es) = (count Q es)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2239
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2240
  by (unfold count_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2241
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2242
lemma count_rec3 [simp]: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2243
  shows "count Q [] =  0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2244
  by (unfold count_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2245
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2246
lemma cntP_simp1[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2247
  "cntP (P th cs'#s) th = cntP s th + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2248
  by (unfold cntP_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2249
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2250
lemma cntP_simp2[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2251
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2252
  shows "cntP (P th cs'#s) th' = cntP s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2253
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2254
  by (unfold cntP_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2255
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2256
lemma cntP_simp3[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2257
  assumes "\<not> isP e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2258
  shows "cntP (e#s) th' = cntP s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2259
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2260
  by (unfold cntP_def, cases e, simp+)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2261
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2262
lemma cntV_simp1[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2263
  "cntV (V th cs'#s) th = cntV s th + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2264
  by (unfold cntV_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2265
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2266
lemma cntV_simp2[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2267
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2268
  shows "cntV (V th cs'#s) th' = cntV s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2269
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2270
  by (unfold cntV_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2271
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2272
lemma cntV_simp3[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2273
  assumes "\<not> isV e"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2274
  shows "cntV (e#s) th' = cntV s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2275
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2276
  by (unfold cntV_def, cases e, simp+)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2277
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2278
lemma cntP_diff_inv:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2279
  assumes "cntP (e#s) th \<noteq> cntP s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2280
  shows "isP e \<and> actor e = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2281
proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2282
  case (P th' pty)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2283
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2284
  by (cases "(\<lambda>e. \<exists>cs. e = P th cs) (P th' pty)", 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2285
        insert assms P, auto simp:cntP_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2286
qed (insert assms, auto simp:cntP_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2287
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2288
lemma cntV_diff_inv:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2289
  assumes "cntV (e#s) th \<noteq> cntV s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2290
  shows "isV e \<and> actor e = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2291
proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2292
  case (V th' pty)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2293
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2294
  by (cases "(\<lambda>e. \<exists>cs. e = V th cs) (V th' pty)", 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2295
        insert assms V, auto simp:cntV_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2296
qed (insert assms, auto simp:cntV_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2297
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2298
lemma children_RAG_alt_def:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2299
  "children (RAG (s::state)) (Th th) = Cs ` {cs. holding s th cs}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2300
  by (unfold s_RAG_def, auto simp:children_def holding_eq)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2301
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2302
fun the_cs :: "node \<Rightarrow> cs" where
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2303
  "the_cs (Cs cs) = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2304
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2305
lemma holdents_alt_def:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2306
  "holdents s th = the_cs ` (children (RAG (s::state)) (Th th))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2307
  by (unfold children_RAG_alt_def holdents_def, simp add: image_image)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2308
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2309
lemma cntCS_alt_def:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2310
  "cntCS s th = card (children (RAG s) (Th th))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2311
  apply (unfold children_RAG_alt_def cntCS_def holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2312
  by (rule card_image[symmetric], auto simp:inj_on_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2313
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2314
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2315
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2316
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2317
lemma finite_holdents: "finite (holdents s th)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2318
  by (unfold holdents_alt_def, insert finite_children, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2319
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2320
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2321
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2322
context valid_trace_p_w
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2323
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2324
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2325
lemma holding_s_holder: "holding s holder cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2326
  by (unfold s_holding_def, fold wq_def, unfold wq_s_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2327
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2328
lemma holding_es_holder: "holding (e#s) holder cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2329
  by (unfold s_holding_def, fold wq_def, unfold wq_es_cs wq_s_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2330
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2331
lemma holdents_es:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2332
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R") 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2333
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2334
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2335
    assume "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2336
    hence h: "holding (e#s) th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2337
    have "holding s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2338
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2339
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2340
      from held_unique[OF h[unfolded True] holding_es_holder]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2341
      have "th' = holder" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2342
      thus ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2343
        by (unfold True holdents_def, insert holding_s_holder, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2344
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2345
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2346
      hence "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2347
      from h[unfolded s_holding_def, folded wq_def, unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2348
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2349
       by (unfold s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2350
    qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2351
    hence "cs' \<in> ?R" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2352
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2353
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2354
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2355
    hence h: "holding s th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2356
    have "holding (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2357
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2358
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2359
      from held_unique[OF h[unfolded True] holding_s_holder]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2360
      have "th' = holder" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2361
      thus ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2362
        by (unfold True holdents_def, insert holding_es_holder, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2363
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2364
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2365
      hence "wq s cs' = wq (e#s) cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2366
      from h[unfolded s_holding_def, folded wq_def, unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2367
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2368
       by (unfold s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2369
    qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2370
    hence "cs' \<in> ?L" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2371
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2372
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2373
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2374
lemma cntCS_es_th[simp]: "cntCS (e#s) th' = cntCS s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2375
 by (unfold cntCS_def holdents_es, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2376
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2377
lemma th_not_ready_es: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2378
  shows "th \<notin> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2379
  using waiting_es_th_cs 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2380
  by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2381
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2382
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2383
  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2384
context valid_trace_p_h
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2385
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2386
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2387
lemma th_not_waiting':
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2388
  "\<not> waiting (e#s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2389
proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2390
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2391
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2392
    by (unfold True s_waiting_def, fold wq_def, unfold wq_es_cs', auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2393
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2394
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2395
  from th_not_waiting[of cs', unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2396
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2397
    by (unfold s_waiting_def, fold wq_def, insert False, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2398
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2399
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2400
lemma ready_th_es: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2401
  shows "th \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2402
  using th_not_waiting'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2403
  by (unfold readys_def, insert live_th_es, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2404
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2405
lemma holdents_es_th:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2406
  "holdents (e#s) th = (holdents s th) \<union> {cs}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2407
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2408
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2409
    assume "cs' \<in> ?L" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2410
    hence "holding (e#s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2411
      by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2412
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2413
     by (cases rule:holding_esE, auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2414
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2415
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2416
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2417
    hence "holding s th cs' \<or> cs' = cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2418
      by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2419
    hence "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2420
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2421
      assume "holding s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2422
      from holding_kept[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2423
      show ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2424
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2425
      assume "cs' = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2426
      thus ?thesis using holding_es_th_cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2427
        by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2428
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2429
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2430
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2431
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2432
lemma cntCS_es_th: "cntCS (e#s) th = cntCS s th + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2433
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2434
  have "card (holdents s th \<union> {cs}) = card (holdents s th) + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2435
  proof(subst card_Un_disjoint)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2436
    show "holdents s th \<inter> {cs} = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2437
      using not_holding_s_th_cs by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2438
  qed (auto simp:finite_holdents)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2439
  thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2440
   by (unfold cntCS_def holdents_es_th, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2441
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2442
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2443
lemma no_holder: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2444
  "\<not> holding s th' cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2445
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2446
  assume otherwise: "holding s th' cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2447
  from this[unfolded s_holding_def, folded wq_def, unfolded we]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2448
  show False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2449
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2450
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2451
lemma holdents_es_th':
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2452
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2453
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2454
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2455
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2456
    assume "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2457
    hence h_e: "holding (e#s) th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2458
    have "cs' \<noteq> cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2459
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2460
      assume "cs' = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2461
      from held_unique[OF h_e[unfolded this] holding_es_th_cs]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2462
      have "th' = th" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2463
      with assms show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2464
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2465
    from h_e[unfolded s_holding_def, folded wq_def, unfolded wq_neq_simp[OF this]]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2466
    have "th' \<in> set (wq s cs') \<and> th' = hd (wq s cs')" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2467
    hence "cs' \<in> ?R" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2468
      by (unfold holdents_def s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2469
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2470
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2471
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2472
    hence "holding s th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2473
    from holding_kept[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2474
    have "holding (e # s) th' cs'" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2475
    hence "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2476
      by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2477
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2478
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2479
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2480
lemma cntCS_es_th'[simp]: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2481
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2482
  shows "cntCS (e#s) th' = cntCS s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2483
  by (unfold cntCS_def holdents_es_th'[OF assms], simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2484
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2485
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2486
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2487
context valid_trace_p
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2488
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2489
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2490
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2491
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2492
  and "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2493
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2494
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2495
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2496
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2497
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2498
        using assms(2)[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2499
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2500
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2501
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2502
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2503
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2504
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2505
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2506
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2507
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2508
      proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2509
        case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2510
        then interpret vt: valid_trace_p_h
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2511
          by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2512
        show ?thesis using n_wait wait waiting_kept by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2513
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2514
        case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2515
        then interpret vt: valid_trace_p_w by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2516
        show ?thesis using n_wait wait waiting_kept by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2517
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2518
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2519
  } with assms(2) show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2520
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2521
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2522
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2523
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2524
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2525
  and "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2526
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2527
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2528
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2529
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2530
    have n_wait: "\<not> waiting s th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2531
        using assms(2)[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2532
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2533
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2534
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2535
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2536
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2537
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2538
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2539
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2540
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2541
      proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2542
        case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2543
        then interpret vt: valid_trace_p_h
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2544
          by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2545
        show ?thesis using n_wait vt.waiting_esE wait by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2546
      next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2547
        case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2548
        then interpret vt: valid_trace_p_w by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2549
        show ?thesis using assms(1) n_wait vt.waiting_esE wait by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2550
      qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2551
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2552
  } with assms(2) show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2553
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2554
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2555
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2556
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2557
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2558
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2559
  using readys_kept1[OF assms] readys_kept2[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2560
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2561
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2562
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2563
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2564
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2565
proof(cases "th' = th")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2566
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2567
  note eq_th' = this
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2568
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2569
  proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2570
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2571
    then interpret vt: valid_trace_p_h by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2572
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2573
      using assms eq_th' is_p ready_th_s vt.cntCS_es_th vt.ready_th_es pvD_def by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2574
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2575
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2576
    then interpret vt: valid_trace_p_w by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2577
    show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2578
      using add.commute add.left_commute assms eq_th' is_p live_th_s 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2579
            ready_th_s vt.th_not_ready_es pvD_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2580
      apply (auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2581
      by (fold is_p, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2582
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2583
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2584
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2585
  note h_False = False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2586
  thus ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2587
  proof(cases "wq s cs = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2588
    case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2589
    then interpret vt: valid_trace_p_h by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2590
    show ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2591
      by (insert True h_False pvD_def, auto split:if_splits,unfold is_p, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2592
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2593
    case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2594
    then interpret vt: valid_trace_p_w by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2595
    show ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2596
      by (insert False h_False pvD_def, auto split:if_splits,unfold is_p, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2597
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2598
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2599
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2600
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2601
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2602
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2603
context valid_trace_v (* ccc *)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2604
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2605
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2606
lemma holding_th_cs_s: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2607
  "holding s th cs" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2608
 by  (unfold s_holding_def, fold wq_def, unfold wq_s_cs, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2609
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2610
lemma th_ready_s [simp]: "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2611
  using runing_th_s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2612
  by (unfold runing_def readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2613
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2614
lemma th_live_s [simp]: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2615
  using th_ready_s by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2616
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2617
lemma th_ready_es [simp]: "th \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2618
  using runing_th_s neq_t_th
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2619
  by (unfold is_v runing_def readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2620
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2621
lemma th_live_es [simp]: "th \<in> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2622
  using th_ready_es by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2623
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2624
lemma pvD_th_s[simp]: "pvD s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2625
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2626
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2627
lemma pvD_th_es[simp]: "pvD (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2628
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2629
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2630
lemma cntCS_s_th [simp]: "cntCS s th > 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2631
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2632
  have "cs \<in> holdents s th" using holding_th_cs_s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2633
    by (unfold holdents_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2634
  moreover have "finite (holdents s th)" using finite_holdents
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2635
    by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2636
  ultimately show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2637
    by (unfold cntCS_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2638
        auto intro!:card_gt_0_iff[symmetric, THEN iffD1])
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2639
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2640
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2641
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2642
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2643
context valid_trace_v_n
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2644
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2645
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2646
lemma not_ready_taker_s[simp]: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2647
  "taker \<notin> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2648
  using waiting_taker
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2649
  by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2650
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2651
lemma taker_live_s [simp]: "taker \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2652
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2653
  have "taker \<in> set wq'" by (simp add: eq_wq') 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2654
  from th'_in_inv[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2655
  have "taker \<in> set rest" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2656
  hence "taker \<in> set (wq s cs)" by (simp add: wq_s_cs) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2657
  thus ?thesis using wq_threads by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2658
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2659
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2660
lemma taker_live_es [simp]: "taker \<in> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2661
  using taker_live_s threads_es by blast
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2662
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2663
lemma taker_ready_es [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2664
  shows "taker \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2665
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2666
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2667
    assume "waiting (e#s) taker cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2668
    hence False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2669
    proof(cases rule:waiting_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2670
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2671
      thus ?thesis using waiting_taker waiting_unique by auto 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2672
    qed simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2673
  } thus ?thesis by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2674
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2675
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2676
lemma neq_taker_th: "taker \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2677
  using th_not_waiting waiting_taker by blast
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2678
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2679
lemma not_holding_taker_s_cs:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2680
  shows "\<not> holding s taker cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2681
  using holding_cs_eq_th neq_taker_th by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2682
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2683
lemma holdents_es_taker:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2684
  "holdents (e#s) taker = holdents s taker \<union> {cs}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2685
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2686
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2687
    assume "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2688
    hence "holding (e#s) taker cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2689
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2690
    proof(cases rule:holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2691
      case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2692
      thus ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2693
    qed auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2694
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2695
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2696
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2697
    hence "holding s taker cs' \<or> cs' = cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2698
    hence "cs' \<in> ?L" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2699
    proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2700
      assume "holding s taker cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2701
      hence "holding (e#s) taker cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2702
          using holding_esI2 holding_taker by fastforce 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2703
      thus ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2704
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2705
      assume "cs' = cs"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2706
      with holding_taker
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2707
      show ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2708
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2709
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2710
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2711
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2712
lemma cntCS_es_taker [simp]: "cntCS (e#s) taker = cntCS s taker + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2713
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2714
  have "card (holdents s taker \<union> {cs}) = card (holdents s taker) + 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2715
  proof(subst card_Un_disjoint)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2716
    show "holdents s taker \<inter> {cs} = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2717
      using not_holding_taker_s_cs by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2718
  qed (auto simp:finite_holdents)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2719
  thus ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2720
    by (unfold cntCS_def, insert holdents_es_taker, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2721
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2722
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2723
lemma pvD_taker_s[simp]: "pvD s taker = 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2724
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2725
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2726
lemma pvD_taker_es[simp]: "pvD (e#s) taker = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2727
  by (unfold pvD_def, simp)  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2728
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2729
lemma pvD_th_s[simp]: "pvD s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2730
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2731
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2732
lemma pvD_th_es[simp]: "pvD (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2733
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2734
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2735
lemma holdents_es_th:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2736
  "holdents (e#s) th = holdents s th - {cs}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2737
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2738
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2739
    assume "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2740
    hence "holding (e#s) th cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2741
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2742
    proof(cases rule:holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2743
      case 2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2744
      thus ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2745
    qed (insert neq_taker_th, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2746
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2747
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2748
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2749
    hence "cs' \<noteq> cs" "holding s th cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2750
    from holding_esI2[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2751
    have "cs' \<in> ?L" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2752
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2753
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2754
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2755
lemma cntCS_es_th [simp]: "cntCS (e#s) th = cntCS s th - 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2756
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2757
  have "card (holdents s th - {cs}) = card (holdents s th) - 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2758
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2759
    have "cs \<in> holdents s th" using holding_th_cs_s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2760
      by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2761
    moreover have "finite (holdents s th)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2762
        by (simp add: finite_holdents) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2763
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2764
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2765
  thus ?thesis by (unfold cntCS_def holdents_es_th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2766
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2767
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2768
lemma holdents_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2769
  assumes "th' \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2770
  and "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2771
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2772
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2773
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2774
    assume h: "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2775
    have "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2776
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2777
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2778
      hence eq_wq: "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2779
      from h have "holding (e#s) th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2780
      from this[unfolded s_holding_def, folded wq_def, unfolded eq_wq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2781
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2782
        by (unfold holdents_def s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2783
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2784
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2785
      from h[unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2786
      have "holding (e#s) th' cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2787
      from held_unique[OF this holding_taker]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2788
      have "th' = taker" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2789
      with assms show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2790
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2791
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2792
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2793
    assume h: "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2794
    have "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2795
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2796
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2797
      hence eq_wq: "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2798
      from h have "holding s th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2799
      from this[unfolded s_holding_def, folded wq_def, unfolded eq_wq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2800
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2801
        by (unfold holdents_def s_holding_def, fold wq_def, insert eq_wq, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2802
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2803
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2804
      from h[unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2805
      have "holding s th' cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2806
      from held_unique[OF this holding_th_cs_s]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2807
      have "th' = th" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2808
      with assms show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2809
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2810
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2811
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2812
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2813
lemma cntCS_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2814
  assumes "th' \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2815
  and "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2816
  shows "cntCS (e#s) th' = cntCS s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2817
  by (unfold cntCS_def holdents_kept[OF assms], simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2818
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2819
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2820
  assumes "th' \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2821
  and "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2822
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2823
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2824
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2825
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2826
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2827
        using assms(2)[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2828
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2829
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2830
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2831
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2832
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2833
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2834
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2835
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2836
      have "th' \<in> set (th # rest) \<and> th' \<noteq> hd (th # rest)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2837
        using wait[unfolded True s_waiting_def, folded wq_def, unfolded wq_s_cs] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2838
      moreover have "\<not> (th' \<in> set rest \<and> th' \<noteq> hd (taker # rest'))" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2839
        using n_wait[unfolded True s_waiting_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2840
                    unfolded wq_es_cs set_wq', unfolded eq_wq'] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2841
      ultimately have "th' = taker" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2842
      with assms(1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2843
      show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2844
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2845
  } with assms(2) show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2846
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2847
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2848
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2849
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2850
  assumes "th' \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2851
  and "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2852
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2853
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2854
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2855
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2856
    have n_wait: "\<not> waiting s th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2857
        using assms(2)[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2858
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2859
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2860
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2861
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2862
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2863
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2864
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2865
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2866
      have "th' \<in> set rest \<and> th' \<noteq> hd (taker # rest')"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2867
          using  wait [unfolded True s_waiting_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2868
                    unfolded wq_es_cs set_wq', unfolded eq_wq']  .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2869
      moreover have "\<not> (th' \<in> set (th # rest) \<and> th' \<noteq> hd (th # rest))"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2870
          using n_wait[unfolded True s_waiting_def, folded wq_def, unfolded wq_s_cs] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2871
      ultimately have "th' = taker" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2872
      with assms(1)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2873
      show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2874
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2875
  } with assms(2) show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2876
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2877
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2878
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2879
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2880
  assumes "th' \<noteq> taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2881
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2882
  using readys_kept1[OF assms] readys_kept2[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2883
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2884
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2885
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2886
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2887
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2888
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2889
  { assume eq_th': "th' = taker"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2890
    have ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2891
      apply (unfold eq_th' pvD_taker_es cntCS_es_taker)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2892
      by (insert neq_taker_th assms[unfolded eq_th'], unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2893
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2894
    assume eq_th': "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2895
    have ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2896
      apply (unfold eq_th' pvD_th_es cntCS_es_th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2897
      by (insert assms[unfolded eq_th'], unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2898
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2899
    assume h: "th' \<noteq> taker" "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2900
    have ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2901
      apply (unfold cntCS_kept[OF h], insert h, unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2902
      by (fold is_v, unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2903
  } ultimately show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2904
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2905
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2906
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2907
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2908
context valid_trace_v_e
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2909
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2910
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2911
lemma holdents_es_th:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2912
  "holdents (e#s) th = holdents s th - {cs}" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2913
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2914
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2915
    assume "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2916
    hence "holding (e#s) th cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2917
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2918
    proof(cases rule:holding_esE)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2919
      case 1
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2920
      thus ?thesis by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2921
    qed 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2922
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2923
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2924
    assume "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2925
    hence "cs' \<noteq> cs" "holding s th cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2926
    from holding_esI2[OF this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2927
    have "cs' \<in> ?L" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2928
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2929
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2930
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2931
lemma cntCS_es_th [simp]: "cntCS (e#s) th = cntCS s th - 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2932
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2933
  have "card (holdents s th - {cs}) = card (holdents s th) - 1"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2934
  proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2935
    have "cs \<in> holdents s th" using holding_th_cs_s
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2936
      by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2937
    moreover have "finite (holdents s th)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2938
        by (simp add: finite_holdents) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2939
    ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2940
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2941
  thus ?thesis by (unfold cntCS_def holdents_es_th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2942
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2943
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2944
lemma holdents_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2945
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2946
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2947
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2948
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2949
    assume h: "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2950
    have "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2951
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2952
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2953
      hence eq_wq: "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2954
      from h have "holding (e#s) th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2955
      from this[unfolded s_holding_def, folded wq_def, unfolded eq_wq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2956
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2957
        by (unfold holdents_def s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2958
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2959
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2960
      from h[unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2961
      have "holding (e#s) th' cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2962
      from this[unfolded s_holding_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2963
            unfolded wq_es_cs nil_wq']
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2964
      show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2965
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2966
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2967
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2968
    assume h: "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2969
    have "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2970
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2971
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2972
      hence eq_wq: "wq (e#s) cs' = wq s cs'" by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2973
      from h have "holding s th' cs'" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2974
      from this[unfolded s_holding_def, folded wq_def, unfolded eq_wq]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2975
      show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2976
        by (unfold holdents_def s_holding_def, fold wq_def, insert eq_wq, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2977
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2978
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2979
      from h[unfolded this]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2980
      have "holding s th' cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2981
      from held_unique[OF this holding_th_cs_s]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2982
      have "th' = th" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2983
      with assms show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2984
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2985
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2986
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2987
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2988
lemma cntCS_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2989
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2990
  shows "cntCS (e#s) th' = cntCS s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2991
  by (unfold cntCS_def holdents_kept[OF assms], simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2992
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2993
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2994
  assumes "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2995
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2996
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2997
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2998
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  2999
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3000
        using assms(1)[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3001
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3002
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3003
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3004
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3005
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3006
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3007
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3008
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3009
      have "th' \<in> set (th # rest) \<and> th' \<noteq> hd (th # rest)" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3010
        using wait[unfolded True s_waiting_def, folded wq_def, unfolded wq_s_cs] . 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3011
      hence "th' \<in> set rest" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3012
      with set_wq' have "th' \<in> set wq'" by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3013
      with nil_wq' show ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3014
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3015
  } thus ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3016
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3017
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3018
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3019
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3020
  assumes "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3021
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3022
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3023
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3024
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3025
    have n_wait: "\<not> waiting s th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3026
        using assms[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3027
    have False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3028
    proof(cases "cs' = cs")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3029
      case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3030
      with n_wait wait
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3031
      show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3032
        by (unfold s_waiting_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3033
    next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3034
      case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3035
      have "th' \<in> set [] \<and> th' \<noteq> hd []"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3036
        using wait[unfolded True s_waiting_def, folded wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3037
              unfolded wq_es_cs nil_wq'] .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3038
      thus ?thesis by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3039
    qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3040
  } with assms show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3041
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3042
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3043
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3044
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3045
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3046
  using readys_kept1[OF assms] readys_kept2[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3047
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3048
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3049
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3050
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3051
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3052
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3053
  {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3054
    assume eq_th': "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3055
    have ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3056
      apply (unfold eq_th' pvD_th_es cntCS_es_th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3057
      by (insert assms[unfolded eq_th'], unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3058
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3059
    assume h: "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3060
    have ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3061
      apply (unfold cntCS_kept[OF h], insert h, unfold is_v, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3062
      by (fold is_v, unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3063
  } ultimately show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3064
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3065
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3066
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3067
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3068
context valid_trace_v
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3069
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3070
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3071
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3072
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3073
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3074
proof(cases "rest = []")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3075
  case True
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3076
  then interpret vt: valid_trace_v_e by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3077
  show ?thesis using assms using vt.cnp_cnv_cncs_kept by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3078
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3079
  case False
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3080
  then interpret vt: valid_trace_v_n by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3081
  show ?thesis using assms using vt.cnp_cnv_cncs_kept by blast 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3082
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3083
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3084
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3085
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3086
context valid_trace_create
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3087
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3088
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3089
lemma th_not_live_s [simp]: "th \<notin> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3090
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3091
  from pip_e[unfolded is_create]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3092
  show ?thesis by (cases, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3093
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3094
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3095
lemma th_not_ready_s [simp]: "th \<notin> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3096
  using th_not_live_s by (unfold readys_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3097
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3098
lemma th_live_es [simp]: "th \<in> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3099
  by (unfold is_create, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3100
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3101
lemma not_waiting_th_s [simp]: "\<not> waiting s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3102
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3103
  assume "waiting s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3104
  from this[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3105
  have "th \<in> set (wq s cs')" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3106
  from wq_threads[OF this] have "th \<in> threads s" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3107
  with th_not_live_s show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3108
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3109
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3110
lemma not_holding_th_s [simp]: "\<not> holding s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3111
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3112
  assume "holding s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3113
  from this[unfolded s_holding_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3114
  have "th \<in> set (wq s cs')" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3115
  from wq_threads[OF this] have "th \<in> threads s" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3116
  with th_not_live_s show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3117
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3118
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3119
lemma not_waiting_th_es [simp]: "\<not> waiting (e#s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3120
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3121
  assume "waiting (e # s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3122
  from this[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3123
  have "th \<in> set (wq s cs')" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3124
  from wq_threads[OF this] have "th \<in> threads s" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3125
  with th_not_live_s show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3126
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3127
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3128
lemma not_holding_th_es [simp]: "\<not> holding (e#s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3129
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3130
  assume "holding (e # s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3131
  from this[unfolded s_holding_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3132
  have "th \<in> set (wq s cs')" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3133
  from wq_threads[OF this] have "th \<in> threads s" .
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3134
  with th_not_live_s show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3135
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3136
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3137
lemma ready_th_es [simp]: "th \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3138
  by (simp add:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3139
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3140
lemma holdents_th_s: "holdents s th = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3141
  by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3142
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3143
lemma holdents_th_es: "holdents (e#s) th = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3144
  by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3145
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3146
lemma cntCS_th_s [simp]: "cntCS s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3147
  by (unfold cntCS_def, simp add:holdents_th_s)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3148
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3149
lemma cntCS_th_es [simp]: "cntCS (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3150
  by (unfold cntCS_def, simp add:holdents_th_es)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3151
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3152
lemma pvD_th_s [simp]: "pvD s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3153
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3154
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3155
lemma pvD_th_es [simp]: "pvD (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3156
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3157
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3158
lemma holdents_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3159
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3160
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3161
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3162
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3163
    assume h: "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3164
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3165
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3166
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3167
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3168
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3169
    assume h: "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3170
    hence "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3171
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3172
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3173
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3174
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3175
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3176
lemma cntCS_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3177
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3178
  shows "cntCS (e#s) th' = cntCS s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3179
  using holdents_kept[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3180
  by (unfold cntCS_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3181
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3182
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3183
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3184
  and "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3185
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3186
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3187
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3188
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3189
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3190
      using assms by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3191
    from wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3192
         n_wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3193
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3194
  } thus ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3195
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3196
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3197
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3198
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3199
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3200
  and "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3201
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3202
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3203
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3204
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3205
    have n_wait: "\<not> waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3206
      using assms(2) by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3207
    from wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3208
         n_wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3209
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3210
  } with assms show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3211
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3212
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3213
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3214
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3215
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3216
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3217
  using readys_kept1[OF assms] readys_kept2[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3218
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3219
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3220
lemma pvD_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3221
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3222
  shows "pvD (e#s) th' = pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3223
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3224
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3225
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3226
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3227
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3228
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3229
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3230
  {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3231
    assume eq_th': "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3232
    have ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3233
      by (unfold eq_th', simp, unfold is_create, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3234
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3235
    assume h: "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3236
    hence ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3237
      by (simp, simp add:is_create)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3238
  } ultimately show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3239
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3240
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3241
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3242
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3243
context valid_trace_exit
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3244
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3245
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3246
lemma th_live_s [simp]: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3247
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3248
  from pip_e[unfolded is_exit]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3249
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3250
  by (cases, unfold runing_def readys_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3251
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3252
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3253
lemma th_ready_s [simp]: "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3254
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3255
  from pip_e[unfolded is_exit]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3256
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3257
  by (cases, unfold runing_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3258
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3259
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3260
lemma th_not_live_es [simp]: "th \<notin> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3261
  by (unfold is_exit, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3262
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3263
lemma not_holding_th_s [simp]: "\<not> holding s th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3264
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3265
  from pip_e[unfolded is_exit]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3266
  show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3267
   by (cases, unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3268
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3269
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3270
lemma cntCS_th_s [simp]: "cntCS s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3271
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3272
  from pip_e[unfolded is_exit]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3273
  show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3274
   by (cases, unfold cntCS_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3275
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3276
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3277
lemma not_holding_th_es [simp]: "\<not> holding (e#s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3278
proof
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3279
  assume "holding (e # s) th cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3280
  from this[unfolded s_holding_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3281
  have "holding s th cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3282
    by (unfold s_holding_def, fold wq_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3283
  with not_holding_th_s 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3284
  show False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3285
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3286
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3287
lemma ready_th_es [simp]: "th \<notin> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3288
  by (simp add:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3289
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3290
lemma holdents_th_s: "holdents s th = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3291
  by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3292
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3293
lemma holdents_th_es: "holdents (e#s) th = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3294
  by (unfold holdents_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3295
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3296
lemma cntCS_th_es [simp]: "cntCS (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3297
  by (unfold cntCS_def, simp add:holdents_th_es)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3298
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3299
lemma pvD_th_s [simp]: "pvD s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3300
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3301
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3302
lemma pvD_th_es [simp]: "pvD (e#s) th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3303
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3304
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3305
lemma holdents_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3306
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3307
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3308
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3309
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3310
    assume h: "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3311
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3312
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3313
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3314
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3315
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3316
    assume h: "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3317
    hence "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3318
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3319
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3320
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3321
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3322
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3323
lemma cntCS_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3324
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3325
  shows "cntCS (e#s) th' = cntCS s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3326
  using holdents_kept[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3327
  by (unfold cntCS_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3328
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3329
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3330
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3331
  and "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3332
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3333
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3334
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3335
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3336
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3337
      using assms by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3338
    from wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3339
         n_wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3340
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3341
  } thus ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3342
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3343
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3344
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3345
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3346
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3347
  and "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3348
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3349
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3350
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3351
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3352
    have n_wait: "\<not> waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3353
      using assms(2) by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3354
    from wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3355
         n_wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3356
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3357
  } with assms show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3358
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3359
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3360
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3361
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3362
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3363
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3364
  using readys_kept1[OF assms] readys_kept2[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3365
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3366
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3367
lemma pvD_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3368
  assumes "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3369
  shows "pvD (e#s) th' = pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3370
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3371
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3372
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3373
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3374
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3375
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3376
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3377
  {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3378
    assume eq_th': "th' = th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3379
    have ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3380
      by (unfold eq_th', simp, unfold is_exit, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3381
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3382
    assume h: "th' \<noteq> th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3383
    hence ?thesis using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3384
      by (simp, simp add:is_exit)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3385
  } ultimately show ?thesis by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3386
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3387
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3388
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3389
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3390
context valid_trace_set
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3391
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3392
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3393
lemma th_live_s [simp]: "th \<in> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3394
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3395
  from pip_e[unfolded is_set]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3396
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3397
  by (cases, unfold runing_def readys_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3398
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3399
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3400
lemma th_ready_s [simp]: "th \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3401
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3402
  from pip_e[unfolded is_set]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3403
  show ?thesis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3404
  by (cases, unfold runing_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3405
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3406
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3407
lemma th_not_live_es [simp]: "th \<in> threads (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3408
  by (unfold is_set, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3409
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3410
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3411
lemma holdents_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3412
  shows "holdents (e#s) th' = holdents s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3413
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3414
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3415
    assume h: "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3416
    hence "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3417
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3418
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3419
  } moreover {
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3420
    fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3421
    assume h: "cs' \<in> ?R"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3422
    hence "cs' \<in> ?L"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3423
      by (unfold holdents_def s_holding_def, fold wq_def, 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3424
             unfold wq_neq_simp, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3425
  } ultimately show ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3426
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3427
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3428
lemma cntCS_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3429
  shows "cntCS (e#s) th' = cntCS s th'" (is "?L = ?R")
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3430
  using holdents_kept
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3431
  by (unfold cntCS_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3432
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3433
lemma threads_kept[simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3434
  "threads (e#s) = threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3435
  by (unfold is_set, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3436
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3437
lemma readys_kept1: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3438
  assumes "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3439
  shows "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3440
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3441
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3442
    assume wait: "waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3443
    have n_wait: "\<not> waiting (e#s) th' cs'" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3444
      using assms by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3445
    from wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3446
         n_wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3447
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3448
  } moreover have "th' \<in> threads s" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3449
    using assms[unfolded readys_def] by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3450
  ultimately show ?thesis 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3451
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3452
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3453
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3454
lemma readys_kept2: 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3455
  assumes "th' \<in> readys s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3456
  shows "th' \<in> readys (e#s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3457
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3458
  { fix cs'
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3459
    assume wait: "waiting (e#s) th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3460
    have n_wait: "\<not> waiting s th' cs'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3461
      using assms by (auto simp:readys_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3462
    from wait[unfolded s_waiting_def, folded wq_def, unfolded wq_neq_simp]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3463
         n_wait[unfolded s_waiting_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3464
    have False by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3465
  } with assms show ?thesis  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3466
    by (unfold readys_def, auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3467
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3468
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3469
lemma readys_simp [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3470
  shows "(th' \<in> readys (e#s)) = (th' \<in> readys s)"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3471
  using readys_kept1 readys_kept2
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3472
  by metis
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3473
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3474
lemma pvD_kept [simp]:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3475
  shows "pvD (e#s) th' = pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3476
  by (unfold pvD_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3477
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3478
lemma cnp_cnv_cncs_kept:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3479
  assumes "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3480
  shows "cntP (e#s) th' = cntV (e#s) th' +  cntCS (e#s) th' + pvD (e#s) th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3481
  using assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3482
  by (unfold is_set, simp, fold is_set, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3483
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3484
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3485
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3486
context valid_trace
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3487
begin
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3488
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3489
lemma cnp_cnv_cncs: "cntP s th' = cntV s th' + cntCS s th' + pvD s th'"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3490
proof(induct rule:ind)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3491
  case Nil
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3492
  thus ?case 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3493
    by (unfold cntP_def cntV_def pvD_def cntCS_def holdents_def 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3494
              s_holding_def, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3495
next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3496
  case (Cons s e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3497
  interpret vt_e: valid_trace_e s e using Cons by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3498
  show ?case
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3499
  proof(cases e)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3500
    case (Create th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3501
    interpret vt_create: valid_trace_create s e th prio 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3502
      using Create by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3503
    show ?thesis using Cons by (simp add: vt_create.cnp_cnv_cncs_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3504
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3505
    case (Exit th)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3506
    interpret vt_exit: valid_trace_exit s e th  
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3507
        using Exit by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3508
   show ?thesis using Cons by (simp add: vt_exit.cnp_cnv_cncs_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3509
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3510
    case (P th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3511
    interpret vt_p: valid_trace_p s e th cs using P by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3512
    show ?thesis using Cons by (simp add: vt_p.cnp_cnv_cncs_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3513
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3514
    case (V th cs)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3515
    interpret vt_v: valid_trace_v s e th cs using V by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3516
    show ?thesis using Cons by (simp add: vt_v.cnp_cnv_cncs_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3517
  next
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3518
    case (Set th prio)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3519
    interpret vt_set: valid_trace_set s e th prio
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3520
        using Set by (unfold_locales, simp)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3521
    show ?thesis using Cons by (simp add: vt_set.cnp_cnv_cncs_kept) 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3522
  qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3523
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3524
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3525
lemma not_thread_holdents:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3526
  assumes not_in: "th \<notin> threads s" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3527
  shows "holdents s th = {}"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3528
proof -
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3529
  { fix cs
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3530
    assume "cs \<in> holdents s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3531
    hence "holding s th cs" by (auto simp:holdents_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3532
    from this[unfolded s_holding_def, folded wq_def]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3533
    have "th \<in> set (wq s cs)" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3534
    with wq_threads have "th \<in> threads s" by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3535
    with assms
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3536
    have False by simp
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3537
  } thus ?thesis by auto
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3538
qed
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3539
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3540
lemma not_thread_cncs:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3541
  assumes not_in: "th \<notin> threads s" 
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3542
  shows "cntCS s th = 0"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3543
  using not_thread_holdents[OF assms]
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3544
  by (simp add:cntCS_def)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3545
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3546
lemma cnp_cnv_eq:
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3547
  assumes "th \<notin> threads s"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3548
  shows "cntP s th = cntV s th"
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3549
  using assms cnp_cnv_cncs not_thread_cncs pvD_def
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3550
  by (auto)
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3551
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3552
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3553
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3554
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3555
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3556
end
c495eb16beb6 CpsG.thy restored. It was deleted. But now restored as a temporary holder of PIPBasics.thy.
zhangx
parents:
diff changeset
  3557