[STATEMENT]
lemma  share_all_until_volatile_write_thread_local:
  assumes dist: "ownership_distinct ts"
  assumes consis: "sharing_consis \<S> ts"
  assumes i_bound: "i < length ts"
  assumes ts_i: "ts!i = (p,is,\<theta>,sb,\<D>,\<O>,\<R>)"
  assumes a_owned: "a \<in> \<O> \<union> all_acquired sb"
  shows "share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
using dist consis i_bound ts_i
[PROOF STATE]
proof (prove)
using this:
ownership_distinct ts
sharing_consis \<S> ts
i < length ts
ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (1 subgoal):
 1. share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
proof (induct ts arbitrary: \<S> i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>\<S> i. \<lbrakk>ownership_distinct []; sharing_consis \<S> []; i < length []; [] ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write [] \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ownership_distinct []
sharing_consis \<S> []
i < length []
[] ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (2 subgoals):
 1. \<And>\<S> i. \<lbrakk>ownership_distinct []; sharing_consis \<S> []; i < length []; [] ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write [] \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ownership_distinct []
sharing_consis \<S> []
i < length []
[] ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (1 subgoal):
 1. share_all_until_volatile_write [] \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write [] \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
case (Cons t ts)
[PROOF STATE]
proof (state)
this:
\<lbrakk>ownership_distinct ts; sharing_consis ?\<S> ts; ?i < length ts; ts ! ?i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts ?\<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) ?\<S> a
ownership_distinct (t # ts)
sharing_consis \<S> (t # ts)
i < length (t # ts)
(t # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
obtain p\<^sub>t "is\<^sub>t" \<O>\<^sub>t \<R>\<^sub>t \<D>\<^sub>t \<theta>\<^sub>t sb\<^sub>t where
    t: "t=(p\<^sub>t,is\<^sub>t,\<theta>\<^sub>t,sb\<^sub>t,\<D>\<^sub>t,\<O>\<^sub>t,\<R>\<^sub>t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p\<^sub>t is\<^sub>t \<theta>\<^sub>t sb\<^sub>t \<D>\<^sub>t \<O>\<^sub>t \<R>\<^sub>t. t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases t)
[PROOF STATE]
proof (state)
this:
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
have dist: "ownership_distinct (t#ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ownership_distinct (t # ts)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
ownership_distinct (t # ts)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ownership_distinct (t # ts)
[PROOF STEP]
interpret ownership_distinct "t#ts"
[PROOF STATE]
proof (prove)
using this:
ownership_distinct (t # ts)

goal (1 subgoal):
 1. ownership_distinct (t # ts)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
have consis: "sharing_consis \<S> (t#ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sharing_consis \<S> (t # ts)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
sharing_consis \<S> (t # ts)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sharing_consis \<S> (t # ts)
[PROOF STEP]
interpret sharing_consis \<S> "t#ts"
[PROOF STATE]
proof (prove)
using this:
sharing_consis \<S> (t # ts)

goal (1 subgoal):
 1. sharing_consis \<S> (t # ts)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from ownership_distinct_tl [OF dist]
[PROOF STATE]
proof (chain)
picking this:
ownership_distinct ts
[PROOF STEP]
have dist': "ownership_distinct ts"
[PROOF STATE]
proof (prove)
using this:
ownership_distinct ts

goal (1 subgoal):
 1. ownership_distinct ts
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ownership_distinct ts

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from sharing_consis_tl [OF consis]
[PROOF STATE]
proof (chain)
picking this:
sharing_consis \<S> ts
[PROOF STEP]
have consis': "sharing_consis \<S> ts"
[PROOF STATE]
proof (prove)
using this:
sharing_consis \<S> ts

goal (1 subgoal):
 1. sharing_consis \<S> ts
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sharing_consis \<S> ts

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sharing_consis \<S> ts
[PROOF STEP]
interpret consis': sharing_consis \<S> "ts"
[PROOF STATE]
proof (prove)
using this:
sharing_consis \<S> ts

goal (1 subgoal):
 1. sharing_consis \<S> ts
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
let ?\<S>' = "(share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from sharing_consis [of 0, simplified, OF t]
[PROOF STATE]
proof (chain)
picking this:
sharing_consistent \<S> \<O>\<^sub>t sb\<^sub>t
[PROOF STEP]
have "sharing_consistent \<S> \<O>\<^sub>t sb\<^sub>t"
[PROOF STATE]
proof (prove)
using this:
sharing_consistent \<S> \<O>\<^sub>t sb\<^sub>t

goal (1 subgoal):
 1. sharing_consistent \<S> \<O>\<^sub>t sb\<^sub>t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sharing_consistent \<S> \<O>\<^sub>t sb\<^sub>t

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from sharing_consistent_takeWhile [OF this]
[PROOF STATE]
proof (chain)
picking this:
sharing_consistent \<S> \<O>\<^sub>t (takeWhile ?P sb\<^sub>t)
[PROOF STEP]
have consis_sb: "sharing_consistent \<S> \<O>\<^sub>t (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)"
[PROOF STATE]
proof (prove)
using this:
sharing_consistent \<S> \<O>\<^sub>t (takeWhile ?P sb\<^sub>t)

goal (1 subgoal):
 1. sharing_consistent \<S> \<O>\<^sub>t (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sharing_consistent \<S> \<O>\<^sub>t (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from freshly_shared_owned [OF consis_sb]
[PROOF STATE]
proof (chain)
picking this:
dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t
[PROOF STEP]
have fresh_owned: "dom ?\<S>' - dom \<S> \<subseteq> \<O>\<^sub>t"
[PROOF STATE]
proof (prove)
using this:
dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t

goal (1 subgoal):
 1. dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from unshared_all_unshared [OF consis_sb] unshared_acquired_or_owned [OF consis_sb]
[PROOF STATE]
proof (chain)
picking this:
dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_unshared (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)
all_unshared (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t
[PROOF STEP]
have unshared_acq_owned: "dom \<S> - dom ?\<S>'
                 \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t"
[PROOF STATE]
proof (prove)
using this:
dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_unshared (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)
all_unshared (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t

goal (1 subgoal):
 1. dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
have sep:
    "\<forall>i < length ts. let (_,_,_,sb',_,_,_) = ts!i in
          all_acquired sb' \<inter> dom \<S> - dom ?\<S>' = {} \<and>
          all_unshared sb' \<inter> dom ?\<S>' - dom \<S> = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
fix i p\<^sub>i "is\<^sub>i" \<O>\<^sub>i \<R>\<^sub>i \<D>\<^sub>i \<theta>\<^sub>i sb\<^sub>i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
assume i_bound: "i < length ts"
[PROOF STATE]
proof (state)
this:
i < length ts

goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
assume ts_i: "ts ! i = (p\<^sub>i,is\<^sub>i,\<theta>\<^sub>i,sb\<^sub>i,\<D>\<^sub>i,\<O>\<^sub>i,\<R>\<^sub>i)"
[PROOF STATE]
proof (state)
this:
ts ! i = (p\<^sub>i, is\<^sub>i, \<theta>\<^sub>i, sb\<^sub>i, \<D>\<^sub>i, \<O>\<^sub>i, \<R>\<^sub>i)

goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
have "all_acquired sb\<^sub>i \<inter> dom \<S> - dom ?\<S>' = {} \<and>
            all_unshared sb\<^sub>i \<inter> dom ?\<S>' - dom \<S> = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
from ownership_distinct [of "0" "Suc i"] ts_i t i_bound
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < length (t # ts); Suc i < length (t # ts); 0 \<noteq> Suc i; (t # ts) ! 0 = (?p\<^sub>i, ?is\<^sub>i, ?\<theta>\<^sub>i, ?sb\<^sub>i, ?\<D>\<^sub>i, ?\<O>\<^sub>i, ?\<R>\<^sub>i); (t # ts) ! Suc i = (?p\<^sub>j, ?is\<^sub>j, ?\<theta>\<^sub>j, ?sb\<^sub>j, ?\<D>\<^sub>j, ?\<O>\<^sub>j, ?\<R>\<^sub>j)\<rbrakk> \<Longrightarrow> (?\<O>\<^sub>i \<union> all_acquired ?sb\<^sub>i) \<inter> (?\<O>\<^sub>j \<union> all_acquired ?sb\<^sub>j) = {}
ts ! i = (p\<^sub>i, is\<^sub>i, \<theta>\<^sub>i, sb\<^sub>i, \<D>\<^sub>i, \<O>\<^sub>i, \<R>\<^sub>i)
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
i < length ts
[PROOF STEP]
have dist: "(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < length (t # ts); Suc i < length (t # ts); 0 \<noteq> Suc i; (t # ts) ! 0 = (?p\<^sub>i, ?is\<^sub>i, ?\<theta>\<^sub>i, ?sb\<^sub>i, ?\<D>\<^sub>i, ?\<O>\<^sub>i, ?\<R>\<^sub>i); (t # ts) ! Suc i = (?p\<^sub>j, ?is\<^sub>j, ?\<theta>\<^sub>j, ?sb\<^sub>j, ?\<D>\<^sub>j, ?\<O>\<^sub>j, ?\<R>\<^sub>j)\<rbrakk> \<Longrightarrow> (?\<O>\<^sub>i \<union> all_acquired ?sb\<^sub>i) \<inter> (?\<O>\<^sub>j \<union> all_acquired ?sb\<^sub>j) = {}
ts ! i = (p\<^sub>i, is\<^sub>i, \<theta>\<^sub>i, sb\<^sub>i, \<D>\<^sub>i, \<O>\<^sub>i, \<R>\<^sub>i)
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
i < length ts

goal (1 subgoal):
 1. (\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
from dist unshared_acq_owned all_acquired_takeWhile [of "(Not \<circ> is_volatile_Write\<^sub>s\<^sub>b)" sb\<^sub>t]
[PROOF STATE]
proof (chain)
picking this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}
dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t
all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<subseteq> all_acquired sb\<^sub>t
[PROOF STEP]
have "all_acquired sb\<^sub>i \<inter> dom \<S> - dom ?\<S>' = {}"
[PROOF STATE]
proof (prove)
using this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}
dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) \<subseteq> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> \<O>\<^sub>t
all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<subseteq> all_acquired sb\<^sub>t

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {}

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {}

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
from sharing_consis [of "Suc i"] ts_i i_bound
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Suc i < length (t # ts); (t # ts) ! Suc i = (?p, ?is, ?\<theta>, ?sb, ?\<D>, ?\<O>, ?\<R>)\<rbrakk> \<Longrightarrow> sharing_consistent \<S> ?\<O> ?sb
ts ! i = (p\<^sub>i, is\<^sub>i, \<theta>\<^sub>i, sb\<^sub>i, \<D>\<^sub>i, \<O>\<^sub>i, \<R>\<^sub>i)
i < length ts
[PROOF STEP]
have "sharing_consistent \<S> \<O>\<^sub>i sb\<^sub>i"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Suc i < length (t # ts); (t # ts) ! Suc i = (?p, ?is, ?\<theta>, ?sb, ?\<D>, ?\<O>, ?\<R>)\<rbrakk> \<Longrightarrow> sharing_consistent \<S> ?\<O> ?sb
ts ! i = (p\<^sub>i, is\<^sub>i, \<theta>\<^sub>i, sb\<^sub>i, \<D>\<^sub>i, \<O>\<^sub>i, \<R>\<^sub>i)
i < length ts

goal (1 subgoal):
 1. sharing_consistent \<S> \<O>\<^sub>i sb\<^sub>i
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sharing_consistent \<S> \<O>\<^sub>i sb\<^sub>i

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
from unshared_acquired_or_owned [OF this]
[PROOF STATE]
proof (chain)
picking this:
all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i
[PROOF STEP]
have "all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i"
[PROOF STATE]
proof (prove)
using this:
all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i

goal (1 subgoal):
 1. all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
with dist fresh_owned
[PROOF STATE]
proof (chain)
picking this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}
dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t
all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i
[PROOF STEP]
have "all_unshared sb\<^sub>i \<inter> dom ?\<S>' - dom \<S> = {}"
[PROOF STATE]
proof (prove)
using this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>i \<union> all_acquired sb\<^sub>i) = {}
dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> \<subseteq> \<O>\<^sub>t
all_unshared sb\<^sub>i \<subseteq> all_acquired sb\<^sub>i \<union> \<O>\<^sub>i

goal (1 subgoal):
 1. all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {}
all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {}
all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
all_acquired sb\<^sub>i \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb\<^sub>i \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?ib2 < length ts; ts ! ?ib2 = (?p\<^sub>i2, ?is\<^sub>i2, ?\<theta>\<^sub>i2, ?sb\<^sub>i2, ?\<D>\<^sub>i2, ?\<O>\<^sub>i2, ?\<R>\<^sub>i2)\<rbrakk> \<Longrightarrow> all_acquired ?sb\<^sub>i2 \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared ?sb\<^sub>i2 \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?ib2 < length ts; ts ! ?ib2 = (?p\<^sub>i2, ?is\<^sub>i2, ?\<theta>\<^sub>i2, ?sb\<^sub>i2, ?\<D>\<^sub>i2, ?\<O>\<^sub>i2, ?\<R>\<^sub>i2)\<rbrakk> \<Longrightarrow> all_acquired ?sb\<^sub>i2 \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared ?sb\<^sub>i2 \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. \<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}
[PROOF STEP]
by (fastforce simp add: Let_def)
[PROOF STATE]
proof (state)
this:
\<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<length ts. let (uu_, uu_, uu_, sb', uu_, uu_, uu_) = ts ! i in all_acquired sb' \<inter> dom \<S> - dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) = {} \<and> all_unshared sb' \<inter> dom (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) - dom \<S> = {}

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from consis'.sharing_consis_preservation [OF this]
[PROOF STATE]
proof (chain)
picking this:
sharing_consis (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) ts
[PROOF STEP]
have consis_shared': "sharing_consis ?\<S>' ts"
[PROOF STATE]
proof (prove)
using this:
sharing_consis (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) ts

goal (1 subgoal):
 1. sharing_consis (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) ts
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sharing_consis (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) ts

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
have aargh: "(Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) = (\<lambda>a. \<not> is_volatile_Write\<^sub>s\<^sub>b a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Not \<circ> is_volatile_Write\<^sub>s\<^sub>b = (\<lambda>a. \<not> is_volatile_Write\<^sub>s\<^sub>b a)
[PROOF STEP]
by (rule ext) auto
[PROOF STATE]
proof (state)
this:
Not \<circ> is_volatile_Write\<^sub>s\<^sub>b = (\<lambda>a. \<not> is_volatile_Write\<^sub>s\<^sub>b a)

goal (1 subgoal):
 1. \<And>aa ts \<S> i. \<lbrakk>\<And>\<S> i. \<lbrakk>ownership_distinct ts; sharing_consis \<S> ts; i < length ts; ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write ts \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a; ownership_distinct (aa # ts); sharing_consis \<S> (aa # ts); i < length (aa # ts); (aa # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> share_all_until_volatile_write (aa # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
proof (cases "i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
with Cons.prems
[PROOF STATE]
proof (chain)
picking this:
ownership_distinct (t # ts)
sharing_consis \<S> (t # ts)
i < length (t # ts)
(t # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = 0
[PROOF STEP]
have t': "t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)"
[PROOF STATE]
proof (prove)
using this:
ownership_distinct (t # ts)
sharing_consis \<S> (t # ts)
i < length (t # ts)
(t # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = 0

goal (1 subgoal):
 1. t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
fix j p\<^sub>j "is\<^sub>j" \<theta>\<^sub>j sb\<^sub>j \<D>\<^sub>j \<O>\<^sub>j \<R>\<^sub>j
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
assume j_bound: "j < length ts"
[PROOF STATE]
proof (state)
this:
j < length ts

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
assume ts_j: "ts ! j = (p\<^sub>j, is\<^sub>j, \<theta>\<^sub>j, sb\<^sub>j, \<D>\<^sub>j, \<O>\<^sub>j, \<R>\<^sub>j)"
[PROOF STATE]
proof (state)
this:
ts ! j = (p\<^sub>j, is\<^sub>j, \<theta>\<^sub>j, sb\<^sub>j, \<D>\<^sub>j, \<O>\<^sub>j, \<R>\<^sub>j)

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
have "a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j
[PROOF STEP]
from ownership_distinct [of "0" "Suc j", simplified, OF j_bound t ts_j] t a_owned t' 0
[PROOF STATE]
proof (chain)
picking this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>j \<union> all_acquired sb\<^sub>j) = {}
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
a \<in> \<O> \<union> all_acquired sb
t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<O>\<^sub>t \<union> all_acquired sb\<^sub>t) \<inter> (\<O>\<^sub>j \<union> all_acquired sb\<^sub>j) = {}
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
a \<in> \<O> \<union> all_acquired sb
t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = 0

goal (1 subgoal):
 1. a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<notin> \<O>\<^sub>j \<union> all_acquired sb\<^sub>j

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j3 < length ts; ts ! ?j3 = (?p\<^sub>j3, ?is\<^sub>j3, ?\<theta>\<^sub>j3, ?sb\<^sub>j3, ?\<D>\<^sub>j3, ?\<O>\<^sub>j3, ?\<R>\<^sub>j3)\<rbrakk> \<Longrightarrow> a \<notin> ?\<O>\<^sub>j3 \<union> all_acquired ?sb\<^sub>j3

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
with share_all_until_volatile_write_unowned [OF dist' consis_shared', of a]
[PROOF STATE]
proof (chain)
picking this:
\<forall>i p is \<theta> sb \<D> \<O> \<R>. i < length ts \<longrightarrow> ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>) \<longrightarrow> a \<notin> \<O> \<union> all_acquired sb \<Longrightarrow> share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a
\<lbrakk>?j3 < length ts; ts ! ?j3 = (?p\<^sub>j3, ?is\<^sub>j3, ?\<theta>\<^sub>j3, ?sb\<^sub>j3, ?\<D>\<^sub>j3, ?\<O>\<^sub>j3, ?\<R>\<^sub>j3)\<rbrakk> \<Longrightarrow> a \<notin> ?\<O>\<^sub>j3 \<union> all_acquired ?sb\<^sub>j3
[PROOF STEP]
have "share_all_until_volatile_write ts ?\<S>' a = ?\<S>' a"
[PROOF STATE]
proof (prove)
using this:
\<forall>i p is \<theta> sb \<D> \<O> \<R>. i < length ts \<longrightarrow> ts ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>) \<longrightarrow> a \<notin> \<O> \<union> all_acquired sb \<Longrightarrow> share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a
\<lbrakk>?j3 < length ts; ts ! ?j3 = (?p\<^sub>j3, ?is\<^sub>j3, ?\<theta>\<^sub>j3, ?sb\<^sub>j3, ?\<D>\<^sub>j3, ?\<O>\<^sub>j3, ?\<R>\<^sub>j3)\<rbrakk> \<Longrightarrow> a \<notin> ?\<O>\<^sub>j3 \<union> all_acquired ?sb\<^sub>j3

goal (1 subgoal):
 1. share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
 2. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a

goal (1 subgoal):
 1. share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
using t t' 0
[PROOF STATE]
proof (prove)
using this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
t = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = 0

goal (1 subgoal):
 1. share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
by (auto simp add: Cons t aargh)
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
i = Suc n

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
with Cons.prems
[PROOF STATE]
proof (chain)
picking this:
ownership_distinct (t # ts)
sharing_consis \<S> (t # ts)
i < length (t # ts)
(t # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = Suc n
[PROOF STEP]
obtain n_bound: "n < length ts" and ts_n: "ts!n = (p,is,\<theta>,sb,\<D>,\<O>,\<R>)"
[PROOF STATE]
proof (prove)
using this:
ownership_distinct (t # ts)
sharing_consis \<S> (t # ts)
i < length (t # ts)
(t # ts) ! i = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
i = Suc n

goal (1 subgoal):
 1. (\<lbrakk>n < length ts; ts ! n = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < length ts
ts ! n = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from Cons.hyps [OF dist' consis_shared' n_bound ts_n]
[PROOF STATE]
proof (chain)
picking this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a
[PROOF STEP]
have "share_all_until_volatile_write ts ?\<S>' a =
            share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) ?\<S>' a"
[PROOF STATE]
proof (prove)
using this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a

goal (1 subgoal):
 1. share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from ownership_distinct [of "0" "Suc n"] t a_owned ts_n n_bound
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < length (t # ts); Suc n < length (t # ts); 0 \<noteq> Suc n; (t # ts) ! 0 = (?p\<^sub>i, ?is\<^sub>i, ?\<theta>\<^sub>i, ?sb\<^sub>i, ?\<D>\<^sub>i, ?\<O>\<^sub>i, ?\<R>\<^sub>i); (t # ts) ! Suc n = (?p\<^sub>j, ?is\<^sub>j, ?\<theta>\<^sub>j, ?sb\<^sub>j, ?\<D>\<^sub>j, ?\<O>\<^sub>j, ?\<R>\<^sub>j)\<rbrakk> \<Longrightarrow> (?\<O>\<^sub>i \<union> all_acquired ?sb\<^sub>i) \<inter> (?\<O>\<^sub>j \<union> all_acquired ?sb\<^sub>j) = {}
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
a \<in> \<O> \<union> all_acquired sb
ts ! n = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
n < length ts
[PROOF STEP]
have "a \<notin> \<O>\<^sub>t \<union> all_acquired sb\<^sub>t"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < length (t # ts); Suc n < length (t # ts); 0 \<noteq> Suc n; (t # ts) ! 0 = (?p\<^sub>i, ?is\<^sub>i, ?\<theta>\<^sub>i, ?sb\<^sub>i, ?\<D>\<^sub>i, ?\<O>\<^sub>i, ?\<R>\<^sub>i); (t # ts) ! Suc n = (?p\<^sub>j, ?is\<^sub>j, ?\<theta>\<^sub>j, ?sb\<^sub>j, ?\<D>\<^sub>j, ?\<O>\<^sub>j, ?\<R>\<^sub>j)\<rbrakk> \<Longrightarrow> (?\<O>\<^sub>i \<union> all_acquired ?sb\<^sub>i) \<inter> (?\<O>\<^sub>j \<union> all_acquired ?sb\<^sub>j) = {}
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
a \<in> \<O> \<union> all_acquired sb
ts ! n = (p, is, \<theta>, sb, \<D>, \<O>, \<R>)
n < length ts

goal (1 subgoal):
 1. a \<notin> \<O>\<^sub>t \<union> all_acquired sb\<^sub>t
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a \<notin> \<O>\<^sub>t \<union> all_acquired sb\<^sub>t

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
with share_other_untouched [OF consis_sb, of a]
      all_acquired_append [of "(takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)" "(dropWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)"]
[PROOF STATE]
proof (chain)
picking this:
a \<notin> \<O>\<^sub>t \<union> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<Longrightarrow> share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a = \<S> a
all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t @ dropWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) = all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> all_acquired (dropWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)
a \<notin> \<O>\<^sub>t \<union> all_acquired sb\<^sub>t
[PROOF STEP]
have "?\<S>' a = \<S> a"
[PROOF STATE]
proof (prove)
using this:
a \<notin> \<O>\<^sub>t \<union> all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<Longrightarrow> share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a = \<S> a
all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t @ dropWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) = all_acquired (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<union> all_acquired (dropWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t)
a \<notin> \<O>\<^sub>t \<union> all_acquired sb\<^sub>t

goal (1 subgoal):
 1. share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a = \<S> a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S> a = \<S> a

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
from share_shared_eq [of ?\<S>' a \<S>,OF this ]
[PROOF STATE]
proof (chain)
picking this:
share ?sb (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share ?sb \<S> a
[PROOF STEP]
have "share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) ?\<S>' a =
           share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a"
[PROOF STATE]
proof (prove)
using this:
share ?sb (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share ?sb \<S> a

goal (1 subgoal):
 1. share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a
share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a
share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal (1 subgoal):
 1. share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
using t Suc
[PROOF STATE]
proof (prove)
using this:
share_all_until_volatile_write ts (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a
share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) (share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb\<^sub>t) \<S>) a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
t = (p\<^sub>t, is\<^sub>t, \<theta>\<^sub>t, sb\<^sub>t, \<D>\<^sub>t, \<O>\<^sub>t, \<R>\<^sub>t)
i = Suc n

goal (1 subgoal):
 1. share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a
[PROOF STEP]
by (auto simp add: aargh)
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
share_all_until_volatile_write (t # ts) \<S> a = share (takeWhile (Not \<circ> is_volatile_Write\<^sub>s\<^sub>b) sb) \<S> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_before_unsafe: "\<not>(\<forall>(h
    :: ('object_ptr::{equal,linorder}, 'node_ptr::{equal,linorder}, 'element_ptr::{equal,linorder},
'character_data_ptr::{equal,linorder}, 'document_ptr::{equal,linorder}, 'shadow_root_ptr::{equal,linorder},
'Object::{equal,linorder}, 'Node::{equal,linorder}, 'Element::{equal,linorder},
'CharacterData::{equal,linorder}, 'Document::{equal,linorder}) heap
  ) h' ptr child. heap_is_wellformed h \<longrightarrow> type_wf h \<longrightarrow> known_ptrs h \<longrightarrow>
h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast child} {} h h')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')
[PROOF STEP]
obtain h document_ptr e1 e2 where h: "Inr ((document_ptr, e1, e2), h) = (Heap (fmempty)
      :: ('object_ptr::{equal,linorder}, 'node_ptr::{equal,linorder}, 'element_ptr::{equal,linorder},
'character_data_ptr::{equal,linorder}, 'document_ptr::{equal,linorder}, 'shadow_root_ptr::{equal,linorder},
'Object::{equal,linorder}, 'Node::{equal,linorder}, 'Element::{equal,linorder},
'CharacterData::{equal,linorder}, 'Document::{equal,linorder}) heap
    ) \<turnstile> (do {
      document_ptr \<leftarrow> create_document;
      e1 \<leftarrow> create_element document_ptr ''div'';
      e2 \<leftarrow> create_element document_ptr ''div'';
      return (document_ptr, e1, e2)
  })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>document_ptr e1 e2 h. Inr ((document_ptr, e1, e2), h) = Heap fmempty \<turnstile> Heap_Error_Monad.bind create_document (\<lambda>document_ptr. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e1. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e2. return (document_ptr, e1, e2)))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(code_simp, auto simp add: equal_eq List.member_def)+
[PROOF STATE]
proof (state)
this:
Inr ((document_ptr, e1, e2), h) = Heap fmempty \<turnstile> Heap_Error_Monad.bind create_document (\<lambda>document_ptr. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e1. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e2. return (document_ptr, e1, e2))))

goal (1 subgoal):
 1. \<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Inr ((document_ptr, e1, e2), h) = Heap fmempty \<turnstile> Heap_Error_Monad.bind create_document (\<lambda>document_ptr. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e1. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e2. return (document_ptr, e1, e2))))
[PROOF STEP]
obtain h' where
    "heap_is_wellformed h" and "type_wf h" and "known_ptrs h" and
    h': "h \<turnstile> insert_before (cast e1) (cast e2) None \<rightarrow>\<^sub>h h'" and
    "\<not>(is_weakly_dom_component_safe {cast e1, cast e2} {} h h')"
[PROOF STATE]
proof (prove)
using this:
Inr ((document_ptr, e1, e2), h) = Heap fmempty \<turnstile> Heap_Error_Monad.bind create_document (\<lambda>document_ptr. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e1. Heap_Error_Monad.bind (create_element document_ptr ''div'') (\<lambda>e2. return (document_ptr, e1, e2))))

goal (1 subgoal):
 1. (\<And>h'. \<lbrakk>heap_is_wellformed h; DocumentClass.type_wf h; DocumentClass.known_ptrs h; h \<turnstile> insert_before (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1) (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2) None \<rightarrow>\<^sub>h h'; \<not> is_weakly_dom_component_safe {cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1, cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2} {} h h'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(code_simp, auto simp add: equal_eq List.member_def)+
[PROOF STATE]
proof (state)
this:
heap_is_wellformed h
DocumentClass.type_wf h
DocumentClass.known_ptrs h
h \<turnstile> insert_before (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1) (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2) None \<rightarrow>\<^sub>h h'
\<not> is_weakly_dom_component_safe {cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1, cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2} {} h h'

goal (1 subgoal):
 1. \<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
heap_is_wellformed h
DocumentClass.type_wf h
DocumentClass.known_ptrs h
h \<turnstile> insert_before (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1) (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2) None \<rightarrow>\<^sub>h h'
\<not> is_weakly_dom_component_safe {cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1, cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2} {} h h'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
heap_is_wellformed h
DocumentClass.type_wf h
DocumentClass.known_ptrs h
h \<turnstile> insert_before (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1) (cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2) None \<rightarrow>\<^sub>h h'
\<not> is_weakly_dom_component_safe {cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e1, cast\<^sub>e\<^sub>l\<^sub>e\<^sub>m\<^sub>e\<^sub>n\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r e2} {} h h'

goal (1 subgoal):
 1. \<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>h h' ptr child. heap_is_wellformed h \<longrightarrow> DocumentClass.type_wf h \<longrightarrow> DocumentClass.known_ptrs h \<longrightarrow> h \<turnstile> insert_before ptr child None \<rightarrow>\<^sub>h h' \<longrightarrow> is_weakly_dom_component_safe {ptr, cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r child} {} h h')

goal:
No subgoals!
[PROOF STEP]
qed