theory Trace_RG

lemma prefix_closed_drop:
  "\<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s" proof (induct n arbitrary: res) case 0 then show ?case by auto next case (Suc n) have drop_1: "(tr, res) \<in> f s \<Longrightarrow> \<exists>res'. (drop 1 tr, res') \<in> f s" for tr res by (cases tr; fastforce dest: prefix_closedD[rotated] intro: Suc) show ?case using Suc.hyps[OF Suc.prems] by (metis drop_1[simplified] drop_drop add_0 add_Suc) qed

(* Proof state trace *)
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s proof (state)
goal (2 subgoals):
 1. \<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop 0 tr, res') \<in> f s
 2. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (state)
this:
(tr, res) \<in> f s
prefix_closed f

goal (2 subgoals):
 1. \<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop 0 tr, res') \<in> f s
 2. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (chain)
picking this:
(tr, res) \<in> f s
prefix_closed f proof (prove)
using this:
(tr, res) \<in> f s
prefix_closed f

goal (1 subgoal):
 1. \<exists>res'. (drop 0 tr, res') \<in> f s proof (state)
this:
\<exists>res'. (drop 0 tr, res') \<in> f s

goal (1 subgoal):
 1. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (state)
goal (1 subgoal):
 1. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (state)
this:
\<lbrakk>(tr, ?res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s
(tr, res) \<in> f s
prefix_closed f

goal (1 subgoal):
 1. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (prove)
goal (1 subgoal):
 1. (tr, res) \<in> f s \<Longrightarrow> \<exists>res'. (drop 1 tr, res') \<in> f s proof (state)
this:
(?tr, ?res) \<in> f s \<Longrightarrow> \<exists>res'. (drop 1 ?tr, res') \<in> f s

goal (1 subgoal):
 1. \<And>n res. \<lbrakk>\<And>res. \<lbrakk>(tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop n tr, res') \<in> f s; (tr, res) \<in> f s; prefix_closed f\<rbrakk> \<Longrightarrow> \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (prove)
goal (1 subgoal):
 1. \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (prove)
using this:
\<exists>res'. (drop n tr, res') \<in> f s

goal (1 subgoal):
 1. \<exists>res'. (drop (Suc n) tr, res') \<in> f s proof (state)
this:
\<exists>res'. (drop (Suc n) tr, res') \<in> f s

goal:
No subgoals!