[STATEMENT]
lemma Outpts_A_Card_10:
     "\<lbrakk> Outpts C A \<lbrace>Key K, (Crypt (pairK(A,B)) (Nonce Nb))\<rbrace> \<in> set evs;
         evs \<in> sr \<rbrakk>
     \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and>
         (\<exists> Na Ver1 Ver2 Ver3.
       Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)),
                              Ver1, Ver2, Ver3\<rbrace> \<in> set evs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs; evs \<in> sr\<rbrakk> \<Longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs)
[PROOF STEP]
apply (erule rev_mp, erule sr.induct)
[PROOF STATE]
proof (prove)
goal (20 subgoals):
 1. Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set [] \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set [])
 2. \<And>evsF X Ba Aa. \<lbrakk>evsF \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evsF \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evsF); X \<in> synth (analz (knows Spy evsF)); illegalUse (Card Ba)\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Says Spy Aa X # Inputs Spy (Card Ba) X # evsF) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Says Spy Aa X # Inputs Spy (Card Ba) X # evsF))
 3. \<And>evsFo Nba Aa Ba. \<lbrakk>evsFo \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evsFo \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evsFo); Nonce Nba \<in> analz (knows Spy evsFo); Key (pairK (Aa, Ba)) \<in> knows Spy evsFo\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Notes Spy (Key (sesK (Nba, pairK (Aa, Ba)))) # evsFo) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Notes Spy (Key (sesK (Nba, pairK (Aa, Ba)))) # evsFo))
 4. \<And>evsR Aa Ba X. \<lbrakk>evsR \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evsR \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evsR); Says Aa Ba X \<in> set evsR\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Gets Ba X # evsR) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Gets Ba X # evsR))
 5. \<And>evs1 Aa Ba. \<lbrakk>evs1 \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs1 \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs1); Aa \<noteq> Server\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Says Aa Server \<lbrace>Agent Aa, Agent Ba\<rbrace> # evs1) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Says Aa Server \<lbrace>Agent Aa, Agent Ba\<rbrace> # evs1))
 6. \<And>evs2 Aa Ba. \<lbrakk>evs2 \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs2 \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs2); Gets Server \<lbrace>Agent Aa, Agent Ba\<rbrace> \<in> set evs2\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Says Server Aa \<lbrace>Nonce (Pairkey (Aa, Ba)), Crypt (shrK Aa) \<lbrace>Nonce (Pairkey (Aa, Ba)), Agent Ba\<rbrace>\<rbrace> # evs2) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Says Server Aa \<lbrace>Nonce (Pairkey (Aa, Ba)), Crypt (shrK Aa) \<lbrace>Nonce (Pairkey (Aa, Ba)), Agent Ba\<rbrace>\<rbrace> # evs2))
 7. \<And>evs3 Aa Ba Pk Certificate. \<lbrakk>evs3 \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs3 \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs3); legalUse Card Aa; Says Aa Server \<lbrace>Agent Aa, Agent Ba\<rbrace> \<in> set evs3; Gets Aa \<lbrace>Nonce Pk, Certificate\<rbrace> \<in> set evs3\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Inputs Aa (Card Aa) (Agent Aa) # evs3) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Inputs Aa (Card Aa) (Agent Aa) # evs3))
 8. \<And>evs4 Aa Na. \<lbrakk>evs4 \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs4 \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs4); Aa \<noteq> Server; Nonce Na \<notin> used evs4; legalUse Card Aa; Inputs Aa (Card Aa) (Agent Aa) \<in> set evs4\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Outpts (Card Aa) Aa \<lbrace>Nonce Na, Crypt (crdK (Card Aa)) (Nonce Na)\<rbrace> # evs4) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Naa Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Naa, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Outpts (Card Aa) Aa \<lbrace>Nonce Na, Crypt (crdK (Card Aa)) (Nonce Na)\<rbrace> # evs4))
 9. \<And>evs4F Na Aa. \<lbrakk>evs4F \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs4F \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs4F); Nonce Na \<notin> used evs4F; illegalUse (Card Aa); Inputs Spy (Card Aa) (Agent Aa) \<in> set evs4F\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Outpts (Card Aa) Spy \<lbrace>Nonce Na, Crypt (crdK (Card Aa)) (Nonce Na)\<rbrace> # evs4F) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Naa Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Naa, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Outpts (Card Aa) Spy \<lbrace>Nonce Na, Crypt (crdK (Card Aa)) (Nonce Na)\<rbrace> # evs4F))
 10. \<And>evs5 Aa Na Certificate Ba. \<lbrakk>evs5 \<in> sr; Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs5 \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Na Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set evs5); Outpts (Card Aa) Aa \<lbrace>Nonce Na, Certificate\<rbrace> \<in> set evs5; \<forall>p q. Certificate \<noteq> \<lbrace>p, q\<rbrace>\<rbrakk> \<Longrightarrow> Outpts C A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set (Says Aa Ba \<lbrace>Agent Aa, Nonce Na\<rbrace> # evs5) \<longrightarrow> legalUse C \<and> C = Card A \<and> (\<exists>Naa Ver1 Ver2 Ver3. Inputs A (Card A) \<lbrace>Agent B, Nonce Naa, Nonce Nb, Nonce (Pairkey (A, B)), Ver1, Ver2, Ver3\<rbrace> \<in> set (Says Aa Ba \<lbrace>Agent Aa, Nonce Na\<rbrace> # evs5))
A total of 20 subgoals...
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P
[PROOF STEP]
apply (recursion_example "(A \<and> D) \<and> (B \<and> C)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P
[PROOF STEP]
oops


[STATEMENT]
lemma ev_wait_one_weakly_step_consistent:
  assumes eq_obs: "vpeq u s1 s2"
      and eq_act: "vpeq (partition tid) s1 s2"
      and inv1:   "atomic_step_invariant s1"
      and inv2:   "atomic_step_invariant s2"
      and prec1: "atomic_step_precondition s1 (current s1) ipt"
      and prec2: "atomic_step_precondition s1 (current s1) ipt"
    shows "vpeq u
                (atomic_step_ev_wait_one tid  s1)
                (atomic_step_ev_wait_one tid  s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vpeq u (atomic_step_ev_wait_one tid s1) (atomic_step_ev_wait_one tid s2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vpeq u s1 s2
vpeq (Step.partition tid) s1 s2
atomic_step_invariant s1
atomic_step_invariant s2
atomic_step_precondition s1 (current s1) ipt
atomic_step_precondition s1 (current s1) ipt

goal (1 subgoal):
 1. vpeq u (atomic_step_ev_wait_one tid s1) (atomic_step_ev_wait_one tid s2)
[PROOF STEP]
unfolding vpeq_def vpeq_subj_subj_def vpeq_obj_def vpeq_subj_obj_def vpeq_local_def
              atomic_step_ev_wait_one_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>obj_id. Policy.sp_spec_subj_obj u obj_id READ \<longrightarrow> obj s1 obj_id = obj s2 obj_id) \<and> (\<forall>v. (Policy.sp_spec_subj_subj u v \<longrightarrow> sp_impl_subj_subj s1 u v = sp_impl_subj_subj s2 u v) \<and> (Policy.sp_spec_subj_subj v u \<longrightarrow> sp_impl_subj_subj s1 v u = sp_impl_subj_subj s2 v u)) \<and> (\<forall>ob m p1. (Policy.sp_spec_subj_obj u ob m \<longrightarrow> sp_impl_subj_obj s1 u ob m = sp_impl_subj_obj s2 u ob m) \<and> (Policy.sp_spec_subj_obj p1 ob PROVIDE \<and> (Policy.sp_spec_subj_obj u ob READ \<or> Policy.sp_spec_subj_obj u ob WRITE) \<longrightarrow> sp_impl_subj_obj s1 p1 ob PROVIDE = sp_impl_subj_obj s2 p1 ob PROVIDE)) \<and> (\<forall>tid. Step.partition tid = u \<longrightarrow> thread s1 tid = thread s2 tid)
(\<forall>obj_id. Policy.sp_spec_subj_obj (Step.partition tid) obj_id READ \<longrightarrow> obj s1 obj_id = obj s2 obj_id) \<and> (\<forall>v. (Policy.sp_spec_subj_subj (Step.partition tid) v \<longrightarrow> sp_impl_subj_subj s1 (Step.partition tid) v = sp_impl_subj_subj s2 (Step.partition tid) v) \<and> (Policy.sp_spec_subj_subj v (Step.partition tid) \<longrightarrow> sp_impl_subj_subj s1 v (Step.partition tid) = sp_impl_subj_subj s2 v (Step.partition tid))) \<and> (\<forall>ob m p1. (Policy.sp_spec_subj_obj (Step.partition tid) ob m \<longrightarrow> sp_impl_subj_obj s1 (Step.partition tid) ob m = sp_impl_subj_obj s2 (Step.partition tid) ob m) \<and> (Policy.sp_spec_subj_obj p1 ob PROVIDE \<and> (Policy.sp_spec_subj_obj (Step.partition tid) ob READ \<or> Policy.sp_spec_subj_obj (Step.partition tid) ob WRITE) \<longrightarrow> sp_impl_subj_obj s1 p1 ob PROVIDE = sp_impl_subj_obj s2 p1 ob PROVIDE)) \<and> (\<forall>tida. Step.partition tida = Step.partition tid \<longrightarrow> thread s1 tida = thread s2 tida)
atomic_step_invariant s1
atomic_step_invariant s2
atomic_step_precondition s1 (current s1) ipt
atomic_step_precondition s1 (current s1) ipt

goal (1 subgoal):
 1. (\<forall>obj_id. Policy.sp_spec_subj_obj u obj_id READ \<longrightarrow> obj (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) obj_id = obj (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) obj_id) \<and> (\<forall>v. (Policy.sp_spec_subj_subj u v \<longrightarrow> sp_impl_subj_subj (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) u v = sp_impl_subj_subj (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) u v) \<and> (Policy.sp_spec_subj_subj v u \<longrightarrow> sp_impl_subj_subj (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) v u = sp_impl_subj_subj (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) v u)) \<and> (\<forall>ob m p1. (Policy.sp_spec_subj_obj u ob m \<longrightarrow> sp_impl_subj_obj (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) u ob m = sp_impl_subj_obj (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) u ob m) \<and> (Policy.sp_spec_subj_obj p1 ob PROVIDE \<and> (Policy.sp_spec_subj_obj u ob READ \<or> Policy.sp_spec_subj_obj u ob WRITE) \<longrightarrow> sp_impl_subj_obj (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) p1 ob PROVIDE = sp_impl_subj_obj (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) p1 ob PROVIDE)) \<and> (\<forall>tida. Step.partition tida = u \<longrightarrow> thread (s1\<lparr>thread := (thread s1)(tid := thread s1 tid\<lparr>ev_counter := ev_counter (thread s1 tid) - 1\<rparr>)\<rparr>) tida = thread (s2\<lparr>thread := (thread s2)(tid := thread s2 tid\<lparr>ev_counter := ev_counter (thread s2 tid) - 1\<rparr>)\<rparr>) tida)
[PROOF STEP]
by simp