prio/CpsG.thy
author urbanc
Tue, 28 Feb 2012 13:13:32 +0000
changeset 336 f9e0d3274c14
parent 333 813e7257c7c3
child 340 0244e76df2ca
permissions -rw-r--r--
fixed typo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     1
theory CpsG
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     2
imports PrioG 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     3
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     4
336
f9e0d3274c14 fixed typo
urbanc
parents: 333
diff changeset
     5
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     6
lemma not_thread_holdents:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     7
  fixes th s
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
     8
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
     9
  and not_in: "th \<notin> threads s" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    10
  shows "holdents s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    11
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    12
  from vt not_in show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    13
  proof(induct arbitrary:th)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    14
    case (vt_cons s e th)
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
    15
    assume vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    16
      and ih: "\<And>th. th \<notin> threads s \<Longrightarrow> holdents s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    17
      and stp: "step s e"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    18
      and not_in: "th \<notin> threads (e # s)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    19
    from stp show ?case
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    20
    proof(cases)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    21
      case (thread_create thread prio)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    22
      assume eq_e: "e = Create thread prio"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    23
        and not_in': "thread \<notin> threads s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    24
      have "holdents (e # s) th = holdents s th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    25
        apply (unfold eq_e holdents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    26
        by (simp add:depend_create_unchanged)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    27
      moreover have "th \<notin> threads s" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    28
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    29
        from not_in eq_e show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    30
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    31
      moreover note ih ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    32
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    33
      case (thread_exit thread)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    34
      assume eq_e: "e = Exit thread"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    35
      and nh: "holdents s thread = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    36
      show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    37
      proof(cases "th = thread")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    38
        case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    39
        with nh eq_e
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    40
        show ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    41
          by (auto simp:holdents_def depend_exit_unchanged)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    42
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    43
        case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    44
        with not_in and eq_e
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    45
        have "th \<notin> threads s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    46
        from ih[OF this] False eq_e show ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    47
          by (auto simp:holdents_def depend_exit_unchanged)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    48
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    49
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    50
      case (thread_P thread cs)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    51
      assume eq_e: "e = P thread cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    52
      and is_runing: "thread \<in> runing s"
333
813e7257c7c3 some polishing of the repository
urbanc
parents: 312
diff changeset
    53
      from assms thread_exit ih stp not_in vt eq_e have vtp: "vt (P thread cs#s)" by auto
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    54
      have neq_th: "th \<noteq> thread" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    55
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    56
        from not_in eq_e have "th \<notin> threads s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    57
        moreover from is_runing have "thread \<in> threads s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    58
          by (simp add:runing_def readys_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    59
        ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    60
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    61
      hence "holdents (e # s) th  = holdents s th "
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    62
        apply (unfold cntCS_def holdents_def eq_e)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    63
        by (unfold step_depend_p[OF vtp], auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    64
      moreover have "holdents s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    65
      proof(rule ih)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    66
        from not_in eq_e show "th \<notin> threads s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    67
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    68
      ultimately show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    69
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    70
      case (thread_V thread cs)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    71
      assume eq_e: "e = V thread cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    72
        and is_runing: "thread \<in> runing s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    73
        and hold: "holding s thread cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    74
      have neq_th: "th \<noteq> thread" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    75
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    76
        from not_in eq_e have "th \<notin> threads s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    77
        moreover from is_runing have "thread \<in> threads s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    78
          by (simp add:runing_def readys_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    79
        ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    80
      qed
333
813e7257c7c3 some polishing of the repository
urbanc
parents: 312
diff changeset
    81
      from assms thread_V eq_e ih stp not_in vt have vtv: "vt (V thread cs#s)" by auto
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    82
      from hold obtain rest 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    83
        where eq_wq: "wq s cs = thread # rest"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
    84
        by (case_tac "wq s cs", auto simp: wq_def s_holding_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    85
      from not_in eq_e eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    86
      have "\<not> next_th s thread cs th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    87
        apply (auto simp:next_th_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    88
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    89
        assume ne: "rest \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    90
          and ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> threads s" (is "?t \<notin> threads s")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    91
        have "?t \<in> set rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    92
        proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    93
          from wq_distinct[OF step_back_vt[OF vtv], of cs] and eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    94
          show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    95
        next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    96
          fix x assume "distinct x \<and> set x = set rest" with ne
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    97
          show "hd x \<in> set rest" by (cases x, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    98
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
    99
        with eq_wq have "?t \<in> set (wq s cs)" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   100
        from wq_threads[OF step_back_vt[OF vtv], OF this] and ni
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   101
        show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   102
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   103
      moreover note neq_th eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   104
      ultimately have "holdents (e # s) th  = holdents s th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   105
        by (unfold eq_e cntCS_def holdents_def step_depend_v[OF vtv], auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   106
      moreover have "holdents s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   107
      proof(rule ih)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   108
        from not_in eq_e show "th \<notin> threads s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   109
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   110
      ultimately show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   111
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   112
      case (thread_set thread prio)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   113
      print_facts
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   114
      assume eq_e: "e = Set thread prio"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   115
        and is_runing: "thread \<in> runing s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   116
      from not_in and eq_e have "th \<notin> threads s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   117
      from ih [OF this] and eq_e
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   118
      show ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   119
        apply (unfold eq_e cntCS_def holdents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   120
        by (simp add:depend_set_unchanged)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   121
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   122
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   123
      case vt_nil
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   124
      show ?case
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   125
      by (auto simp:count_def holdents_def s_depend_def wq_def cs_holding_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   126
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   127
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   128
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   129
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   130
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   131
lemma next_th_neq: 
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   132
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   133
  and nt: "next_th s th cs th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   134
  shows "th' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   135
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   136
  from nt show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   137
    apply (auto simp:next_th_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   138
  proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   139
    fix rest
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   140
    assume eq_wq: "wq s cs = hd (SOME q. distinct q \<and> set q = set rest) # rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   141
      and ne: "rest \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   142
    have "hd (SOME q. distinct q \<and> set q = set rest) \<in> set rest" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   143
    proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   144
      from wq_distinct[OF vt, of cs] eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   145
      show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   146
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   147
      fix x
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   148
      assume "distinct x \<and> set x = set rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   149
      hence eq_set: "set x = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   150
      with ne have "x \<noteq> []" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   151
      hence "hd x \<in> set x" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   152
      with eq_set show "hd x \<in> set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   153
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   154
    with wq_distinct[OF vt, of cs] eq_wq show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   155
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   156
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   157
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   158
lemma next_th_unique: 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   159
  assumes nt1: "next_th s th cs th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   160
  and nt2: "next_th s th cs th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   161
  shows "th1 = th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   162
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   163
  from assms show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   164
    by (unfold next_th_def, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   165
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   166
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   167
lemma pp_sub: "(r^+)^+ \<subseteq> r^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   168
  by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   169
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   170
lemma wf_depend:
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   171
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   172
  shows "wf (depend s)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   173
proof(rule finite_acyclic_wf)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   174
  from finite_depend[OF vt] show "finite (depend s)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   175
next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   176
  from acyclic_depend[OF vt] show "acyclic (depend s)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   177
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   178
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   179
lemma Max_Union:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   180
  assumes fc: "finite C"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   181
  and ne: "C \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   182
  and fa: "\<And> A. A \<in> C \<Longrightarrow> finite A \<and> A \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   183
  shows "Max (\<Union> C) = Max (Max ` C)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   184
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   185
  from fc ne fa show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   186
  proof(induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   187
    case (insert x F)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   188
    assume ih: "\<lbrakk>F \<noteq> {}; \<And>A. A \<in> F \<Longrightarrow> finite A \<and> A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (\<Union>F) = Max (Max ` F)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   189
    and h: "\<And> A. A \<in> insert x F \<Longrightarrow> finite A \<and> A \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   190
    show ?case (is "?L = ?R")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   191
    proof(cases "F = {}")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   192
      case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   193
      from Union_insert have "?L = Max (x \<union> (\<Union> F))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   194
      also have "\<dots> = max (Max x) (Max(\<Union> F))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   195
      proof(rule Max_Un)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   196
        from h[of x] show "finite x" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   197
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   198
        from h[of x] show "x \<noteq> {}" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   199
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   200
        show "finite (\<Union>F)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   201
        proof(rule finite_Union)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   202
          show "finite F" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   203
        next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   204
          from h show "\<And>M. M \<in> F \<Longrightarrow> finite M" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   205
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   206
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   207
        from False and h show "\<Union>F \<noteq> {}" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   208
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   209
      also have "\<dots> = ?R"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   210
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   211
        have "?R = Max (Max ` ({x} \<union> F))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   212
        also have "\<dots> = Max ({Max x} \<union> (Max ` F))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   213
        also have "\<dots> = max (Max x) (Max (\<Union>F))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   214
        proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   215
          have "Max ({Max x} \<union> Max ` F) = max (Max {Max x}) (Max (Max ` F))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   216
          proof(rule Max_Un)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   217
            show "finite {Max x}" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   218
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   219
            show "{Max x} \<noteq> {}" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   220
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   221
            from insert show "finite (Max ` F)" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   222
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   223
            from False show "Max ` F \<noteq> {}" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   224
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   225
          moreover have "Max {Max x} = Max x" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   226
          moreover have "Max (\<Union>F) = Max (Max ` F)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   227
          proof(rule ih)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   228
            show "F \<noteq> {}" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   229
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   230
            from h show "\<And>A. A \<in> F \<Longrightarrow> finite A \<and> A \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   231
              by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   232
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   233
          ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   234
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   235
        finally show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   236
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   237
      finally show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   238
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   239
      case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   240
      thus ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   241
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   242
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   243
    case empty
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   244
    assume "{} \<noteq> {}" show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   245
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   246
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   247
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   248
definition child :: "state \<Rightarrow> (node \<times> node) set"
312
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
   249
  where "child s \<equiv>
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   250
            {(Th th', Th th) | th th'. \<exists> cs. (Th th', Cs cs) \<in> depend s \<and> (Cs cs, Th th) \<in> depend s}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   251
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   252
definition children :: "state \<Rightarrow> thread \<Rightarrow> thread set"
312
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
   253
  where "children s th \<equiv> {th'. (Th th', Th th) \<in> child s}"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   254
312
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
   255
lemma children_def2:
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
   256
  "children s th \<equiv> {th'. \<exists> cs. (Th th', Cs cs) \<in> depend s \<and> (Cs cs, Th th) \<in> depend s}"
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
   257
unfolding child_def children_def by simp
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   258
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   259
lemma children_dependents: "children s th \<subseteq> dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   260
  by (unfold children_def child_def cs_dependents_def, auto simp:eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   261
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   262
lemma child_unique:
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   263
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   264
  and ch1: "(Th th, Th th1) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   265
  and ch2: "(Th th, Th th2) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   266
  shows "th1 = th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   267
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   268
  from ch1 ch2 show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   269
  proof(unfold child_def, clarsimp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   270
    fix cs csa
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   271
    assume h1: "(Th th, Cs cs) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   272
      and h2: "(Cs cs, Th th1) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   273
      and h3: "(Th th, Cs csa) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   274
      and h4: "(Cs csa, Th th2) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   275
    from unique_depend[OF vt h1 h3] have "cs = csa" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   276
    with h4 have "(Cs cs, Th th2) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   277
    from unique_depend[OF vt h2 this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   278
    show "th1 = th2" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   279
  qed 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   280
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   281
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   282
290
6a6d0bd16035 more on paper
urbanc
parents: 272
diff changeset
   283
lemma cp_eq_cpreced_f: "cp s = cpreced (wq s) s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   284
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   285
  from fun_eq_iff 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   286
  have h:"\<And>f g. (\<forall> x. f x = g x) \<Longrightarrow> f = g" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   287
  show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   288
  proof(rule h)
290
6a6d0bd16035 more on paper
urbanc
parents: 272
diff changeset
   289
    from cp_eq_cpreced show "\<forall>x. cp s x = cpreced (wq s) s x" by auto
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   290
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   291
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   292
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   293
lemma depend_children:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   294
  assumes h: "(Th th1, Th th2) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   295
  shows "th1 \<in> children s th2 \<or> (\<exists> th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (depend s)^+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   296
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   297
  from h show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   298
  proof(induct rule: tranclE)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   299
    fix c th2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   300
    assume h1: "(Th th1, c) \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   301
    and h2: "(c, Th th2) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   302
    from h2 obtain cs where eq_c: "c = Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   303
      by (case_tac c, auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   304
    show "th1 \<in> children s th2 \<or> (\<exists>th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (depend s)\<^sup>+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   305
    proof(rule tranclE[OF h1])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   306
      fix ca
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   307
      assume h3: "(Th th1, ca) \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   308
        and h4: "(ca, c) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   309
      show "th1 \<in> children s th2 \<or> (\<exists>th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (depend s)\<^sup>+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   310
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   311
        from eq_c and h4 obtain th3 where eq_ca: "ca = Th th3"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   312
          by (case_tac ca, auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   313
        from eq_ca h4 h2 eq_c
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   314
        have "th3 \<in> children s th2" by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   315
        moreover from h3 eq_ca have "(Th th1, Th th3) \<in> (depend s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   316
        ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   317
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   318
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   319
      assume "(Th th1, c) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   320
      with h2 eq_c
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   321
      have "th1 \<in> children s th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   322
        by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   323
      thus ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   324
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   325
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   326
    assume "(Th th1, Th th2) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   327
    thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   328
      by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   329
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   330
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   331
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   332
lemma sub_child: "child s \<subseteq> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   333
  by (unfold child_def, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   334
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   335
lemma wf_child: 
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   336
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   337
  shows "wf (child s)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   338
proof(rule wf_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   339
  from wf_trancl[OF wf_depend[OF vt]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   340
  show "wf ((depend s)\<^sup>+)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   341
next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   342
  from sub_child show "child s \<subseteq> (depend s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   343
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   344
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   345
lemma depend_child_pre:
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   346
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   347
  shows
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   348
  "(Th th, n) \<in> (depend s)^+ \<longrightarrow> (\<forall> th'. n = (Th th') \<longrightarrow> (Th th, Th th') \<in> (child s)^+)" (is "?P n")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   349
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   350
  from wf_trancl[OF wf_depend[OF vt]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   351
  have wf: "wf ((depend s)^+)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   352
  show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   353
  proof(rule wf_induct[OF wf, of ?P], clarsimp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   354
    fix th'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   355
    assume ih[rule_format]: "\<forall>y. (y, Th th') \<in> (depend s)\<^sup>+ \<longrightarrow>
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   356
               (Th th, y) \<in> (depend s)\<^sup>+ \<longrightarrow> (\<forall>th'. y = Th th' \<longrightarrow> (Th th, Th th') \<in> (child s)\<^sup>+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   357
    and h: "(Th th, Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   358
    show "(Th th, Th th') \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   359
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   360
      from depend_children[OF h]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   361
      have "th \<in> children s th' \<or> (\<exists>th3. th3 \<in> children s th' \<and> (Th th, Th th3) \<in> (depend s)\<^sup>+)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   362
      thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   363
      proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   364
        assume "th \<in> children s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   365
        thus "(Th th, Th th') \<in> (child s)\<^sup>+" by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   366
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   367
        assume "\<exists>th3. th3 \<in> children s th' \<and> (Th th, Th th3) \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   368
        then obtain th3 where th3_in: "th3 \<in> children s th'" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   369
          and th_dp: "(Th th, Th th3) \<in> (depend s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   370
        from th3_in have "(Th th3, Th th') \<in> (depend s)^+" by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   371
        from ih[OF this th_dp, of th3] have "(Th th, Th th3) \<in> (child s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   372
        with th3_in show "(Th th, Th th') \<in> (child s)\<^sup>+" by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   373
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   374
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   375
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   376
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   377
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   378
lemma depend_child: "\<lbrakk>vt s; (Th th, Th th') \<in> (depend s)^+\<rbrakk> \<Longrightarrow> (Th th, Th th') \<in> (child s)^+"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   379
  by (insert depend_child_pre, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   380
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   381
lemma child_depend_p:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   382
  assumes "(n1, n2) \<in> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   383
  shows "(n1, n2) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   384
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   385
  from assms show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   386
  proof(induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   387
    case (base y)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   388
    with sub_child show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   389
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   390
    case (step y z)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   391
    assume "(y, z) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   392
    with sub_child have "(y, z) \<in> (depend s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   393
    moreover have "(n1, y) \<in> (depend s)^+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   394
    ultimately show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   395
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   396
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   397
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   398
lemma child_depend_eq: 
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   399
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   400
  shows 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   401
  "((Th th1, Th th2) \<in> (child s)^+) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   402
   ((Th th1, Th th2) \<in> (depend s)^+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   403
  by (auto intro: depend_child[OF vt] child_depend_p)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   404
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   405
lemma children_no_dep:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   406
  fixes s th th1 th2 th3
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   407
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   408
  and ch1: "(Th th1, Th th) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   409
  and ch2: "(Th th2, Th th) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   410
  and ch3: "(Th th1, Th th2) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   411
  shows "False"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   412
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   413
  from depend_child[OF vt ch3]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   414
  have "(Th th1, Th th2) \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   415
  thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   416
  proof(rule converse_tranclE)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   417
    thm tranclD
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   418
    assume "(Th th1, Th th2) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   419
    from child_unique[OF vt ch1 this] have "th = th2" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   420
    with ch2 have "(Th th2, Th th2) \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   421
    with wf_child[OF vt] show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   422
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   423
    fix c
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   424
    assume h1: "(Th th1, c) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   425
      and h2: "(c, Th th2) \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   426
    from h1 obtain th3 where eq_c: "c = Th th3" by (unfold child_def, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   427
    with h1 have "(Th th1, Th th3) \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   428
    from child_unique[OF vt ch1 this] have eq_th3: "th3 = th" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   429
    with eq_c and h2 have "(Th th, Th th2) \<in> (child s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   430
    with ch2 have "(Th th, Th th) \<in> (child s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   431
    moreover have "wf ((child s)\<^sup>+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   432
    proof(rule wf_trancl)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   433
      from wf_child[OF vt] show "wf (child s)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   434
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   435
    ultimately show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   436
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   437
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   438
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   439
lemma unique_depend_p:
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   440
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   441
  and dp1: "(n, n1) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   442
  and dp2: "(n, n2) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   443
  and neq: "n1 \<noteq> n2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   444
  shows "(n1, n2) \<in> (depend s)^+ \<or> (n2, n1) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   445
proof(rule unique_chain [OF _ dp1 dp2 neq])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   446
  from unique_depend[OF vt]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   447
  show "\<And>a b c. \<lbrakk>(a, b) \<in> depend s; (a, c) \<in> depend s\<rbrakk> \<Longrightarrow> b = c" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   448
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   449
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   450
lemma dependents_child_unique:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   451
  fixes s th th1 th2 th3
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   452
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   453
  and ch1: "(Th th1, Th th) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   454
  and ch2: "(Th th2, Th th) \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   455
  and dp1: "th3 \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   456
  and dp2: "th3 \<in> dependents s th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   457
shows "th1 = th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   458
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   459
  { assume neq: "th1 \<noteq> th2"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   460
    from dp1 have dp1: "(Th th3, Th th1) \<in> (depend s)^+" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   461
      by (simp add:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   462
    from dp2 have dp2: "(Th th3, Th th2) \<in> (depend s)^+" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   463
      by (simp add:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   464
    from unique_depend_p[OF vt dp1 dp2] and neq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   465
    have "(Th th1, Th th2) \<in> (depend s)\<^sup>+ \<or> (Th th2, Th th1) \<in> (depend s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   466
    hence False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   467
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   468
      assume "(Th th1, Th th2) \<in> (depend s)\<^sup>+ "
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   469
      from children_no_dep[OF vt ch1 ch2 this] show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   470
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   471
      assume " (Th th2, Th th1) \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   472
      from children_no_dep[OF vt ch2 ch1 this] show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   473
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   474
  } thus ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   475
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   476
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   477
lemma cp_rec:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   478
  fixes s th
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   479
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   480
  shows "cp s th = Max ({preced th s} \<union> (cp s ` children s th))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   481
proof(unfold cp_eq_cpreced_f cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   482
  let ?f = "(\<lambda>th. preced th s)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   483
  show "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th)) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   484
        Max ({preced th s} \<union> (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th))) ` children s th)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   485
  proof(cases " children s th = {}")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   486
    case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   487
    have "(\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th))) ` children s th = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   488
          {Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) | th' . th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   489
      (is "?L = ?R")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   490
      by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   491
    also have "\<dots> = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   492
      Max ` {((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) | th' . th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   493
      (is "_ = Max ` ?C")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   494
      by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   495
    finally have "Max ?L = Max (Max ` ?C)" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   496
    also have "\<dots> = Max (\<Union> ?C)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   497
    proof(rule Max_Union[symmetric])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   498
      from children_dependents[of s th] finite_threads[OF vt] and dependents_threads[OF vt, of th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   499
      show "finite {(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   500
        by (auto simp:finite_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   501
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   502
      from False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   503
      show "{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th} \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   504
        by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   505
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   506
      show "\<And>A. A \<in> {(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th} \<Longrightarrow>
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   507
        finite A \<and> A \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   508
        apply (auto simp:finite_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   509
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   510
        fix th'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   511
        from finite_threads[OF vt] and dependents_threads[OF vt, of th']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   512
        show "finite ((\<lambda>th. preced th s) ` dependents (wq s) th')" by (auto simp:finite_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   513
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   514
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   515
    also have "\<dots> = Max ((\<lambda>th. preced th s) ` dependents (wq s) th)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   516
      (is "Max ?A = Max ?B")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   517
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   518
      have "?A = ?B"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   519
      proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   520
        show "\<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   521
                    \<subseteq> (\<lambda>th. preced th s) ` dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   522
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   523
          fix x 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   524
          assume "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   525
          then obtain th' where 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   526
             th'_in: "th' \<in> children s th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   527
            and x_in: "x \<in> ?f ` ({th'} \<union> dependents (wq s) th')" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   528
          hence "x = ?f th' \<or> x \<in> (?f ` dependents (wq s) th')" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   529
          thus "x \<in> ?f ` dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   530
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   531
            assume "x = preced th' s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   532
            with th'_in and children_dependents
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   533
            show "x \<in> (\<lambda>th. preced th s) ` dependents (wq s) th" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   534
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   535
            assume "x \<in> (\<lambda>th. preced th s) ` dependents (wq s) th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   536
            moreover note th'_in
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   537
            ultimately show " x \<in> (\<lambda>th. preced th s) ` dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   538
              by (unfold cs_dependents_def children_def child_def, auto simp:eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   539
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   540
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   541
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   542
        show "?f ` dependents (wq s) th
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   543
           \<subseteq> \<Union>{?f ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   544
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   545
          fix x 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   546
          assume x_in: "x \<in> (\<lambda>th. preced th s) ` dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   547
          then obtain th' where
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   548
            eq_x: "x = ?f th'" and dp: "(Th th', Th th) \<in> (depend s)^+" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   549
            by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   550
          from depend_children[OF dp]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   551
          have "th' \<in> children s th \<or> (\<exists>th3. th3 \<in> children s th \<and> (Th th', Th th3) \<in> (depend s)\<^sup>+)" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   552
          thus "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   553
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   554
            assume "th' \<in> children s th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   555
            with eq_x
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   556
            show "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   557
              by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   558
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   559
            assume "\<exists>th3. th3 \<in> children s th \<and> (Th th', Th th3) \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   560
            then obtain th3 where th3_in: "th3 \<in> children s th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   561
              and dp3: "(Th th', Th th3) \<in> (depend s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   562
            show "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th') |th'. th' \<in> children s th}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   563
            proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   564
              from dp3
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   565
              have "th' \<in> dependents (wq s) th3"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   566
                by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   567
              with eq_x th3_in show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   568
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   569
          qed          
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   570
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   571
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   572
      thus ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   573
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   574
    finally have "Max ((\<lambda>th. preced th s) ` dependents (wq s) th) = Max (?L)" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   575
      (is "?X = ?Y") by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   576
    moreover have "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th)) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   577
                   max (?f th) ?X" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   578
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   579
      have "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th)) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   580
            Max ({?f th} \<union> ?f ` (dependents (wq s) th))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   581
      also have "\<dots> = max (Max {?f th}) (Max (?f ` (dependents (wq s) th)))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   582
      proof(rule Max_Un, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   583
        from finite_threads[OF vt] and dependents_threads[OF vt, of th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   584
        show "finite ((\<lambda>th. preced th s) ` dependents (wq s) th)" by (auto simp:finite_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   585
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   586
        assume "dependents (wq s) th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   587
        with False and children_dependents show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   588
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   589
      also have "\<dots> = max (?f th) ?X" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   590
      finally show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   591
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   592
    moreover have "Max ({preced th s} \<union> 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   593
                     (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th))) ` children s th) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   594
                   max (?f th) ?Y"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   595
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   596
      have "Max ({preced th s} \<union> 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   597
                     (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependents (wq s) th))) ` children s th) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   598
            max (Max {preced th s}) ?Y"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   599
      proof(rule Max_Un, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   600
        from finite_threads[OF vt] dependents_threads[OF vt, of th] children_dependents [of s th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   601
        show "finite ((\<lambda>th. Max (insert (preced th s) ((\<lambda>th. preced th s) ` dependents (wq s) th))) ` 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   602
                       children s th)" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   603
          by (auto simp:finite_subset)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   604
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   605
        assume "children s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   606
        with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   607
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   608
      thus ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   609
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   610
    ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   611
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   612
    case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   613
    moreover have "dependents (wq s) th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   614
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   615
      { fix th'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   616
        assume "th' \<in> dependents (wq s) th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   617
        hence " (Th th', Th th) \<in> (depend s)\<^sup>+" by (simp add:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   618
        from depend_children[OF this] and True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   619
        have "False" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   620
      } thus ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   621
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   622
    ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   623
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   624
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   625
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   626
definition cps:: "state \<Rightarrow> (thread \<times> precedence) set"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   627
where "cps s = {(th, cp s th) | th . th \<in> threads s}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   628
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   629
locale step_set_cps =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   630
  fixes s' th prio s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   631
  defines s_def : "s \<equiv> (Set th prio#s')"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   632
  assumes vt_s: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   633
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   634
context step_set_cps 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   635
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   636
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   637
lemma eq_preced:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   638
  fixes th'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   639
  assumes "th' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   640
  shows "preced th' s = preced th' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   641
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   642
  from assms show ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   643
    by (unfold s_def, auto simp:preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   644
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   645
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   646
lemma eq_dep: "depend s = depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   647
  by (unfold s_def depend_set_unchanged, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   648
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   649
lemma eq_cp:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   650
  fixes th' 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   651
  assumes neq_th: "th' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   652
  and nd: "th \<notin> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   653
  shows "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   654
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   655
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   656
  have eq_dp: "\<And> th. dependents (wq s) th = dependents (wq s') th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   657
    by (unfold cs_dependents_def, auto simp:eq_dep eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   658
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   659
    fix th1 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   660
    assume "th1 \<in> {th'} \<union> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   661
    hence "th1 = th' \<or> th1 \<in> dependents (wq s') th'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   662
    hence "preced th1 s = preced th1 s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   663
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   664
      assume "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   665
      with eq_preced[OF neq_th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   666
      show "preced th1 s = preced th1 s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   667
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   668
      assume "th1 \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   669
      with nd and eq_dp have "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   670
        by (auto simp:eq_depend cs_dependents_def s_dependents_def eq_dep)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   671
      from eq_preced[OF this] show "preced th1 s = preced th1 s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   672
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   673
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   674
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   675
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   676
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   677
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   678
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   679
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   680
lemma eq_up:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   681
  fixes th' th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   682
  assumes dp1: "th \<in> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   683
  and dp2: "th' \<in> dependents s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   684
  and eq_cps: "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   685
  shows "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   686
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   687
  from dp2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   688
  have "(Th th', Th th'') \<in> (depend (wq s))\<^sup>+" by (simp add:s_dependents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   689
  from depend_child[OF vt_s this[unfolded eq_depend]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   690
  have ch_th': "(Th th', Th th'') \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   691
  moreover { fix n th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   692
    have "\<lbrakk>(Th th', n) \<in> (child s)^+\<rbrakk> \<Longrightarrow>
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   693
                   (\<forall> th'' . n = Th th'' \<longrightarrow> cp s th'' = cp s' th'')"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   694
    proof(erule trancl_induct, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   695
      fix y th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   696
      assume y_ch: "(y, Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   697
        and ih: "\<forall>th''. y = Th th'' \<longrightarrow> cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   698
        and ch': "(Th th', y) \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   699
      from y_ch obtain thy where eq_y: "y = Th thy" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   700
      with ih have eq_cpy:"cp s thy = cp s' thy" by blast
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   701
      from dp1 have "(Th th, Th th') \<in> (depend s)^+" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   702
      moreover from child_depend_p[OF ch'] and eq_y
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   703
      have "(Th th', Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   704
      ultimately have dp_thy: "(Th th, Th thy) \<in> (depend s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   705
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   706
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   707
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   708
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   709
        proof(rule eq_preced)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   710
          show "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   711
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   712
            assume "th'' = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   713
            with dp_thy y_ch[unfolded eq_y] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   714
            have "(Th th, Th th) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   715
              by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   716
            with wf_trancl[OF wf_depend[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   717
            show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   718
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   719
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   720
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   721
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   722
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   723
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   724
          proof(cases "th1 = thy")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   725
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   726
            with eq_cpy show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   727
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   728
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   729
            have neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   730
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   731
              assume eq_th1: "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   732
              with dp_thy have "(Th th1, Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   733
              from children_no_dep[OF vt_s _ _ this] and 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   734
              th1_in y_ch eq_y show False by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   735
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   736
            have "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   737
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   738
              assume h:"th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   739
              from eq_y dp_thy have "th \<in> dependents s thy" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   740
              from dependents_child_unique[OF vt_s _ _ h this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   741
              th1_in y_ch eq_y have "th1 = thy" by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   742
              with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   743
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   744
            from eq_cp[OF neq_th1 this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   745
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   746
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   747
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   748
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   749
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   750
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   751
          by (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   752
        ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   753
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   754
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   755
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   756
      fix th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   757
      assume dp': "(Th th', Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   758
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   759
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   760
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   761
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   762
        proof(rule eq_preced)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   763
          show "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   764
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   765
            assume "th'' = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   766
            with dp1 dp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   767
            have "(Th th, Th th) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   768
              by (auto simp:child_def s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   769
            with wf_trancl[OF wf_depend[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   770
            show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   771
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   772
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   773
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   774
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   775
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   776
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   777
          proof(cases "th1 = th'")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   778
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   779
            with eq_cps show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   780
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   781
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   782
            have neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   783
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   784
              assume eq_th1: "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   785
              with dp1 have "(Th th1, Th th') \<in> (depend s)^+" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   786
                by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   787
              from children_no_dep[OF vt_s _ _ this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   788
              th1_in dp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   789
              show False by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   790
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   791
            thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   792
            proof(rule eq_cp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   793
              show "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   794
              proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   795
                assume "th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   796
                from dependents_child_unique[OF vt_s _ _ this dp1]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   797
                th1_in dp' have "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   798
                  by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   799
                with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   800
              qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   801
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   802
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   803
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   804
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   805
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   806
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   807
          by (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   808
        ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   809
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   810
      qed     
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   811
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   812
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   813
  ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   814
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   815
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   816
lemma eq_up_self:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   817
  fixes th' th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   818
  assumes dp: "th \<in> dependents s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   819
  and eq_cps: "cp s th = cp s' th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   820
  shows "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   821
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   822
  from dp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   823
  have "(Th th, Th th'') \<in> (depend (wq s))\<^sup>+" by (simp add:s_dependents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   824
  from depend_child[OF vt_s this[unfolded eq_depend]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   825
  have ch_th': "(Th th, Th th'') \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   826
  moreover { fix n th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   827
    have "\<lbrakk>(Th th, n) \<in> (child s)^+\<rbrakk> \<Longrightarrow>
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   828
                   (\<forall> th'' . n = Th th'' \<longrightarrow> cp s th'' = cp s' th'')"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   829
    proof(erule trancl_induct, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   830
      fix y th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   831
      assume y_ch: "(y, Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   832
        and ih: "\<forall>th''. y = Th th'' \<longrightarrow> cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   833
        and ch': "(Th th, y) \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   834
      from y_ch obtain thy where eq_y: "y = Th thy" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   835
      with ih have eq_cpy:"cp s thy = cp s' thy" by blast
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   836
      from child_depend_p[OF ch'] and eq_y
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   837
      have dp_thy: "(Th th, Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   838
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   839
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   840
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   841
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   842
        proof(rule eq_preced)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   843
          show "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   844
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   845
            assume "th'' = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   846
            with dp_thy y_ch[unfolded eq_y] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   847
            have "(Th th, Th th) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   848
              by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   849
            with wf_trancl[OF wf_depend[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   850
            show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   851
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   852
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   853
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   854
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   855
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   856
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   857
          proof(cases "th1 = thy")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   858
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   859
            with eq_cpy show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   860
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   861
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   862
            have neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   863
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   864
              assume eq_th1: "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   865
              with dp_thy have "(Th th1, Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   866
              from children_no_dep[OF vt_s _ _ this] and 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   867
              th1_in y_ch eq_y show False by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   868
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   869
            have "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   870
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   871
              assume h:"th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   872
              from eq_y dp_thy have "th \<in> dependents s thy" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   873
              from dependents_child_unique[OF vt_s _ _ h this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   874
              th1_in y_ch eq_y have "th1 = thy" by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   875
              with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   876
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   877
            from eq_cp[OF neq_th1 this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   878
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   879
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   880
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   881
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   882
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   883
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   884
          by (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   885
        ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   886
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   887
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   888
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   889
      fix th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   890
      assume dp': "(Th th, Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   891
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   892
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   893
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   894
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   895
        proof(rule eq_preced)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   896
          show "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   897
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   898
            assume "th'' = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   899
            with dp dp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   900
            have "(Th th, Th th) \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   901
              by (auto simp:child_def s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   902
            with wf_trancl[OF wf_depend[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   903
            show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   904
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   905
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   906
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   907
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   908
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   909
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   910
          proof(cases "th1 = th")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   911
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   912
            with eq_cps show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   913
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   914
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   915
            assume neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   916
            thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   917
            proof(rule eq_cp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   918
              show "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   919
              proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   920
                assume "th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   921
                hence "(Th th, Th th1) \<in> (depend s)^+" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   922
                from children_no_dep[OF vt_s _ _ this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   923
                and th1_in dp' show False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   924
                  by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   925
              qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   926
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   927
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   928
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   929
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   930
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   931
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   932
          by (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   933
        ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   934
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   935
      qed     
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   936
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   937
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   938
  ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   939
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   940
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   941
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   942
lemma next_waiting:
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   943
  assumes vt: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   944
  and nxt: "next_th s th cs th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   945
  shows "waiting s th' cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   946
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   947
  from assms show ?thesis
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
   948
    apply (auto simp:next_th_def s_waiting_def[folded wq_def])
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   949
  proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   950
    fix rest
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   951
    assume ni: "hd (SOME q. distinct q \<and> set q = set rest) \<notin> set rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   952
      and eq_wq: "wq s cs = th # rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   953
      and ne: "rest \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   954
    have "set (SOME q. distinct q \<and> set q = set rest) = set rest" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   955
    proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   956
      from wq_distinct[OF vt, of cs] eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   957
      show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   958
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   959
      show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   960
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   961
    with ni
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   962
    have "hd (SOME q. distinct q \<and> set q = set rest) \<notin>  set (SOME q. distinct q \<and> set q = set rest)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   963
      by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   964
    moreover have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   965
    proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   966
      from wq_distinct[OF vt, of cs] eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   967
      show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   968
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   969
      from ne show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> x \<noteq> []" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   970
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   971
    ultimately show "hd (SOME q. distinct q \<and> set q = set rest) = th" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   972
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   973
    fix rest
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   974
    assume eq_wq: "wq s cs = hd (SOME q. distinct q \<and> set q = set rest) # rest"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   975
      and ne: "rest \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   976
    have "(SOME q. distinct q \<and> set q = set rest) \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   977
    proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   978
      from wq_distinct[OF vt, of cs] eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   979
      show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   980
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   981
      from ne show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> x \<noteq> []" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   982
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   983
    hence "hd (SOME q. distinct q \<and> set q = set rest) \<in> set (SOME q. distinct q \<and> set q = set rest)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   984
      by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   985
    moreover have "set (SOME q. distinct q \<and> set q = set rest) = set rest" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   986
    proof(rule someI2)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   987
      from wq_distinct[OF vt, of cs] eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   988
      show "distinct rest \<and> set rest = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   989
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   990
      show "\<And>x. distinct x \<and> set x = set rest \<Longrightarrow> set x = set rest" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   991
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   992
    ultimately have "hd (SOME q. distinct q \<and> set q = set rest) \<in> set rest" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   993
    with eq_wq and wq_distinct[OF vt, of cs]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   994
    show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   995
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   996
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   997
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   998
locale step_v_cps =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
   999
  fixes s' th cs s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1000
  defines s_def : "s \<equiv> (V th cs#s')"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1001
  assumes vt_s: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1002
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1003
locale step_v_cps_nt = step_v_cps +
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1004
  fixes th'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1005
  assumes nt: "next_th s' th cs th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1006
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1007
context step_v_cps_nt
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1008
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1009
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1010
lemma depend_s:
312
09281ccb31bd added implementation section
urbanc
parents: 298
diff changeset
  1011
  "depend s = (depend s' - {(Cs cs, Th th), (Th th', Cs cs)}) \<union>
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1012
                                         {(Cs cs, Th th')}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1013
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1014
  from step_depend_v[OF vt_s[unfolded s_def], folded s_def]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1015
    and nt show ?thesis  by (auto intro:next_th_unique)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1016
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1017
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1018
lemma dependents_kept:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1019
  fixes th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1020
  assumes neq1: "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1021
  and neq2: "th'' \<noteq> th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1022
  shows "dependents (wq s) th'' = dependents (wq s') th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1023
proof(auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1024
  fix x
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1025
  assume "x \<in> dependents (wq s) th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1026
  hence dp: "(Th x, Th th'') \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1027
    by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1028
  { fix n
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1029
    have "(n, Th th'') \<in> (depend s)^+ \<Longrightarrow>  (n, Th th'') \<in> (depend s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1030
    proof(induct rule:converse_trancl_induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1031
      fix y 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1032
      assume "(y, Th th'') \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1033
      with depend_s neq1 neq2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1034
      have "(y, Th th'') \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1035
      thus "(y, Th th'') \<in> (depend s')\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1036
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1037
      fix y z 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1038
      assume yz: "(y, z) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1039
        and ztp: "(z, Th th'') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1040
        and ztp': "(z, Th th'') \<in> (depend s')\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1041
      have "y \<noteq> Cs cs \<and> y \<noteq> Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1042
      proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1043
        show "y \<noteq> Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1044
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1045
          assume eq_y: "y = Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1046
          with yz have dp_yz: "(Cs cs, z) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1047
          from depend_s
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1048
          have cst': "(Cs cs, Th th') \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1049
          from unique_depend[OF vt_s this dp_yz] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1050
          have eq_z: "z = Th th'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1051
          with ztp have "(Th th', Th th'') \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1052
          from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1053
          obtain cs' where dp'': "(Th th', Cs cs') \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1054
            by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1055
          with depend_s have dp': "(Th th', Cs cs') \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1056
          from dp'' eq_y yz eq_z have "(Cs cs, Cs cs') \<in> (depend s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1057
          moreover have "cs' = cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1058
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1059
            from next_waiting[OF step_back_vt[OF vt_s[unfolded s_def]] nt]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1060
            have "(Th th', Cs cs) \<in> depend s'"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1061
              by (auto simp:s_waiting_def wq_def s_depend_def cs_waiting_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1062
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] this dp']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1063
            show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1064
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1065
          ultimately have "(Cs cs, Cs cs) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1066
          moreover note wf_trancl[OF wf_depend[OF vt_s]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1067
          ultimately show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1068
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1069
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1070
        show "y \<noteq> Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1071
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1072
          assume eq_y: "y = Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1073
          with yz have dps: "(Th th', z) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1074
          with depend_s have dps': "(Th th', z) \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1075
          have "z = Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1076
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1077
            from next_waiting[OF step_back_vt[OF vt_s[unfolded s_def]] nt]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1078
            have "(Th th', Cs cs) \<in> depend s'"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1079
              by (auto simp:s_waiting_def wq_def s_depend_def cs_waiting_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1080
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] dps' this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1081
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1082
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1083
          with dps depend_s show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1084
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1085
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1086
      with depend_s yz have "(y, z) \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1087
      with ztp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1088
      show "(y, Th th'') \<in> (depend s')\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1089
    qed    
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1090
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1091
  from this[OF dp]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1092
  show "x \<in> dependents (wq s') th''" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1093
    by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1094
next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1095
  fix x
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1096
  assume "x \<in> dependents (wq s') th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1097
  hence dp: "(Th x, Th th'') \<in> (depend s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1098
    by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1099
  { fix n
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1100
    have "(n, Th th'') \<in> (depend s')^+ \<Longrightarrow>  (n, Th th'') \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1101
    proof(induct rule:converse_trancl_induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1102
      fix y 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1103
      assume "(y, Th th'') \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1104
      with depend_s neq1 neq2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1105
      have "(y, Th th'') \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1106
      thus "(y, Th th'') \<in> (depend s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1107
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1108
      fix y z 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1109
      assume yz: "(y, z) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1110
        and ztp: "(z, Th th'') \<in> (depend s')\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1111
        and ztp': "(z, Th th'') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1112
      have "y \<noteq> Cs cs \<and> y \<noteq> Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1113
      proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1114
        show "y \<noteq> Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1115
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1116
          assume eq_y: "y = Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1117
          with yz have dp_yz: "(Cs cs, z) \<in> depend s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1118
          from this have eq_z: "z = Th th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1119
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1120
            from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1121
            have "(Cs cs, Th th) \<in> depend s'"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1122
              by(cases, auto simp: wq_def s_depend_def cs_holding_def s_holding_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1123
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] this dp_yz]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1124
            show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1125
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1126
          from converse_tranclE[OF ztp]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1127
          obtain u where "(z, u) \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1128
          moreover 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1129
          from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1130
          have "th \<in> readys s'" by (cases, simp add:runing_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1131
          moreover note eq_z
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1132
          ultimately show False 
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1133
            by (auto simp:readys_def wq_def s_depend_def s_waiting_def cs_waiting_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1134
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1135
      next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1136
        show "y \<noteq> Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1137
        proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1138
          assume eq_y: "y = Th th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1139
          with yz have dps: "(Th th', z) \<in> depend s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1140
          have "z = Cs cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1141
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1142
            from next_waiting[OF step_back_vt[OF vt_s[unfolded s_def]] nt]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1143
            have "(Th th', Cs cs) \<in> depend s'"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1144
              by (auto simp:s_waiting_def wq_def s_depend_def cs_waiting_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1145
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] dps this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1146
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1147
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1148
          with ztp have cs_i: "(Cs cs, Th th'') \<in>  (depend s')\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1149
          from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1150
          have cs_th: "(Cs cs, Th th) \<in> depend s'"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1151
            by(cases, auto simp: s_depend_def wq_def cs_holding_def s_holding_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1152
          have "(Cs cs, Th th'') \<notin>  depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1153
          proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1154
            assume "(Cs cs, Th th'') \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1155
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] this cs_th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1156
            and neq1 show "False" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1157
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1158
          with converse_tranclE[OF cs_i]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1159
          obtain u where cu: "(Cs cs, u) \<in> depend s'"  
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1160
            and u_t: "(u, Th th'') \<in> (depend s')\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1161
          have "u = Th th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1162
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1163
            from unique_depend[OF step_back_vt[OF vt_s[unfolded s_def]] cu cs_th]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1164
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1165
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1166
          with u_t have "(Th th, Th th'') \<in> (depend s')\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1167
          from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1168
          obtain v where "(Th th, v) \<in> (depend s')" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1169
          moreover from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1170
          have "th \<in> readys s'" by (cases, simp add:runing_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1171
          ultimately show False 
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1172
            by (auto simp:readys_def wq_def s_depend_def s_waiting_def cs_waiting_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1173
        qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1174
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1175
      with depend_s yz have "(y, z) \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1176
      with ztp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1177
      show "(y, Th th'') \<in> (depend s)\<^sup>+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1178
    qed    
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1179
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1180
  from this[OF dp]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1181
  show "x \<in> dependents (wq s) th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1182
    by (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1183
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1184
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1185
lemma cp_kept:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1186
  fixes th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1187
  assumes neq1: "th'' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1188
  and neq2: "th'' \<noteq> th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1189
  shows "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1190
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1191
  from dependents_kept[OF neq1 neq2]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1192
  have "dependents (wq s) th'' = dependents (wq s') th''" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1193
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1194
    fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1195
    assume "th1 \<in> dependents (wq s) th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1196
    have "preced th1 s = preced th1 s'" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1197
      by (unfold s_def, auto simp:preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1198
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1199
  moreover have "preced th'' s = preced th'' s'" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1200
    by (unfold s_def, auto simp:preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1201
  ultimately have "((\<lambda>th. preced th s) ` ({th''} \<union> dependents (wq s) th'')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1202
    ((\<lambda>th. preced th s') ` ({th''} \<union> dependents (wq s') th''))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1203
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1204
  thus ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1205
    by (unfold cp_eq_cpreced cpreced_def, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1206
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1207
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1208
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1209
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1210
locale step_v_cps_nnt = step_v_cps +
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1211
  assumes nnt: "\<And> th'. (\<not> next_th s' th cs th')"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1212
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1213
context step_v_cps_nnt
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1214
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1215
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1216
lemma nw_cs: "(Th th1, Cs cs) \<notin> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1217
proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1218
  assume "(Th th1, Cs cs) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1219
  thus "False"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1220
    apply (auto simp:s_depend_def cs_waiting_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1221
  proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1222
    assume h1: "th1 \<in> set (wq s' cs)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1223
      and h2: "th1 \<noteq> hd (wq s' cs)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1224
    from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1225
    show "False"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1226
    proof(cases)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1227
      assume "holding s' th cs" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1228
      then obtain rest where
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1229
        eq_wq: "wq s' cs = th#rest"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1230
        apply (unfold s_holding_def wq_def[symmetric])
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1231
        by (case_tac "(wq s' cs)", auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1232
      with h1 h2 have ne: "rest \<noteq> []" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1233
      with eq_wq
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1234
      have "next_th s' th cs (hd (SOME q. distinct q \<and> set q = set rest))"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1235
        by(unfold next_th_def, rule_tac x = "rest" in exI, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1236
      with nnt show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1237
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1238
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1239
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1240
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1241
lemma depend_s: "depend s = depend s' - {(Cs cs, Th th)}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1242
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1243
  from nnt and  step_depend_v[OF vt_s[unfolded s_def], folded s_def]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1244
  show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1245
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1246
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1247
lemma child_kept_left:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1248
  assumes 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1249
  "(n1, n2) \<in> (child s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1250
  shows "(n1, n2) \<in> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1251
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1252
  from assms show ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1253
  proof(induct rule: converse_trancl_induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1254
    case (base y)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1255
    from base obtain th1 cs1 th2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1256
      where h1: "(Th th1, Cs cs1) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1257
      and h2: "(Cs cs1, Th th2) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1258
      and eq_y: "y = Th th1" and eq_n2: "n2 = Th th2"  by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1259
    have "cs1 \<noteq> cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1260
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1261
      assume eq_cs: "cs1 = cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1262
      with h1 have "(Th th1, Cs cs1) \<in> depend s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1263
      with nw_cs eq_cs show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1264
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1265
    with h1 h2 depend_s have 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1266
      h1': "(Th th1, Cs cs1) \<in> depend s" and
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1267
      h2': "(Cs cs1, Th th2) \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1268
    hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1269
    with eq_y eq_n2 have "(y, n2) \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1270
    thus ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1271
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1272
    case (step y z)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1273
    have "(y, z) \<in> child s'" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1274
    then obtain th1 cs1 th2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1275
      where h1: "(Th th1, Cs cs1) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1276
      and h2: "(Cs cs1, Th th2) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1277
      and eq_y: "y = Th th1" and eq_z: "z = Th th2"  by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1278
    have "cs1 \<noteq> cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1279
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1280
      assume eq_cs: "cs1 = cs"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1281
      with h1 have "(Th th1, Cs cs1) \<in> depend s'" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1282
      with nw_cs eq_cs show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1283
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1284
    with h1 h2 depend_s have 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1285
      h1': "(Th th1, Cs cs1) \<in> depend s" and
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1286
      h2': "(Cs cs1, Th th2) \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1287
    hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1288
    with eq_y eq_z have "(y, z) \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1289
    moreover have "(z, n2) \<in> (child s)^+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1290
    ultimately show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1291
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1292
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1293
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1294
lemma  child_kept_right:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1295
  assumes
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1296
  "(n1, n2) \<in> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1297
  shows "(n1, n2) \<in> (child s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1298
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1299
  from assms show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1300
  proof(induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1301
    case (base y)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1302
    from base and depend_s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1303
    have "(n1, y) \<in> child s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1304
      by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1305
    thus ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1306
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1307
    case (step y z)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1308
    have "(y, z) \<in> child s" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1309
    with depend_s have "(y, z) \<in> child s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1310
      by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1311
    moreover have "(n1, y) \<in> (child s')\<^sup>+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1312
    ultimately show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1313
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1314
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1315
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1316
lemma eq_child: "(child s)^+ = (child s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1317
  by (insert child_kept_left child_kept_right, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1318
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1319
lemma eq_cp:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1320
  fixes th' 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1321
  shows "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1322
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1323
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1324
  have eq_dp: "\<And> th. dependents (wq s) th = dependents (wq s') th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1325
    apply (unfold cs_dependents_def, unfold eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1326
  proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1327
    from eq_child
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1328
    have "\<And>th. {th'. (Th th', Th th) \<in> (child s)\<^sup>+} = {th'. (Th th', Th th) \<in> (child s')\<^sup>+}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1329
      by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1330
    with child_depend_eq[OF vt_s] child_depend_eq[OF step_back_vt[OF vt_s[unfolded s_def]]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1331
    show "\<And>th. {th'. (Th th', Th th) \<in> (depend s)\<^sup>+} = {th'. (Th th', Th th) \<in> (depend s')\<^sup>+}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1332
      by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1333
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1334
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1335
    fix th1 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1336
    assume "th1 \<in> {th'} \<union> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1337
    hence "th1 = th' \<or> th1 \<in> dependents (wq s') th'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1338
    hence "preced th1 s = preced th1 s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1339
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1340
      assume "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1341
      show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1342
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1343
      assume "th1 \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1344
      show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1345
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1346
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1347
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1348
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1349
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1350
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1351
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1352
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1353
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1354
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1355
locale step_P_cps =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1356
  fixes s' th cs s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1357
  defines s_def : "s \<equiv> (P th cs#s')"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1358
  assumes vt_s: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1359
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1360
locale step_P_cps_ne =step_P_cps +
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1361
  assumes ne: "wq s' cs \<noteq> []"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1362
272
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1363
locale step_P_cps_e =step_P_cps +
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1364
  assumes ee: "wq s' cs = []"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1365
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1366
context step_P_cps_e
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1367
begin
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1368
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1369
lemma depend_s: "depend s = depend s' \<union> {(Cs cs, Th th)}"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1370
proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1371
  from ee and  step_depend_p[OF vt_s[unfolded s_def], folded s_def]
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1372
  show ?thesis by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1373
qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1374
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1375
lemma child_kept_left:
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1376
  assumes 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1377
  "(n1, n2) \<in> (child s')^+"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1378
  shows "(n1, n2) \<in> (child s)^+"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1379
proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1380
  from assms show ?thesis 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1381
  proof(induct rule: converse_trancl_induct)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1382
    case (base y)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1383
    from base obtain th1 cs1 th2
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1384
      where h1: "(Th th1, Cs cs1) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1385
      and h2: "(Cs cs1, Th th2) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1386
      and eq_y: "y = Th th1" and eq_n2: "n2 = Th th2"  by (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1387
    have "cs1 \<noteq> cs"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1388
    proof
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1389
      assume eq_cs: "cs1 = cs"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1390
      with h1 have "(Th th1, Cs cs) \<in> depend s'" by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1391
      with ee show False
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1392
        by (auto simp:s_depend_def cs_waiting_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1393
    qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1394
    with h1 h2 depend_s have 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1395
      h1': "(Th th1, Cs cs1) \<in> depend s" and
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1396
      h2': "(Cs cs1, Th th2) \<in> depend s" by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1397
    hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1398
    with eq_y eq_n2 have "(y, n2) \<in> child s" by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1399
    thus ?case by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1400
  next
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1401
    case (step y z)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1402
    have "(y, z) \<in> child s'" by fact
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1403
    then obtain th1 cs1 th2
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1404
      where h1: "(Th th1, Cs cs1) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1405
      and h2: "(Cs cs1, Th th2) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1406
      and eq_y: "y = Th th1" and eq_z: "z = Th th2"  by (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1407
    have "cs1 \<noteq> cs"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1408
    proof
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1409
      assume eq_cs: "cs1 = cs"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1410
      with h1 have "(Th th1, Cs cs) \<in> depend s'" by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1411
      with ee show False 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1412
        by (auto simp:s_depend_def cs_waiting_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1413
    qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1414
    with h1 h2 depend_s have 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1415
      h1': "(Th th1, Cs cs1) \<in> depend s" and
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1416
      h2': "(Cs cs1, Th th2) \<in> depend s" by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1417
    hence "(Th th1, Th th2) \<in> child s" by (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1418
    with eq_y eq_z have "(y, z) \<in> child s" by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1419
    moreover have "(z, n2) \<in> (child s)^+" by fact
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1420
    ultimately show ?case by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1421
  qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1422
qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1423
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1424
lemma  child_kept_right:
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1425
  assumes
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1426
  "(n1, n2) \<in> (child s)^+"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1427
  shows "(n1, n2) \<in> (child s')^+"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1428
proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1429
  from assms show ?thesis
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1430
  proof(induct)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1431
    case (base y)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1432
    from base and depend_s
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1433
    have "(n1, y) \<in> child s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1434
      apply (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1435
      proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1436
        fix th'
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1437
        assume "(Th th', Cs cs) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1438
        with ee have "False"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1439
          by (auto simp:s_depend_def cs_waiting_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1440
        thus "\<exists>cs. (Th th', Cs cs) \<in> depend s' \<and> (Cs cs, Th th) \<in> depend s'" by auto 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1441
      qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1442
    thus ?case by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1443
  next
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1444
    case (step y z)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1445
    have "(y, z) \<in> child s" by fact
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1446
    with depend_s have "(y, z) \<in> child s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1447
      apply (auto simp:child_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1448
      proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1449
        fix th'
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1450
        assume "(Th th', Cs cs) \<in> depend s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1451
        with ee have "False"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1452
          by (auto simp:s_depend_def cs_waiting_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1453
        thus "\<exists>cs. (Th th', Cs cs) \<in> depend s' \<and> (Cs cs, Th th) \<in> depend s'" by auto 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1454
      qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1455
    moreover have "(n1, y) \<in> (child s')\<^sup>+" by fact
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1456
    ultimately show ?case by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1457
  qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1458
qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1459
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1460
lemma eq_child: "(child s)^+ = (child s')^+"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1461
  by (insert child_kept_left child_kept_right, auto)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1462
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1463
lemma eq_cp:
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1464
  fixes th' 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1465
  shows "cp s th' = cp s' th'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1466
  apply (unfold cp_eq_cpreced cpreced_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1467
proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1468
  have eq_dp: "\<And> th. dependents (wq s) th = dependents (wq s') th"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1469
    apply (unfold cs_dependents_def, unfold eq_depend)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1470
  proof -
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1471
    from eq_child
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1472
    have "\<And>th. {th'. (Th th', Th th) \<in> (child s)\<^sup>+} = {th'. (Th th', Th th) \<in> (child s')\<^sup>+}"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1473
      by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1474
    with child_depend_eq[OF vt_s] child_depend_eq[OF step_back_vt[OF vt_s[unfolded s_def]]]
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1475
    show "\<And>th. {th'. (Th th', Th th) \<in> (depend s)\<^sup>+} = {th'. (Th th', Th th) \<in> (depend s')\<^sup>+}"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1476
      by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1477
  qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1478
  moreover {
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1479
    fix th1 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1480
    assume "th1 \<in> {th'} \<union> dependents (wq s') th'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1481
    hence "th1 = th' \<or> th1 \<in> dependents (wq s') th'" by auto
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1482
    hence "preced th1 s = preced th1 s'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1483
    proof
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1484
      assume "th1 = th'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1485
      show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1486
    next
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1487
      assume "th1 \<in> dependents (wq s') th'"
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1488
      show "preced th1 s = preced th1 s'" by (simp add:s_def preced_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1489
    qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1490
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1491
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1492
    by (auto simp:image_def)
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1493
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1494
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1495
qed
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1496
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1497
end
ee4611c1e13c All comments added.
zhang
parents: 262
diff changeset
  1498
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1499
context step_P_cps_ne
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1500
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1501
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1502
lemma depend_s: "depend s = depend s' \<union> {(Th th, Cs cs)}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1503
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1504
  from step_depend_p[OF vt_s[unfolded s_def]] and ne
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1505
  show ?thesis by (simp add:s_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1506
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1507
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1508
lemma eq_child_left:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1509
  assumes nd: "(Th th, Th th') \<notin> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1510
  shows "(n1, Th th') \<in> (child s)^+ \<Longrightarrow> (n1, Th th') \<in> (child s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1511
proof(induct rule:converse_trancl_induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1512
  case (base y)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1513
  from base obtain th1 cs1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1514
    where h1: "(Th th1, Cs cs1) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1515
    and h2: "(Cs cs1, Th th') \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1516
    and eq_y: "y = Th th1"   by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1517
  have "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1518
  proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1519
    assume "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1520
    with base eq_y have "(Th th, Th th') \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1521
    with nd show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1522
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1523
  with h1 h2 depend_s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1524
  have h1': "(Th th1, Cs cs1) \<in> depend s'" and 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1525
       h2': "(Cs cs1, Th th') \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1526
  with eq_y show ?case by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1527
next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1528
  case (step y z)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1529
  have yz: "(y, z) \<in> child s" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1530
  then obtain th1 cs1 th2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1531
    where h1: "(Th th1, Cs cs1) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1532
    and h2: "(Cs cs1, Th th2) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1533
    and eq_y: "y = Th th1" and eq_z: "z = Th th2"  by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1534
  have "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1535
  proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1536
    assume "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1537
    with yz eq_y have "(Th th, z) \<in> child s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1538
    moreover have "(z, Th th') \<in> (child s)^+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1539
    ultimately have "(Th th, Th th') \<in> (child s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1540
    with nd show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1541
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1542
  with h1 h2 depend_s have h1': "(Th th1, Cs cs1) \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1543
                       and h2': "(Cs cs1, Th th2) \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1544
  with eq_y eq_z have "(y, z) \<in> child s'" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1545
  moreover have "(z, Th th') \<in> (child s')^+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1546
  ultimately show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1547
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1548
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1549
lemma eq_child_right:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1550
  shows "(n1, Th th') \<in> (child s')^+ \<Longrightarrow> (n1, Th th') \<in> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1551
proof(induct rule:converse_trancl_induct)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1552
  case (base y)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1553
  with depend_s show ?case by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1554
next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1555
  case (step y z)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1556
  have "(y, z) \<in> child s'" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1557
  with depend_s have "(y, z) \<in> child s" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1558
  moreover have "(z, Th th') \<in> (child s)^+" by fact
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1559
  ultimately show ?case by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1560
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1561
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1562
lemma eq_child:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1563
  assumes nd: "(Th th, Th th') \<notin> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1564
  shows "((n1, Th th') \<in> (child s)^+) = ((n1, Th th') \<in> (child s')^+)"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1565
  by (insert eq_child_left[OF nd] eq_child_right, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1566
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1567
lemma eq_cp:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1568
  fixes th' 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1569
  assumes nd: "th \<notin> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1570
  shows "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1571
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1572
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1573
  have nd': "(Th th, Th th') \<notin> (child s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1574
  proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1575
    assume "(Th th, Th th') \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1576
    with child_depend_eq[OF vt_s]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1577
    have "(Th th, Th th') \<in> (depend s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1578
    with nd show False 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1579
      by (simp add:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1580
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1581
  have eq_dp: "dependents (wq s) th' = dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1582
  proof(auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1583
    fix x assume " x \<in> dependents (wq s) th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1584
    thus "x \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1585
      apply (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1586
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1587
      assume "(Th x, Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1588
      with  child_depend_eq[OF vt_s] have "(Th x, Th th') \<in> (child s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1589
      with eq_child[OF nd'] have "(Th x, Th th') \<in> (child s')^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1590
      with child_depend_eq[OF step_back_vt[OF vt_s[unfolded s_def]]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1591
      show "(Th x, Th th') \<in> (depend s')\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1592
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1593
  next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1594
    fix x assume "x \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1595
    thus "x \<in> dependents (wq s) th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1596
      apply (auto simp:cs_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1597
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1598
      assume "(Th x, Th th') \<in> (depend s')\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1599
      with child_depend_eq[OF step_back_vt[OF vt_s[unfolded s_def]]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1600
      have "(Th x, Th th') \<in> (child s')\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1601
      with eq_child[OF nd'] have "(Th x, Th th') \<in> (child s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1602
      with  child_depend_eq[OF vt_s]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1603
      show "(Th x, Th th') \<in> (depend s)\<^sup>+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1604
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1605
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1606
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1607
    fix th1 have "preced th1 s = preced th1 s'" by (simp add:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1608
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1609
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1610
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1611
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1612
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1613
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1614
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1615
lemma eq_up:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1616
  fixes th' th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1617
  assumes dp1: "th \<in> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1618
  and dp2: "th' \<in> dependents s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1619
  and eq_cps: "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1620
  shows "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1621
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1622
  from dp2
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1623
  have "(Th th', Th th'') \<in> (depend (wq s))\<^sup>+" by (simp add:s_dependents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1624
  from depend_child[OF vt_s this[unfolded eq_depend]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1625
  have ch_th': "(Th th', Th th'') \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1626
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1627
    fix n th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1628
    have "\<lbrakk>(Th th', n) \<in> (child s)^+\<rbrakk> \<Longrightarrow>
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1629
                   (\<forall> th'' . n = Th th'' \<longrightarrow> cp s th'' = cp s' th'')"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1630
    proof(erule trancl_induct, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1631
      fix y th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1632
      assume y_ch: "(y, Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1633
        and ih: "\<forall>th''. y = Th th'' \<longrightarrow> cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1634
        and ch': "(Th th', y) \<in> (child s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1635
      from y_ch obtain thy where eq_y: "y = Th thy" by (auto simp:child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1636
      with ih have eq_cpy:"cp s thy = cp s' thy" by blast
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1637
      from dp1 have "(Th th, Th th') \<in> (depend s)^+" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1638
      moreover from child_depend_p[OF ch'] and eq_y
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1639
      have "(Th th', Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1640
      ultimately have dp_thy: "(Th th, Th thy) \<in> (depend s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1641
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1642
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1643
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1644
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1645
          by (simp add:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1646
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1647
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1648
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1649
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1650
          proof(cases "th1 = thy")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1651
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1652
            with eq_cpy show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1653
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1654
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1655
            have neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1656
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1657
              assume eq_th1: "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1658
              with dp_thy have "(Th th1, Th thy) \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1659
              from children_no_dep[OF vt_s _ _ this] and 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1660
              th1_in y_ch eq_y show False by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1661
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1662
            have "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1663
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1664
              assume h:"th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1665
              from eq_y dp_thy have "th \<in> dependents s thy" by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1666
              from dependents_child_unique[OF vt_s _ _ h this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1667
              th1_in y_ch eq_y have "th1 = thy" by (auto simp:children_def child_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1668
              with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1669
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1670
            from eq_cp[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1671
            show ?thesis .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1672
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1673
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1674
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1675
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1676
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1677
          apply (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1678
          apply (fold s_def, auto simp:depend_s)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1679
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1680
            assume "(Cs cs, Th th'') \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1681
            with depend_s have cs_th': "(Cs cs, Th th'') \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1682
            from dp1 have "(Th th, Th th') \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1683
              by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1684
            from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1685
            obtain cs1 where h1: "(Th th, Cs cs1) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1686
              and h2: "(Cs cs1 , Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1687
              by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1688
            have eq_cs: "cs1 = cs" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1689
            proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1690
              from depend_s have "(Th th, Cs cs) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1691
              from unique_depend[OF vt_s this h1]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1692
              show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1693
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1694
            have False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1695
            proof(rule converse_tranclE[OF h2])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1696
              assume "(Cs cs1, Th th') \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1697
              with eq_cs have "(Cs cs, Th th') \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1698
              from unique_depend[OF vt_s this cs_th']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1699
              have "th' = th''" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1700
              with ch' y_ch have "(Th th'', Th th'') \<in> (child s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1701
              with wf_trancl[OF wf_child[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1702
              show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1703
            next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1704
              fix y
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1705
              assume "(Cs cs1, y) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1706
                and ytd: " (y, Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1707
              with eq_cs have csy: "(Cs cs, y) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1708
              from unique_depend[OF vt_s this cs_th']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1709
              have "y = Th th''" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1710
              with ytd have "(Th th'', Th th') \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1711
              from depend_child[OF vt_s this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1712
              have "(Th th'', Th th') \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1713
              moreover from ch' y_ch have ch'': "(Th th', Th th'') \<in> (child s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1714
              ultimately have "(Th th'', Th th'') \<in> (child s)^+" by auto 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1715
              with wf_trancl[OF wf_child[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1716
              show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1717
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1718
            thus "\<exists>cs. (Th th, Cs cs) \<in> depend s' \<and> (Cs cs, Th th'') \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1719
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1720
          ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1721
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1722
      qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1723
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1724
      fix th''
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1725
      assume dp': "(Th th', Th th'') \<in> child s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1726
      show "cp s th'' = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1727
        apply (subst cp_rec[OF vt_s])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1728
      proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1729
        have "preced th'' s = preced th'' s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1730
          by (simp add:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1731
        moreover { 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1732
          fix th1
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1733
          assume th1_in: "th1 \<in> children s th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1734
          have "cp s th1 = cp s' th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1735
          proof(cases "th1 = th'")
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1736
            case True
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1737
            with eq_cps show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1738
          next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1739
            case False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1740
            have neq_th1: "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1741
            proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1742
              assume eq_th1: "th1 = th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1743
              with dp1 have "(Th th1, Th th') \<in> (depend s)^+" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1744
                by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1745
              from children_no_dep[OF vt_s _ _ this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1746
              th1_in dp'
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1747
              show False by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1748
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1749
            show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1750
            proof(rule eq_cp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1751
              show "th \<notin> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1752
              proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1753
                assume "th \<in> dependents s th1"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1754
                from dependents_child_unique[OF vt_s _ _ this dp1]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1755
                th1_in dp' have "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1756
                  by (auto simp:children_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1757
                with False show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1758
              qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1759
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1760
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1761
        }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1762
        ultimately have "{preced th'' s} \<union> (cp s ` children s th'') = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1763
          {preced th'' s'} \<union> (cp s' ` children s th'')" by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1764
        moreover have "children s th'' = children s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1765
          apply (unfold children_def child_def s_def depend_set_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1766
          apply (fold s_def, auto simp:depend_s)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1767
          proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1768
            assume "(Cs cs, Th th'') \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1769
            with depend_s have cs_th': "(Cs cs, Th th'') \<in> depend s" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1770
            from dp1 have "(Th th, Th th') \<in> (depend s)^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1771
              by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1772
            from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1773
            obtain cs1 where h1: "(Th th, Cs cs1) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1774
              and h2: "(Cs cs1 , Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1775
              by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1776
            have eq_cs: "cs1 = cs" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1777
            proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1778
              from depend_s have "(Th th, Cs cs) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1779
              from unique_depend[OF vt_s this h1]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1780
              show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1781
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1782
            have False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1783
            proof(rule converse_tranclE[OF h2])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1784
              assume "(Cs cs1, Th th') \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1785
              with eq_cs have "(Cs cs, Th th') \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1786
              from unique_depend[OF vt_s this cs_th']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1787
              have "th' = th''" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1788
              with dp' have "(Th th'', Th th'') \<in> (child s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1789
              with wf_trancl[OF wf_child[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1790
              show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1791
            next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1792
              fix y
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1793
              assume "(Cs cs1, y) \<in> depend s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1794
                and ytd: " (y, Th th') \<in> (depend s)\<^sup>+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1795
              with eq_cs have csy: "(Cs cs, y) \<in> depend s" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1796
              from unique_depend[OF vt_s this cs_th']
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1797
              have "y = Th th''" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1798
              with ytd have "(Th th'', Th th') \<in> (depend s)^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1799
              from depend_child[OF vt_s this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1800
              have "(Th th'', Th th') \<in> (child s)\<^sup>+" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1801
              moreover from dp' have ch'': "(Th th', Th th'') \<in> (child s)^+" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1802
              ultimately have "(Th th'', Th th'') \<in> (child s)^+" by auto 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1803
              with wf_trancl[OF wf_child[OF vt_s]] 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1804
              show False by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1805
            qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1806
            thus "\<exists>cs. (Th th, Cs cs) \<in> depend s' \<and> (Cs cs, Th th'') \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1807
          qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1808
        ultimately show "Max ({preced th'' s} \<union> cp s ` children s th'') = cp s' th''"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1809
          by (simp add:cp_rec[OF step_back_vt[OF vt_s[unfolded s_def]]])
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1810
      qed     
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1811
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1812
  }
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1813
  ultimately show ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1814
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1815
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1816
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1817
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1818
locale step_create_cps =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1819
  fixes s' th prio s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1820
  defines s_def : "s \<equiv> (Create th prio#s')"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1821
  assumes vt_s: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1822
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1823
context step_create_cps
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1824
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1825
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1826
lemma eq_dep: "depend s = depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1827
  by (unfold s_def depend_create_unchanged, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1828
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1829
lemma eq_cp:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1830
  fixes th' 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1831
  assumes neq_th: "th' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1832
  shows "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1833
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1834
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1835
  have nd: "th \<notin> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1836
  proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1837
    assume "th \<in> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1838
    hence "(Th th, Th th') \<in> (depend s)^+" by (simp add:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1839
    with eq_dep have "(Th th, Th th') \<in> (depend s')^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1840
    from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1841
    obtain y where "(Th th, y) \<in> depend s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1842
    with dm_depend_threads[OF step_back_vt[OF vt_s[unfolded s_def]]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1843
    have in_th: "th \<in> threads s'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1844
    from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1845
    show False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1846
    proof(cases)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1847
      assume "th \<notin> threads s'" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1848
      with in_th show ?thesis by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1849
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1850
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1851
  have eq_dp: "\<And> th. dependents (wq s) th = dependents (wq s') th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1852
    by (unfold cs_dependents_def, auto simp:eq_dep eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1853
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1854
    fix th1 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1855
    assume "th1 \<in> {th'} \<union> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1856
    hence "th1 = th' \<or> th1 \<in> dependents (wq s') th'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1857
    hence "preced th1 s = preced th1 s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1858
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1859
      assume "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1860
      with neq_th
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1861
      show "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1862
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1863
      assume "th1 \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1864
      with nd and eq_dp have "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1865
        by (auto simp:eq_depend cs_dependents_def s_dependents_def eq_dep)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1866
      thus "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1867
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1868
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1869
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1870
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1871
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1872
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1873
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1874
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1875
lemma nil_dependents: "dependents s th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1876
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1877
  from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1878
  show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1879
  proof(cases)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1880
    assume "th \<notin> threads s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1881
    from not_thread_holdents[OF step_back_vt[OF vt_s[unfolded s_def]] this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1882
    have hdn: " holdents s' th = {}" .
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1883
    have "dependents s' th = {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1884
    proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1885
      { assume "dependents s' th \<noteq> {}"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1886
        then obtain th' where dp: "(Th th', Th th) \<in> (depend s')^+"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1887
          by (auto simp:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1888
        from tranclE[OF this] obtain cs' where 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1889
          "(Cs cs', Th th) \<in> depend s'" by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1890
        with hdn
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1891
        have False by (auto simp:holdents_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1892
      } thus ?thesis by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1893
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1894
    thus ?thesis 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1895
      by (unfold s_def s_dependents_def eq_depend depend_create_unchanged, simp)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1896
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1897
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1898
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1899
lemma eq_cp_th: "cp s th = preced th s"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1900
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1901
  by (insert nil_dependents, unfold s_dependents_def cs_dependents_def, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1902
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1903
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1904
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1905
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1906
locale step_exit_cps =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1907
  fixes s' th prio s 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1908
  defines s_def : "s \<equiv> (Exit th#s')"
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1909
  assumes vt_s: "vt s"
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1910
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1911
context step_exit_cps
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1912
begin
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1913
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1914
lemma eq_dep: "depend s = depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1915
  by (unfold s_def depend_exit_unchanged, auto)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1916
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1917
lemma eq_cp:
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1918
  fixes th' 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1919
  assumes neq_th: "th' \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1920
  shows "cp s th' = cp s' th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1921
  apply (unfold cp_eq_cpreced cpreced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1922
proof -
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1923
  have nd: "th \<notin> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1924
  proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1925
    assume "th \<in> dependents s th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1926
    hence "(Th th, Th th') \<in> (depend s)^+" by (simp add:s_dependents_def eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1927
    with eq_dep have "(Th th, Th th') \<in> (depend s')^+" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1928
    from converse_tranclE[OF this]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1929
    obtain cs' where bk: "(Th th, Cs cs') \<in> depend s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1930
      by (auto simp:s_depend_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1931
    from step_back_step[OF vt_s[unfolded s_def]]
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1932
    show False
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1933
    proof(cases)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1934
      assume "th \<in> runing s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1935
      with bk show ?thesis
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1936
        apply (unfold runing_def readys_def s_waiting_def s_depend_def)
298
f2e0d031a395 completed model section; vt has only state as argument
urbanc
parents: 290
diff changeset
  1937
        by (auto simp:cs_waiting_def wq_def)
262
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1938
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1939
  qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1940
  have eq_dp: "\<And> th. dependents (wq s) th = dependents (wq s') th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1941
    by (unfold cs_dependents_def, auto simp:eq_dep eq_depend)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1942
  moreover {
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1943
    fix th1 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1944
    assume "th1 \<in> {th'} \<union> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1945
    hence "th1 = th' \<or> th1 \<in> dependents (wq s') th'" by auto
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1946
    hence "preced th1 s = preced th1 s'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1947
    proof
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1948
      assume "th1 = th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1949
      with neq_th
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1950
      show "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1951
    next
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1952
      assume "th1 \<in> dependents (wq s') th'"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1953
      with nd and eq_dp have "th1 \<noteq> th"
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1954
        by (auto simp:eq_depend cs_dependents_def s_dependents_def eq_dep)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1955
      thus "preced th1 s = preced th1 s'" by (auto simp:s_def preced_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1956
    qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1957
  } ultimately have "((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) = 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1958
                     ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" 
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1959
    by (auto simp:image_def)
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1960
  thus "Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependents (wq s) th')) =
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1961
        Max ((\<lambda>th. preced th s') ` ({th'} \<union> dependents (wq s') th'))" by simp
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1962
qed
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1963
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1964
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1965
end
4190df6f4488 initial version of the PIP formalisation
urbanc
parents:
diff changeset
  1966