[STATEMENT]
lemma propa_dom_invariant_aux:
  fixes a b ss w
assumes propa: "propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w) "
    and b_n_nil: "b \<noteq> [] "
    and a_in_A: "\<forall>\<tau>\<in>set a. \<tau> \<in> A"
    and ass: "\<forall>p<n.
          sorted (rev ( (a ! p))) \<and>
          (a!p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a!p). x < p)) \<and>
          (a!p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x,p)\<in> g_E G \<and> x < p)) \<and>
          (p \<notin> set b \<longrightarrow> stable r step a p)"
    and sorted_b: "sorted b  "
    and len_eq:  "length a = n  "
    and b_lt_n: "\<forall>x\<in>set b. x < n  "
  shows "(\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and>
         (\<forall>p<n.
           sorted (rev ( (ss ! p))) \<and>
           (ss!p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss!p). x < p)) \<and>
           (ss!p = rev [0..<n] \<longrightarrow> (\<exists>x\<in> set w. (x,p)\<in> g_E G \<and> x < p)) \<and>
           (p \<notin> set w \<longrightarrow> stable r step ss p)) \<and>
         sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x <n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
b \<noteq> []
\<forall>\<tau>\<in>set a. \<tau> \<in> A
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
Sorted_Less.sorted b
length a = n
\<forall>x\<in>set b. x < n

goal (1 subgoal):
 1. (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?a_hdb = "a!hd b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?ss_hdw = "ss!hd w"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?ss_hdb = "ss!hd b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?a_hdw = "a!hd w"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?qs_a = "step (hd b) ?a_hdb"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?qs_ss = "step (hd w) ?ss_hdw"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?qs_ss_hdb = "step (hd b) ?ss_hdb"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?q_a_wl = "{q. \<exists>t.(q,t)\<in>set ?qs_a \<and> t \<squnion>\<^bsub>f\<^esub> (a!q) \<noteq> a!q}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
let ?q_ss_wl = "{q. \<exists>t.(q,t)\<in>set ?qs_ss \<and> t \<squnion>\<^bsub>f\<^esub> (ss!q) \<noteq> ss!q}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from a_in_A len_eq
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
length a = n
[PROOF STEP]
have a_in_list_nA: "a \<in> nlists n A"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
length a = n

goal (1 subgoal):
 1. a \<in> nlists n A
[PROOF STEP]
by (auto intro: nlistsI)
[PROOF STATE]
proof (state)
this:
a \<in> nlists n A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from a_in_A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
[PROOF STEP]
have "\<forall>p< length a. a!p \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A

goal (1 subgoal):
 1. \<forall>p<length a. a ! p \<in> A
[PROOF STEP]
by (auto simp add:A_def)
[PROOF STATE]
proof (state)
this:
\<forall>p<length a. a ! p \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>p<length a. a ! p \<in> A
[PROOF STEP]
have a_p_subset: "\<forall>p< length a. set (a!p) \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
\<forall>p<length a. a ! p \<in> A

goal (1 subgoal):
 1. \<forall>p<length a. set (a ! p) \<subseteq> set nodes
[PROOF STEP]
by (auto simp add:inpow_subset_nodes A_def)
[PROOF STATE]
proof (state)
this:
\<forall>p<length a. set (a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from a_in_A ass sorted_b len_eq b_lt_n  b_n_nil
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
Sorted_Less.sorted b
length a = n
\<forall>x\<in>set b. x < n
b \<noteq> []
[PROOF STEP]
have wf_a_b: "wf_dom a b"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
Sorted_Less.sorted b
length a = n
\<forall>x\<in>set b. x < n
b \<noteq> []

goal (1 subgoal):
 1. wf_dom a b
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
wf_dom a b

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with b_n_nil
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> []
wf_dom a b
[PROOF STEP]
have a_hd_b_neq_all: "?a_hdb \<noteq> rev [0..<n]"
                and sorted_hd_b_cons: "sorted (rev (hd b # ?a_hdb))"
                and hd_b_cons_in_nodes: "set (hd b # ?a_hdb) \<subseteq> set nodes"
                and hd_b_cons_in_A: "hd b # ?a_hdb \<in> A"
                and step_pres_bounded: "(\<forall>(q, \<tau>)\<in>set (step (hd b) ?a_hdb). q < length a \<and> \<tau> \<in> A)"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> []
wf_dom a b

goal (1 subgoal):
 1. (a ! hd b \<noteq> rev [0..<n] &&& Sorted_Less.sorted (rev (hd b # a ! hd b))) &&& set (hd b # a ! hd b) \<subseteq> set nodes &&& hd b # a ! hd b \<in> A &&& \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
[PROOF STEP]
using propa_dom_invariant_auxi
[PROOF STATE]
proof (prove)
using this:
b \<noteq> []
wf_dom a b
\<lbrakk>wf_dom ?a ?b; ?b \<noteq> []\<rbrakk> \<Longrightarrow> ?a ! hd ?b \<noteq> rev [0..<n] \<and> Sorted_Less.sorted (rev (hd ?b # ?a ! hd ?b)) \<and> set (hd ?b # ?a ! hd ?b) \<subseteq> set nodes \<and> hd ?b # ?a ! hd ?b \<in> A \<and> (\<forall>(q, \<tau>)\<in>set (step (hd ?b) (?a ! hd ?b)). q < length ?a \<and> \<tau> \<in> A)

goal (1 subgoal):
 1. (a ! hd b \<noteq> rev [0..<n] &&& Sorted_Less.sorted (rev (hd b # a ! hd b))) &&& set (hd b # a ! hd b) \<subseteq> set nodes &&& hd b # a ! hd b \<in> A &&& \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! hd b \<noteq> rev [0..<n]
Sorted_Less.sorted (rev (hd b # a ! hd b))
set (hd b # a ! hd b) \<subseteq> set nodes
hd b # a ! hd b \<in> A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! hd b \<noteq> rev [0..<n]
Sorted_Less.sorted (rev (hd b # a ! hd b))
set (hd b # a ! hd b) \<subseteq> set nodes
hd b # a ! hd b \<in> A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
[PROOF STEP]
have hdb_subset_n: "set (hd b # ?a_hdb) \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
a ! hd b \<noteq> rev [0..<n]
Sorted_Less.sorted (rev (hd b # a ! hd b))
set (hd b # a ! hd b) \<subseteq> set nodes
hd b # a ! hd b \<in> A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A

goal (1 subgoal):
 1. set (hd b # a ! hd b) \<subseteq> {0..<n}
[PROOF STEP]
using nodes_def verts_set n_def
[PROOF STATE]
proof (prove)
using this:
a ! hd b \<noteq> rev [0..<n]
Sorted_Less.sorted (rev (hd b # a ! hd b))
set (hd b # a ! hd b) \<subseteq> set nodes
hd b # a ! hd b \<in> A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
nodes \<equiv> g_V G
set (g_V G) = {0..<length (g_V G)}
n \<equiv> length nodes

goal (1 subgoal):
 1. set (hd b # a ! hd b) \<subseteq> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (hd b # a ! hd b) \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from b_lt_n b_n_nil
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set b. x < n
b \<noteq> []
[PROOF STEP]
have hd_b_lt_n: "hd b < n"
                       and tl_b_lt_n: "\<forall>x\<in> set (tl b). x < n"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set b. x < n
b \<noteq> []

goal (1 subgoal):
 1. hd b < n &&& \<forall>x\<in>set (tl b). x < n
[PROOF STEP]
by (induct b)(auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
hd b < n
\<forall>x\<in>set (tl b). x < n

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd b < n
\<forall>x\<in>set (tl b). x < n
[PROOF STEP]
have dist: "distinct (map fst ?qs_a)"
[PROOF STATE]
proof (prove)
using this:
hd b < n
\<forall>x\<in>set (tl b). x < n

goal (1 subgoal):
 1. distinct (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
using distinct_p
[PROOF STATE]
proof (prove)
using this:
hd b < n
\<forall>x\<in>set (tl b). x < n
?p < n \<longrightarrow> distinct (map fst (step ?p (?ss ! ?p)))

goal (1 subgoal):
 1. distinct (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from b_lt_n len_eq sorted_b
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set b. x < n
length a = n
Sorted_Less.sorted b
[PROOF STEP]
have sorted_tl_b: "sorted (tl b)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set b. x < n
length a = n
Sorted_Less.sorted b

goal (1 subgoal):
 1. Sorted_Less.sorted (tl b)
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (tl b)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from b_lt_n verts n_def nodes_def verts_set
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set b. x < n
g_V G = [0..<length (g_V G)]
n \<equiv> length nodes
nodes \<equiv> g_V G
set (g_V G) = {0..<length (g_V G)}
[PROOF STEP]
have b_in_verts: "\<forall>x\<in>set b. x \<in> set (g_V G)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set b. x < n
g_V G = [0..<length (g_V G)]
n \<equiv> length nodes
nodes \<equiv> g_V G
set (g_V G) = {0..<length (g_V G)}

goal (1 subgoal):
 1. \<forall>x\<in>set b. x \<in> set (g_V G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set b. x \<in> set (g_V G)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set b. x \<in> set (g_V G)
[PROOF STEP]
have hd_b_in_verts: "hd b \<in> set (g_V G)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set b. x \<in> set (g_V G)

goal (1 subgoal):
 1. hd b \<in> set (g_V G)
[PROOF STEP]
using b_n_nil
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set b. x \<in> set (g_V G)
b \<noteq> []

goal (1 subgoal):
 1. hd b \<in> set (g_V G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b \<in> set (g_V G)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd b \<in> set (g_V G)
[PROOF STEP]
have fin_succ_hd_b: "finite (succs (hd b))"
[PROOF STATE]
proof (prove)
using this:
hd b \<in> set (g_V G)

goal (1 subgoal):
 1. finite (succs (hd b))
[PROOF STEP]
using fin_succs
[PROOF STATE]
proof (prove)
using this:
hd b \<in> set (g_V G)
\<forall>v\<in>set (g_V G). finite (succs v)

goal (1 subgoal):
 1. finite (succs (hd b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (succs (hd b))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have fin_q1: "finite {q. \<exists>t.(q,t)\<in>set ?qs_a}"
   and fin_q2: "finite ?q_a_wl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))} &&& finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
by (auto simp add:step_def exec_def image_def)
[PROOF STATE]
proof (state)
this:
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
have fin: "finite (?q_a_wl \<union> set (tl b))"
[PROOF STATE]
proof (prove)
using this:
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
finite {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from a_in_A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
[PROOF STEP]
have set_a: "set a \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A

goal (1 subgoal):
 1. set a \<subseteq> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set a \<subseteq> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with step_pres_bounded sorted_tl_b len_eq dist
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
length a = n
distinct (map fst (step (hd b) (a ! hd b)))
set a \<subseteq> A
[PROOF STEP]
have "\<forall>(q, \<tau>) \<in> set ?qs_a. (fst(propa f ?qs_a a (tl b)))!q = \<tau> \<squnion>\<^bsub>f\<^esub>a!q"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
length a = n
distinct (map fst (step (hd b) (a ! hd b)))
set a \<subseteq> A

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
by (auto dest:propa_property1)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with propa
[PROOF STATE]
proof (chain)
picking this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have propa_ss1: "\<forall>(q, \<tau>) \<in> set ?qs_a. ss!q = \<tau> \<squnion>\<^bsub>f\<^esub>a!q"
[PROOF STATE]
proof (prove)
using this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have propa_ss1': "\<forall>(q, \<tau>) \<in> set ?qs_a. ss!q =  (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub>a!q"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
by (auto simp add:step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have succ_self_eq: "\<forall>(q, \<tau>) \<in> set ?qs_a. q = hd b \<longrightarrow> ss!q = a!q"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q = hd b \<longrightarrow> ss ! q = a ! q
[PROOF STEP]
by(auto simp add: f_def nodes_sup_def plussub_def inter_sorted_cons[OF sorted_hd_b_cons])
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q = hd b \<longrightarrow> ss ! q = a ! q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have step_hd_b: "\<forall>(q,\<tau>)\<in>set ?qs_a. \<tau> = (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). \<tau> = hd b # a ! hd b
[PROOF STEP]
by(auto simp add:step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). \<tau> = hd b # a ! hd b

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from step_pres_bounded sorted_tl_b set_a len_eq dist
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A
length a = n
distinct (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
have  "\<And>q. q \<notin> set(map fst ?qs_a) \<Longrightarrow> q < length a \<Longrightarrow> (fst(propa f ?qs_a a (tl b)))!q = a!q"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A
length a = n
distinct (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. \<And>q. \<lbrakk>q \<notin> set (map fst (step (hd b) (a ! hd b))); q < length a\<rbrakk> \<Longrightarrow> fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! q = a ! q
[PROOF STEP]
by (auto intro:propa_property2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! ?q = a ! ?q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with propa
[PROOF STATE]
proof (chain)
picking this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! ?q = a ! ?q
[PROOF STEP]
have exec2: "\<And>q. q \<notin> set(map fst ?qs_a) \<Longrightarrow> q < length a \<Longrightarrow> ss!q = a!q"
[PROOF STATE]
proof (prove)
using this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> fst (propa f (step (hd b) (a ! hd b)) a (tl b)) ! ?q = a ! ?q

goal (1 subgoal):
 1. \<And>q. \<lbrakk>q \<notin> set (map fst (step (hd b) (a ! hd b))); q < length a\<rbrakk> \<Longrightarrow> ss ! q = a ! q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
[PROOF STEP]
have ss_hd_b_eq_a: "ss!hd b = a!hd b"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q

goal (1 subgoal):
 1. ss ! hd b = a ! hd b
[PROOF STEP]
using hd_b_lt_n len_eq  fin_succ_hd_b succ_self_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
hd b < n
length a = n
finite (succs (hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q = hd b \<longrightarrow> ss ! q = a ! q

goal (1 subgoal):
 1. ss ! hd b = a ! hd b
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! hd b = a ! hd b

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ss ! hd b = a ! hd b
[PROOF STEP]
have hdb_nin_w: "hd b \<notin> ?q_a_wl"
[PROOF STATE]
proof (prove)
using this:
ss ! hd b = a ! hd b

goal (1 subgoal):
 1. hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
using fin_succ_hd_b propa_ss1
[PROOF STATE]
proof (prove)
using this:
ss ! hd b = a ! hd b
finite (succs (hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from step_pres_bounded sorted_tl_b set_a
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A
[PROOF STEP]
have "snd (propa f ?qs_a a (tl b)) = (sorted_list_of_set (?q_a_wl \<union> set (tl b)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A

goal (1 subgoal):
 1. snd (propa f (step (hd b) (a ! hd b)) a (tl b)) = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
by (fastforce dest:decomp_propa)
[PROOF STATE]
proof (state)
this:
snd (propa f (step (hd b) (a ! hd b)) a (tl b)) = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with propa
[PROOF STATE]
proof (chain)
picking this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
snd (propa f (step (hd b) (a ! hd b)) a (tl b)) = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
have ww: "w = sorted_list_of_set (?q_a_wl \<union> set (tl b))"
[PROOF STATE]
proof (prove)
using this:
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
snd (propa f (step (hd b) (a ! hd b)) a (tl b)) = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
have sorted_w:"sorted w"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. Sorted_Less.sorted w
[PROOF STEP]
by (simp add:sorted_less_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted w

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from ww
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
have set_ww: "set w =?q_a_wl \<union> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with step_pres_bounded tl_b_lt_n ww fin len_eq
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
\<forall>x\<in>set (tl b). x < n
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
length a = n
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
[PROOF STEP]
have w_lt_n: "(\<forall>x\<in>set w. x < n)"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
\<forall>x\<in>set (tl b). x < n
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
length a = n
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)

goal (1 subgoal):
 1. \<forall>x\<in>set w. x < n
[PROOF STEP]
using len_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
\<forall>x\<in>set (tl b). x < n
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
length a = n
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
length a = n

goal (1 subgoal):
 1. \<forall>x\<in>set w. x < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set w. x < n

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set w. x < n
[PROOF STEP]
have w_set': "\<forall>x\<in>set w. x \<in> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set w. x < n

goal (1 subgoal):
 1. \<forall>x\<in>set w. x \<in> {0..<n}
[PROOF STEP]
using verts_set len_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set w. x < n
set (g_V G) = {0..<length (g_V G)}
length a = n

goal (1 subgoal):
 1. \<forall>x\<in>set w. x \<in> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set w. x \<in> {0..<n}

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set w. x \<in> {0..<n}
[PROOF STEP]
have w_set: "set w \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set w. x \<in> {0..<n}

goal (1 subgoal):
 1. set w \<subseteq> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set w \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from sorted_b
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted b
[PROOF STEP]
have hd_b_nin_tl_b: "hd b \<notin> set (tl b) "
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted b

goal (1 subgoal):
 1. hd b \<notin> set (tl b)
[PROOF STEP]
by (induct b) (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
hd b \<notin> set (tl b)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with hdb_nin_w ww
[PROOF STATE]
proof (chain)
picking this:
hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
hd b \<notin> set (tl b)
[PROOF STEP]
have "hd b \<notin> set w"
[PROOF STATE]
proof (prove)
using this:
hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
hd b \<notin> set (tl b)

goal (1 subgoal):
 1. hd b \<notin> set w
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
hd b \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
hd b \<notin> set (tl b)
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. hd b \<notin> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b \<notin> set w

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from step_pres_bounded sorted_tl_b set_a propa
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
[PROOF STEP]
have ss_merge: "ss = merges f ?qs_a a"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
Sorted_Less.sorted (tl b)
set a \<subseteq> A
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)

goal (1 subgoal):
 1. ss = merges f (step (hd b) (a ! hd b)) a
[PROOF STEP]
by (auto dest: decomp_propa)
[PROOF STATE]
proof (state)
this:
ss = merges f (step (hd b) (a ! hd b)) a

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from step_pres_bounded a_in_list_nA
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
a \<in> nlists n A
[PROOF STEP]
have "\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
a \<in> nlists n A

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A
[PROOF STEP]
using len_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < length a \<and> \<tau> \<in> A
a \<in> nlists n A
length a = n

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with a_in_list_nA
[PROOF STATE]
proof (chain)
picking this:
a \<in> nlists n A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A
[PROOF STEP]
have "merges f ?qs_a a  \<in> nlists n A"
[PROOF STATE]
proof (prove)
using this:
a \<in> nlists n A
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). q < n \<and> \<tau> \<in> A

goal (1 subgoal):
 1. merges f (step (hd b) (a ! hd b)) a \<in> nlists n A
[PROOF STEP]
by (rule Semilat.merges_preserves_type[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
merges f (step (hd b) (a ! hd b)) a \<in> nlists n A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with ss_merge
[PROOF STATE]
proof (chain)
picking this:
ss = merges f (step (hd b) (a ! hd b)) a
merges f (step (hd b) (a ! hd b)) a \<in> nlists n A
[PROOF STEP]
have ss_in_A: "ss \<in> nlists n A"
[PROOF STATE]
proof (prove)
using this:
ss = merges f (step (hd b) (a ! hd b)) a
merges f (step (hd b) (a ! hd b)) a \<in> nlists n A

goal (1 subgoal):
 1. ss \<in> nlists n A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ss \<in> nlists n A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ss \<in> nlists n A
[PROOF STEP]
have len_ss_n: "length ss = n"
[PROOF STATE]
proof (prove)
using this:
ss \<in> nlists n A

goal (1 subgoal):
 1. length ss = n
[PROOF STEP]
using  len_eq
[PROOF STATE]
proof (prove)
using this:
ss \<in> nlists n A
length a = n

goal (1 subgoal):
 1. length ss = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ss = n

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
with len_eq
[PROOF STATE]
proof (chain)
picking this:
length a = n
length ss = n
[PROOF STEP]
have len_ss_n: "length ss = n"
[PROOF STATE]
proof (prove)
using this:
length a = n
length ss = n

goal (1 subgoal):
 1. length ss = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length ss = n

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from ss_in_A
[PROOF STATE]
proof (chain)
picking this:
ss \<in> nlists n A
[PROOF STEP]
have set_ss: "set ss \<subseteq> A "
[PROOF STATE]
proof (prove)
using this:
ss \<in> nlists n A

goal (1 subgoal):
 1. set ss \<subseteq> A
[PROOF STEP]
by (rule nlistsE_set)
[PROOF STATE]
proof (state)
this:
set ss \<subseteq> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set ss \<subseteq> A
[PROOF STEP]
have ss_inA:  "\<forall>\<tau>\<in>set ss. \<tau> \<in> A"
[PROOF STATE]
proof (prove)
using this:
set ss \<subseteq> A

goal (1 subgoal):
 1. \<forall>\<tau>\<in>set ss. \<tau> \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
[PROOF STEP]
have ss_p_subset: "\<forall>p< length ss.  set (ss!p) \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A

goal (1 subgoal):
 1. \<forall>p<length ss. set (ss ! p) \<subseteq> set nodes
[PROOF STEP]
by (auto simp add:inpow_subset_nodes A_def)
[PROOF STATE]
proof (state)
this:
\<forall>p<length ss. set (ss ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from w_lt_n len_ss_n
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set w. x < n
length ss = n
[PROOF STEP]
have bounded_a: "\<And>a b.  w \<noteq> [] \<Longrightarrow> (a, b) \<in> set ?qs_ss \<Longrightarrow> a < length ss"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set w. x < n
length ss = n

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>w \<noteq> []; (a, b) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> a < length ss
[PROOF STEP]
by (auto simp add:bounded_exec')
[PROOF STATE]
proof (state)
this:
\<lbrakk>w \<noteq> []; (?a, ?b) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?a < length ss

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have sorted_a_hdw_n: "w \<noteq> [] \<longrightarrow> sorted (rev ?a_hdw)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
using wf_a_b len_eq w_set'
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
length a = n
\<forall>x\<in>set w. x \<in> {0..<n}

goal (1 subgoal):
 1. w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (a ! hd w))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have sorted_ss_hdw_n: "w \<noteq> [] \<longrightarrow> sorted (rev ?ss_hdw)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (ss ! hd w))
[PROOF STEP]
using ss_in_A inA_is_sorted w_lt_n
[PROOF STATE]
proof (prove)
using this:
ss \<in> nlists n A
?xs \<in> A \<Longrightarrow> Sorted_Less.sorted (rev ?xs)
\<forall>x\<in>set w. x < n

goal (1 subgoal):
 1. w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (ss ! hd w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (ss ! hd w))

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have "w \<noteq> [] \<longrightarrow> (hd w # ?ss_hdw) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> [] \<longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
assume w_n_nil: "w \<noteq> []"
[PROOF STATE]
proof (state)
this:
w \<noteq> []

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with w_lt_n
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set w. x < n
w \<noteq> []
[PROOF STEP]
have hd_w_lt_n: "hd w < n"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set w. x < n
w \<noteq> []

goal (1 subgoal):
 1. hd w < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd w < n

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with a_in_A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
hd w < n
[PROOF STEP]
have a_hdw_inA: "?a_hdw \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
hd w < n

goal (1 subgoal):
 1. a ! hd w \<in> A
[PROOF STEP]
using len_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
hd w < n
length a = n

goal (1 subgoal):
 1. a ! hd w \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! hd w \<in> A

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! hd w \<in> A
[PROOF STEP]
have a_hdw_in_nodes: "set ?a_hdw \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
a ! hd w \<in> A

goal (1 subgoal):
 1. set (a ! hd w) \<subseteq> set nodes
[PROOF STEP]
by (unfold A_def )(rule inpow_subset_nodes)
[PROOF STATE]
proof (state)
this:
set (a ! hd w) \<subseteq> set nodes

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from hd_w_lt_n
[PROOF STATE]
proof (chain)
picking this:
hd w < n
[PROOF STEP]
have hdw_in_nodes: "hd w \<in> set nodes"
[PROOF STATE]
proof (prove)
using this:
hd w < n

goal (1 subgoal):
 1. hd w \<in> set nodes
[PROOF STEP]
using verts_set
[PROOF STATE]
proof (prove)
using this:
hd w < n
set (g_V G) = {0..<length (g_V G)}

goal (1 subgoal):
 1. hd w \<in> set nodes
[PROOF STEP]
by (simp add:n_def nodes_def)
[PROOF STATE]
proof (state)
this:
hd w \<in> set nodes

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from sorted_a_hdw_n w_n_nil
[PROOF STATE]
proof (chain)
picking this:
w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (a ! hd w))
w \<noteq> []
[PROOF STEP]
have sorted_a_hdw: "sorted (rev ?a_hdw)"
[PROOF STATE]
proof (prove)
using this:
w \<noteq> [] \<longrightarrow> Sorted_Less.sorted (rev (a ! hd w))
w \<noteq> []

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (a ! hd w))

goal (1 subgoal):
 1. w \<noteq> [] \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
show "(hd w # ?ss_hdw) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd w # ss ! hd w \<in> A
[PROOF STEP]
proof(cases "hd w \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
hd w \<in> succs (hd b)

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd w \<in> succs (hd b)
[PROOF STEP]
obtain s where s: "(hd w, s) \<in> set ?qs_a"
[PROOF STATE]
proof (prove)
using this:
hd w \<in> succs (hd b)

goal (1 subgoal):
 1. (\<And>s. (hd w, s) \<in> set (step (hd b) (a ! hd b)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
hd w \<in> succs (hd b)
finite (succs (hd b))

goal (1 subgoal):
 1. (\<And>s. (hd w, s) \<in> set (step (hd b) (a ! hd b)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
(hd w, s) \<in> set (step (hd b) (a ! hd b))

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with step_hd_b
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). \<tau> = hd b # a ! hd b
(hd w, s) \<in> set (step (hd b) (a ! hd b))
[PROOF STEP]
have "s = (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). \<tau> = hd b # a ! hd b
(hd w, s) \<in> set (step (hd b) (a ! hd b))

goal (1 subgoal):
 1. s = hd b # a ! hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s = hd b # a ! hd b

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with s propa_ss1
[PROOF STATE]
proof (chain)
picking this:
(hd w, s) \<in> set (step (hd b) (a ! hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
s = hd b # a ! hd b
[PROOF STEP]
have ss_hd_w: "?ss_hdw = (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_hdw"
[PROOF STATE]
proof (prove)
using this:
(hd w, s) \<in> set (step (hd b) (a ! hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
s = hd b # a ! hd b

goal (1 subgoal):
 1. ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with hd_b_cons_in_A a_hdw_inA
[PROOF STATE]
proof (chain)
picking this:
hd b # a ! hd b \<in> A
a ! hd w \<in> A
ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w
[PROOF STEP]
have "?ss_hdw \<in> A"
[PROOF STATE]
proof (prove)
using this:
hd b # a ! hd b \<in> A
a ! hd w \<in> A
ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w

goal (1 subgoal):
 1. ss ! hd w \<in> A
[PROOF STEP]
by (simp add: Semilat.closed_f[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
ss ! hd w \<in> A

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ss ! hd w \<in> A
[PROOF STEP]
have ss_hdw_in_nodes: "set ?ss_hdw \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
ss ! hd w \<in> A

goal (1 subgoal):
 1. set (ss ! hd w) \<subseteq> set nodes
[PROOF STEP]
by (auto simp add:inpow_subset_nodes A_def)
[PROOF STATE]
proof (state)
this:
set (ss ! hd w) \<subseteq> set nodes

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with hdw_in_nodes
[PROOF STATE]
proof (chain)
picking this:
hd w \<in> set nodes
set (ss ! hd w) \<subseteq> set nodes
[PROOF STEP]
have hdw_cons_ss_in_nodes: "set (hd w # ?ss_hdw) \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
hd w \<in> set nodes
set (ss ! hd w) \<subseteq> set nodes

goal (1 subgoal):
 1. set (hd w # ss ! hd w) \<subseteq> set nodes
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (hd w # ss ! hd w) \<subseteq> set nodes

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (hd w # ss ! hd w) \<subseteq> set nodes
[PROOF STEP]
have in_pow: "set (hd w # ?ss_hdw) \<in> Pow (set (g_V G))"
[PROOF STATE]
proof (prove)
using this:
set (hd w # ss ! hd w) \<subseteq> set nodes

goal (1 subgoal):
 1. set (hd w # ss ! hd w) \<in> Pow (set (g_V G))
[PROOF STEP]
by (auto simp add:nodes_def)
[PROOF STATE]
proof (state)
this:
set (hd w # ss ! hd w) \<in> Pow (set (g_V G))

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from sorted_a_hdw ss_hd_w sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (a ! hd w))
ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w
Sorted_Less.sorted (rev (hd b # a ! hd b))
[PROOF STEP]
have "sorted (rev ?ss_hdw)" and "set ?ss_hdw = set (hd b # ?a_hdb) \<inter> set ?a_hdw"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (a ! hd w))
ss ! hd w = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! hd w
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! hd w)) &&& set (ss ! hd w) = set (hd b # a ! hd b) \<inter> set (a ! hd w)
[PROOF STEP]
by (auto simp add:f_def plussub_def nodes_sup_def inter_sorted_correct)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! hd w))
set (ss ! hd w) = set (hd b # a ! hd b) \<inter> set (a ! hd w)

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (ss ! hd w))
set (ss ! hd w) = set (hd b # a ! hd b) \<inter> set (a ! hd w)
[PROOF STEP]
have sorted_ss_hdw: "sorted (rev ?ss_hdw)"
            and ss_hdw_subset_a_hdb_cons: "set ?ss_hdw \<subseteq> set (hd b # ?a_hdb)"
            and ss_hdw_subset_a_hdw: "set ?ss_hdw \<subseteq> set ?a_hdw"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (ss ! hd w))
set (ss ! hd w) = set (hd b # a ! hd b) \<inter> set (a ! hd w)

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! hd w)) &&& set (ss ! hd w) \<subseteq> set (hd b # a ! hd b) &&& set (ss ! hd w) \<subseteq> set (a ! hd w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! hd w))
set (ss ! hd w) \<subseteq> set (hd b # a ! hd b)
set (ss ! hd w) \<subseteq> set (a ! hd w)

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from  sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
[PROOF STEP]
have "\<forall>x\<in> set (hd b # ?a_hdb). x \<le> hd b"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. \<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b
[PROOF STEP]
using b_n_nil
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
b \<noteq> []

goal (1 subgoal):
 1. \<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b
[PROOF STEP]
by (induct b) (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with ss_hdw_subset_a_hdb_cons
[PROOF STATE]
proof (chain)
picking this:
set (ss ! hd w) \<subseteq> set (hd b # a ! hd b)
\<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b
[PROOF STEP]
have ss_hdw_lt_hdb: "\<forall>x\<in>set ?ss_hdw. x \<le> hd b"
[PROOF STATE]
proof (prove)
using this:
set (ss ! hd w) \<subseteq> set (hd b # a ! hd b)
\<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! hd w). x \<le> hd b
[PROOF STEP]
using sorted_hd_b_cons
[PROOF STATE]
proof (prove)
using this:
set (ss ! hd w) \<subseteq> set (hd b # a ! hd b)
\<forall>x\<in>set (hd b # a ! hd b). x \<le> hd b
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! hd w). x \<le> hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! hd w). x \<le> hd b

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
have sorted_rev_hdw: "sorted (rev (hd w # ?ss_hdw))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
proof(cases "?a_hdw = rev [0..<n]")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a ! hd w = rev [0..<n]

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! hd w = rev [0..<n]
[PROOF STEP]
have "\<exists>x\<in> set b. (x,hd w)\<in> g_E G \<and> x < hd w"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w = rev [0..<n]

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
using hd_w_lt_n
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w = rev [0..<n]
hd w < n

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
obtain prev_hd_w where prev_hd_w_in_b: "prev_hd_w \<in> set b"
                                and prev_hd_w: "(prev_hd_w, hd w)\<in> g_E G"
                                and prev_hd_w_lt: "prev_hd_w < hd w"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w

goal (1 subgoal):
 1. (\<And>prev_hd_w. \<lbrakk>prev_hd_w \<in> set b; (prev_hd_w, hd w) \<in> g_E G; prev_hd_w < hd w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<in> set b
(prev_hd_w, hd w) \<in> g_E G
prev_hd_w < hd w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
proof(cases "prev_hd_w = hd b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prev_hd_w = hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
prev_hd_w = hd b

goal (2 subgoals):
 1. prev_hd_w = hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_lt
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w < hd w
prev_hd_w = hd b
[PROOF STEP]
have "hd b < hd w"
[PROOF STATE]
proof (prove)
using this:
prev_hd_w < hd w
prev_hd_w = hd b

goal (1 subgoal):
 1. hd b < hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b < hd w

goal (2 subgoals):
 1. prev_hd_w = hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with ss_hdw_lt_hdb
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set (ss ! hd w). x \<le> hd b
hd b < hd w
[PROOF STEP]
have "\<forall>x\<in>set ?ss_hdw. hd w > x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set (ss ! hd w). x \<le> hd b
hd b < hd w

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (2 subgoals):
 1. prev_hd_w = hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with sorted_ss_hdw
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
by (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
prev_hd_w \<noteq> hd b

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_in_b
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w \<in> set b
prev_hd_w \<noteq> hd b
[PROOF STEP]
have "prev_hd_w \<in> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
prev_hd_w \<in> set b
prev_hd_w \<noteq> hd b

goal (1 subgoal):
 1. prev_hd_w \<in> set (tl b)
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<in> set (tl b)

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with ww
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
prev_hd_w \<in> set (tl b)
[PROOF STEP]
have prev_hd_w_nin_w: "prev_hd_w \<in> set w"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
prev_hd_w \<in> set (tl b)

goal (1 subgoal):
 1. prev_hd_w \<in> set w
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
prev_hd_w \<in> set (tl b)
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. prev_hd_w \<in> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<in> set w

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
from sorted_w
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted w
[PROOF STEP]
have "\<forall>x\<in> set w. x \<ge> hd w"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted w

goal (1 subgoal):
 1. \<forall>x\<in>set w. hd w \<le> x
[PROOF STEP]
by(induct w) (auto simp add:sorted_wrt_append sorted_less_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set w. hd w \<le> x

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_lt
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w < hd w
\<forall>x\<in>set w. hd w \<le> x
[PROOF STEP]
have "prev_hd_w \<notin> set w"
[PROOF STATE]
proof (prove)
using this:
prev_hd_w < hd w
\<forall>x\<in>set w. hd w \<le> x

goal (1 subgoal):
 1. prev_hd_w \<notin> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<notin> set w

goal (1 subgoal):
 1. prev_hd_w \<noteq> hd b \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_nin_w
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w \<in> set w
prev_hd_w \<notin> set w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prev_hd_w \<in> set w
prev_hd_w \<notin> set w

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a ! hd w \<noteq> rev [0..<n]

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]
[PROOF STEP]
have "(\<forall>x\<in>set ?a_hdw. x < hd w)"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! hd w). x < hd w
[PROOF STEP]
using hd_w_lt_n
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]
hd w < n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! hd w). x < hd w
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a ! hd w). x < hd w

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with ss_hdw_subset_a_hdw
[PROOF STATE]
proof (chain)
picking this:
set (ss ! hd w) \<subseteq> set (a ! hd w)
\<forall>x\<in>set (a ! hd w). x < hd w
[PROOF STEP]
have "(\<forall>x\<in>set ?ss_hdw. x < hd w)"
[PROOF STATE]
proof (prove)
using this:
set (ss ! hd w) \<subseteq> set (a ! hd w)
\<forall>x\<in>set (a ! hd w). x < hd w

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with sorted_ss_hdw
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
by (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (2 subgoals):
 1. hd w \<in> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
 2. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with hdw_cons_ss_in_nodes
[PROOF STATE]
proof (chain)
picking this:
set (hd w # ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
show "hd w # ?ss_hdw \<in> A"
[PROOF STATE]
proof (prove)
using this:
set (hd w # ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. hd w # ss ! hd w \<in> A
[PROOF STEP]
using A_def
[PROOF STATE]
proof (prove)
using this:
set (hd w # ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (hd w # ss ! hd w))
A \<equiv> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. hd w # ss ! hd w \<in> A
[PROOF STEP]
by (fastforce dest:subset_nodes_inpow)
[PROOF STATE]
proof (state)
this:
hd w # ss ! hd w \<in> A

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
hd w \<notin> succs (hd b)

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
note hd_w_nin_succ_hdb = this
[PROOF STATE]
proof (state)
this:
hd w \<notin> succs (hd b)

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd w \<notin> succs (hd b)
[PROOF STEP]
have "hd w \<notin> set (map fst ?qs_a)"
[PROOF STATE]
proof (prove)
using this:
hd w \<notin> succs (hd b)

goal (1 subgoal):
 1. hd w \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
hd w \<notin> succs (hd b)
finite (succs (hd b))

goal (1 subgoal):
 1. hd w \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
hd w \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with exec2
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
hd w \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
have ss_hd_w_eq_a: "?ss_hdw = ?a_hdw"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
hd w \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. ss ! hd w = a ! hd w
[PROOF STEP]
using hd_w_lt_n len_ss_n len_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
hd w \<notin> set (map fst (step (hd b) (a ! hd b)))
hd w < n
length ss = n
length a = n

goal (1 subgoal):
 1. ss ! hd w = a ! hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! hd w = a ! hd w

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with a_hdw_in_nodes  sorted_a_hdw
[PROOF STATE]
proof (chain)
picking this:
set (a ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (a ! hd w))
ss ! hd w = a ! hd w
[PROOF STEP]
have ss_hdw_in_nodes: "set ?ss_hdw \<subseteq> set nodes"
                                         and sorted_ss_hdw: "sorted (rev ?ss_hdw)"
[PROOF STATE]
proof (prove)
using this:
set (a ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (a ! hd w))
ss ! hd w = a ! hd w

goal (1 subgoal):
 1. set (ss ! hd w) \<subseteq> set nodes &&& Sorted_Less.sorted (rev (ss ! hd w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (ss ! hd w))

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with hdw_in_nodes
[PROOF STATE]
proof (chain)
picking this:
hd w \<in> set nodes
set (ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (ss ! hd w))
[PROOF STEP]
have hdw_cons_in_nodes: "set (hd w # ?ss_hdw) \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
hd w \<in> set nodes
set (ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (ss ! hd w))

goal (1 subgoal):
 1. set (hd w # ss ! hd w) \<subseteq> set nodes
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
set (hd w # ss ! hd w) \<subseteq> set nodes

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from hd_w_nin_succ_hdb ww
[PROOF STATE]
proof (chain)
picking this:
hd w \<notin> succs (hd b)
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
have hd_w_non: "hd w \<notin>{q. \<exists>t. (q, t) \<in> set ?qs_a \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}"
[PROOF STATE]
proof (prove)
using this:
hd w \<notin> succs (hd b)
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
hd w \<notin> succs (hd b)
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite (succs (hd b))

goal (1 subgoal):
 1. hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
by (auto simp add:step_def exec_def )
[PROOF STATE]
proof (state)
this:
hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
from set_ww hd_w_non
[PROOF STATE]
proof (chain)
picking this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
have hd_w_in_tl_b: "hd w \<in> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. hd w \<in> set (tl b)
[PROOF STEP]
using sorted_tl_b \<open>w \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
hd w \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
Sorted_Less.sorted (tl b)
w \<noteq> []

goal (1 subgoal):
 1. hd w \<in> set (tl b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd w \<in> set (tl b)

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
have sorted_rev_hdw: "sorted (rev (hd w # ?ss_hdw))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
proof(cases "?a_hdw = rev [0..<n]")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a ! hd w = rev [0..<n]

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! hd w = rev [0..<n]
[PROOF STEP]
have "\<exists>x\<in> set b. (x,hd w)\<in> g_E G \<and> x < hd w"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w = rev [0..<n]

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
using hd_w_lt_n
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w = rev [0..<n]
hd w < n

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w
[PROOF STEP]
obtain prev_hd_w where prev_hd_w_in_b: "prev_hd_w \<in> set b"
                                and prev_hd_w:      "(prev_hd_w, hd w)\<in> g_E G"
                                and prev_hd_w_lt:   "prev_hd_w < hd w"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, hd w) \<in> g_E G \<and> x < hd w

goal (1 subgoal):
 1. (\<And>prev_hd_w. \<lbrakk>prev_hd_w \<in> set b; (prev_hd_w, hd w) \<in> g_E G; prev_hd_w < hd w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<in> set b
(prev_hd_w, hd w) \<in> g_E G
prev_hd_w < hd w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
from ww
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
[PROOF STEP]
have "sorted w"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. Sorted_Less.sorted w
[PROOF STEP]
by(simp add:sorted_less_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted w
[PROOF STEP]
have "\<forall>x\<in> set w. x \<ge> hd w"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted w

goal (1 subgoal):
 1. \<forall>x\<in>set w. hd w \<le> x
[PROOF STEP]
using w_n_nil
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted w
w \<noteq> []

goal (1 subgoal):
 1. \<forall>x\<in>set w. hd w \<le> x
[PROOF STEP]
by (induct w) (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set w. hd w \<le> x

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_lt
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w < hd w
\<forall>x\<in>set w. hd w \<le> x
[PROOF STEP]
have prev_hd_w_nin_w: "prev_hd_w \<notin> set w"
[PROOF STATE]
proof (prove)
using this:
prev_hd_w < hd w
\<forall>x\<in>set w. hd w \<le> x

goal (1 subgoal):
 1. prev_hd_w \<notin> set w
[PROOF STEP]
using w_n_nil
[PROOF STATE]
proof (prove)
using this:
prev_hd_w < hd w
\<forall>x\<in>set w. hd w \<le> x
w \<noteq> []

goal (1 subgoal):
 1. prev_hd_w \<notin> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<notin> set w

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with set_ww
[PROOF STATE]
proof (chain)
picking this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
prev_hd_w \<notin> set w
[PROOF STEP]
have "prev_hd_w \<notin> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
prev_hd_w \<notin> set w

goal (1 subgoal):
 1. prev_hd_w \<notin> set (tl b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prev_hd_w \<notin> set (tl b)

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w_in_b
[PROOF STATE]
proof (chain)
picking this:
prev_hd_w \<in> set b
prev_hd_w \<notin> set (tl b)
[PROOF STEP]
have "prev_hd_w = hd b"
[PROOF STATE]
proof (prove)
using this:
prev_hd_w \<in> set b
prev_hd_w \<notin> set (tl b)

goal (1 subgoal):
 1. prev_hd_w = hd b
[PROOF STEP]
using sorted_b
[PROOF STATE]
proof (prove)
using this:
prev_hd_w \<in> set b
prev_hd_w \<notin> set (tl b)
Sorted_Less.sorted b

goal (1 subgoal):
 1. prev_hd_w = hd b
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
prev_hd_w = hd b

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with prev_hd_w
[PROOF STATE]
proof (chain)
picking this:
(prev_hd_w, hd w) \<in> g_E G
prev_hd_w = hd b
[PROOF STEP]
have "(hd b, hd w) \<in> g_E G"
[PROOF STATE]
proof (prove)
using this:
(prev_hd_w, hd w) \<in> g_E G
prev_hd_w = hd b

goal (1 subgoal):
 1. (hd b, hd w) \<in> g_E G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(hd b, hd w) \<in> g_E G

goal (2 subgoals):
 1. a ! hd w = rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
 2. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with hd_w_nin_succ_hdb
[PROOF STATE]
proof (chain)
picking this:
hd w \<notin> succs (hd b)
(hd b, hd w) \<in> g_E G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hd w \<notin> succs (hd b)
(hd b, hd w) \<in> g_E G

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
by (auto simp add:succs_def)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a ! hd w \<noteq> rev [0..<n]

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]
[PROOF STEP]
have a_hdw_lt: "(\<forall>x\<in>set ?a_hdw. x < hd w)"
                     and "sorted (rev ?a_hdw)"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! hd w). x < hd w &&& Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
using hd_w_lt_n
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd w \<noteq> rev [0..<n]
hd w < n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! hd w). x < hd w &&& Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a ! hd w). x < hd w
Sorted_Less.sorted (rev (a ! hd w))

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with ss_hd_w_eq_a
[PROOF STATE]
proof (chain)
picking this:
ss ! hd w = a ! hd w
\<forall>x\<in>set (a ! hd w). x < hd w
Sorted_Less.sorted (rev (a ! hd w))
[PROOF STEP]
have "sorted (rev ?ss_hdw)"
[PROOF STATE]
proof (prove)
using this:
ss ! hd w = a ! hd w
\<forall>x\<in>set (a ! hd w). x < hd w
Sorted_Less.sorted (rev (a ! hd w))

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! hd w))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! hd w))

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
from ss_hd_w_eq_a
[PROOF STATE]
proof (chain)
picking this:
ss ! hd w = a ! hd w
[PROOF STEP]
have "?a_hdw =  ?ss_hdw"
[PROOF STATE]
proof (prove)
using this:
ss ! hd w = a ! hd w

goal (1 subgoal):
 1. a ! hd w = ss ! hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! hd w = ss ! hd w

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with a_hdw_lt
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set (a ! hd w). x < hd w
a ! hd w = ss ! hd w
[PROOF STEP]
have "\<forall>x\<in>set ?ss_hdw. x < hd w"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set (a ! hd w). x < hd w
a ! hd w = ss ! hd w

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (1 subgoal):
 1. a ! hd w \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
with sorted_ss_hdw
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (ss ! hd w))
\<forall>x\<in>set (ss ! hd w). x < hd w

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
by (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. hd w \<notin> succs (hd b) \<Longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
with hdw_cons_in_nodes
[PROOF STATE]
proof (chain)
picking this:
set (hd w # ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (hd w # ss ! hd w))
[PROOF STEP]
show " (hd w # ss ! hd w) \<in> A"
[PROOF STATE]
proof (prove)
using this:
set (hd w # ss ! hd w) \<subseteq> set nodes
Sorted_Less.sorted (rev (hd w # ss ! hd w))

goal (1 subgoal):
 1. hd w # ss ! hd w \<in> A
[PROOF STEP]
by (unfold A_def) (rule subset_nodes_inpow)
[PROOF STATE]
proof (state)
this:
hd w # ss ! hd w \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
hd w # ss ! hd w \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w \<noteq> [] \<longrightarrow> hd w # ss ! hd w \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w \<noteq> [] \<longrightarrow> hd w # ss ! hd w \<in> A
[PROOF STEP]
have pres_ss: "\<And>q \<tau>. w \<noteq> [] \<Longrightarrow> (q, \<tau>) \<in> set (step (hd w) ?ss_hdw) \<Longrightarrow> \<tau> \<in> A"
[PROOF STATE]
proof (prove)
using this:
w \<noteq> [] \<longrightarrow> hd w # ss ! hd w \<in> A

goal (1 subgoal):
 1. \<And>q \<tau>. \<lbrakk>w \<noteq> []; (q, \<tau>) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> \<tau> \<in> A
[PROOF STEP]
by (auto simp add:step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>w \<noteq> []; (?q, ?\<tau>) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?\<tau> \<in> A

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have hd_b_ss_sta: "stable r step ss (hd b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Typing_Framework_1.stable r step ss (hd b)
[PROOF STEP]
proof(unfold stable_def, clarsimp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
fix q \<tau>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
assume "(q, \<tau>) \<in> set ?qs_ss_hdb "
[PROOF STATE]
proof (state)
this:
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))
[PROOF STEP]
have "q \<in> succs (hd b)" and  "\<tau> = transf (hd b) ?ss_hdb"
[PROOF STATE]
proof (prove)
using this:
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))

goal (1 subgoal):
 1. q \<in> succs (hd b) &&& \<tau> = transf (hd b) (ss ! hd b)
[PROOF STEP]
using hd_b_lt_n fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))
hd b < n
finite (succs (hd b))

goal (1 subgoal):
 1. q \<in> succs (hd b) &&& \<tau> = transf (hd b) (ss ! hd b)
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
q \<in> succs (hd b)
\<tau> = transf (hd b) (ss ! hd b)

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> succs (hd b)
\<tau> = transf (hd b) (ss ! hd b)
[PROOF STEP]
have \<tau>:"\<tau> =  (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
q \<in> succs (hd b)
\<tau> = transf (hd b) (ss ! hd b)

goal (1 subgoal):
 1. \<tau> = hd b # a ! hd b
[PROOF STEP]
using ss_hd_b_eq_a
[PROOF STATE]
proof (prove)
using this:
q \<in> succs (hd b)
\<tau> = transf (hd b) (ss ! hd b)
ss ! hd b = a ! hd b

goal (1 subgoal):
 1. \<tau> = hd b # a ! hd b
[PROOF STEP]
by (auto simp add:transf_def)
[PROOF STATE]
proof (state)
this:
\<tau> = hd b # a ! hd b

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from \<open>q \<in> succs (hd b)\<close> hd_b_lt_n
[PROOF STATE]
proof (chain)
picking this:
q \<in> succs (hd b)
hd b < n
[PROOF STEP]
have "q\<in> set (g_V G)"
[PROOF STATE]
proof (prove)
using this:
q \<in> succs (hd b)
hd b < n

goal (1 subgoal):
 1. q \<in> set (g_V G)
[PROOF STEP]
using succ_in_G
[PROOF STATE]
proof (prove)
using this:
q \<in> succs (hd b)
hd b < n
\<forall>v\<in>succs ?n. v \<in> set (g_V G)

goal (1 subgoal):
 1. q \<in> set (g_V G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<in> set (g_V G)

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> set (g_V G)
[PROOF STEP]
have "q < n"
[PROOF STATE]
proof (prove)
using this:
q \<in> set (g_V G)

goal (1 subgoal):
 1. q < n
[PROOF STEP]
using verts_set
[PROOF STATE]
proof (prove)
using this:
q \<in> set (g_V G)
set (g_V G) = {0..<length (g_V G)}

goal (1 subgoal):
 1. q < n
[PROOF STEP]
by (auto simp add:n_def nodes_def)
[PROOF STATE]
proof (state)
this:
q < n

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
q < n
[PROOF STEP]
have a_q_inA: "a!q \<in> A"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
q < n

goal (1 subgoal):
 1. a ! q \<in> A
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
a ! q \<in> A

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from wf_a_b a_hd_b_neq_all hd_b_lt_n
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! hd b \<noteq> rev [0..<n]
hd b < n
[PROOF STEP]
have "\<forall>x\<in> set ( (a!hd b)). x < hd b"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! hd b \<noteq> rev [0..<n]
hd b < n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! hd b). x < hd b
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a ! hd b). x < hd b

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
\<forall>x\<in>set (a ! hd b). x < hd b
[PROOF STEP]
have "sorted (rev (hd b # ?a_hdb))"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
\<forall>x\<in>set (a ! hd b). x < hd b

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (hd b # a ! hd b))
[PROOF STEP]
by (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from propa_ss1 \<open>(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))
[PROOF STEP]
have "ss!q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))

goal (1 subgoal):
 1. ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
using \<open>ss!hd b = a!hd b\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
(q, \<tau>) \<in> set (step (hd b) (ss ! hd b))
ss ! hd b = a ! hd b

goal (1 subgoal):
 1. ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with \<tau>
[PROOF STATE]
proof (chain)
picking this:
\<tau> = hd b # a ! hd b
ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have "ss!q =  (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> a ! q"
[PROOF STATE]
proof (prove)
using this:
\<tau> = hd b # a ! hd b
ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with hd_b_cons_in_A a_q_inA
[PROOF STATE]
proof (chain)
picking this:
hd b # a ! hd b \<in> A
a ! q \<in> A
ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have " (hd b # ?a_hdb)\<sqsubseteq>\<^bsub>r\<^esub> ss!q "
[PROOF STATE]
proof (prove)
using this:
hd b # a ! hd b \<in> A
a ! q \<in> A
ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
by (auto simp add: Semilat.ub1[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. \<And>a ba. (a, ba) \<in> set (step (hd b) (ss ! hd b)) \<Longrightarrow> ba \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with \<tau>
[PROOF STATE]
proof (chain)
picking this:
\<tau> = hd b # a ! hd b
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
show "\<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q"
[PROOF STATE]
proof (prove)
using this:
\<tau> = hd b # a ! hd b
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Typing_Framework_1.stable r step ss (hd b)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
have wf_dom_2: "\<forall>p<n.
        sorted (rev (ss ! p)) \<and>
        (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set ( (ss ! p)). x < p)) \<and>
        (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in> set w. (x,p)\<in> g_E G \<and> x < p)) \<and>
        (p \<notin> set w \<longrightarrow> stable r step ss p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof (intro strip)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
let ?a_p = "a!p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
let ?ss_p = "ss!p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
assume p_lt_n: "p < n"
[PROOF STATE]
proof (state)
this:
p < n

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
p < n
[PROOF STEP]
have a_p_inA: "?a_p \<in> A"
                 and sorted_a_p: "sorted (rev ?a_p)"
                 and sta_a_p: "p \<notin> set b \<longrightarrow> stable r step a p"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
p < n

goal (1 subgoal):
 1. a ! p \<in> A &&& Sorted_Less.sorted (rev (a ! p)) &&& p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
a ! p \<in> A
Sorted_Less.sorted (rev (a ! p))
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from p_lt_n
[PROOF STATE]
proof (chain)
picking this:
p < n
[PROOF STEP]
have "p \<in> set (g_V G)"
[PROOF STATE]
proof (prove)
using this:
p < n

goal (1 subgoal):
 1. p \<in> set (g_V G)
[PROOF STEP]
using verts_set n_def nodes_def
[PROOF STATE]
proof (prove)
using this:
p < n
set (g_V G) = {0..<length (g_V G)}
n \<equiv> length nodes
nodes \<equiv> g_V G

goal (1 subgoal):
 1. p \<in> set (g_V G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<in> set (g_V G)

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> set (g_V G)
[PROOF STEP]
have fin_succ_p: "finite (succs p)"
[PROOF STATE]
proof (prove)
using this:
p \<in> set (g_V G)

goal (1 subgoal):
 1. finite (succs p)
[PROOF STEP]
using fin_succs
[PROOF STATE]
proof (prove)
using this:
p \<in> set (g_V G)
\<forall>v\<in>set (g_V G). finite (succs v)

goal (1 subgoal):
 1. finite (succs p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (succs p)

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from set_a p_lt_n
[PROOF STATE]
proof (chain)
picking this:
set a \<subseteq> A
p < n
[PROOF STEP]
have a_p_inA: "?a_p \<in> A"
[PROOF STATE]
proof (prove)
using this:
set a \<subseteq> A
p < n

goal (1 subgoal):
 1. a ! p \<in> A
[PROOF STEP]
using \<open>length a = n\<close>
[PROOF STATE]
proof (prove)
using this:
set a \<subseteq> A
p < n
length a = n

goal (1 subgoal):
 1. a ! p \<in> A
[PROOF STEP]
by (auto simp add:A_def)
[PROOF STATE]
proof (state)
this:
a ! p \<in> A

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! p \<in> A
[PROOF STEP]
have "set ?a_p \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
a ! p \<in> A

goal (1 subgoal):
 1. set (a ! p) \<subseteq> set nodes
[PROOF STEP]
using inpow_subset_nodes
[PROOF STATE]
proof (prove)
using this:
a ! p \<in> A
?xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> set ?xs \<subseteq> set nodes

goal (1 subgoal):
 1. set (a ! p) \<subseteq> set nodes
[PROOF STEP]
by (auto simp add:A_def)
[PROOF STATE]
proof (state)
this:
set (a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with p_lt_n
[PROOF STATE]
proof (chain)
picking this:
p < n
set (a ! p) \<subseteq> set nodes
[PROOF STEP]
have set_p_a_p: "set (p#?a_p) \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
p < n
set (a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. set (p # a ! p) \<subseteq> set nodes
[PROOF STEP]
using n_def nodes_def verts_set
[PROOF STATE]
proof (prove)
using this:
p < n
set (a ! p) \<subseteq> set nodes
n \<equiv> length nodes
nodes \<equiv> g_V G
set (g_V G) = {0..<length (g_V G)}

goal (1 subgoal):
 1. set (p # a ! p) \<subseteq> set nodes
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (p # a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from p_lt_n len_eq
[PROOF STATE]
proof (chain)
picking this:
p < n
length a = n
[PROOF STEP]
have p_lt_len_a:  "p < length a"
[PROOF STATE]
proof (prove)
using this:
p < n
length a = n

goal (1 subgoal):
 1. p < length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p < length a

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_inA
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
p < length a
[PROOF STEP]
have ss_p_in_A: "ss!p \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
p < length a

goal (1 subgoal):
 1. ss ! p \<in> A
[PROOF STEP]
using len_eq len_ss_n
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
p < length a
length a = n
length ss = n

goal (1 subgoal):
 1. ss ! p \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p \<in> A

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with p_lt_n
[PROOF STATE]
proof (chain)
picking this:
p < n
ss ! p \<in> A
[PROOF STEP]
have sorted_ss_p: "sorted (rev ?ss_p)"
[PROOF STATE]
proof (prove)
using this:
p < n
ss ! p \<in> A

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p))
[PROOF STEP]
by (auto simp add:A_def sorted_less_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p))

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have len_ss_eq_a: "length ss = length a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ss = length a
[PROOF STEP]
using  len_eq len_ss_n
[PROOF STATE]
proof (prove)
using this:
length a = n
length ss = n

goal (1 subgoal):
 1. length ss = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length ss = length a

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have p_nin_w_eq: "p \<notin> set w \<longleftrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<notin> set w) = ((p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<notin> set w \<Longrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
 2. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
assume "p \<notin> set w"
[PROOF STATE]
proof (state)
this:
p \<notin> set w

goal (2 subgoals):
 1. p \<notin> set w \<Longrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
 2. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
with set_ww
[PROOF STATE]
proof (chain)
picking this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
p \<notin> set w
[PROOF STEP]
have p_nin1: "p \<notin> {q. \<exists>t. (q, t) \<in> set ?qs_a\<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}"
                   and p_nin2: "p \<notin> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
p \<notin> set w

goal (1 subgoal):
 1. p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} &&& p \<notin> set (tl b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
p \<notin> set (tl b)

goal (2 subgoals):
 1. p \<notin> set w \<Longrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
 2. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
from p_nin1
[PROOF STATE]
proof (chain)
picking this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}
[PROOF STEP]
have p_nin: "(\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (prove)
using this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q}

goal (1 subgoal):
 1. \<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (2 subgoals):
 1. p \<notin> set w \<Longrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
 2. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
from p_nin2
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set (tl b)
[PROOF STEP]
have  "p \<notin> set b \<or> p = hd b"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set (tl b)

goal (1 subgoal):
 1. p \<notin> set b \<or> p = hd b
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
p \<notin> set b \<or> p = hd b

goal (2 subgoals):
 1. p \<notin> set w \<Longrightarrow> (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
 2. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
with p_nin
[PROOF STATE]
proof (chain)
picking this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
p \<notin> set b \<or> p = hd b
[PROOF STEP]
show "(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set  ?qs_a \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (prove)
using this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
p \<notin> set b \<or> p = hd b

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
assume "(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (state)
this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
have p1: "p \<notin> set b \<or> p = hd b"
            and p2: "\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = ?a_p"
[PROOF STATE]
proof (prove)
using this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. p \<notin> set b \<or> p = hd b &&& \<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set b \<or> p = hd b
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
from p1
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b \<or> p = hd b
[PROOF STEP]
have "p \<notin> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b \<or> p = hd b

goal (1 subgoal):
 1. p \<notin> set (tl b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<notin> set b \<Longrightarrow> p \<notin> set (tl b)
 2. p = hd b \<Longrightarrow> p \<notin> set (tl b)
[PROOF STEP]
assume "p \<notin> set b"
[PROOF STATE]
proof (state)
this:
p \<notin> set b

goal (2 subgoals):
 1. p \<notin> set b \<Longrightarrow> p \<notin> set (tl b)
 2. p = hd b \<Longrightarrow> p \<notin> set (tl b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b

goal (1 subgoal):
 1. p \<notin> set (tl b)
[PROOF STEP]
by(induct b) auto
[PROOF STATE]
proof (state)
this:
p \<notin> set (tl b)

goal (1 subgoal):
 1. p = hd b \<Longrightarrow> p \<notin> set (tl b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p = hd b \<Longrightarrow> p \<notin> set (tl b)
[PROOF STEP]
assume "p = hd b"
[PROOF STATE]
proof (state)
this:
p = hd b

goal (1 subgoal):
 1. p = hd b \<Longrightarrow> p \<notin> set (tl b)
[PROOF STEP]
with sorted_b
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted b
p = hd b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted b
p = hd b

goal (1 subgoal):
 1. p \<notin> set (tl b)
[PROOF STEP]
by (induct b) (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
p \<notin> set (tl b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<notin> set (tl b)

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p) \<Longrightarrow> p \<notin> set w
[PROOF STEP]
with p2 set_ww
[PROOF STATE]
proof (chain)
picking this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
p \<notin> set (tl b)
[PROOF STEP]
show "p \<notin> set w"
[PROOF STATE]
proof (prove)
using this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
p \<notin> set (tl b)

goal (1 subgoal):
 1. p \<notin> set w
[PROOF STEP]
using set_ww
[PROOF STATE]
proof (prove)
using this:
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
p \<notin> set (tl b)
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)

goal (1 subgoal):
 1. p \<notin> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(p \<notin> set w) = ((p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p))

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have stable_ss_p: "p \<notin> set w \<longrightarrow> w \<noteq> Nil \<longrightarrow> stable r step ss p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
proof (clarsimp simp add: stable_def split_paired_all)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
fix q \<tau>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
assume p_nin_w: "p \<notin> set w" and w_n_nil: "w \<noteq> Nil" and step_ss_p: "(q, \<tau>) \<in> set (step p ?ss_p) "
[PROOF STATE]
proof (state)
this:
p \<notin> set w
w \<noteq> []
(q, \<tau>) \<in> set (step p (ss ! p))

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from p_nin_w
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set w
[PROOF STEP]
have p_cond: "(p \<notin> set b \<or> p = hd b) \<and>
                                 (\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow>  (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set w

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
using p_nin_w_eq
[PROOF STATE]
proof (prove)
using this:
p \<notin> set w
(p \<notin> set w) = ((p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> s \<squnion>\<^bsub>f\<^esub> a ! p = a ! p))

goal (1 subgoal):
 1. (p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
by (auto simp add:transf_def step_def exec_def)
[PROOF STATE]
proof (state)
this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
have p_cond1: "(p \<notin> set b \<or> p = hd b)"
            and p_cond2: "(\<forall>s. (p, s) \<in> set ?qs_a \<longrightarrow>  (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p = ?a_p)"
[PROOF STATE]
proof (prove)
using this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. p \<notin> set b \<or> p = hd b &&& \<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set b \<or> p = hd b
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from bounded_a pres_ss w_n_nil
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>w \<noteq> []; (?a, ?b) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?a < length ss
\<lbrakk>w \<noteq> []; (?q, ?\<tau>) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?\<tau> \<in> A
w \<noteq> []
[PROOF STEP]
have " \<forall>(q, t)\<in>set ?qs_ss. q < length ss \<and> t \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>w \<noteq> []; (?a, ?b) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?a < length ss
\<lbrakk>w \<noteq> []; (?q, ?\<tau>) \<in> set (step (hd w) (ss ! hd w))\<rbrakk> \<Longrightarrow> ?\<tau> \<in> A
w \<noteq> []

goal (1 subgoal):
 1. \<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> t \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> t \<in> A

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> t \<in> A
[PROOF STEP]
have "\<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> (transf (hd w) (ss!hd w)) \<in> A"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> t \<in> A

goal (1 subgoal):
 1. \<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> transf (hd w) (ss ! hd w) \<in> A
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, t)\<in>set (step (hd w) (ss ! hd w)). q < length ss \<and> transf (hd w) (ss ! hd w) \<in> A

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
have ss_a_p_eq: "?ss_p = ?a_p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
proof(cases "p \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
note p_in_succ_hd_b = this
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
from \<open>p \<in> succs (hd b)\<close> propa_ss1'
[PROOF STATE]
proof (chain)
picking this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have ss_p: "?ss_p =  (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p"
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
finite (succs (hd b))

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
from p_in_succ_hd_b p_cond2
[PROOF STATE]
proof (chain)
picking this:
p \<in> succs (hd b)
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
have " (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p= ?a_p"
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
finite (succs (hd b))

goal (1 subgoal):
 1. hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with ss_p
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> succs (hd b)

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> succs (hd b)
[PROOF STEP]
have "p \<notin> {q. \<exists>t. (q, t) \<in> set ?qs_a}"
[PROOF STATE]
proof (prove)
using this:
p \<notin> succs (hd b)

goal (1 subgoal):
 1. p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
[PROOF STEP]
using fin fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
p \<notin> succs (hd b)
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
finite (succs (hd b))

goal (1 subgoal):
 1. p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}
[PROOF STEP]
have "p \<notin> set ( map fst ?qs_a)"
[PROOF STATE]
proof (prove)
using this:
p \<notin> {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b))}

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with p_lt_n
[PROOF STATE]
proof (chain)
picking this:
p < n
p \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p < n
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
using exec2 len_eq
[PROOF STATE]
proof (prove)
using this:
p < n
p \<notin> set (map fst (step (hd b) (a ! hd b)))
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
length a = n

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
have "(\<forall>(q, \<tau>)\<in>set (step p ?ss_p). transf p ?ss_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! q) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step p (ss ! p)). transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
proof(intro strip, clarsimp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
fix succ_p z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
let ?a_succ_p = "a!succ_p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
let ?ss_succ_p = "ss!succ_p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
assume "(succ_p, z)  \<in> set (step p ?ss_p)"
[PROOF STATE]
proof (state)
this:
(succ_p, z) \<in> set (step p (ss ! p))

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(succ_p, z) \<in> set (step p (ss ! p))
[PROOF STEP]
have succ_p: "succ_p \<in> succs p"
[PROOF STATE]
proof (prove)
using this:
(succ_p, z) \<in> set (step p (ss ! p))

goal (1 subgoal):
 1. succ_p \<in> succs p
[PROOF STEP]
using p_lt_n fin_succ_p
[PROOF STATE]
proof (prove)
using this:
(succ_p, z) \<in> set (step p (ss ! p))
p < n
finite (succs p)

goal (1 subgoal):
 1. succ_p \<in> succs p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs p

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with p_lt_n
[PROOF STATE]
proof (chain)
picking this:
p < n
succ_p \<in> succs p
[PROOF STEP]
have succ_p_lt_n: "succ_p < n"
[PROOF STATE]
proof (prove)
using this:
p < n
succ_p \<in> succs p

goal (1 subgoal):
 1. succ_p < n
[PROOF STEP]
using succ_in_verts  n_def nodes_def verts_set
[PROOF STATE]
proof (prove)
using this:
p < n
succ_p \<in> succs p
?s \<in> succs ?n \<Longrightarrow> {?s, ?n} \<subseteq> set (g_V G)
n \<equiv> length nodes
nodes \<equiv> g_V G
set (g_V G) = {0..<length (g_V G)}

goal (1 subgoal):
 1. succ_p < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
succ_p < n

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
succ_p < n
[PROOF STEP]
have a_succ_p_inA: "?a_succ_p \<in> A"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
succ_p < n

goal (1 subgoal):
 1. a ! succ_p \<in> A
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
a ! succ_p \<in> A

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
from succ_p_lt_n ss_in_A
[PROOF STATE]
proof (chain)
picking this:
succ_p < n
ss \<in> nlists n A
[PROOF STEP]
have ss_succ_p_inA: "?ss_succ_p \<in> A"
[PROOF STATE]
proof (prove)
using this:
succ_p < n
ss \<in> nlists n A

goal (1 subgoal):
 1. ss ! succ_p \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! succ_p \<in> A

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
have p_nin_b_ssp: "p \<notin> set b \<Longrightarrow> transf p ?ss_p \<in> A \<and> transf p ?ss_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
assume "p \<notin> set b"
[PROOF STATE]
proof (state)
this:
p \<notin> set b

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
with sta_a_p
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p
p \<notin> set b
[PROOF STEP]
have "(\<forall>(q,\<tau>) \<in> set (step p ?a_p). \<tau> \<sqsubseteq>\<^sub>r a!q)"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p
p \<notin> set b

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q
[PROOF STEP]
by (simp add:stable_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
with succ_p
[PROOF STATE]
proof (chain)
picking this:
succ_p \<in> succs p
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q
[PROOF STEP]
have transf_p_succp':"transf p ?a_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q

goal (1 subgoal):
 1. transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
using fin_succ_p
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q
finite (succs p)

goal (1 subgoal):
 1. transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by (auto simp add:stable_def step_def exec_def)
[PROOF STATE]
proof (state)
this:
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
with ss_a_p_eq
[PROOF STATE]
proof (chain)
picking this:
ss ! p = a ! p
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
have transf_lt_p: "transf p ?ss_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
from transf_p_succp'
[PROOF STATE]
proof (chain)
picking this:
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
have "(p# ?a_p) \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p # a ! p \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by (auto simp add:transf_def)
[PROOF STATE]
proof (state)
this:
p # a ! p \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p # a ! p \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
have "sorted (rev (p#?a_p)) \<or> (p#?a_p = ?a_succ_p)"
[PROOF STATE]
proof (prove)
using this:
p # a ! p \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (p # a ! p)) \<or> p # a ! p = a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def transf_def r_def lesssub_def lesub_def nodes_le_def)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (p # a ! p)) \<or> p # a ! p = a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
with set_p_a_p a_succ_p_inA
[PROOF STATE]
proof (chain)
picking this:
set (p # a ! p) \<subseteq> set nodes
a ! succ_p \<in> A
Sorted_Less.sorted (rev (p # a ! p)) \<or> p # a ! p = a ! succ_p
[PROOF STEP]
have "(p#?a_p) \<in> (rev \<circ> sorted_list_of_set) ` (Pow (set nodes))"
[PROOF STATE]
proof (prove)
using this:
set (p # a ! p) \<subseteq> set nodes
a ! succ_p \<in> A
Sorted_Less.sorted (rev (p # a ! p)) \<or> p # a ! p = a ! succ_p

goal (1 subgoal):
 1. p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
using subset_nodes_inpow
[PROOF STATE]
proof (prove)
using this:
set (p # a ! p) \<subseteq> set nodes
a ! succ_p \<in> A
Sorted_Less.sorted (rev (p # a ! p)) \<or> p # a ! p = a ! succ_p
\<lbrakk>Sorted_Less.sorted (rev ?xs); set ?xs \<subseteq> set nodes\<rbrakk> \<Longrightarrow> ?xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
by (auto simp add:A_def)
[PROOF STATE]
proof (state)
this:
p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
have "transf p ?a_p \<in> A"
[PROOF STATE]
proof (prove)
using this:
p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. transf p (a ! p) \<in> A
[PROOF STEP]
using transf_def
[PROOF STATE]
proof (prove)
using this:
p # a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
transf ?n ?input \<equiv> ?n # ?input

goal (1 subgoal):
 1. transf p (a ! p) \<in> A
[PROOF STEP]
by (auto simp add:A_def transf_def)
[PROOF STATE]
proof (state)
this:
transf p (a ! p) \<in> A

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
transf p (a ! p) \<in> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transf p (a ! p) \<in> A

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
using ss_a_p_eq transf_lt_p
[PROOF STATE]
proof (prove)
using this:
transf p (a ! p) \<in> A
ss ! p = a ! p
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (step p (ss ! p)) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
show "transf p ?ss_p \<sqsubseteq>\<^bsub>r\<^esub> ?ss_succ_p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof(cases "p \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
note p_in_succ_hd_b = this
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with p_cond
[PROOF STATE]
proof (chain)
picking this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
p \<in> succs (hd b)
[PROOF STEP]
have " (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p =?a_p"
[PROOF STATE]
proof (prove)
using this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
p \<in> succs (hd b)

goal (1 subgoal):
 1. hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
p \<in> succs (hd b)
finite (succs (hd b))

goal (1 subgoal):
 1. hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
from p_in_succ_hd_b propa_ss1'
[PROOF STATE]
proof (chain)
picking this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
[PROOF STEP]
have ss_p: "?ss_p = (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p"
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
p \<in> succs (hd b)
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
finite (succs (hd b))

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
have transf_p2: "transf p ?ss_p = (p # (inter_sorted_rev (hd b # ?a_hdb) ?a_p))"
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p

goal (1 subgoal):
 1. transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p)
[PROOF STEP]
by (auto simp add:f_def plussub_def nodes_sup_def transf_def )
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p)

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof(cases "succ_p \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<in> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs (hd b)

goal (2 subgoals):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<in> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
note succ_p_is_succ_hdb = this
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs (hd b)

goal (2 subgoals):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<in> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with propa_ss1
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
succ_p \<in> succs (hd b)
[PROOF STEP]
have ss_succ_p: "?ss_succ_p = (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
succ_p \<in> succs (hd b)

goal (1 subgoal):
 1. ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
succ_p \<in> succs (hd b)
finite (succs (hd b))

goal (1 subgoal):
 1. ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p

goal (2 subgoals):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<in> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with a_succ_p_inA hd_b_cons_in_A
[PROOF STATE]
proof (chain)
picking this:
a ! succ_p \<in> A
hd b # a ! hd b \<in> A
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p
[PROOF STEP]
have succ_p1: "(hd b # ?a_hdb) \<sqsubseteq>\<^bsub>r\<^esub>?ss_succ_p"
                                               and succ_p2: "?a_succ_p\<sqsubseteq>\<^bsub>r\<^esub> ?ss_succ_p "
[PROOF STATE]
proof (prove)
using this:
a ! succ_p \<in> A
hd b # a ! hd b \<in> A
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p

goal (1 subgoal):
 1. hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p &&& a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto simp add:Semilat.ub1[OF Semilat.intro, OF is_semi]
                                Semilat.ub2[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (2 subgoals):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<in> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof(cases "p \<in> set b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> set b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
note p_in_set_b = this
[PROOF STATE]
proof (state)
this:
p \<in> set b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> set b
[PROOF STEP]
have p_eq_hdb: "p = hd b"
[PROOF STATE]
proof (prove)
using this:
p \<in> set b

goal (1 subgoal):
 1. p = hd b
[PROOF STEP]
using p_cond
[PROOF STATE]
proof (prove)
using this:
p \<in> set b
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. p = hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = hd b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p
[PROOF STATE]
proof (chain)
picking this:
succ_p \<in> succs p
p = hd b
[PROOF STEP]
have succ_p_is_succ_hdb: "succ_p \<in> succs (hd b)"
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
p = hd b

goal (1 subgoal):
 1. succ_p \<in> succs (hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
from ss_a_p_eq p_eq_hdb
[PROOF STATE]
proof (chain)
picking this:
ss ! p = a ! p
p = hd b
[PROOF STEP]
have "(hd b # ?ss_hdb) = hd b # ?a_hdb"
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
p = hd b

goal (1 subgoal):
 1. hd b # ss ! hd b = hd b # a ! hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b # ss ! hd b = hd b # a ! hd b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p1
[PROOF STATE]
proof (chain)
picking this:
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
hd b # ss ! hd b = hd b # a ! hd b
[PROOF STEP]
have "hd b # ss ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p"
[PROOF STATE]
proof (prove)
using this:
hd b # a ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
hd b # ss ! hd b = hd b # a ! hd b

goal (1 subgoal):
 1. hd b # ss ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b # ss ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with p_eq_hdb
[PROOF STATE]
proof (chain)
picking this:
p = hd b
hd b # ss ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = hd b
hd b # ss ! hd b \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto simp add:transf_def)
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> set b

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b
[PROOF STEP]
have "transf p ?ss_p \<in> A" and "transf p ?ss_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A &&& transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
using p_nin_b_ssp
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b
p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A &&& transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<in> A
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p2 a_succ_p_inA ss_succ_p_inA
[PROOF STATE]
proof (chain)
picking this:
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
a ! succ_p \<in> A
ss ! succ_p \<in> A
transf p (ss ! p) \<in> A
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
a ! succ_p \<in> A
ss ! succ_p \<in> A
transf p (ss ! p) \<in> A
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto intro: order_trans Semilat.orderI[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
succ_p \<notin> succs (hd b)

goal (1 subgoal):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
note succ_p_n_succ_hdb = this
[PROOF STATE]
proof (state)
this:
succ_p \<notin> succs (hd b)

goal (1 subgoal):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with exec2
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
succ_p \<notin> succs (hd b)
[PROOF STEP]
have ss_succ_p_eq_a: "?ss_succ_p = ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
succ_p \<notin> succs (hd b)

goal (1 subgoal):
 1. ss ! succ_p = a ! succ_p
[PROOF STEP]
using fin_succ_hd_b succ_p_lt_n  len_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
succ_p \<notin> succs (hd b)
finite (succs (hd b))
succ_p < n
length a = n

goal (1 subgoal):
 1. ss ! succ_p = a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! succ_p = a ! succ_p

goal (1 subgoal):
 1. \<lbrakk>transf p (ss ! p) = p # inter_sorted_rev (hd b # a ! hd b) (a ! p); succ_p \<notin> succs (hd b)\<rbrakk> \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof(cases "p \<in> set b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> set b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with p_cond
[PROOF STATE]
proof (chain)
picking this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
p \<in> set b
[PROOF STEP]
have p_eq_hdb: "p = hd b"
[PROOF STATE]
proof (prove)
using this:
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
p \<in> set b

goal (1 subgoal):
 1. p = hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = hd b

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p
[PROOF STATE]
proof (chain)
picking this:
succ_p \<in> succs p
p = hd b
[PROOF STEP]
have succ_p_is_succ_hdb: "succ_p \<in> succs (hd b)"
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
p = hd b

goal (1 subgoal):
 1. succ_p \<in> succs (hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p_n_succ_hdb
[PROOF STATE]
proof (chain)
picking this:
succ_p \<notin> succs (hd b)
succ_p \<in> succs (hd b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
succ_p \<notin> succs (hd b)
succ_p \<in> succs (hd b)

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> set b

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with sta_a_p
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p
p \<notin> set b
[PROOF STEP]
have "\<forall>(q,\<tau>) \<in> set (step p ?a_p). \<tau> \<sqsubseteq>\<^sub>r a!q"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p
p \<notin> set b

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q
[PROOF STEP]
by (simp add:stable_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p fin_succ_p
[PROOF STATE]
proof (chain)
picking this:
succ_p \<in> succs p
finite (succs p)
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q
[PROOF STEP]
have "transf p ?a_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
finite (succs p)
\<forall>(q, \<tau>)\<in>set (step p (a ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> a ! q

goal (1 subgoal):
 1. transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with ss_succ_p_eq_a ss_a_p_eq
[PROOF STATE]
proof (chain)
picking this:
ss ! succ_p = a ! succ_p
ss ! p = a ! p
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! succ_p = a ! succ_p
ss ! p = a ! p
transf p (a ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> succs (hd b)

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
note p_nin_succ_hd_b = this
[PROOF STATE]
proof (state)
this:
p \<notin> succs (hd b)

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
from p_nin_succ_hd_b p_cond
[PROOF STATE]
proof (chain)
picking this:
p \<notin> succs (hd b)
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)
[PROOF STEP]
have "p \<notin> set b \<or> p = hd b"
[PROOF STATE]
proof (prove)
using this:
p \<notin> succs (hd b)
(p \<notin> set b \<or> p = hd b) \<and> (\<forall>s. (p, s) \<in> set (step (hd b) (a ! hd b)) \<longrightarrow> hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p = a ! p)

goal (1 subgoal):
 1. p \<notin> set b \<or> p = hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set b \<or> p = hd b

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b \<or> p = hd b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b \<or> p = hd b

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
assume "p \<notin> set b"
[PROOF STATE]
proof (state)
this:
p \<notin> set b

goal (2 subgoals):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b
[PROOF STEP]
have transf_ss_p_inA: "transf p ?ss_p \<in> A" and transf_lt_p: "transf p ?ss_p \<sqsubseteq>\<^sub>r ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A &&& transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
using p_nin_b_ssp
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b
p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<in> A \<and> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<in> A &&& transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<in> A
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p

goal (2 subgoals):
 1. p \<notin> set b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
show "transf p ?ss_p \<sqsubseteq>\<^bsub>r\<^esub> ?ss_succ_p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
proof(cases "succ_p \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. succ_p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
succ_p \<in> succs (hd b)

goal (2 subgoals):
 1. succ_p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p_lt_n propa_ss1' len_eq  fin_succ_hd_b
[PROOF STATE]
proof (chain)
picking this:
succ_p < n
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
length a = n
finite (succs (hd b))
succ_p \<in> succs (hd b)
[PROOF STEP]
have "?ss_succ_p = (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
succ_p < n
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! q
length a = n
finite (succs (hd b))
succ_p \<in> succs (hd b)

goal (1 subgoal):
 1. ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p

goal (2 subgoals):
 1. succ_p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with a_succ_p_inA hd_b_cons_in_A
[PROOF STATE]
proof (chain)
picking this:
a ! succ_p \<in> A
hd b # a ! hd b \<in> A
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p
[PROOF STEP]
have "?a_succ_p \<sqsubseteq>\<^sub>r ?ss_succ_p"
[PROOF STATE]
proof (prove)
using this:
a ! succ_p \<in> A
hd b # a ! hd b \<in> A
ss ! succ_p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! succ_p

goal (1 subgoal):
 1. a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto simp add:Semilat.ub2[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (2 subgoals):
 1. succ_p \<in> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
 2. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with transf_lt_p transf_ss_p_inA a_succ_p_inA ss_succ_p_inA
[PROOF STATE]
proof (chain)
picking this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
transf p (ss ! p) \<in> A
a ! succ_p \<in> A
ss ! succ_p \<in> A
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
transf p (ss ! p) \<in> A
a ! succ_p \<in> A
ss ! succ_p \<in> A
a ! succ_p \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto intro: order_trans  Semilat.orderI[OF Semilat.intro, OF is_semi])
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
succ_p \<notin> succs (hd b)

goal (1 subgoal):
 1. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p_lt_n exec2 len_eq  fin_succ_hd_b
[PROOF STATE]
proof (chain)
picking this:
succ_p < n
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
length a = n
finite (succs (hd b))
succ_p \<notin> succs (hd b)
[PROOF STEP]
have "?ss_succ_p = ?a_succ_p"
[PROOF STATE]
proof (prove)
using this:
succ_p < n
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
length a = n
finite (succs (hd b))
succ_p \<notin> succs (hd b)

goal (1 subgoal):
 1. ss ! succ_p = a ! succ_p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! succ_p = a ! succ_p

goal (1 subgoal):
 1. succ_p \<notin> succs (hd b) \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with transf_lt_p
[PROOF STATE]
proof (chain)
picking this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
ss ! succ_p = a ! succ_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> a ! succ_p
ss ! succ_p = a ! succ_p

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal (1 subgoal):
 1. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
assume "p = hd b"
[PROOF STATE]
proof (state)
this:
p = hd b

goal (1 subgoal):
 1. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with hd_b_ss_sta
[PROOF STATE]
proof (chain)
picking this:
Typing_Framework_1.stable r step ss (hd b)
p = hd b
[PROOF STEP]
have "(\<forall>(q,\<tau>) \<in> set (step p ?ss_p). \<tau> \<sqsubseteq>\<^sub>r ss!q)"
[PROOF STATE]
proof (prove)
using this:
Typing_Framework_1.stable r step ss (hd b)
p = hd b

goal (1 subgoal):
 1. \<forall>(q, \<tau>)\<in>set (step p (ss ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
by (simp add:stable_def)
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. p = hd b \<Longrightarrow> transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
with succ_p \<open>p = hd b\<close>
[PROOF STATE]
proof (chain)
picking this:
succ_p \<in> succs p
p = hd b
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
show "transf p ?ss_p \<sqsubseteq>\<^bsub>r\<^esub> ?ss_succ_p"
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
p = hd b
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
succ_p \<in> succs p
p = hd b
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
finite (succs (hd b))

goal (1 subgoal):
 1. transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p
[PROOF STEP]
by (auto simp add:stable_def step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! succ_p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>p \<notin> set w; w \<noteq> []; (a, b) \<in> set (step p (ss ! p))\<rbrakk> \<Longrightarrow> b \<sqsubseteq>\<^bsub>r\<^esub> ss ! a
[PROOF STEP]
with step_ss_p
[PROOF STATE]
proof (chain)
picking this:
(q, \<tau>) \<in> set (step p (ss ! p))
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
show "\<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q"
[PROOF STATE]
proof (prove)
using this:
(q, \<tau>) \<in> set (step p (ss ! p))
\<forall>(q, \<tau>)\<in>set (step p (ss ! p)). transf p (ss ! p) \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal (1 subgoal):
 1. \<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
\<tau> \<sqsubseteq>\<^bsub>r\<^esub> ss ! q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. \<And>p. p < n \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show "sorted (rev ?ss_p) \<and>
          (?ss_p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set?ss_p. x < p)) \<and>
          (?ss_p = rev [0..<n] \<longrightarrow> (\<exists>x\<in> set w. (x,p)\<in> g_E G \<and> x < p)) \<and>
          (p \<notin> set w \<longrightarrow> stable r step ss p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "w \<noteq> []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
w \<noteq> []

goal (2 subgoals):
 1. w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
note w_n_nil = this
[PROOF STATE]
proof (state)
this:
w \<noteq> []

goal (2 subgoals):
 1. w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof (cases "p \<in> set( map fst (?qs_a))")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> set (map fst (step (hd b) (a ! hd b)))

goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with propa_ss1
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
p \<in> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
have ss_p: "?ss_p = (hd b # ?a_hdb) \<squnion>\<^bsub>f\<^esub> ?a_p"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
p \<in> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
by (simp add:step_def exec_def transf_def)
[PROOF STATE]
proof (state)
this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p

goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with sorted_hd_b_cons sorted_a_p
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
Sorted_Less.sorted (rev (a ! p))
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
have ss_p_lt_hdb: "set ?ss_p \<subseteq> set (hd b # ?a_hdb)"
         and ss_p_lt: "set ?ss_p \<subseteq> set ?a_p"
         and ss_p_inter: "set ?ss_p = set (hd b # ?a_hdb) \<inter> set ?a_p"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
Sorted_Less.sorted (rev (a ! p))
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p

goal (1 subgoal):
 1. set (ss ! p) \<subseteq> set (hd b # a ! hd b) &&& set (ss ! p) \<subseteq> set (a ! p) &&& set (ss ! p) = set (hd b # a ! hd b) \<inter> set (a ! p)
[PROOF STEP]
by (auto simp add:f_def plussub_def nodes_sup_def inter_sorted_correct)
[PROOF STATE]
proof (state)
this:
set (ss ! p) \<subseteq> set (hd b # a ! hd b)
set (ss ! p) \<subseteq> set (a ! p)
set (ss ! p) = set (hd b # a ! hd b) \<inter> set (a ! p)

goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from sorted_hd_b_cons sorted_a_p
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
Sorted_Less.sorted (rev (a ! p))
[PROOF STEP]
have "inter_sorted_rev (hd b # ?a_hdb) ?a_p = rev (sorted_list_of_set (set (hd b # ?a_hdb) \<inter> set ?a_p))"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
Sorted_Less.sorted (rev (a ! p))

goal (1 subgoal):
 1. inter_sorted_rev (hd b # a ! hd b) (a ! p) = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
[PROOF STEP]
by (rule inter_sorted_correct_col)
[PROOF STATE]
proof (state)
this:
inter_sorted_rev (hd b # a ! hd b) (a ! p) = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))

goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
inter_sorted_rev (hd b # a ! hd b) (a ! p) = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
[PROOF STEP]
have ss_p2: "?ss_p = (rev (sorted_list_of_set (set (hd b # ?a_hdb) \<inter> set ?a_p)))"
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> a ! p
inter_sorted_rev (hd b # a ! hd b) (a ! p) = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))

goal (1 subgoal):
 1. ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
[PROOF STEP]
by (auto simp add:f_def plussub_def nodes_sup_def)
[PROOF STATE]
proof (state)
this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))

goal (2 subgoals):
 1. p \<in> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "?a_p \<noteq> (rev [0..<n])")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
note a_p_neq_all = this
[PROOF STATE]
proof (state)
this:
a ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! p \<noteq> rev [0..<n]
[PROOF STEP]
have seta_p_neq_all: "set ?a_p \<noteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. set (a ! p) \<noteq> {0..<n}
[PROOF STEP]
using sorted_a_p
[PROOF STATE]
proof (prove)
using this:
a ! p \<noteq> rev [0..<n]
Sorted_Less.sorted (rev (a ! p))

goal (1 subgoal):
 1. set (a ! p) \<noteq> {0..<n}
[PROOF STEP]
by (auto intro: sorted_less_rev_set_unique)
[PROOF STATE]
proof (state)
this:
set (a ! p) \<noteq> {0..<n}

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from a_p_neq_all wf_a_b p_lt_n
[PROOF STATE]
proof (chain)
picking this:
a ! p \<noteq> rev [0..<n]
wf_dom a b
p < n
[PROOF STEP]
have a_lt_p: "(\<forall>x\<in>set ?a_p. x < p)"
[PROOF STATE]
proof (prove)
using this:
a ! p \<noteq> rev [0..<n]
wf_dom a b
p < n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
using n_def len_eq
[PROOF STATE]
proof (prove)
using this:
a ! p \<noteq> rev [0..<n]
wf_dom a b
p < n
n \<equiv> length nodes
length a = n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a ! p). x < p

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_lt
[PROOF STATE]
proof (chain)
picking this:
set (ss ! p) \<subseteq> set (a ! p)
\<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
have "\<forall>x\<in>set ?ss_p. x < p"
[PROOF STATE]
proof (prove)
using this:
set (ss ! p) \<subseteq> set (a ! p)
\<forall>x\<in>set (a ! p). x < p

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! p). x < p

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
have  ss_lt_p: "?ss_p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set ?ss_p. x < p)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set (ss ! p). x < p

goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "set ?ss_p \<noteq> {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (ss ! p) \<noteq> {0..<n}
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
assume "\<not> set ?ss_p \<noteq> {0..<n}"
[PROOF STATE]
proof (state)
this:
\<not> set (ss ! p) \<noteq> {0..<n}

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
with ss_p_lt
[PROOF STATE]
proof (chain)
picking this:
set (ss ! p) \<subseteq> set (a ! p)
\<not> set (ss ! p) \<noteq> {0..<n}
[PROOF STEP]
have cc:  "{0..<n} \<subseteq> set ?a_p"
[PROOF STATE]
proof (prove)
using this:
set (ss ! p) \<subseteq> set (a ! p)
\<not> set (ss ! p) \<noteq> {0..<n}

goal (1 subgoal):
 1. {0..<n} \<subseteq> set (a ! p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} \<subseteq> set (a ! p)

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
from a_in_A p_lt_len_a
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
p < length a
[PROOF STEP]
have " ?a_p \<in> ((rev \<circ> sorted_list_of_set) ` (Pow (set nodes)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set a. \<tau> \<in> A
p < length a

goal (1 subgoal):
 1. a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
by (auto simp add: A_def)
[PROOF STATE]
proof (state)
this:
a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
have ass_set_in_nodes: "set ?a_p \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
a ! p \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. set (a ! p) \<subseteq> set nodes
[PROOF STEP]
by (rule inpow_subset_nodes)
[PROOF STATE]
proof (state)
this:
set (a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (a ! p) \<subseteq> set nodes
[PROOF STEP]
have "set ?a_p \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
set (a ! p) \<subseteq> set nodes

goal (1 subgoal):
 1. set (a ! p) \<subseteq> {0..<n}
[PROOF STEP]
by (auto simp add:nodes_def n_def verts_set)
[PROOF STATE]
proof (state)
this:
set (a ! p) \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
with cc
[PROOF STATE]
proof (chain)
picking this:
{0..<n} \<subseteq> set (a ! p)
set (a ! p) \<subseteq> {0..<n}
[PROOF STEP]
have "set ?a_p = {0..<n}"
[PROOF STATE]
proof (prove)
using this:
{0..<n} \<subseteq> set (a ! p)
set (a ! p) \<subseteq> {0..<n}

goal (1 subgoal):
 1. set (a ! p) = {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (a ! p) = {0..<n}

goal (1 subgoal):
 1. \<not> set (ss ! p) \<noteq> {0..<n} \<Longrightarrow> False
[PROOF STEP]
with seta_p_neq_all
[PROOF STATE]
proof (chain)
picking this:
set (a ! p) \<noteq> {0..<n}
set (a ! p) = {0..<n}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
set (a ! p) \<noteq> {0..<n}
set (a ! p) = {0..<n}

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (ss ! p) \<noteq> {0..<n}

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (ss ! p) \<noteq> {0..<n}
[PROOF STEP]
have ss_p_not_all: "?ss_p \<noteq> rev [0..<n]"
[PROOF STATE]
proof (prove)
using this:
set (ss ! p) \<noteq> {0..<n}

goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
using  sorted_ss_p
[PROOF STATE]
proof (prove)
using this:
set (ss ! p) \<noteq> {0..<n}
Sorted_Less.sorted (rev (ss ! p))

goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
by (auto intro: sorted_less_rev_set_unique)
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
have "?ss_p = rev [0..<n] \<longrightarrow>  (\<exists>x\<in>set w. (x,p)\<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with sorted_ss_p ss_lt_p stable_ss_p w_n_nil
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (ss ! p))
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (ss ! p))
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a ! p \<noteq> rev [0..<n]
[PROOF STEP]
have a_p_all: "?a_p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. a ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with wf_a_b p_lt_n
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
p < n
a ! p = rev [0..<n]
[PROOF STEP]
have ex_lt_p: " (\<exists>x\<in> set b. (x,p)\<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
p < n
a ! p = rev [0..<n]

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "hd b \<in> set b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd b \<in> set b
[PROOF STEP]
using b_n_nil
[PROOF STATE]
proof (prove)
using this:
b \<noteq> []

goal (1 subgoal):
 1. hd b \<in> set b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b \<in> set b

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from a_p_all
[PROOF STATE]
proof (chain)
picking this:
a ! p = rev [0..<n]
[PROOF STEP]
have "set ?a_p = {0..<n}"
[PROOF STATE]
proof (prove)
using this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. set (a ! p) = {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (a ! p) = {0..<n}

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_inter
[PROOF STATE]
proof (chain)
picking this:
set (ss ! p) = set (hd b # a ! hd b) \<inter> set (a ! p)
set (a ! p) = {0..<n}
[PROOF STEP]
have "set ?ss_p \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
set (ss ! p) = set (hd b # a ! hd b) \<inter> set (a ! p)
set (a ! p) = {0..<n}

goal (1 subgoal):
 1. set (ss ! p) \<subseteq> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (ss ! p) \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p2 hdb_subset_n \<open>set ?a_p  = {0..<n}\<close>
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
set (hd b # a ! hd b) \<subseteq> {0..<n}
set (a ! p) = {0..<n}
set (ss ! p) \<subseteq> {0..<n}
[PROOF STEP]
have "(set (hd b # ?a_hdb) \<inter> set ?a_p) = set (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
set (hd b # a ! hd b) \<subseteq> {0..<n}
set (a ! p) = {0..<n}
set (ss ! p) \<subseteq> {0..<n}

goal (1 subgoal):
 1. set (hd b # a ! hd b) \<inter> set (a ! p) = set (hd b # a ! hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (hd b # a ! hd b) \<inter> set (a ! p) = set (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p2
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
set (hd b # a ! hd b) \<inter> set (a ! p) = set (hd b # a ! hd b)
[PROOF STEP]
have ss_p3: "?ss_p =  (rev (sorted_list_of_set (set (hd b # ?a_hdb))))"
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b) \<inter> set (a ! p)))
set (hd b # a ! hd b) \<inter> set (a ! p) = set (hd b # a ! hd b)

goal (1 subgoal):
 1. ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b)))

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
[PROOF STEP]
have "sorted_list_of_set (set (hd b # ?a_hdb)) = rev (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. sorted_list_of_set (set (hd b # a ! hd b)) = rev (hd b # a ! hd b)
[PROOF STEP]
by (fastforce dest: sorted_less_rev_set_eq)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (set (hd b # a ! hd b)) = rev (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p3
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b)))
sorted_list_of_set (set (hd b # a ! hd b)) = rev (hd b # a ! hd b)
[PROOF STEP]
have ss_p_4: "?ss_p = (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev (sorted_list_of_set (set (hd b # a ! hd b)))
sorted_list_of_set (set (hd b # a ! hd b)) = rev (hd b # a ! hd b)

goal (1 subgoal):
 1. ss ! p = hd b # a ! hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = hd b # a ! hd b

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "(?ss_p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set ?ss_p. x < p)) \<and>
                (?ss_p = rev [0..<n] \<longrightarrow>  (\<exists>x\<in> set w. (x,p)\<in> g_E G \<and> x < p)) \<and>
                (p \<notin> set w \<longrightarrow> stable r step ss p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "?ss_p \<noteq>  (rev [0..<n])")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
note ss_p_n_all = this
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_4
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b
ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b
ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "hd b < p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
hd b < p

goal (2 subgoals):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_4 sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b
Sorted_Less.sorted (rev (hd b # a ! hd b))
hd b < p
[PROOF STEP]
have ss_p_lt_p: "\<forall>x\<in>set ( (ss ! p)). x < p"
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b
Sorted_Less.sorted (rev (hd b # a ! hd b))
hd b < p

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
by (auto simp add:sorted_wrt_append)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! p). x < p

goal (2 subgoals):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_4 ss_p_n_all stable_ss_p \<open>w \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b
ss ! p \<noteq> rev [0..<n]
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []
\<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b
ss ! p \<noteq> rev [0..<n]
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []
\<forall>x\<in>set (ss ! p). x < p

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> hd b < p

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
note hd_b_ge_p = this
[PROOF STATE]
proof (state)
this:
\<not> hd b < p

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from ex_lt_p
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
obtain x where "x\<in> set b " and " (x,p)\<in> g_E G " and "x < p"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> set b; (x, p) \<in> g_E G; x < p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set b
(x, p) \<in> g_E G
x < p

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from \<open>x \<in> set b\<close> \<open>x < p\<close> hd_b_ge_p
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b
x < p
\<not> hd b < p
[PROOF STEP]
have "tl b \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b
x < p
\<not> hd b < p

goal (1 subgoal):
 1. tl b \<noteq> []
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
tl b \<noteq> []

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with  hd_b_ge_p sorted_b
[PROOF STATE]
proof (chain)
picking this:
\<not> hd b < p
Sorted_Less.sorted b
tl b \<noteq> []
[PROOF STEP]
have temp_t: "\<forall>x\<in> set (tl b). x \<ge> p"
[PROOF STATE]
proof (prove)
using this:
\<not> hd b < p
Sorted_Less.sorted b
tl b \<noteq> []

goal (1 subgoal):
 1. \<forall>x\<in>set (tl b). p \<le> x
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (tl b). p \<le> x

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with \<open>\<not>hd b < p\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> hd b < p
\<forall>x\<in>set (tl b). p \<le> x
[PROOF STEP]
have "x \<in> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
\<not> hd b < p
\<forall>x\<in>set (tl b). p \<le> x

goal (1 subgoal):
 1. x \<in> set (tl b)
[PROOF STEP]
using \<open>(x,p)\<in> g_E G \<close> \<open>x \<in> set b\<close> \<open>x < p\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> hd b < p
\<forall>x\<in>set (tl b). p \<le> x
(x, p) \<in> g_E G
x \<in> set b
x < p

goal (1 subgoal):
 1. x \<in> set (tl b)
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
x \<in> set (tl b)

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with \<open>x < p\<close> temp_t
[PROOF STATE]
proof (chain)
picking this:
x < p
\<forall>x\<in>set (tl b). p \<le> x
x \<in> set (tl b)
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
x < p
\<forall>x\<in>set (tl b). p \<le> x
x \<in> set (tl b)

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal (1 subgoal):
 1. \<lbrakk>ss ! p = hd b # a ! hd b; ss ! p \<noteq> rev [0..<n]; \<not> hd b < p\<rbrakk> \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
have "?ss_p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<not> ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. ss ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_p_4
[PROOF STATE]
proof (chain)
picking this:
ss ! p = hd b # a ! hd b
ss ! p = rev [0..<n]
[PROOF STEP]
have hd_b_as1: "(hd b # ?a_hdb) = rev [0..<n]"
[PROOF STATE]
proof (prove)
using this:
ss ! p = hd b # a ! hd b
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. hd b # a ! hd b = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b = rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd b # a ! hd b = rev [0..<n]
[PROOF STEP]
have "hd (hd b # ?a_hdb) = hd (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
hd b # a ! hd b = rev [0..<n]

goal (1 subgoal):
 1. hd (hd b # a ! hd b) = hd (rev [0..<n])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd (hd b # a ! hd b) = hd (rev [0..<n])

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd (hd b # a ! hd b) = hd (rev [0..<n])
[PROOF STEP]
have hd_b: "hd b = hd (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
hd (hd b # a ! hd b) = hd (rev [0..<n])

goal (1 subgoal):
 1. hd b = hd (rev [0..<n])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b = hd (rev [0..<n])

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "n > 0 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
using n_def nodes_def len_verts_gt0
[PROOF STATE]
proof (prove)
using this:
n \<equiv> length nodes
nodes \<equiv> g_V G
0 < length (g_V G)

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have last_hd: "last [0..<n] = hd (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. last [0..<n] = hd (rev [0..<n])
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < 0 \<Longrightarrow> last [0..<0] = hd (rev [0..<0])
 2. \<And>n. \<lbrakk>0 < n \<Longrightarrow> last [0..<n] = hd (rev [0..<n]); 0 < Suc n\<rbrakk> \<Longrightarrow> last [0..<Suc n] = hd (rev [0..<Suc n])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
last [0..<n] = hd (rev [0..<n])

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "last[0..<n] = n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last [0..<n] = n - 1
[PROOF STEP]
using \<open>n> 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. last [0..<n] = n - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
last [0..<n] = n - 1

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
last [0..<n] = n - 1
[PROOF STEP]
have "hd (rev [0..<n]) = n - 1"
[PROOF STATE]
proof (prove)
using this:
last [0..<n] = n - 1

goal (1 subgoal):
 1. hd (rev [0..<n]) = n - 1
[PROOF STEP]
using last_hd
[PROOF STATE]
proof (prove)
using this:
last [0..<n] = n - 1
last [0..<n] = hd (rev [0..<n])

goal (1 subgoal):
 1. hd (rev [0..<n]) = n - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd (rev [0..<n]) = n - 1

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with hd_b
[PROOF STATE]
proof (chain)
picking this:
hd b = hd (rev [0..<n])
hd (rev [0..<n]) = n - 1
[PROOF STEP]
have hd_b_n_minus1: "hd b = n - 1"
[PROOF STATE]
proof (prove)
using this:
hd b = hd (rev [0..<n])
hd (rev [0..<n]) = n - 1

goal (1 subgoal):
 1. hd b = n - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd b = n - 1

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "hd b < p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
hd b < p

goal (2 subgoals):
 1. hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with hd_b_n_minus1 p_lt_n
[PROOF STATE]
proof (chain)
picking this:
hd b = n - 1
p < n
hd b < p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hd b = n - 1
p < n
hd b < p

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> hd b < p

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from ex_lt_p
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
obtain x where x: "x\<in>set b \<and> (x, p) \<in> g_E G \<and> x < p"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. (\<And>x. x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
have "x\<in>set b " and " (x, p) \<in> g_E G " and " x < p"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. x \<in> set b &&& (x, p) \<in> g_E G &&& x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set b
(x, p) \<in> g_E G
x < p

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from x \<open>\<not>hd b <p\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
\<not> hd b < p
[PROOF STEP]
have x_n_hd_b: "x \<noteq> hd b"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
\<not> hd b < p

goal (1 subgoal):
 1. x \<noteq> hd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> hd b

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with  \<open>x\<in>set b \<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b
x \<noteq> hd b
[PROOF STEP]
have "tl b \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b
x \<noteq> hd b

goal (1 subgoal):
 1. tl b \<noteq> []
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
tl b \<noteq> []

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with \<open>x\<in>set b \<close> x_n_hd_b
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b
x \<noteq> hd b
tl b \<noteq> []
[PROOF STEP]
have "x \<in> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b
x \<noteq> hd b
tl b \<noteq> []

goal (1 subgoal):
 1. x \<in> set (tl b)
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
x \<in> set (tl b)

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ww
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)
[PROOF STEP]
have "x \<in> set w"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)

goal (1 subgoal):
 1. x \<in> set w
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. x \<in> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set w

goal (1 subgoal):
 1. \<not> hd b < p \<Longrightarrow> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> set w

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
using \<open>ss!p =  (rev [0..<n])\<close> \<open>(x, p) \<in> g_E G\<close> \<open>x<p\<close> stable_ss_p \<open>w \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> set w
ss ! p = rev [0..<n]
(x, p) \<in> g_E G
x < p
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []

goal (1 subgoal):
 1. (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
using sorted_ss_p
[PROOF STATE]
proof (prove)
using this:
(ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
Sorted_Less.sorted (rev (ss ! p))

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
note p_not_in_succ = this
[PROOF STATE]
proof (state)
this:
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with exec2 p_lt_n len_eq
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
p < n
length a = n
p \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
have ss_a_p_eq: "ss!p = a!p"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
p < n
length a = n
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ass p_lt_n  wf_a_b
[PROOF STATE]
proof (chain)
picking this:
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
p < n
wf_dom a b
ss ! p = a ! p
[PROOF STEP]
have cond1: "(?ss_p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set ?ss_p. x < p))"
[PROOF STATE]
proof (prove)
using this:
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
p < n
wf_dom a b
ss ! p = a ! p

goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)

goal (1 subgoal):
 1. p \<notin> set (map fst (step (hd b) (a ! hd b))) \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
proof(cases "?a_p \<noteq>  (rev [0..<n])")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a ! p \<noteq> rev [0..<n]

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with wf_a_b
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
a ! p \<noteq> rev [0..<n]
[PROOF STEP]
have "(\<forall>x\<in>set ?a_p. x < p)"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
using p_lt_n  len_eq
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
a ! p \<noteq> rev [0..<n]
p < n
length a = n

goal (1 subgoal):
 1. \<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a ! p). x < p

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_a_p_eq
[PROOF STATE]
proof (chain)
picking this:
ss ! p = a ! p
\<forall>x\<in>set (a ! p). x < p
[PROOF STEP]
have "(\<forall>x\<in>set ?ss_p. x < p)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
\<forall>x\<in>set (a ! p). x < p

goal (1 subgoal):
 1. \<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (ss ! p). x < p

goal (2 subgoals):
 1. a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
 2. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with cond1 sorted_ss_p
[PROOF STATE]
proof (chain)
picking this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<forall>x\<in>set (ss ! p). x < p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<forall>x\<in>set (ss ! p). x < p

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
using p_lt_n  len_eq stable_ss_p w_n_nil
[PROOF STATE]
proof (prove)
using this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<forall>x\<in>set (ss ! p). x < p
p < n
length a = n
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a ! p \<noteq> rev [0..<n]
[PROOF STEP]
have "?a_p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. a ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from ss_a_p_eq ass p_lt_n  wf_a_b
[PROOF STATE]
proof (chain)
picking this:
ss ! p = a ! p
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
p < n
wf_dom a b
[PROOF STEP]
have "?ss_p = rev [0..<n] \<longrightarrow>  (\<exists>x\<in> set b. (x,p)\<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
\<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p)
p < n
wf_dom a b

goal (1 subgoal):
 1. ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ss_a_p_eq \<open>a!p =  (rev [0..<n])\<close>
[PROOF STATE]
proof (chain)
picking this:
ss ! p = a ! p
a ! p = rev [0..<n]
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
[PROOF STEP]
have hd_b_lt_p: " (\<exists>x\<in> set b. (x,p)\<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
a ! p = rev [0..<n]
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
using len_eq
[PROOF STATE]
proof (prove)
using this:
ss ! p = a ! p
a ! p = rev [0..<n]
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
length a = n

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
obtain x where "x\<in> set b " and " (x,p) \<in>  g_E G" and " x < p"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> set b; (x, p) \<in> g_E G; x < p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set b
(x, p) \<in> g_E G
x < p

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from fin_succ_hd_b \<open>(x,p) \<in>  g_E G\<close> p_not_in_succ
[PROOF STATE]
proof (chain)
picking this:
finite (succs (hd b))
(x, p) \<in> g_E G
p \<notin> set (map fst (step (hd b) (a ! hd b)))
[PROOF STEP]
have "x \<noteq> hd b "
[PROOF STATE]
proof (prove)
using this:
finite (succs (hd b))
(x, p) \<in> g_E G
p \<notin> set (map fst (step (hd b) (a ! hd b)))

goal (1 subgoal):
 1. x \<noteq> hd b
[PROOF STEP]
by (auto simp add:step_def exec_def succs_def)
[PROOF STATE]
proof (state)
this:
x \<noteq> hd b

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with \<open>x\<in> set b\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b
x \<noteq> hd b
[PROOF STEP]
have "x \<in> set (tl b)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b
x \<noteq> hd b

goal (1 subgoal):
 1. x \<in> set (tl b)
[PROOF STEP]
using b_n_nil
[PROOF STATE]
proof (prove)
using this:
x \<in> set b
x \<noteq> hd b
b \<noteq> []

goal (1 subgoal):
 1. x \<in> set (tl b)
[PROOF STEP]
by (induct b)  auto
[PROOF STATE]
proof (state)
this:
x \<in> set (tl b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with ww
[PROOF STATE]
proof (chain)
picking this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)
[PROOF STEP]
have "x \<in> set w"
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)

goal (1 subgoal):
 1. x \<in> set w
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
w = sorted_list_of_set ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))
x \<in> set (tl b)
finite ({q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b))

goal (1 subgoal):
 1. x \<in> set w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set w

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with \<open>(x,p) \<in>  g_E G\<close> and \<open> x < p\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, p) \<in> g_E G
x < p
x \<in> set w
[PROOF STEP]
have "(\<exists>x\<in> set w. (x,p)\<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
(x, p) \<in> g_E G
x < p
x \<in> set w

goal (1 subgoal):
 1. \<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with cond1 sorted_ss_p
[PROOF STATE]
proof (chain)
picking this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
using stable_ss_p w_n_nil
[PROOF STATE]
proof (prove)
using this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
Sorted_Less.sorted (rev (ss ! p))
\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p
p \<notin> set w \<longrightarrow> w \<noteq> [] \<longrightarrow> Typing_Framework_1.stable r step ss p
w \<noteq> []

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> w \<noteq> []

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> w \<noteq> []
[PROOF STEP]
have w_n_nil: "w =[]"
[PROOF STATE]
proof (prove)
using this:
\<not> w \<noteq> []

goal (1 subgoal):
 1. w = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w = []

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with set_ww
[PROOF STATE]
proof (chain)
picking this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
w = []
[PROOF STEP]
have "tl b = []" and succ_hd_b_eq: "\<forall>(q, t) \<in> set ?qs_a.  t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q"
[PROOF STATE]
proof (prove)
using this:
set w = {q. \<exists>t. (q, t) \<in> set (step (hd b) (a ! hd b)) \<and> t \<squnion>\<^bsub>f\<^esub> a ! q \<noteq> a ! q} \<union> set (tl b)
w = []

goal (1 subgoal):
 1. tl b = [] &&& \<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tl b = []
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from  succ_hd_b_eq propa
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
[PROOF STEP]
have "\<forall>p<n. ss!p = a!p"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)

goal (1 subgoal):
 1. \<forall>p<n. ss ! p = a ! p
[PROOF STEP]
proof (intro strip)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q; propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); p < n\<rbrakk> \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q; propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); p < n\<rbrakk> \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
assume ass_eq: " \<forall>(q, t)\<in>set ?qs_a. t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q "
           and " propa f ?qs_a a (tl b) = (ss, w) " and p_lt_n: " p < n "
[PROOF STATE]
proof (state)
this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w)
p < n

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q; propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); p < n\<rbrakk> \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
show "ss ! p = a ! p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
proof(cases "p \<in> succs (hd b)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with fin_succ_hd_b propa_ss1
[PROOF STATE]
proof (chain)
picking this:
finite (succs (hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
p \<in> succs (hd b)
[PROOF STEP]
have ss_p_eq: "ss!p = transf (hd b) (a!hd b)   \<squnion>\<^bsub>f\<^esub> a ! p"
[PROOF STATE]
proof (prove)
using this:
finite (succs (hd b))
\<forall>(q, \<tau>)\<in>set (step (hd b) (a ! hd b)). ss ! q = \<tau> \<squnion>\<^bsub>f\<^esub> a ! q
p \<in> succs (hd b)

goal (1 subgoal):
 1. ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with ass_eq \<open>p \<in> succs (hd b)\<close> fin_succ_hd_b
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
p \<in> succs (hd b)
finite (succs (hd b))
ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p
[PROOF STEP]
have "transf (hd b) (a!hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
p \<in> succs (hd b)
finite (succs (hd b))
ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p

goal (1 subgoal):
 1. transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (2 subgoals):
 1. p \<in> succs (hd b) \<Longrightarrow> ss ! p = a ! p
 2. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with ss_p_eq
[PROOF STATE]
proof (chain)
picking this:
ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ss ! p = transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<notin> succs (hd b)

goal (1 subgoal):
 1. p \<notin> succs (hd b) \<Longrightarrow> ss ! p = a ! p
[PROOF STEP]
with fin_succ_hd_b exec2 p_lt_n n_def len_eq nodes_def
[PROOF STATE]
proof (chain)
picking this:
finite (succs (hd b))
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
p < n
n \<equiv> length nodes
length a = n
nodes \<equiv> g_V G
p \<notin> succs (hd b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (succs (hd b))
\<lbrakk>?q \<notin> set (map fst (step (hd b) (a ! hd b))); ?q < length a\<rbrakk> \<Longrightarrow> ss ! ?q = a ! ?q
p < n
n \<equiv> length nodes
length a = n
nodes \<equiv> g_V G
p \<notin> succs (hd b)

goal (1 subgoal):
 1. ss ! p = a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ss ! p = a ! p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>p<n. ss ! p = a ! p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>p<n. ss ! p = a ! p
[PROOF STEP]
have "\<forall>p< length ss. ss!p = a!p"
[PROOF STATE]
proof (prove)
using this:
\<forall>p<n. ss ! p = a ! p

goal (1 subgoal):
 1. \<forall>p<length ss. ss ! p = a ! p
[PROOF STEP]
using \<open>length ss = n\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p<n. ss ! p = a ! p
length ss = n

goal (1 subgoal):
 1. \<forall>p<length ss. ss ! p = a ! p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p<length ss. ss ! p = a ! p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>p<length ss. ss ! p = a ! p
[PROOF STEP]
have ss_eq_a: "ss = a"
[PROOF STATE]
proof (prove)
using this:
\<forall>p<length ss. ss ! p = a ! p

goal (1 subgoal):
 1. ss = a
[PROOF STEP]
using n_def len_eq nodes_def \<open>length ss = n\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p<length ss. ss ! p = a ! p
n \<equiv> length nodes
length a = n
nodes \<equiv> g_V G
length ss = n

goal (1 subgoal):
 1. ss = a
[PROOF STEP]
by (auto simp add:list_eq_iff_nth_eq)
[PROOF STATE]
proof (state)
this:
ss = a

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with wf_a_b p_lt_n
[PROOF STATE]
proof (chain)
picking this:
wf_dom a b
p < n
ss = a
[PROOF STEP]
have
                              t3: "(?ss_p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set ?ss_p. x < p))" and
                              t4:  "(?ss_p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p))" and
                              sta_temp: "(p \<notin> set b \<longrightarrow>  stable r step ss p)"
[PROOF STATE]
proof (prove)
using this:
wf_dom a b
p < n
ss = a

goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p) &&& ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p) &&& p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
by (auto simp add:wf_dom_def)
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
from  \<open>tl b = []\<close>  \<open>b \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
tl b = []
b \<noteq> []
[PROOF STEP]
have "p \<notin> set b \<longleftrightarrow> p \<noteq> hd b "
[PROOF STATE]
proof (prove)
using this:
tl b = []
b \<noteq> []

goal (1 subgoal):
 1. (p \<notin> set b) = (p \<noteq> hd b)
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
(p \<notin> set b) = (p \<noteq> hd b)

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with sta_temp
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step ss p
(p \<notin> set b) = (p \<noteq> hd b)
[PROOF STEP]
have "p \<noteq> hd b \<longrightarrow> stable r step ss p"
[PROOF STATE]
proof (prove)
using this:
p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step ss p
(p \<notin> set b) = (p \<noteq> hd b)

goal (1 subgoal):
 1. p \<noteq> hd b \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> hd b \<longrightarrow> Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with hd_b_ss_sta
[PROOF STATE]
proof (chain)
picking this:
Typing_Framework_1.stable r step ss (hd b)
p \<noteq> hd b \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
have "stable r step ss p"
[PROOF STATE]
proof (prove)
using this:
Typing_Framework_1.stable r step ss (hd b)
p \<noteq> hd b \<longrightarrow> Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. Typing_Framework_1.stable r step ss p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Typing_Framework_1.stable r step ss p
[PROOF STEP]
have sta_temp': "p \<notin> set w \<longrightarrow>  stable r step ss p"
[PROOF STATE]
proof (prove)
using this:
Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
using w_n_nil
[PROOF STATE]
proof (prove)
using this:
Typing_Framework_1.stable r step ss p
w = []

goal (1 subgoal):
 1. p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
have "?ss_p \<noteq> (rev [0..<n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
assume "\<not>?ss_p \<noteq>  (rev [0..<n])"
[PROOF STATE]
proof (state)
this:
\<not> ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
have ss_p_all: "?ss_p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<not> ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. ss ! p = rev [0..<n]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with \<open>ss = a\<close>
[PROOF STATE]
proof (chain)
picking this:
ss = a
ss ! p = rev [0..<n]
[PROOF STEP]
have "a!p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
ss = a
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. a ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
from \<open>?ss_p =  (rev [0..<n])\<close>
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev [0..<n]
[PROOF STEP]
have " ?ss_p = rev [0..<n]"
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. ss ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with  t4
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
ss ! p = rev [0..<n]
[PROOF STEP]
have "(\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)"
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)
ss ! p = rev [0..<n]

goal (1 subgoal):
 1. \<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
obtain x where x: "x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. (\<And>x. x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with \<open>tl b = []\<close>  \<open>b \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
tl b = []
b \<noteq> []
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
[PROOF STEP]
have "x =hd b"
[PROOF STATE]
proof (prove)
using this:
tl b = []
b \<noteq> []
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p

goal (1 subgoal):
 1. x = hd b
[PROOF STEP]
by (induct b) auto
[PROOF STATE]
proof (state)
this:
x = hd b

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
x = hd b
[PROOF STEP]
have " (hd b, p) \<in> g_E G" and hdb_lt_p: "hd b < p"
[PROOF STATE]
proof (prove)
using this:
x \<in> set b \<and> (x, p) \<in> g_E G \<and> x < p
x = hd b

goal (1 subgoal):
 1. (hd b, p) \<in> g_E G &&& hd b < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(hd b, p) \<in> g_E G
hd b < p

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(hd b, p) \<in> g_E G
hd b < p
[PROOF STEP]
have "p \<in> succs (hd b)"
[PROOF STATE]
proof (prove)
using this:
(hd b, p) \<in> g_E G
hd b < p

goal (1 subgoal):
 1. p \<in> succs (hd b)
[PROOF STEP]
by (simp add:succs_def)
[PROOF STATE]
proof (state)
this:
p \<in> succs (hd b)

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with succ_hd_b_eq
[PROOF STATE]
proof (chain)
picking this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
p \<in> succs (hd b)
[PROOF STEP]
have transf_hd_b_ap: "transf (hd b) (a!hd b)  \<squnion>\<^bsub>f\<^esub> a ! p = a ! p"
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
p \<in> succs (hd b)

goal (1 subgoal):
 1. transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
using fin_succ_hd_b
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, t)\<in>set (step (hd b) (a ! hd b)). t \<squnion>\<^bsub>f\<^esub> a ! q = a ! q
p \<in> succs (hd b)
finite (succs (hd b))

goal (1 subgoal):
 1. transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
[PROOF STEP]
by (auto simp add:step_def exec_def)
[PROOF STATE]
proof (state)
this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
have a_p_neq_all: "?a_p \<noteq> (rev [0..<n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ! p \<noteq> rev [0..<n]
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?a_p \<noteq>  (rev [0..<n])"
[PROOF STATE]
proof (state)
this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a ! p \<noteq> rev [0..<n]
[PROOF STEP]
have a_p_all: "?a_p =  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
\<not> a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. a ! p = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ! p = rev [0..<n]
[PROOF STEP]
have "transf (hd b) ?a_hdb \<squnion>\<^bsub>f\<^esub> ?a_p =  (hd b # ?a_hdb)  \<squnion>\<^bsub>f\<^esub>  (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
a ! p = rev [0..<n]

goal (1 subgoal):
 1. transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> rev [0..<n]
[PROOF STEP]
by (auto simp add:transf_def)
[PROOF STATE]
proof (state)
this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> rev [0..<n]
[PROOF STEP]
have "transf (hd b) ?a_hdb  \<squnion>\<^bsub>f\<^esub>?a_p =  ( (inter_sorted_rev (hd b # ?a_hdb) (rev [0..<n])))"
[PROOF STATE]
proof (prove)
using this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = hd b # a ! hd b \<squnion>\<^bsub>f\<^esub> rev [0..<n]

goal (1 subgoal):
 1. transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])
[PROOF STEP]
by (auto simp add:f_def plussub_def nodes_sup_def )
[PROOF STATE]
proof (state)
this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with transf_hd_b_ap a_p_all
[PROOF STATE]
proof (chain)
picking this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
a ! p = rev [0..<n]
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])
[PROOF STEP]
have "inter_sorted_rev (hd b # ?a_hdb) (rev [0..<n]) =
                                              (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = a ! p
a ! p = rev [0..<n]
transf (hd b) (a ! hd b) \<squnion>\<^bsub>f\<^esub> a ! p = inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])

goal (1 subgoal):
 1. inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]
[PROOF STEP]
have tx: "inter_sorted_rev (hd b # ?a_hdb) (rev [0..<n]) = (rev [0..<n])"
[PROOF STATE]
proof (prove)
using this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]

goal (1 subgoal):
 1. inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
from sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
[PROOF STEP]
have "set (inter_sorted_rev (hd b # ?a_hdb) (rev [0..<n])) \<subseteq>
                                    set (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))

goal (1 subgoal):
 1. set (inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])) \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
by (auto simp add: inter_sorted_correct)
[PROOF STATE]
proof (state)
this:
set (inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])) \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with tx
[PROOF STATE]
proof (chain)
picking this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]
set (inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])) \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
have "set (rev [0..<n]) \<subseteq> set (hd b #  ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
inter_sorted_rev (hd b # a ! hd b) (rev [0..<n]) = rev [0..<n]
set (inter_sorted_rev (hd b # a ! hd b) (rev [0..<n])) \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. set (rev [0..<n]) \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (rev [0..<n]) \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (rev [0..<n]) \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
have ty: "{0..<n} \<subseteq> set (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
set (rev [0..<n]) \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. {0..<n} \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
from hdb_subset_n ty
[PROOF STATE]
proof (chain)
picking this:
set (hd b # a ! hd b) \<subseteq> {0..<n}
{0..<n} \<subseteq> set (hd b # a ! hd b)
[PROOF STEP]
have "{0..<n} = set (hd b # ?a_hdb)"
[PROOF STATE]
proof (prove)
using this:
set (hd b # a ! hd b) \<subseteq> {0..<n}
{0..<n} \<subseteq> set (hd b # a ! hd b)

goal (1 subgoal):
 1. {0..<n} = set (hd b # a ! hd b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} = set (hd b # a ! hd b)

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with sorted_hd_b_cons
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
{0..<n} = set (hd b # a ! hd b)
[PROOF STEP]
have tz: "hd b # ?a_hdb = rev [0..<n]"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (hd b # a ! hd b))
{0..<n} = set (hd b # a ! hd b)

goal (1 subgoal):
 1. hd b # a ! hd b = rev [0..<n]
[PROOF STEP]
by (auto simp add:sorted_less_rev_set_unique)
[PROOF STATE]
proof (state)
this:
hd b # a ! hd b = rev [0..<n]

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
from n_def nodes_def len_verts_gt0 verts
[PROOF STATE]
proof (chain)
picking this:
n \<equiv> length nodes
nodes \<equiv> g_V G
0 < length (g_V G)
g_V G = [0..<length (g_V G)]
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
using this:
n \<equiv> length nodes
nodes \<equiv> g_V G
0 < length (g_V G)
g_V G = [0..<length (g_V G)]

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with tz
[PROOF STATE]
proof (chain)
picking this:
hd b # a ! hd b = rev [0..<n]
0 < n
[PROOF STEP]
have tzz: "hd b = n - 1"
[PROOF STATE]
proof (prove)
using this:
hd b # a ! hd b = rev [0..<n]
0 < n

goal (1 subgoal):
 1. hd b = n - 1
[PROOF STEP]
by (induct n)  auto
[PROOF STATE]
proof (state)
this:
hd b = n - 1

goal (1 subgoal):
 1. \<not> a ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
from p_lt_n tzz hdb_lt_p
[PROOF STATE]
proof (chain)
picking this:
p < n
hd b = n - 1
hd b < p
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p < n
hd b = n - 1
hd b < p

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> ss ! p \<noteq> rev [0..<n] \<Longrightarrow> False
[PROOF STEP]
with  ss_p_all ss_eq_a
[PROOF STATE]
proof (chain)
picking this:
ss ! p = rev [0..<n]
ss = a
a ! p \<noteq> rev [0..<n]
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
ss ! p = rev [0..<n]
ss = a
a ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. \<not> w \<noteq> [] \<Longrightarrow> Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
with sta_temp' sorted_ss_p t3
[PROOF STATE]
proof (chain)
picking this:
p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p
Sorted_Less.sorted (rev (ss ! p))
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
ss ! p \<noteq> rev [0..<n]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p
Sorted_Less.sorted (rev (ss ! p))
ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)
ss ! p \<noteq> rev [0..<n]

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)

goal (1 subgoal):
 1. \<lbrakk>propa f (step (hd b) (a ! hd b)) a (tl b) = (ss, w); b \<noteq> []; \<forall>\<tau>\<in>set a. \<tau> \<in> A; \<forall>p<n. Sorted_Less.sorted (rev (a ! p)) \<and> (a ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (a ! p). x < p)) \<and> (a ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set b. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set b \<longrightarrow> Typing_Framework_1.stable r step a p); Sorted_Less.sorted b; length a = n; \<forall>x\<in>set b. x < n\<rbrakk> \<Longrightarrow> (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
from ss_inA wf_dom_2 sorted_w len_ss_n w_lt_n
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
Sorted_Less.sorted w
length ss = n
\<forall>x\<in>set w. x < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<tau>\<in>set ss. \<tau> \<in> A
\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)
Sorted_Less.sorted w
length ss = n
\<forall>x\<in>set w. x < n

goal (1 subgoal):
 1. (\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>\<tau>\<in>set ss. \<tau> \<in> A) \<and> (\<forall>p<n. Sorted_Less.sorted (rev (ss ! p)) \<and> (ss ! p \<noteq> rev [0..<n] \<longrightarrow> (\<forall>x\<in>set (ss ! p). x < p)) \<and> (ss ! p = rev [0..<n] \<longrightarrow> (\<exists>x\<in>set w. (x, p) \<in> g_E G \<and> x < p)) \<and> (p \<notin> set w \<longrightarrow> Typing_Framework_1.stable r step ss p)) \<and> Sorted_Less.sorted w \<and> length ss = n \<and> (\<forall>x\<in>set w. x < n)

goal:
No subgoals!
[PROOF STEP]
qed