undo_local_steps: fixes c :: "nat \<Rightarrow> ('a \<times> instr list \<times> (nat \<Rightarrow> nat option) \<times> unit \<times> bool \<times> nat set \<times> (nat \<Rightarrow> bool option)) list \<times> (nat \<Rightarrow> nat) \<times> (nat \<Rightarrow> bool option)"   and n :: "nat"   and k :: "nat"   and ts :: "('a \<times> instr list \<times> (nat \<Rightarrow> nat option) \<times> unit \<times> bool \<times> nat set \<times> (nat \<Rightarrow> bool option)) list"   and m :: "nat \<Rightarrow> nat"   and \<S> :: "nat \<Rightarrow> bool option"   and i :: "nat"   and u_ts :: "('a \<times> instr list \<times> (nat \<Rightarrow> nat option) \<times> unit \<times> bool \<times> nat set \<times> (nat \<Rightarrow> bool option)) list"   and u_m :: "nat \<Rightarrow> nat"   and u_shared :: "nat \<Rightarrow> bool option"   and u_p :: "'a"   and u_is :: "instr list"   and u_tmps :: "nat \<Rightarrow> nat option"   and u_sb :: "unit"   and u_dirty :: "bool"   and u_owns :: "nat set"   and u_rels :: "nat \<Rightarrow> bool option" assumes "trace c n k"   and "c n = (ts, m, \<S>)"   and "\<forall>l\<le>k. \<forall>ts\<^sub>l \<S>\<^sub>l m\<^sub>l. c (n + l) = (ts\<^sub>l, m\<^sub>l, \<S>\<^sub>l) \<longrightarrow> ts\<^sub>l ! i = ts ! i"   and "safe_delayed (u_ts, u_m, u_shared)"   and "length u_ts = length ts"   and "i < length ts"   and "\<forall>j<length ts. j \<noteq> i \<longrightarrow> u_ts ! j = ts ! j"   and "u_ts ! i = (u_p, u_is, u_tmps, u_sb, u_dirty, u_owns, u_rels)"   and "\<forall>a. a \<notin> u_owns \<longrightarrow> u_m a = m a"   and "\<forall>a. a \<in> u_owns \<longrightarrow> a \<in> dom u_shared \<longrightarrow> u_m a = m a"   and "\<forall>a. a \<notin> u_owns \<longrightarrow> a \<notin> owned (ts ! i) \<longrightarrow> u_shared a = \<S> a"   and "simple_ownership_distinct u_ts"   and "simple_ownership_distinct ts"   and "\<forall>x<k. safe_delayed (c (n + x))" shows "\<exists>c' l. l \<le> k \<and> trace c' n l \<and> c' n = (u_ts, u_m, u_shared) \<and> (\<forall>x\<le>l. length (fst (c' (n + x))) = length (fst (c (n + x)))) \<and> (\<forall>x<l. safe_delayed (c' (n + x))) \<and> (l < k \<longrightarrow> \<not> safe_delayed (c' (n + l))) \<and> (\<forall>x\<le>l. \<forall>ts\<^sub>x \<S>\<^sub>x m\<^sub>x ts\<^sub>x' \<S>\<^sub>x' m\<^sub>x'. c (n + x) = (ts\<^sub>x, m\<^sub>x, \<S>\<^sub>x) \<longrightarrow> c' (n + x) = (ts\<^sub>x', m\<^sub>x', \<S>\<^sub>x') \<longrightarrow> ts\<^sub>x' ! i = u_ts ! i \<and> (\<forall>a\<in>u_owns. \<S>\<^sub>x' a = u_shared a) \<and> (\<forall>a\<in>u_owns. \<S>\<^sub>x a = \<S> a) \<and> (\<forall>a\<in>u_owns. m\<^sub>x' a = u_m a) \<and> (\<forall>a\<in>u_owns. m\<^sub>x a = m a)) \<and> (\<forall>x\<le>l. \<forall>ts\<^sub>x \<S>\<^sub>x m\<^sub>x ts\<^sub>x' \<S>\<^sub>x' m\<^sub>x'. c (n + x) = (ts\<^sub>x, m\<^sub>x, \<S>\<^sub>x) \<longrightarrow> c' (n + x) = (ts\<^sub>x', m\<^sub>x', \<S>\<^sub>x') \<longrightarrow> (\<forall>j<length ts\<^sub>x. j \<noteq> i \<longrightarrow> ts\<^sub>x' ! j = ts\<^sub>x ! j) \<and> (\<forall>a. a \<notin> u_owns \<longrightarrow> a \<notin> owned (ts ! i) \<longrightarrow> \<S>\<^sub>x' a = \<S>\<^sub>x a) \<and> (\<forall>a. a \<notin> u_owns \<longrightarrow> m\<^sub>x' a = m\<^sub>x a))"