src/HOL/MicroJava/DFA/LBVComplete.thy
changeset 68386 98cf1c823c48
parent 68249 949d93804740
equal deleted inserted replaced
68364:5c579bb9adb1 68386:98cf1c823c48
    78   have "?s1 = \<top> \<Longrightarrow> ?thesis" by simp
    78   have "?s1 = \<top> \<Longrightarrow> ?thesis" by simp
    79   moreover {
    79   moreover {
    80     assume merge: "?s1 \<noteq> T" 
    80     assume merge: "?s1 \<noteq> T" 
    81     from x ss1 have "?s1 =
    81     from x ss1 have "?s1 =
    82       (if \<forall>(pc', s')\<in>set ss1. pc' \<noteq> pc + 1 \<longrightarrow> s' <=_r c!pc'
    82       (if \<forall>(pc', s')\<in>set ss1. pc' \<noteq> pc + 1 \<longrightarrow> s' <=_r c!pc'
    83       then (map snd (filter (\<lambda>(p', t'). p'=pc+1) ss1)) ++_f x
    83       then (map snd [(p', t') \<leftarrow> ss1 . p'=pc+1]) ++_f x
    84       else \<top>)" 
    84       else \<top>)" 
    85       by (rule merge_def)  
    85       by (rule merge_def)  
    86     with merge obtain
    86     with merge obtain
    87       app: "\<forall>(pc',s')\<in>set ss1. pc' \<noteq> pc+1 \<longrightarrow> s' <=_r c!pc'" 
    87       app: "\<forall>(pc',s')\<in>set ss1. pc' \<noteq> pc+1 \<longrightarrow> s' <=_r c!pc'" 
    88            (is "?app ss1") and
    88            (is "?app ss1") and
    89       sum: "(map snd (filter (\<lambda>(p',t'). p' = pc+1) ss1) ++_f x) = ?s1" 
    89       sum: "(map snd [(p',t') \<leftarrow> ss1 . p' = pc+1] ++_f x) = ?s1" 
    90            (is "?map ss1 ++_f x = _" is "?sum ss1 = _")
    90            (is "?map ss1 ++_f x = _" is "?sum ss1 = _")
    91       by (simp split: if_split_asm)
    91       by (simp split: if_split_asm)
    92     from app less 
    92     from app less 
    93     have "?app ss2" by (blast dest: trans_r lesub_step_typeD)
    93     have "?app ss2" by (blast dest: trans_r lesub_step_typeD)
    94     moreover {
    94     moreover {
   113     }
   113     }
   114     moreover
   114     moreover
   115     from x ss2 have 
   115     from x ss2 have 
   116       "?s2 =
   116       "?s2 =
   117       (if \<forall>(pc', s')\<in>set ss2. pc' \<noteq> pc + 1 \<longrightarrow> s' <=_r c!pc'
   117       (if \<forall>(pc', s')\<in>set ss2. pc' \<noteq> pc + 1 \<longrightarrow> s' <=_r c!pc'
   118       then map snd (filter (\<lambda>(p', t'). p' = pc + 1) ss2) ++_f x
   118       then map snd [(p', t') \<leftarrow> ss2 . p' = pc + 1] ++_f x
   119       else \<top>)" 
   119       else \<top>)" 
   120       by (rule merge_def)
   120       by (rule merge_def)
   121     ultimately have ?thesis by simp
   121     ultimately have ?thesis by simp
   122   }
   122   }
   123   ultimately show ?thesis by (cases "?s1 = \<top>") auto
   123   ultimately show ?thesis by (cases "?s1 = \<top>") auto
   192   from pres this pc 
   192   from pres this pc 
   193   have stepA: "snd`set ?step \<subseteq> A" by (rule pres_typeD2) 
   193   have stepA: "snd`set ?step \<subseteq> A" by (rule pres_typeD2) 
   194   ultimately
   194   ultimately
   195   have "merge c pc ?step (c!Suc pc) =
   195   have "merge c pc ?step (c!Suc pc) =
   196     (if \<forall>(pc',s')\<in>set ?step. pc'\<noteq>pc+1 \<longrightarrow> s' <=_r c!pc'
   196     (if \<forall>(pc',s')\<in>set ?step. pc'\<noteq>pc+1 \<longrightarrow> s' <=_r c!pc'
   197     then map snd (filter (\<lambda>(p',t').p'=pc+1) ?step) ++_f c!Suc pc
   197     then map snd [(p',t') \<leftarrow> ?step.p'=pc+1] ++_f c!Suc pc
   198     else \<top>)" unfolding mrg_def by (rule lbv.merge_def [OF lbvc.axioms(1), OF lbvc_axioms])
   198     else \<top>)" unfolding mrg_def by (rule lbv.merge_def [OF lbvc.axioms(1), OF lbvc_axioms])
   199   moreover {
   199   moreover {
   200     fix pc' s' assume s': "(pc', s') \<in> set ?step" and suc_pc: "pc' \<noteq> pc+1"
   200     fix pc' s' assume s': "(pc', s') \<in> set ?step" and suc_pc: "pc' \<noteq> pc+1"
   201     with less have "s' <=_r \<phi>!pc'" by auto
   201     with less have "s' <=_r \<phi>!pc'" by auto
   202     also 
   202     also 
   205     hence "\<phi>!pc' = c!pc'" ..
   205     hence "\<phi>!pc' = c!pc'" ..
   206     finally have "s' <=_r c!pc'" .
   206     finally have "s' <=_r c!pc'" .
   207   } hence "\<forall>(pc',s')\<in>set ?step. pc'\<noteq>pc+1 \<longrightarrow> s' <=_r c!pc'" by auto
   207   } hence "\<forall>(pc',s')\<in>set ?step. pc'\<noteq>pc+1 \<longrightarrow> s' <=_r c!pc'" by auto
   208   moreover
   208   moreover
   209   from pc have "Suc pc = length \<phi> \<or> Suc pc < length \<phi>" by auto
   209   from pc have "Suc pc = length \<phi> \<or> Suc pc < length \<phi>" by auto
   210   hence "map snd (filter (\<lambda>(p',t').p'=pc+1) ?step) ++_f c!Suc pc \<noteq> \<top>" 
   210   hence "map snd [(p',t') \<leftarrow> ?step.p'=pc+1] ++_f c!Suc pc \<noteq> \<top>" 
   211          (is "?map ++_f _ \<noteq> _")
   211          (is "?map ++_f _ \<noteq> _")
   212   proof (rule disjE)
   212   proof (rule disjE)
   213     assume pc': "Suc pc = length \<phi>"
   213     assume pc': "Suc pc = length \<phi>"
   214     with cert have "c!Suc pc = \<bottom>" by (simp add: cert_okD2)
   214     with cert have "c!Suc pc = \<bottom>" by (simp add: cert_okD2)
   215     moreover 
   215     moreover 
   216     from pc' bounded pc 
   216     from pc' bounded pc 
   217     have "\<forall>(p',t')\<in>set ?step. p'\<noteq>pc+1" by clarify (drule boundedD, auto)
   217     have "\<forall>(p',t')\<in>set ?step. p'\<noteq>pc+1" by clarify (drule boundedD, auto)
   218     hence "filter (\<lambda>(p',t').p'=pc+1) ?step = []" by (blast intro: filter_False) 
   218     hence "[(p',t') \<leftarrow> ?step.p'=pc+1] = []" by (blast intro: filter_False) 
   219     hence "?map = []" by simp
   219     hence "?map = []" by simp
   220     ultimately show ?thesis by (simp add: B_neq_T)  
   220     ultimately show ?thesis by (simp add: B_neq_T)  
   221   next
   221   next
   222     assume pc': "Suc pc < length \<phi>"
   222     assume pc': "Suc pc < length \<phi>"
   223     from pc' phi have "\<phi>!Suc pc \<in> A" by simp
   223     from pc' phi have "\<phi>!Suc pc \<in> A" by simp
   260   moreover
   260   moreover
   261   from stable pc have "?wti \<noteq> \<top>" by (rule stable_wti)
   261   from stable pc have "?wti \<noteq> \<top>" by (rule stable_wti)
   262   hence "merge c pc ?step (c!Suc pc) \<noteq> \<top>" by (simp add: wti)
   262   hence "merge c pc ?step (c!Suc pc) \<noteq> \<top>" by (simp add: wti)
   263   ultimately
   263   ultimately
   264   have "merge c pc ?step (c!Suc pc) =
   264   have "merge c pc ?step (c!Suc pc) =
   265     map snd (filter (\<lambda>(p',t').p'=pc+1) ?step) ++_f c!Suc pc" by (rule merge_not_top_s) 
   265     map snd [(p',t')\<leftarrow> ?step.p'=pc+1] ++_f c!Suc pc" by (rule merge_not_top_s) 
   266   hence "?wti = \<dots>" (is "_ = (?map ++_f _)" is "_ = ?sum") by (simp add: wti)
   266   hence "?wti = \<dots>" (is "_ = (?map ++_f _)" is "_ = ?sum") by (simp add: wti)
   267   also {
   267   also {
   268     from suc_pc phi have "\<phi>!Suc pc \<in> A" by simp
   268     from suc_pc phi have "\<phi>!Suc pc \<in> A" by simp
   269     moreover note cert_suc
   269     moreover note cert_suc
   270     moreover from stepA have "set ?map \<subseteq> A" by auto
   270     moreover from stepA have "set ?map \<subseteq> A" by auto