Theory Weak_Sim_Pres
theory Weak_Sim_Pres
imports Sim_Pres Weak_Simulation Weak_Stat_Imp
begin
context env begin
lemma weakInputPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and M :: 'a
and xvec :: "name list"
and N :: 'a
assumes PRelQ: "⋀Tvec Ψ'. length xvec = length Tvec ⟹ (Ψ ⊗ Ψ', P[xvec::=Tvec], Q[xvec::=Tvec]) ∈ Rel"
shows "Ψ ⊳ M⦇λ*xvec N⦈.P ↝<Rel> M⦇λ*xvec N⦈.Q"
proof(induct rule: weakSimI2)
case(cAct Ψ' α Q')
from ‹Ψ ⊳ M⦇λ*xvec N⦈.Q ⟼α ≺ Q'› show ?case
proof(induct rule: inputCases)
case(cInput K Tvec)
from ‹Ψ ⊢ M ↔ K› ‹set xvec ⊆ supp N› ‹length xvec = length Tvec› ‹distinct xvec›
have "Ψ : (M⦇λ*xvec N⦈.Q) ⊳ M⦇λ*xvec N⦈.P ⟹K⦇(N[xvec::=Tvec])⦈ ≺ (P[xvec::=Tvec])"
by(rule_tac weakInput) auto
moreover have "Ψ ⊗ Ψ' ⊳ P[xvec::=Tvec] ⟹⇧^⇩τ P[xvec::=Tvec]" by simp
moreover from ‹length xvec = length Tvec› have "(Ψ ⊗ Ψ', P[xvec::=Tvec], Q[xvec::=Tvec]) ∈ Rel"
by(rule PRelQ)
ultimately show ?case by blast
qed
next
case(cTau Q')
from ‹Ψ ⊳ M⦇λ*xvec N⦈.Q ⟼τ ≺ Q'› have False by auto
thus ?case by simp
qed
lemma weakOutputPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and M :: 'a
and N :: 'a
assumes PRelQ: "⋀Ψ'. (Ψ ⊗ Ψ', P, Q) ∈ Rel"
shows "Ψ ⊳ M⟨N⟩.P ↝<Rel> M⟨N⟩.Q"
proof(induct rule: weakSimI2)
case(cAct Ψ' α Q')
from ‹Ψ ⊳ M⟨N⟩.Q ⟼α ≺ Q'› show ?case
proof(induct rule: outputCases)
case(cOutput K)
from ‹Ψ ⊢ M ↔ K›
have "Ψ : (M⟨N⟩.Q) ⊳ M⟨N⟩.P ⟹K⟨N⟩ ≺ P" by(rule weakOutput) auto
moreover have "Ψ ⊗ Ψ' ⊳ P ⟹⇧^⇩τ P" by simp
moreover have "(Ψ ⊗ Ψ', P, Q) ∈ Rel" by(rule PRelQ)
ultimately show ?case by blast
qed
next
case(cTau Q')
from ‹Ψ ⊳ M⟨N⟩.Q ⟼τ ≺ Q'› have False by auto
thus ?case by simp
qed
lemma resTauCases[consumes 3, case_names cRes]:
fixes Ψ :: 'b
and x :: name
and P :: "('a, 'b, 'c) psi"
and P' :: "('a, 'b, 'c) psi"
and C :: "'d::fs_name"
assumes Trans: "Ψ ⊳ ⦇νx⦈P ⟼τ ≺ P'"
and "x ♯ Ψ"
and "x ♯ P'"
and rScope: "⋀P'. ⟦Ψ ⊳ P ⟼τ ≺ P'⟧ ⟹ Prop (⦇νx⦈P')"
shows "Prop P'"
proof -
note Trans ‹x ♯ Ψ›
moreover have "x ♯ (τ)" by simp
moreover note ‹x ♯ P'›
moreover have "bn(τ) ♯* Ψ" and "bn(τ) ♯* P" and "bn(τ) ♯* subject(τ)" and "bn(τ) = []" by simp+
ultimately show ?thesis
by(induct rule: resCases) (auto intro: rScope)
qed
lemma weakResPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and x :: name
and Rel' :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
assumes PSimQ: "Ψ ⊳ P ↝<Rel> Q"
and "eqvt Rel'"
and "x ♯ Ψ"
and "Rel ⊆ Rel'"
and C1: "⋀Ψ' R S y. ⟦(Ψ', R, S) ∈ Rel; y ♯ Ψ'⟧ ⟹ (Ψ', ⦇νy⦈R, ⦇νy⦈S) ∈ Rel'"
shows "Ψ ⊳ ⦇νx⦈P ↝<Rel'> ⦇νx⦈Q"
proof -
note ‹eqvt Rel'› ‹x ♯ Ψ›
moreover have "x ♯ ⦇νx⦈P" and "x ♯ ⦇νx⦈Q" by(simp add: abs_fresh)+
ultimately show ?thesis
proof(induct rule: weakSimIFresh[of _ _ _ _ _ "()"])
case(cAct α Q' Ψ')
from ‹bn α ♯* ⦇νx⦈P› ‹bn α ♯* ⦇νx⦈Q› ‹x ♯ α› have "bn α ♯* P" and "bn α ♯* Q" by simp+
from ‹Ψ ⊳ ⦇νx⦈Q ⟼α ≺ Q'› ‹x ♯ Ψ› ‹x ♯ α› ‹x ♯ Q'› ‹bn α ♯* Ψ› ‹bn α ♯* Q› ‹bn α ♯* subject α› ‹bn α ♯* P› ‹x ♯ α›
show ?case
proof(induct rule: resCases)
case(cOpen M xvec1 xvec2 y N Q')
from ‹bn(M⦇ν*(xvec1@y#xvec2)⦈⟨N⟩) ♯* P› have "xvec1 ♯* P" and "xvec2 ♯* P" and "y ♯ P" by simp+
from ‹x ♯ (M⦇ν*(xvec1@y#xvec2)⦈⟨N⟩)› have "x ♯ xvec1" and "x ≠ y" and "x ♯ xvec2" and "x ♯ M" by simp+
from PSimQ ‹Ψ ⊳ Q ⟼M⦇ν*(xvec1@xvec2)⦈⟨([(x, y)] ∙ N)⟩ ≺ ([(x, y)] ∙ Q')› ‹xvec1 ♯* Ψ› ‹xvec2 ♯* Ψ› ‹xvec1 ♯* P› ‹xvec2 ♯* P› ‹α ≠ τ›
obtain P'' P' where PTrans: "Ψ : Q ⊳ P ⟹M⦇ν*(xvec1@xvec2)⦈⟨([(x, y)] ∙ N)⟩ ≺ P''"
and P''Chain: "Ψ ⊗ ([(x, y)] ∙ Ψ') ⊳ P'' ⟹⇧^⇩τ P'" and P'RelQ': "(Ψ ⊗ ([(x, y)] ∙ Ψ'), P', ([(x, y)] ∙ Q')) ∈ Rel"
by (fastforce dest: weakSimE)
from PTrans have "([(x, y)] ∙ Ψ) : ([(x, y)] ∙ Q) ⊳ ([(x, y)] ∙ P) ⟹([(x, y)] ∙ (M⦇ν*(xvec1@xvec2)⦈⟨([(x, y)] ∙ N)⟩)) ≺ ([(x, y)] ∙ P'')"
by(rule eqvts)
with ‹x ♯ Ψ› ‹y ♯ Ψ› ‹x ♯ M› ‹y ♯ M› ‹x ♯ xvec1› ‹y ♯ xvec1› ‹x ♯ xvec2› ‹y ♯ xvec2›
have "Ψ : ([(x, y)] ∙ Q) ⊳ ([(x, y)] ∙ P) ⟹M⦇ν*(xvec1@xvec2)⦈⟨N⟩ ≺ ([(x, y)] ∙ P'')"
by(simp add: eqvts)
hence "Ψ : ⦇νy⦈([(x, y)] ∙ Q) ⊳ ⦇νy⦈([(x, y)] ∙ P) ⟹M⦇ν*(xvec1@y#xvec2)⦈⟨N⟩ ≺ ([(x, y)] ∙ P'')"
using ‹y ∈ supp N› ‹y ♯ Ψ› ‹y ♯ M› ‹y ♯ xvec1› ‹y ♯ xvec2›
by(rule weakOpen)
with ‹y ♯ P› ‹y ♯ Q› have "Ψ : ⦇νx⦈Q ⊳ ⦇νx⦈P ⟹M⦇ν*(xvec1@y#xvec2)⦈⟨N⟩ ≺ ([(x, y)] ∙ P'')"
by(simp add: alphaRes)
moreover from P''Chain have "([(x, y)] ∙ (Ψ ⊗ ([(x, y)] ∙ Ψ'))) ⊳ ([(x, y)] ∙ P'') ⟹⇧^⇩τ ([(x, y)] ∙ P')"
by(rule eqvts)
with ‹x ♯ Ψ› ‹y ♯ Ψ› have "Ψ ⊗ Ψ' ⊳ ([(x, y)] ∙ P'') ⟹⇧^⇩τ ([(x, y)] ∙ P')" by(simp add: eqvts)
moreover from P'RelQ' ‹Rel ⊆ Rel'› have "(Ψ ⊗ ([(x, y)] ∙ Ψ'), P', ([(x, y)] ∙ Q')) ∈ Rel'" by auto
with ‹eqvt Rel'› have "([(x, y)] ∙ (Ψ ⊗ ([(x, y)] ∙ Ψ'), P', ([(x, y)] ∙ Q'))) ∈ Rel'" by(rule eqvtI)
with ‹x ♯ Ψ› ‹y ♯ Ψ› have " (Ψ ⊗ Ψ', [(x, y)] ∙ P', Q') ∈ Rel'" by(simp add: eqvts)
ultimately show ?case by blast
next
case(cRes Q')
from PSimQ ‹Ψ ⊳ Q ⟼α ≺ Q'› ‹bn α ♯* Ψ› ‹bn α ♯* P› ‹α ≠ τ›
obtain P'' P' where PTrans: "Ψ : Q ⊳ P ⟹α ≺ P''"
and P''Chain: "Ψ ⊗ Ψ' ⊳ P'' ⟹⇧^⇩τ P'" and P'RelQ': "(Ψ ⊗ Ψ', P', Q') ∈ Rel"
by(blast dest: weakSimE)
from PTrans ‹x ♯ Ψ› ‹x ♯ α› have "Ψ : ⦇νx⦈Q ⊳ ⦇νx⦈P ⟹α ≺ ⦇νx⦈P''"
by(rule_tac weakScope)
moreover from P''Chain ‹x ♯ Ψ› ‹x ♯ Ψ'› have "Ψ ⊗ Ψ' ⊳ ⦇νx⦈P'' ⟹⇧^⇩τ ⦇νx⦈P'"
by(rule_tac tauChainResPres) auto
moreover from P'RelQ' ‹x ♯ Ψ› ‹x ♯ Ψ'› have "(Ψ ⊗ Ψ', ⦇νx⦈P', ⦇νx⦈Q') ∈ Rel'"
apply(rule_tac C1) by(auto simp add: fresh_left calc_atm)
ultimately show ?case by blast
qed
next
case(cTau Q')
from ‹Ψ ⊳ ⦇νx⦈Q ⟼τ ≺ Q'› ‹x ♯ Ψ› ‹x ♯ Q'›
show ?case
proof(induct rule: resTauCases)
case(cRes Q')
from PSimQ ‹Ψ ⊳ Q ⟼τ ≺ Q'› obtain P' where PChain: "Ψ ⊳ P ⟹⇧^⇩τ P'" and P'RelQ': "(Ψ, P', Q') ∈ Rel"
by(blast dest: weakSimE)
from PChain ‹x ♯ Ψ› have "Ψ ⊳ ⦇νx⦈P ⟹⇧^⇩τ ⦇νx⦈P'" by(rule tauChainResPres)
moreover from P'RelQ' ‹x ♯ Ψ› have "(Ψ, ⦇νx⦈P', ⦇νx⦈Q') ∈ Rel'" by(rule C1)
ultimately show ?case by blast
qed
qed
qed
lemma weakResChainPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and xvec :: "name list"
assumes PSimQ: "Ψ ⊳ P ↝<Rel> Q"
and "eqvt Rel"
and "xvec ♯* Ψ"
and C1: "⋀Ψ' R S yvec. ⟦(Ψ', R, S) ∈ Rel; yvec ♯* Ψ'⟧ ⟹ (Ψ', ⦇ν*yvec⦈R, ⦇ν*yvec⦈S) ∈ Rel"
shows "Ψ ⊳ ⦇ν*xvec⦈P ↝<Rel> ⦇ν*xvec⦈Q"
using ‹xvec ♯* Ψ›
proof(induct xvec)
case Nil
from PSimQ show ?case by simp
next
case(Cons x xvec)
from ‹(x#xvec) ♯* Ψ› have "x ♯ Ψ" and "xvec ♯* Ψ" by simp+
from ‹xvec ♯* Ψ ⟹ Ψ ⊳ ⦇ν*xvec⦈P ↝<Rel> ⦇ν*xvec⦈Q› ‹xvec ♯* Ψ›
have "Ψ ⊳ ⦇ν*xvec⦈P ↝<Rel> ⦇ν*xvec⦈Q" by simp
moreover note ‹eqvt Rel› ‹x ♯ Ψ›
moreover have "Rel ⊆ Rel" by simp
moreover have "⋀Ψ P Q x. ⟦(Ψ, P, Q) ∈ Rel; x ♯ Ψ⟧ ⟹ (Ψ, ⦇ν*[x]⦈P, ⦇ν*[x]⦈Q) ∈ Rel"
by(rule_tac yvec="[x]" in C1) auto
hence "⋀Ψ P Q x. ⟦(Ψ, P, Q) ∈ Rel; x ♯ Ψ⟧ ⟹ (Ψ, ⦇νx⦈P, ⦇νx⦈Q) ∈ Rel"
by simp
ultimately have "Ψ ⊳ ⦇νx⦈(⦇ν*xvec⦈P) ↝<Rel> ⦇νx⦈(⦇ν*xvec⦈Q)"
by(rule weakResPres)
thus ?case by simp
qed
lemma parTauCases[consumes 1, case_names cPar1 cPar2 cComm1 cComm2]:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and R :: "('a, 'b, 'c) psi"
and C :: "'d::fs_name"
assumes Trans: "Ψ ⊳ P ∥ Q ⟼τ ≺ R"
and rPar1: "⋀P' A⇩Q Ψ⇩Q. ⟦Ψ ⊗ Ψ⇩Q ⊳ P ⟼τ ≺ P'; extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩; distinct A⇩Q;
A⇩Q ♯* Ψ; A⇩Q ♯* P; A⇩Q ♯* Q; A⇩Q ♯* C⟧ ⟹ Prop (P' ∥ Q)"
and rPar2: "⋀Q' A⇩P Ψ⇩P. ⟦Ψ ⊗ Ψ⇩P ⊳ Q ⟼τ ≺ Q'; extractFrame P = ⟨A⇩P, Ψ⇩P⟩; distinct A⇩P;
A⇩P ♯* Ψ; A⇩P ♯* P; A⇩P ♯* Q; A⇩P ♯* C⟧ ⟹ Prop (P ∥ Q')"
and rComm1: "⋀Ψ⇩Q M N P' A⇩P Ψ⇩P K xvec Q' A⇩Q.
⟦Ψ ⊗ Ψ⇩Q ⊳ P ⟼M⦇N⦈ ≺ P'; extractFrame P = ⟨A⇩P, Ψ⇩P⟩; distinct A⇩P;
Ψ ⊗ Ψ⇩P ⊳ Q ⟼K⦇ν*xvec⦈⟨N⟩ ≺ Q'; extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩; distinct A⇩Q;
Ψ ⊗ Ψ⇩P ⊗ Ψ⇩Q ⊢ M ↔ K; distinct xvec;
A⇩P ♯* Ψ; A⇩P ♯* Ψ⇩Q; A⇩P ♯* P; A⇩P ♯* M; A⇩P ♯* N; A⇩P ♯* P'; A⇩P ♯* Q; A⇩P ♯* xvec; A⇩P ♯* Q'; A⇩P ♯* A⇩Q; A⇩P ♯* C;
A⇩Q ♯* Ψ; A⇩Q ♯* Ψ⇩P; A⇩Q ♯* P; A⇩Q ♯* K; A⇩Q ♯* N; A⇩Q ♯* P'; A⇩Q ♯* Q; A⇩Q ♯* xvec; A⇩Q ♯* Q'; A⇩Q ♯* C;
xvec ♯* Ψ; xvec ♯* Ψ⇩P; xvec ♯* P; xvec ♯* M; xvec ♯* K; xvec ♯* Q; xvec ♯* Ψ⇩Q; xvec ♯* C⟧ ⟹
Prop (⦇ν*xvec⦈(P' ∥ Q'))"
and rComm2: "⋀Ψ⇩Q M xvec N P' A⇩P Ψ⇩P K Q' A⇩Q.
⟦Ψ ⊗ Ψ⇩Q ⊳ P ⟼M⦇ν*xvec⦈⟨N⟩ ≺ P'; extractFrame P = ⟨A⇩P, Ψ⇩P⟩; distinct A⇩P;
Ψ ⊗ Ψ⇩P ⊳ Q ⟼K⦇N⦈ ≺ Q'; extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩; distinct A⇩Q;
Ψ ⊗ Ψ⇩P ⊗ Ψ⇩Q ⊢ M ↔ K; distinct xvec;
A⇩P ♯* Ψ; A⇩P ♯* Ψ⇩Q; A⇩P ♯* P; A⇩P ♯* M; A⇩P ♯* N; A⇩P ♯* P'; A⇩P ♯* Q; A⇩P ♯* xvec; A⇩P ♯* Q'; A⇩P ♯* A⇩Q; A⇩P ♯* C;
A⇩Q ♯* Ψ; A⇩Q ♯* Ψ⇩P; A⇩Q ♯* P; A⇩Q ♯* K; A⇩Q ♯* N; A⇩Q ♯* P'; A⇩Q ♯* Q; A⇩Q ♯* xvec; A⇩Q ♯* Q'; A⇩Q ♯* C;
xvec ♯* Ψ; xvec ♯* Ψ⇩P; xvec ♯* P; xvec ♯* M; xvec ♯* K; xvec ♯* Q; xvec ♯* Ψ⇩Q; xvec ♯* C⟧ ⟹
Prop (⦇ν*xvec⦈(P' ∥ Q'))"
shows "Prop R"
proof -
from Trans obtain α where "Ψ ⊳ P ∥ Q ⟼α ≺ R" and "bn α ♯* Ψ" and "bn α ♯* P" and "bn α ♯* Q" and "bn α ♯* subject α" and "α = τ" by auto
thus ?thesis using rPar1 rPar2 rComm1 rComm2
by(induct rule: parCases[where C=C]) (auto simp add: residualInject)
qed
lemma weakParPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and R :: "('a, 'b, 'c) psi"
and Rel' :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
assumes PRelQ: "⋀A⇩R Ψ⇩R. ⟦extractFrame R = ⟨A⇩R, Ψ⇩R⟩; A⇩R ♯* Ψ; A⇩R ♯* P; A⇩R ♯* Q⟧ ⟹ (Ψ ⊗ Ψ⇩R, P, Q) ∈ Rel"
and Eqvt: "eqvt Rel"
and Eqvt': "eqvt Rel'"
and Sim: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ Ψ' ⊳ S ↝<Rel> T"
and Sym: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ (Ψ', T, S) ∈ Rel"
and Ext: "⋀Ψ' S T Ψ'. ⟦(Ψ', S, T) ∈ Rel⟧ ⟹ (Ψ' ⊗ Ψ'', S, T) ∈ Rel"
and StatImp: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ Ψ' ⊳ S ⪅<Rel> T"
and C1: "⋀Ψ' S T A⇩U Ψ⇩U U. ⟦(Ψ' ⊗ Ψ⇩U, S, T) ∈ Rel; extractFrame U = ⟨A⇩U, Ψ⇩U⟩; A⇩U ♯* Ψ'; A⇩U ♯* S; A⇩U ♯* T⟧ ⟹ (Ψ', S ∥ U, T ∥ U) ∈ Rel'"
and C2: "⋀Ψ' S T xvec. ⟦(Ψ', S, T) ∈ Rel'; xvec ♯* Ψ'⟧ ⟹ (Ψ', ⦇ν*xvec⦈S, ⦇ν*xvec⦈T) ∈ Rel'"
and C3: "⋀Ψ' S T Ψ''. ⟦(Ψ', S, T) ∈ Rel; Ψ' ≃ Ψ''⟧ ⟹ (Ψ'', S, T) ∈ Rel"
shows "Ψ ⊳ P ∥ R ↝<Rel'> Q ∥ R"
proof -
from Eqvt' show ?thesis
proof(induct rule: weakSimI[where C="()"])
case(cAct Ψ' α QR)
from ‹bn α ♯* (P ∥ R)› ‹bn α ♯* (Q ∥ R)›
have "bn α ♯* P" and "bn α ♯* Q" and "bn α ♯* R"
by simp+
from ‹Ψ ⊳ Q ∥ R ⟼α ≺ QR› ‹bn α ♯* Ψ› ‹bn α ♯* Q› ‹bn α ♯* R› ‹bn α ♯* subject α› ‹α ≠ τ› show ?case
proof(induct rule: parCases[where C="(P, R, Ψ')"])
case(cPar1 Q' A⇩R Ψ⇩R)
from ‹A⇩R ♯* (P, R, Ψ')› have "A⇩R ♯* P" and "A⇩R ♯* Ψ'" by simp+
have FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" by fact
from ‹A⇩R ♯* α› ‹bn α ♯* R› FrR
have "bn α ♯* Ψ⇩R" by(drule_tac extractFrameFreshChain) auto
have QTrans: "Ψ ⊗ Ψ⇩R ⊳ Q ⟼α ≺ Q'" by fact
from FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q› have "Ψ ⊗ Ψ⇩R ⊳ P ↝<Rel> Q"
by(blast intro: PRelQ Sim)
then obtain P'' P' where PTrans: "Ψ ⊗ Ψ⇩R : Q ⊳ P ⟹α ≺ P''"
and P''Chain: "(Ψ ⊗ Ψ⇩R) ⊗ Ψ' ⊳ P'' ⟹⇧^⇩τ P'" and P'RelQ': "((Ψ ⊗ Ψ⇩R) ⊗ Ψ', P', Q') ∈ Rel"
using QTrans ‹bn α ♯* Ψ› ‹bn α ♯* Ψ⇩R› ‹bn α ♯* P› ‹bn α ♯* R› ‹A⇩R ♯* α› ‹α ≠ τ›
by(drule_tac Ψ'=Ψ' in weakSimE(1)) auto
from PTrans QTrans ‹A⇩R ♯* P› ‹A⇩R ♯* Q› ‹A⇩R ♯* α› ‹bn α ♯* subject α› ‹distinct(bn α)›
have "A⇩R ♯* P''" and "A⇩R ♯* Q'"
by(fastforce dest: weakFreshChainDerivative freeFreshChainDerivative)+
with P''Chain have "A⇩R ♯* P'" by(force dest: tauChainFreshChain)
from PTrans FrR ‹bn α ♯* R› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* α› ‹A⇩R ♯* Q›
have "Ψ : Q ∥ R ⊳ P ∥ R ⟹α ≺ (P'' ∥ R)"
by(rule_tac weakPar1)
moreover from P''Chain have "(Ψ ⊗ Ψ') ⊗ Ψ⇩R ⊳ P'' ⟹⇧^⇩τ P'"
by(metis tauChainStatEq Associativity Commutativity Composition)
with FrR have "Ψ ⊗ Ψ' ⊳ P'' ∥ R ⟹⇧^⇩τ P' ∥ R" using ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ'› ‹A⇩R ♯* P''›
by(rule_tac tauChainPar1) auto
moreover from P'RelQ' have "((Ψ ⊗ Ψ') ⊗ Ψ⇩R, P', Q') ∈ Rel"
by(metis C3 compositionSym Associativity Commutativity)
hence "(Ψ ⊗ Ψ', P' ∥ R, Q' ∥ R) ∈ Rel'" using FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ'› ‹A⇩R ♯* P'› ‹A⇩R ♯* Q'›
by(rule_tac C1) auto
ultimately show ?case by blast
next
case(cPar2 R' A⇩Q Ψ⇩Q)
from ‹A⇩Q ♯* (P, R, Ψ')› have "A⇩Q ♯* P" and "A⇩Q ♯* R" and "A⇩Q ♯* Ψ'" by simp+
obtain A⇩P Ψ⇩P where FrP: "extractFrame P = ⟨A⇩P, Ψ⇩P⟩" and "A⇩P ♯* (Ψ, A⇩Q, Ψ⇩Q, α, R)"
by(rule freshFrame)
hence "A⇩P ♯* Ψ" and "A⇩P ♯* A⇩Q" and "A⇩P ♯* Ψ⇩Q" and "A⇩P ♯* α" and "A⇩P ♯* R"
by simp+
have FrQ: "extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩" by fact
from ‹A⇩Q ♯* P› FrP ‹A⇩P ♯* A⇩Q› have "A⇩Q ♯* Ψ⇩P"
by(drule_tac extractFrameFreshChain) auto
from FrP FrQ ‹bn α ♯* P› ‹bn α ♯* Q› ‹A⇩P ♯* α› ‹A⇩Q ♯* α›
have "bn α ♯* Ψ⇩P" and "bn α ♯* Ψ⇩Q"
by(force dest: extractFrameFreshChain)+
obtain A⇩R Ψ⇩R where FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" and "A⇩R ♯* (Ψ, P, Q, A⇩Q, A⇩P, Ψ⇩Q, Ψ⇩P, α, R, Ψ')"
and "distinct A⇩R"
by(rule freshFrame)
then have "A⇩R ♯* Ψ" and "A⇩R ♯* P" and "A⇩R ♯* Q" and "A⇩R ♯* A⇩Q" and "A⇩R ♯* A⇩P" and "A⇩R ♯* Ψ⇩Q" and "A⇩R ♯* Ψ⇩P"
and "A⇩R ♯* α" and "A⇩R ♯* R" and "A⇩R ♯* Ψ'"
by simp+
from ‹A⇩Q ♯* R› FrR ‹A⇩R ♯* A⇩Q› have "A⇩Q ♯* Ψ⇩R" by(drule_tac extractFrameFreshChain) auto
from ‹A⇩P ♯* R› ‹A⇩R ♯* A⇩P› FrR have "A⇩P ♯* Ψ⇩R" by(drule_tac extractFrameFreshChain) auto
moreover from ‹Ψ ⊗ Ψ⇩Q ⊳ R ⟼α ≺ R'› FrR ‹distinct A⇩R› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q› ‹A⇩R ♯* R› ‹A⇩R ♯* α› ‹A⇩R ♯* Ψ'›
‹bn α ♯* Ψ› ‹bn α ♯* P› ‹bn α ♯* Q› ‹bn α ♯* R› ‹bn α ♯* subject α› ‹distinct(bn α)›
obtain p Ψ'' A⇩R' Ψ⇩R' where S: "set p ⊆ set(bn α) × set(bn(p ∙ α))" and "(p ∙ Ψ⇩R) ⊗ Ψ'' ≃ Ψ⇩R'"
and FrR': "extractFrame R' = ⟨A⇩R', Ψ⇩R'⟩"
and "bn(p ∙ α) ♯* Ψ" and "bn(p ∙ α) ♯* P" and "bn(p ∙ α) ♯* Q"
and "A⇩R' ♯* Ψ" and "A⇩R' ♯* P" and "A⇩R' ♯* Q" and "A⇩R' ♯* Ψ'" and "distinctPerm p"
by(rule_tac C="(Ψ, Ψ', P, Q)" and C'="(Ψ, P, Q)" in expandFrame) (assumption | simp)+
from FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q›
have "(Ψ ⊗ Ψ⇩R, P, Q) ∈ Rel" by(rule PRelQ)
hence "(Ψ ⊗ Ψ⇩R, Q, P) ∈ Rel" by(rule Sym)
hence "Ψ ⊗ Ψ⇩R ⊳ Q ⪅<Rel> P" by(rule StatImp)
then obtain P' P'' where PChain: "Ψ ⊗ Ψ⇩R ⊳ P ⟹⇧^⇩τ P'"
and QimpP': "insertAssertion(extractFrame Q) (Ψ ⊗ Ψ⇩R) ↪⇩F insertAssertion(extractFrame P') (Ψ ⊗ Ψ⇩R)"
and P'Chain: "(Ψ ⊗ Ψ⇩R) ⊗ ((p ∙ Ψ'') ⊗ (p ∙ Ψ')) ⊳ P' ⟹⇧^⇩τ P''"
and P'RelQ: "((Ψ ⊗ Ψ⇩R) ⊗ ((p ∙ Ψ'') ⊗ (p ∙ Ψ')), Q, P'') ∈ Rel"
by(rule weakStatImpE)
obtain A⇩P' Ψ⇩P' where FrP': "extractFrame P' = ⟨A⇩P', Ψ⇩P'⟩" and "A⇩P' ♯* Ψ" and "A⇩P' ♯* Ψ⇩R" and "A⇩P' ♯* Ψ⇩Q"
and "A⇩P' ♯* A⇩Q" and "A⇩P' ♯* R" and "A⇩P' ♯* A⇩R" and "A⇩P' ♯* α"
by(rule_tac C="(Ψ, Ψ⇩R, Ψ⇩Q, A⇩Q, R, A⇩R, α)" in freshFrame) auto
from PChain ‹A⇩R ♯* P› ‹A⇩Q ♯* P› ‹bn α ♯* P› have "A⇩Q ♯* P'" and "A⇩R ♯* P'" and "bn α ♯* P'"
by(force intro: tauChainFreshChain)+
from ‹A⇩R ♯* P'› ‹A⇩P' ♯* A⇩R› ‹A⇩Q ♯* P'› ‹A⇩P' ♯* A⇩Q› FrP' have "A⇩Q ♯* Ψ⇩P'" and "A⇩R ♯* Ψ⇩P'"
by(force dest: extractFrameFreshChain)+
from PChain FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ P' ∥ R" by(rule tauChainPar1)
moreover have "insertAssertion (extractFrame(Q ∥ R)) Ψ ↪⇩F insertAssertion(extractFrame(P' ∥ R)) Ψ"
proof -
have "⟨A⇩Q, Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R⟩ ≃⇩F ⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩"
by(metis Associativity Composition Commutativity AssertionStatEqTrans AssertionStatEqSym frameNilStatEq frameResChainPres)
moreover from QimpP' FrQ FrP' ‹A⇩Q ♯* Ψ⇩R› ‹A⇩P' ♯* Ψ⇩R› ‹A⇩P' ♯* Ψ› ‹A⇩Q ♯* Ψ›
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩ ↪⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩" using freshCompChain by simp
moreover have "⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩ ≃⇩F ⟨A⇩P', Ψ ⊗ Ψ⇩P' ⊗ Ψ⇩R⟩"
by(metis Associativity Composition Commutativity AssertionStatEqTrans AssertionStatEqSym frameNilStatEq frameResChainPres)
ultimately have "⟨A⇩Q, Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R⟩ ↪⇩F ⟨A⇩P', Ψ ⊗ Ψ⇩P' ⊗ Ψ⇩R⟩"
by(rule FrameStatEqImpCompose)
hence "⟨(A⇩R@A⇩Q), Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R⟩ ↪⇩F ⟨(A⇩R@A⇩P'), Ψ ⊗ Ψ⇩P' ⊗ Ψ⇩R⟩"
by(force intro: frameImpResChainPres simp add: frameChainAppend)
with FrQ FrR FrP' ‹A⇩R ♯* A⇩Q› ‹A⇩P' ♯* A⇩R› ‹A⇩Q ♯* Ψ⇩R› ‹A⇩R ♯* Ψ⇩Q› ‹A⇩R ♯* Ψ⇩P'› ‹A⇩P' ♯* Ψ⇩R›
‹A⇩P' ♯* Ψ› ‹A⇩Q ♯* Ψ› ‹A⇩R ♯* Ψ›
show ?thesis
by(simp add: frameChainAppend) (metis frameImpChainComm FrameStatImpTrans)
qed
moreover have RTrans: "Ψ ⊗ Ψ⇩P' ⊳ R ⟼α ≺ R'"
proof -
have "Ψ ⊗ Ψ⇩Q ⊳ R ⟼α ≺ R'" by fact
moreover have "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ↪⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩P') ⊗ Ψ⇩R⟩"
proof -
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ≃⇩F ⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩"
by(metis frameIntAssociativity Commutativity FrameStatEqTrans frameIntCompositionSym FrameStatEqSym)
moreover with FrP' FrQ QimpP' ‹A⇩P' ♯* Ψ› ‹A⇩Q ♯* Ψ› ‹A⇩P' ♯* Ψ⇩R› ‹A⇩Q ♯* Ψ⇩R›
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩ ↪⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩" using freshCompChain
by simp
moreover have "⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩ ≃⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩P') ⊗ Ψ⇩R⟩"
by(metis frameIntAssociativity Commutativity FrameStatEqTrans frameIntCompositionSym frameIntAssociativity[THEN FrameStatEqSym])
ultimately show ?thesis
by(rule FrameStatEqImpCompose)
qed
ultimately show ?thesis
using ‹A⇩P' ♯* Ψ› ‹A⇩P' ♯* Ψ⇩Q› ‹A⇩Q ♯* Ψ› ‹A⇩Q ♯* Ψ⇩P'› ‹A⇩P' ♯* R› ‹A⇩Q ♯* R› ‹A⇩P' ♯* α› ‹A⇩Q ♯* α›
‹A⇩P' ♯* A⇩R› ‹A⇩R ♯* A⇩Q› ‹A⇩R ♯* Ψ⇩P'› ‹A⇩R ♯* Ψ⇩Q› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ⇩P'› ‹A⇩Q ♯* Ψ⇩P'› FrR ‹distinct A⇩R›
by(force intro: transferFrame)
qed
hence "Ψ ⊳ P' ∥ R ⟼α ≺ (P' ∥ R')" using FrP' ‹bn α ♯* P'› ‹A⇩P' ♯* Ψ› ‹A⇩P' ♯* R› ‹A⇩P' ♯* α› ‹A⇩P' ♯* α›
by(rule_tac Par2)
ultimately have "Ψ : (Q ∥ R) ⊳ P ∥ R ⟹α ≺ (P' ∥ R')"
by(rule_tac weakTransitionI)
moreover from PChain P'Chain ‹bn α ♯* P'› ‹bn(p ∙ α) ♯* P› ‹A⇩R' ♯* P›
have "bn α ♯* P''" and "bn(p ∙ α) ♯* P'" and "bn(p ∙ α) ♯* P''" and "A⇩R' ♯* P'" and "A⇩R' ♯* P''"
by(metis tauChainFreshChain)+
from P'Chain have "(p ∙ ((Ψ ⊗ Ψ⇩R) ⊗ (p ∙ Ψ'') ⊗ (p ∙ Ψ'))) ⊳ (p ∙ P') ⟹⇧^⇩τ (p ∙ P'')"
by(rule eqvts)
with ‹bn α ♯* Ψ› ‹bn(p ∙ α) ♯* Ψ› ‹bn α ♯* P'› ‹bn(p ∙ α) ♯* P'› ‹bn α ♯* P''› ‹bn(p ∙ α) ♯* P''›
S ‹distinctPerm p›
have "(Ψ ⊗ (p ∙ Ψ⇩R)) ⊗ Ψ'' ⊗ Ψ' ⊳ P' ⟹⇧^⇩τ P''"
by(simp add: eqvts)
hence "(Ψ ⊗ Ψ') ⊗ (p ∙ Ψ⇩R) ⊗ Ψ'' ⊳ P' ⟹⇧^⇩τ P''"
by(rule tauChainStatEq) (metis Associativity Commutativity Composition AssertionStatEqTrans)
with ‹(p ∙ Ψ⇩R) ⊗ Ψ'' ≃ Ψ⇩R'› have "(Ψ ⊗ Ψ') ⊗ Ψ⇩R' ⊳ P' ⟹⇧^⇩τ P''" by(metis tauChainStatEq compositionSym)
hence "Ψ ⊗ Ψ' ⊳ P' ∥ R' ⟹⇧^⇩τ P'' ∥ R'" using FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* Ψ'› ‹A⇩R' ♯* P'› by(rule_tac tauChainPar1) auto
moreover from P'RelQ have "((Ψ ⊗ Ψ⇩R) ⊗ (p ∙ Ψ'') ⊗ (p ∙ Ψ'), P'', Q) ∈ Rel" by(rule Sym)
with ‹eqvt Rel› have "(p ∙ ((Ψ ⊗ Ψ⇩R) ⊗ (p ∙ Ψ'') ⊗ (p ∙ Ψ'), P'', Q)) ∈ Rel" by(rule eqvtI)
with ‹bn α ♯* Ψ› ‹bn(p ∙ α) ♯* Ψ› ‹bn α ♯* P''› ‹bn(p ∙ α) ♯* P''› ‹bn α ♯* Q› ‹bn(p ∙ α) ♯* Q› S ‹distinctPerm p›
have "((Ψ ⊗ (p ∙ Ψ⇩R)) ⊗ Ψ'' ⊗ Ψ', P'', Q) ∈ Rel" by(simp add: eqvts)
with ‹(p ∙ Ψ⇩R) ⊗ Ψ'' ≃ Ψ⇩R'› have "((Ψ ⊗ Ψ') ⊗ Ψ⇩R', P'', Q) ∈ Rel"
by(rule_tac C3, auto) (metis Associativity Commutativity Composition AssertionStatEqTrans)
with FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* Ψ'› ‹A⇩R' ♯* P''› ‹A⇩R' ♯* Q›
have "(Ψ ⊗ Ψ', P'' ∥ R', Q ∥ R') ∈ Rel'" by(rule_tac C1) auto
ultimately show ?case by blast
next
case cComm1
from ‹τ ≠ τ› have False by simp
thus ?case by simp
next
case cComm2
from ‹τ ≠ τ› have False by simp
thus ?case by simp
qed
next
case(cTau QR)
from ‹Ψ ⊳ Q ∥ R ⟼τ ≺ QR› show ?case
proof(induct rule: parTauCases[where C="(P, R)"])
case(cPar1 Q' A⇩R Ψ⇩R)
from ‹A⇩R ♯* (P, R)› have "A⇩R ♯* P"
by simp+
have FrR: " extractFrame R = ⟨A⇩R, Ψ⇩R⟩" by fact
with ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q› have "Ψ ⊗ Ψ⇩R ⊳ P ↝<Rel> Q"
by(blast intro: PRelQ Sim)
moreover have QTrans: "Ψ ⊗ Ψ⇩R ⊳ Q ⟼τ ≺ Q'" by fact
ultimately obtain P' where PChain: "Ψ ⊗ Ψ⇩R ⊳ P ⟹⇧^⇩τ P'" and P'RelQ': "(Ψ ⊗ Ψ⇩R, P', Q') ∈ Rel"
by(force dest: weakSimE)
from PChain QTrans ‹A⇩R ♯* P› ‹A⇩R ♯* Q› have "A⇩R ♯* P'" and "A⇩R ♯* Q'"
by(force dest: freeFreshChainDerivative tauChainFreshChain)+
from PChain FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ (P' ∥ R)"
by(rule tauChainPar1)
moreover from P'RelQ' FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P'› ‹A⇩R ♯* Q'› have "(Ψ, P' ∥ R, Q' ∥ R) ∈ Rel'" by(rule C1)
ultimately show ?case by blast
next
case(cPar2 R' A⇩Q Ψ⇩Q)
from ‹A⇩Q ♯* (P, R)› have "A⇩Q ♯* P" and "A⇩Q ♯* R" by simp+
obtain A⇩P Ψ⇩P where FrP: "extractFrame P = ⟨A⇩P, Ψ⇩P⟩" and "A⇩P ♯* (Ψ, A⇩Q, Ψ⇩Q, R)"
by(rule freshFrame)
hence "A⇩P ♯* Ψ" and "A⇩P ♯* A⇩Q" and "A⇩P ♯* Ψ⇩Q" and "A⇩P ♯* R"
by simp+
have FrQ: "extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩" by fact
from ‹A⇩Q ♯* P› FrP ‹A⇩P ♯* A⇩Q› have "A⇩Q ♯* Ψ⇩P"
by(drule_tac extractFrameFreshChain) auto
obtain A⇩R Ψ⇩R where FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" and "A⇩R ♯* (Ψ, P, Q, A⇩Q, A⇩P, Ψ⇩Q, Ψ⇩P, R)" and "distinct A⇩R"
by(rule freshFrame)
then have "A⇩R ♯* Ψ" and "A⇩R ♯* P" and "A⇩R ♯* Q" and "A⇩R ♯* A⇩Q" and "A⇩R ♯* A⇩P" and "A⇩R ♯* Ψ⇩Q" and "A⇩R ♯* Ψ⇩P"
and "A⇩R ♯* R"
by simp+
from ‹A⇩Q ♯* R› FrR ‹A⇩R ♯* A⇩Q› have "A⇩Q ♯* Ψ⇩R" by(drule_tac extractFrameFreshChain) auto
from ‹A⇩P ♯* R› ‹A⇩R ♯* A⇩P› FrR have "A⇩P ♯* Ψ⇩R" by(drule_tac extractFrameFreshChain) auto
moreover from ‹Ψ ⊗ Ψ⇩Q ⊳ R ⟼τ ≺ R'› FrR ‹distinct A⇩R› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q› ‹A⇩R ♯* R›
obtain Ψ' A⇩R' Ψ⇩R' where "Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'" and FrR': "extractFrame R' = ⟨A⇩R', Ψ⇩R'⟩"
and "A⇩R' ♯* Ψ" and "A⇩R' ♯* P" and "A⇩R' ♯* Q"
by(rule_tac C="(Ψ, P, Q, R)" in expandTauFrame) (assumption | simp)+
from FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q›
obtain P' P'' where PChain: "Ψ ⊗ Ψ⇩R ⊳ P ⟹⇧^⇩τ P'"
and QimpP': "insertAssertion(extractFrame Q) (Ψ ⊗ Ψ⇩R) ↪⇩F insertAssertion(extractFrame P') (Ψ ⊗ Ψ⇩R)"
and P'Chain: "(Ψ ⊗ Ψ⇩R) ⊗ Ψ' ⊳ P' ⟹⇧^⇩τ P''"
and P'RelQ: "((Ψ ⊗ Ψ⇩R) ⊗ Ψ', Q, P'') ∈ Rel"
by(metis StatImp PRelQ Sym weakStatImpE)
obtain A⇩P' Ψ⇩P' where FrP': "extractFrame P' = ⟨A⇩P', Ψ⇩P'⟩" and "A⇩P' ♯* Ψ" and "A⇩P' ♯* Ψ⇩R" and "A⇩P' ♯* Ψ⇩Q"
and "A⇩P' ♯* A⇩Q" and "A⇩P' ♯* R" and "A⇩P' ♯* A⇩R"
by(rule_tac C="(Ψ, Ψ⇩R, Ψ⇩Q, A⇩Q, R, A⇩R)" in freshFrame) auto
from PChain P'Chain ‹A⇩R ♯* P› ‹A⇩Q ♯* P› ‹A⇩R' ♯* P› have "A⇩Q ♯* P'" and "A⇩R ♯* P'" and "A⇩R' ♯* P'" and "A⇩R' ♯* P''"
by(force intro: tauChainFreshChain)+
from ‹A⇩R ♯* P'› ‹A⇩P' ♯* A⇩R› ‹A⇩Q ♯* P'› ‹A⇩P' ♯* A⇩Q› FrP' have "A⇩Q ♯* Ψ⇩P'" and "A⇩R ♯* Ψ⇩P'"
by(force dest: extractFrameFreshChain)+
from PChain FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ P' ∥ R" by(rule tauChainPar1)
moreover have RTrans: "Ψ ⊗ Ψ⇩P' ⊳ R ⟼τ ≺ R'"
proof -
have "Ψ ⊗ Ψ⇩Q ⊳ R ⟼τ ≺ R'" by fact
moreover have "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ↪⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩P') ⊗ Ψ⇩R⟩"
proof -
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ≃⇩F ⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩"
by(metis frameIntAssociativity Commutativity FrameStatEqTrans frameIntCompositionSym FrameStatEqSym)
moreover with FrP' FrQ QimpP' ‹A⇩P' ♯* Ψ› ‹A⇩Q ♯* Ψ› ‹A⇩P' ♯* Ψ⇩R› ‹A⇩Q ♯* Ψ⇩R›
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩ ↪⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩" using freshCompChain
by simp
moreover have "⟨A⇩P', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'⟩ ≃⇩F ⟨A⇩P', (Ψ ⊗ Ψ⇩P') ⊗ Ψ⇩R⟩"
by(metis frameIntAssociativity Commutativity FrameStatEqTrans frameIntCompositionSym frameIntAssociativity[THEN FrameStatEqSym])
ultimately show ?thesis
by(rule FrameStatEqImpCompose)
qed
ultimately show ?thesis
using ‹A⇩P' ♯* Ψ› ‹A⇩P' ♯* Ψ⇩Q› ‹A⇩Q ♯* Ψ› ‹A⇩Q ♯* Ψ⇩P'› ‹A⇩P' ♯* R› ‹A⇩Q ♯* R›
‹A⇩P' ♯* A⇩R› ‹A⇩R ♯* A⇩Q› ‹A⇩R ♯* Ψ⇩P'› ‹A⇩R ♯* Ψ⇩Q› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ⇩P'› ‹A⇩Q ♯* Ψ⇩P'› FrR ‹distinct A⇩R›
by(force intro: transferTauFrame)
qed
hence "Ψ ⊳ P' ∥ R ⟼τ ≺ (P' ∥ R')" using FrP' ‹A⇩P' ♯* Ψ› ‹A⇩P' ♯* R›
by(rule_tac Par2) auto
moreover from P'Chain have "Ψ ⊗ Ψ⇩R ⊗ Ψ' ⊳ P' ⟹⇧^⇩τ P''"
by(rule tauChainStatEq) (metis Associativity)
with ‹Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'› have "Ψ ⊗ Ψ⇩R' ⊳ P' ⟹⇧^⇩τ P''" by(metis tauChainStatEq compositionSym)
hence "Ψ ⊳ P' ∥ R' ⟹⇧^⇩τ P'' ∥ R'" using FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* P'› by(rule_tac tauChainPar1)
ultimately have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ (P'' ∥ R')"
by(fastforce dest: rtrancl_into_rtrancl)
moreover from P'RelQ ‹Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'› have "(Ψ ⊗ Ψ⇩R', P'', Q) ∈ Rel" by(blast intro: C3 Associativity compositionSym Sym)
with FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* P''› ‹A⇩R' ♯* Q› have "(Ψ, P'' ∥ R', Q ∥ R') ∈ Rel'" by(rule_tac C1)
ultimately show ?case by blast
next
case(cComm1 Ψ⇩R M N Q' A⇩Q Ψ⇩Q K xvec R' A⇩R)
have FrQ: "extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩" by fact
from ‹A⇩Q ♯* (P, R)› have "A⇩Q ♯* P" and "A⇩Q ♯* R" by simp+
have FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" by fact
from ‹A⇩R ♯* (P, R)› have "A⇩R ♯* P" and "A⇩R ♯* R" by simp+
from ‹xvec ♯* (P, R)› have "xvec ♯* P" and "xvec ♯* R" by simp+
have QTrans: "Ψ ⊗ Ψ⇩R ⊳ Q ⟼M⦇N⦈ ≺ Q'" and RTrans: "Ψ ⊗ Ψ⇩Q ⊳ R ⟼K⦇ν*xvec⦈⟨N⟩ ≺ R'"
and MeqK: "Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R ⊢ M ↔K" by fact+
from RTrans FrR ‹distinct A⇩R› ‹A⇩R ♯* R› ‹A⇩R ♯* xvec› ‹A⇩R ♯* N› ‹xvec ♯* R› ‹xvec ♯* Q› ‹xvec ♯* Ψ› ‹xvec ♯* Ψ⇩Q› ‹A⇩R ♯* Q›
‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ⇩Q› ‹xvec ♯* K› ‹A⇩R ♯* K› ‹A⇩R ♯* R› ‹xvec ♯* R› ‹A⇩R ♯* P› ‹xvec ♯* P›
‹A⇩Q ♯* A⇩R› ‹A⇩Q ♯* xvec› ‹xvec ♯* K› ‹distinct xvec› ‹A⇩R ♯* N›
obtain p Ψ' A⇩R' Ψ⇩R' where S: "set p ⊆ set xvec × set(p ∙ xvec)" and FrR': "extractFrame R' = ⟨A⇩R', Ψ⇩R'⟩"
and "(p ∙ Ψ⇩R) ⊗ Ψ' ≃ Ψ⇩R'" and "A⇩R' ♯* Q" and "A⇩R' ♯* Ψ" and "(p ∙ xvec) ♯* Ψ"
and "(p ∙ xvec) ♯* Q" and "(p ∙ xvec) ♯* Ψ⇩Q" and "(p ∙ xvec) ♯* K" and "(p ∙ xvec) ♯* R"
and "(p ∙ xvec) ♯* P" and "(p ∙ xvec) ♯* A⇩Q" and "A⇩R' ♯* P" and "A⇩R' ♯* N"
by(rule_tac C="(Ψ, Q, Ψ⇩Q, K, R, P, A⇩Q)" and C'="(Ψ, Q, Ψ⇩Q, K, R, P, A⇩Q)" in expandFrame) (assumption | simp)+
from ‹A⇩R ♯* Ψ› have "(p ∙ A⇩R) ♯* (p ∙ Ψ)" by(simp add: pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst])
with ‹xvec ♯* Ψ› ‹(p ∙ xvec) ♯* Ψ› S have "(p ∙ A⇩R) ♯* Ψ" by simp
from ‹A⇩R ♯* P› have "(p ∙ A⇩R) ♯* (p ∙ P)" by(simp add: pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst])
with ‹xvec ♯* P› ‹(p ∙ xvec) ♯* P› S have "(p ∙ A⇩R) ♯* P" by simp
from ‹A⇩R ♯* Q› have "(p ∙ A⇩R) ♯* (p ∙ Q)" by(simp add: pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst])
with ‹xvec ♯* Q› ‹(p ∙ xvec) ♯* Q› S have "(p ∙ A⇩R) ♯* Q" by simp
from ‹A⇩R ♯* R› have "(p ∙ A⇩R) ♯* (p ∙ R)" by(simp add: pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst])
with ‹xvec ♯* R› ‹(p ∙ xvec) ♯* R› S have "(p ∙ A⇩R) ♯* R" by simp
from ‹A⇩R ♯* K› have "(p ∙ A⇩R) ♯* (p ∙ K)" by(simp add: pt_fresh_star_bij[OF pt_name_inst, OF at_name_inst])
with ‹xvec ♯* K› ‹(p ∙ xvec) ♯* K› S have "(p ∙ A⇩R) ♯* K" by simp
from ‹A⇩Q ♯* xvec› ‹(p ∙ xvec) ♯* A⇩Q› ‹A⇩Q ♯* M› S have "A⇩Q ♯* (p ∙ M)" by(simp add: freshChainSimps)
from ‹A⇩Q ♯* xvec› ‹(p ∙ xvec) ♯* A⇩Q› ‹A⇩Q ♯* A⇩R› S have "A⇩Q ♯* (p ∙ A⇩R)" by(simp add: freshChainSimps)
from QTrans S ‹xvec ♯* Q› ‹(p ∙ xvec) ♯* Q› have "(p ∙ (Ψ ⊗ Ψ⇩R)) ⊳ Q ⟼ (p ∙ M)⦇N⦈ ≺ Q'"
by(rule_tac inputPermFrameSubject) (assumption | auto simp add: fresh_star_def)+
with ‹xvec ♯* Ψ› ‹(p ∙ xvec) ♯* Ψ› S have QTrans: "(Ψ ⊗ (p ∙ Ψ⇩R)) ⊳ Q ⟼ (p ∙ M)⦇N⦈ ≺ Q'"
by(simp add: eqvts)
from FrR have "(p ∙ extractFrame R) = p ∙ ⟨A⇩R, Ψ⇩R⟩" by simp
with ‹xvec ♯* R› ‹(p ∙ xvec) ♯* R› S have FrR: "extractFrame R = ⟨(p ∙ A⇩R), (p ∙ Ψ⇩R)⟩"
by(simp add: eqvts)
from MeqK have "(p ∙ (Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R)) ⊢ (p ∙ M) ↔ (p ∙ K)" by(rule chanEqClosed)
with ‹xvec ♯* Ψ› ‹(p ∙ xvec) ♯* Ψ› ‹xvec ♯* Ψ⇩Q› ‹(p ∙ xvec) ♯* Ψ⇩Q› ‹xvec ♯* K› ‹(p ∙ xvec) ♯* K› S
have MeqK: "Ψ ⊗ Ψ⇩Q ⊗ (p ∙ Ψ⇩R) ⊢ (p ∙ M) ↔ K" by(simp add: eqvts)
from FrR ‹(p ∙ A⇩R) ♯* Ψ› ‹(p ∙ A⇩R) ♯* P› ‹(p ∙ A⇩R) ♯* Q›
have "Ψ ⊗ (p ∙ Ψ⇩R) ⊳ P ↝<Rel> Q" by(force intro: Sim PRelQ)
with QTrans obtain P' P'' where PTrans: "Ψ ⊗ (p ∙ Ψ⇩R) : Q ⊳ P ⟹(p ∙ M)⦇N⦈ ≺ P''"
and P''Chain: "(Ψ ⊗ (p ∙ Ψ⇩R)) ⊗ Ψ' ⊳ P'' ⟹⇧^⇩τ P'"
and P'RelQ': "((Ψ ⊗ (p ∙ Ψ⇩R)) ⊗ Ψ', P', Q') ∈ Rel"
by(fastforce dest: weakSimE)
from PTrans QTrans ‹A⇩R' ♯* P› ‹A⇩R' ♯* Q› ‹A⇩R' ♯* N› have "A⇩R' ♯* P''" and "A⇩R' ♯* Q'"
by(auto dest: weakInputFreshChainDerivative inputFreshChainDerivative)
from PTrans FrQ RTrans FrR MeqK ‹A⇩Q ♯* Ψ› ‹A⇩Q ♯* P› ‹A⇩Q ♯* Q› ‹A⇩Q ♯* R› ‹A⇩Q ♯* (p ∙ M)› ‹A⇩Q ♯* (p ∙ A⇩R)›
‹(p ∙ A⇩R) ♯* Ψ› ‹(p ∙ A⇩R) ♯* P› ‹(p ∙ A⇩R) ♯* Q› ‹(p ∙ A⇩R) ♯* R› ‹(p ∙ A⇩R) ♯* K› ‹xvec ♯* P› ‹distinct A⇩R›
have "Ψ ⊳ P ∥ R ⟹⇩τ ⦇ν*xvec⦈(P'' ∥ R')" apply(rule_tac weakComm1)
by(assumption | simp)+
moreover from P''Chain ‹A⇩R' ♯* P''› have "A⇩R' ♯* P'" by(rule tauChainFreshChain)
from ‹(p ∙ Ψ⇩R) ⊗ Ψ' ≃ Ψ⇩R'› have "(Ψ ⊗ (p ∙ Ψ⇩R)) ⊗ Ψ' ≃ Ψ ⊗ Ψ⇩R'"
by(metis Associativity AssertionStatEqTrans AssertionStatEqSym compositionSym)
with P''Chain have "Ψ ⊗ Ψ⇩R' ⊳ P'' ⟹⇧^⇩τ P'" by(rule tauChainStatEq)
hence "Ψ ⊳ P'' ∥ R' ⟹⇧^⇩τ P' ∥ R'" using FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* P''› by(rule tauChainPar1)
hence "Ψ ⊳ ⦇ν*xvec⦈(P'' ∥ R') ⟹⇧^⇩τ ⦇ν*xvec⦈(P' ∥ R')" using ‹xvec ♯* Ψ› by(rule tauChainResChainPres)
ultimately have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ ⦇ν*xvec⦈(P' ∥ R')"
by auto
moreover from P'RelQ' ‹(p ∙ Ψ⇩R) ⊗ Ψ' ≃ Ψ⇩R'› have "(Ψ ⊗ Ψ⇩R', P', Q') ∈ Rel" by(metis C3 Associativity compositionSym)
with FrR' ‹A⇩R' ♯* P'› ‹A⇩R' ♯* Q'› ‹A⇩R' ♯* Ψ› have "(Ψ, P' ∥ R', Q' ∥ R') ∈ Rel'" by(rule_tac C1)
with ‹xvec ♯* Ψ› have "(Ψ, ⦇ν*xvec⦈(P' ∥ R'), ⦇ν*xvec⦈(Q' ∥ R')) ∈ Rel'"
by(rule_tac C2)
ultimately show ?case by blast
next
case(cComm2 Ψ⇩R M xvec N Q' A⇩Q Ψ⇩Q K R' A⇩R)
have FrQ: "extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩" by fact
from ‹A⇩Q ♯* (P, R)› have "A⇩Q ♯* P" and "A⇩Q ♯* R" by simp+
have FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" by fact
from ‹A⇩R ♯* (P, R)› have "A⇩R ♯* P" and "A⇩R ♯* R" by simp+
from ‹xvec ♯* (P, R)› have "xvec ♯* P" and "xvec ♯* R" by simp+
have QTrans: "Ψ ⊗ Ψ⇩R ⊳ Q ⟼M⦇ν*xvec⦈⟨N⟩ ≺ Q'" and RTrans: "Ψ ⊗ Ψ⇩Q ⊳ R ⟼K⦇N⦈ ≺ R'"
and MeqK: "Ψ ⊗ Ψ⇩Q ⊗ Ψ⇩R ⊢ M ↔K" by fact+
from RTrans FrR ‹distinct A⇩R› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* R› ‹A⇩R ♯* Q'› ‹A⇩R ♯* N› ‹A⇩R ♯* P› ‹A⇩R ♯* xvec› ‹A⇩R ♯* K›
obtain Ψ' A⇩R' Ψ⇩R' where ReqR': "Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'" and FrR': "extractFrame R' = ⟨A⇩R', Ψ⇩R'⟩"
and "A⇩R' ♯* Ψ" and "A⇩R' ♯* P" and "A⇩R' ♯* Q'" and "A⇩R' ♯* N" and "A⇩R' ♯* xvec"
by(rule_tac C="(Ψ, P, Q', N, xvec)" and C'="(Ψ, P, Q', N, xvec)" in expandFrame) (assumption | simp)+
from FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› ‹A⇩R ♯* Q› have "Ψ ⊗ Ψ⇩R ⊳ P ↝<Rel> Q" by(force intro: Sim PRelQ)
with QTrans ‹xvec ♯* Ψ› ‹xvec ♯* Ψ⇩R› ‹xvec ♯* P›
obtain P'' P' where PTrans: "Ψ ⊗ Ψ⇩R : Q ⊳ P ⟹M⦇ν*xvec⦈⟨N⟩ ≺ P''"
and P''Chain: "(Ψ ⊗ Ψ⇩R) ⊗ Ψ' ⊳ P'' ⟹⇧^⇩τ P'"
and P'RelQ': "((Ψ ⊗ Ψ⇩R) ⊗ Ψ', P', Q') ∈ Rel"
by(fastforce dest: weakSimE)
from PTrans obtain P''' where PChain: "Ψ ⊗ Ψ⇩R ⊳ P ⟹⇧^⇩τ P'''"
and QimpP''': "insertAssertion (extractFrame Q) (Ψ ⊗ Ψ⇩R) ↪⇩F insertAssertion (extractFrame P''') (Ψ ⊗ Ψ⇩R)"
and P'''Trans: "Ψ ⊗ Ψ⇩R ⊳ P''' ⟼M⦇ν*xvec⦈⟨N⟩ ≺ P''"
by(rule weakTransitionE)
from PChain ‹A⇩R ♯* P› have "A⇩R ♯* P'''" by(rule tauChainFreshChain)
obtain A⇩P''' Ψ⇩P''' where FrP''': "extractFrame P''' = ⟨A⇩P''', Ψ⇩P'''⟩" and "A⇩P''' ♯* (Ψ, A⇩Q, Ψ⇩Q, A⇩R, Ψ⇩R, M, N, K, R, P''', xvec)" and "distinct A⇩P'''"
by(rule freshFrame)
hence "A⇩P''' ♯* Ψ" and "A⇩P''' ♯* A⇩Q" and "A⇩P''' ♯* Ψ⇩Q" and "A⇩P''' ♯* M" and "A⇩P''' ♯* R"
and "A⇩P''' ♯* N" and "A⇩P''' ♯* K" and "A⇩P''' ♯* A⇩R" and "A⇩P''' ♯* P'''" and "A⇩P''' ♯* xvec" and "A⇩P''' ♯* Ψ⇩R"
by simp+
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ≃⇩F ⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩"
by(metis frameResChainPres frameNilStatEq Commutativity AssertionStatEqTrans Composition Associativity)
moreover with QimpP''' FrP''' FrQ ‹A⇩P''' ♯* Ψ› ‹A⇩Q ♯* Ψ› ‹A⇩P''' ♯* Ψ⇩R› ‹A⇩Q ♯* Ψ⇩R›
have "⟨A⇩Q, (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩Q⟩ ↪⇩F ⟨A⇩P''', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'''⟩" using freshCompChain
by simp
moreover have "⟨A⇩P''', (Ψ ⊗ Ψ⇩R) ⊗ Ψ⇩P'''⟩ ≃⇩F ⟨A⇩P''', (Ψ ⊗ Ψ⇩P''') ⊗ Ψ⇩R⟩"
by(metis frameResChainPres frameNilStatEq Commutativity AssertionStatEqTrans Composition Associativity)
ultimately have QImpP''': "⟨A⇩Q, (Ψ ⊗ Ψ⇩Q) ⊗ Ψ⇩R⟩ ↪⇩F ⟨A⇩P''', (Ψ ⊗ Ψ⇩P''') ⊗ Ψ⇩R⟩"
by(rule FrameStatEqImpCompose)
from PChain FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P› have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ P''' ∥ R" by(rule tauChainPar1)
moreover from RTrans FrR P'''Trans MeqK QImpP''' FrP''' FrQ ‹distinct A⇩P'''› ‹distinct A⇩R› ‹A⇩P''' ♯* A⇩R› ‹A⇩Q ♯* A⇩R›
‹A⇩R ♯* Ψ› ‹A⇩R ♯* P'''› ‹A⇩R ♯* Q› ‹A⇩R ♯* R› ‹A⇩R ♯* K› ‹A⇩P''' ♯* Ψ› ‹A⇩P''' ♯* R›
‹A⇩P''' ♯* P'''› ‹A⇩P''' ♯* M› ‹A⇩Q ♯* R› ‹A⇩Q ♯* M› ‹A⇩R ♯* xvec› ‹xvec ♯* M›
obtain K' where "Ψ ⊗ Ψ⇩P''' ⊳ R ⟼K'⦇N⦈ ≺ R'" and "Ψ ⊗ Ψ⇩P''' ⊗ Ψ⇩R ⊢ M ↔ K'" and "A⇩R ♯* K'"
by(rule_tac comm2Aux) (assumption | simp)+
with P'''Trans FrP''' have "Ψ ⊳ P''' ∥ R ⟼τ ≺ ⦇ν*xvec⦈(P'' ∥ R')" using FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* P'''› ‹A⇩R ♯* R›
‹xvec ♯* R› ‹A⇩P''' ♯* Ψ› ‹A⇩P''' ♯* P'''› ‹A⇩P''' ♯* R› ‹A⇩P''' ♯* M› ‹A⇩R ♯* K'› ‹A⇩P''' ♯* A⇩R›
by(rule_tac Comm2)
moreover from P'''Trans ‹A⇩R ♯* P'''› ‹A⇩R ♯* xvec› ‹xvec ♯* M› ‹distinct xvec› have "A⇩R ♯* P''"
by(rule_tac outputFreshChainDerivative) auto
from PChain ‹A⇩R' ♯* P› have "A⇩R' ♯* P'''" by(rule tauChainFreshChain)
with P'''Trans have "A⇩R' ♯* P''" using ‹A⇩R' ♯* xvec› ‹xvec ♯* M› ‹distinct xvec›
by(rule_tac outputFreshChainDerivative) auto
with P''Chain have "A⇩R' ♯* P'" by(rule tauChainFreshChain)
from ‹Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'› have "(Ψ ⊗ Ψ⇩R) ⊗ Ψ' ≃ Ψ ⊗ Ψ⇩R'"
by(metis Associativity AssertionStatEqTrans AssertionStatEqSym compositionSym)
with P''Chain have "Ψ ⊗ Ψ⇩R' ⊳ P'' ⟹⇧^⇩τ P'" by(rule tauChainStatEq)
hence "Ψ ⊳ P'' ∥ R' ⟹⇧^⇩τ P' ∥ R'" using FrR' ‹A⇩R' ♯* Ψ› ‹A⇩R' ♯* P''›
by(rule tauChainPar1)
hence "Ψ ⊳ ⦇ν*xvec⦈(P'' ∥ R') ⟹⇧^⇩τ ⦇ν*xvec⦈(P' ∥ R')"
using ‹xvec ♯* Ψ› by(rule tauChainResChainPres)
ultimately have "Ψ ⊳ P ∥ R ⟹⇧^⇩τ ⦇ν*xvec⦈(P' ∥ R')" by(drule_tac tauActTauChain) auto
moreover from P'RelQ' ‹Ψ⇩R ⊗ Ψ' ≃ Ψ⇩R'› have "(Ψ ⊗ Ψ⇩R', P', Q') ∈ Rel" by(metis C3 Associativity compositionSym)
with FrR' ‹A⇩R' ♯* P'› ‹A⇩R' ♯* Q'› ‹A⇩R' ♯* Ψ› have "(Ψ, P' ∥ R', Q' ∥ R') ∈ Rel'" by(rule_tac C1)
with ‹xvec ♯* Ψ› have "(Ψ, ⦇ν*xvec⦈(P' ∥ R'), ⦇ν*xvec⦈(Q' ∥ R')) ∈ Rel'"
by(rule_tac C2)
ultimately show ?case by blast
qed
qed
qed
unbundle no relcomp_syntax
lemma weakSimBangPres:
fixes Ψ :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and Rel :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Rel' :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
and Rel'' :: "('b × ('a, 'b, 'c) psi × ('a, 'b, 'c) psi) set"
assumes "(Ψ, P, Q) ∈ Rel"
and "eqvt Rel''"
and "guarded P"
and "guarded Q"
and Rel'Rel: "Rel' ⊆ Rel"
and FrameParPres: "⋀Ψ' Ψ⇩U S T U A⇩U. ⟦(Ψ' ⊗ Ψ⇩U, S, T) ∈ Rel; extractFrame U = ⟨A⇩U, Ψ⇩U⟩; A⇩U ♯* Ψ'; A⇩U ♯* S; A⇩U ♯* T⟧ ⟹
(Ψ', U ∥ S, U ∥ T) ∈ Rel"
and C1: "⋀Ψ' S T U. ⟦(Ψ', S, T) ∈ Rel; guarded S; guarded T⟧ ⟹ (Ψ', U ∥ !S, U ∥ !T) ∈ Rel''"
and ResPres: "⋀Ψ' S T xvec. ⟦(Ψ', S, T) ∈ Rel; xvec ♯* Ψ'⟧ ⟹ (Ψ', ⦇ν*xvec⦈S, ⦇ν*xvec⦈T) ∈ Rel"
and ResPres': "⋀Ψ' S T xvec. ⟦(Ψ', S, T) ∈ Rel'; xvec ♯* Ψ'⟧ ⟹ (Ψ', ⦇ν*xvec⦈S, ⦇ν*xvec⦈T) ∈ Rel'"
and Closed: "⋀Ψ' S T p. (Ψ', S, T) ∈ Rel ⟹ ((p::name prm) ∙ Ψ', p ∙ S, p ∙ T) ∈ Rel"
and Closed': "⋀Ψ' S T p. (Ψ', S, T) ∈ Rel' ⟹ ((p::name prm) ∙ Ψ', p ∙ S, p ∙ T) ∈ Rel'"
and StatEq: "⋀Ψ' S T Ψ''. ⟦(Ψ', S, T) ∈ Rel; Ψ' ≃ Ψ''⟧ ⟹ (Ψ'', S, T) ∈ Rel"
and StatEq': "⋀Ψ' S T Ψ''. ⟦(Ψ', S, T) ∈ Rel'; Ψ' ≃ Ψ''⟧ ⟹ (Ψ'', S, T) ∈ Rel'"
and Trans: "⋀Ψ' S T U. ⟦(Ψ', S, T) ∈ Rel; (Ψ', T, U) ∈ Rel⟧ ⟹ (Ψ', S, U) ∈ Rel"
and Trans': "⋀Ψ' S T U. ⟦(Ψ', S, T) ∈ Rel'; (Ψ', T, U) ∈ Rel'⟧ ⟹ (Ψ', S, U) ∈ Rel'"
and cSim: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ Ψ' ⊳ S ↝<Rel> T"
and cExt: "⋀Ψ' S T Ψ''. (Ψ', S, T) ∈ Rel ⟹ (Ψ' ⊗ Ψ'', S, T) ∈ Rel"
and cExt': "⋀Ψ' S T Ψ''. (Ψ', S, T) ∈ Rel' ⟹ (Ψ' ⊗ Ψ'', S, T) ∈ Rel'"
and cSym: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ (Ψ', T, S) ∈ Rel"
and cSym': "⋀Ψ' S T. (Ψ', S, T) ∈ Rel' ⟹ (Ψ', T, S) ∈ Rel'"
and ParPres: "⋀Ψ' S T U. (Ψ', S, T) ∈ Rel ⟹ (Ψ', S ∥ U, T ∥ U) ∈ Rel"
and ParPres2: "⋀Ψ' S T. (Ψ', S, T) ∈ Rel ⟹ (Ψ', S ∥ S, T ∥ T) ∈ Rel"
and ParPres': "⋀Ψ' S T U. (Ψ', S, T) ∈ Rel' ⟹ (Ψ', U ∥ S, U ∥ T) ∈ Rel'"
and Assoc: "⋀Ψ' S T U. (Ψ', S ∥ (T ∥ U), (S ∥ T) ∥ U) ∈ Rel"
and Assoc': "⋀Ψ' S T U. (Ψ', S ∥ (T ∥ U), (S ∥ T) ∥ U) ∈ Rel'"
and ScopeExt: "⋀xvec Ψ' T S. ⟦xvec ♯* Ψ'; xvec ♯* T⟧ ⟹ (Ψ', ⦇ν*xvec⦈(S ∥ T), (⦇ν*xvec⦈S) ∥ T) ∈ Rel"
and ScopeExt': "⋀xvec Ψ' T S. ⟦xvec ♯* Ψ'; xvec ♯* T⟧ ⟹ (Ψ', ⦇ν*xvec⦈(S ∥ T), (⦇ν*xvec⦈S) ∥ T) ∈ Rel'"
and Compose: "⋀Ψ' S T U O. ⟦(Ψ', S, T) ∈ Rel; (Ψ', T, U) ∈ Rel''; (Ψ', U, O) ∈ Rel'⟧ ⟹ (Ψ', S, O) ∈ Rel''"
and rBangActE: "⋀Ψ' S α S'. ⟦Ψ' ⊳ !S ⟼α ≺ S'; guarded S; bn α ♯* S; α ≠ τ; bn α ♯* subject α⟧ ⟹ ∃T. Ψ' ⊳ S ⟼α ≺ T ∧ (𝟭, S', T ∥ !S) ∈ Rel'"
and rBangTauE: "⋀Ψ' S S'. ⟦Ψ' ⊳ !S ⟼τ ≺ S'; guarded S⟧ ⟹ ∃T. Ψ' ⊳ S ∥ S ⟼τ ≺ T ∧ (𝟭, S', T ∥ !S) ∈ Rel'"
and rBangTauI: "⋀Ψ' S S'. ⟦Ψ' ⊳ S ∥ S ⟹⇧^⇩τ S'; guarded S⟧ ⟹ ∃T. Ψ' ⊳ !S ⟹⇧^⇩τ T ∧ (Ψ', T, S' ∥ !S) ∈ Rel'"
shows "Ψ ⊳ R ∥ !P ↝<Rel''> R ∥ !Q"
using ‹eqvt Rel''›
proof(induct rule: weakSimI[where C="()"])
case(cAct Ψ' α RQ')
from ‹bn α ♯* (R ∥ !P)› ‹bn α ♯* (R ∥ !Q)› have "bn α ♯* P" and "bn α ♯* (!Q)" and "bn α ♯* Q" and "bn α ♯* R"
by simp+
from ‹Ψ ⊳ R ∥ !Q ⟼α ≺ RQ'› ‹bn α ♯* Ψ› ‹bn α ♯* R› ‹bn α ♯* !Q› ‹bn α ♯* subject α› ‹α ≠ τ› show ?case
proof(induct rule: parCases[where C="(Ψ', P, Q, R)"])
case(cPar1 R' A⇩Q Ψ⇩Q)
from ‹extractFrame (!Q) = ⟨A⇩Q, Ψ⇩Q⟩› have "A⇩Q = []" and "Ψ⇩Q = SBottom'" by simp+
with ‹Ψ ⊗ Ψ⇩Q ⊳ R ⟼α ≺ R'› ‹Ψ⇩Q = SBottom'› ‹bn α ♯* Ψ› ‹bn α ♯* P›
have "Ψ ⊳ R ∥ !P ⟼α ≺ (R' ∥ !P)" by(rule_tac Par1) (assumption | simp)+
hence "Ψ : R ∥ !Q ⊳ R ∥ !P ⟹α ≺ R' ∥ !P" by(rule_tac transitionWeakTransition) auto
moreover have "Ψ ⊗ Ψ' ⊳ R' ∥ !P ⟹⇧^⇩τ R' ∥ !P" by auto
moreover from ‹(Ψ, P, Q) ∈ Rel› have "(Ψ ⊗ Ψ', P, Q) ∈ Rel" by(rule cExt)
hence "(Ψ ⊗ Ψ', R' ∥ !P, R' ∥ !Q) ∈ Rel''" using ‹guarded P› ‹guarded Q›
by(rule C1)
ultimately show ?case by blast
next
case(cPar2 Q' A⇩R Ψ⇩R)
from ‹A⇩R ♯* (Ψ', P, Q, R)› have "A⇩R ♯* P" and "A⇩R ♯* Q" and "A⇩R ♯* Ψ'" and "A⇩R ♯* R" by simp+
have FrR: "extractFrame R = ⟨A⇩R, Ψ⇩R⟩" by fact
with ‹bn α ♯* R› ‹A⇩R ♯* α› have "bn α ♯* Ψ⇩R" by(auto dest: extractFrameFreshChain)
obtain A⇩Q Ψ⇩Q where FrQ: "extractFrame Q = ⟨A⇩Q, Ψ⇩Q⟩" and "A⇩Q ♯* Ψ" and "A⇩Q ♯* Ψ⇩R" and "A⇩Q ♯* A⇩R"
by(rule_tac C="(Ψ, Ψ⇩R, A⇩R)" in freshFrame) auto
from FrQ ‹guarded Q› have "Ψ⇩Q ≃ 𝟭" and "supp Ψ⇩Q = ({}::name set)" by(blast dest: guardedStatEq)+
hence "A⇩R ♯* Ψ⇩Q" and "A⇩Q ♯* Ψ⇩Q" by(auto simp add: fresh_star_def fresh_def)
from ‹Ψ ⊗ Ψ⇩R ⊳ !Q ⟼α ≺ Q'› ‹guarded Q› ‹bn α ♯* Q› ‹α ≠ τ› ‹bn α ♯* subject α›
obtain T where QTrans: "Ψ ⊗ Ψ⇩R ⊳ Q ⟼α ≺ T" and "(𝟭, Q', T ∥ !Q) ∈ Rel'"
by(blast dest: rBangActE)
from ‹(Ψ, P, Q) ∈ Rel› have "(Ψ ⊗ Ψ⇩R, P, Q) ∈ Rel" by(rule cExt)
with QTrans ‹bn α ♯* Ψ› ‹bn α ♯* Ψ⇩R› ‹bn α ♯* P› ‹α ≠ τ›
obtain P'' S where PTrans: "Ψ ⊗ Ψ⇩R : Q ⊳ P ⟹α ≺ P''"
and P''Chain: "(Ψ ⊗ Ψ⇩R) ⊗ Ψ' ⊳ P'' ⟹⇧^⇩τ S"
and SRelT: "((Ψ ⊗ Ψ⇩R) ⊗ Ψ', S, T) ∈ Rel"
by(blast dest: cSim weakSimE)
from PTrans have "(Ψ ⊗ Ψ⇩R) ⊗ 𝟭 : Q ⊳ P ⟹α ≺ P''"
by(metis weakTransitionStatEq Identity AssertionStatEqSym)
hence "Ψ ⊗ Ψ⇩R : Q ∥ !P ⊳ P ∥ !P ⟹α ≺ P'' ∥ !P" using ‹bn α ♯* P›
by(force intro: weakPar1)
hence "Ψ ⊗ Ψ⇩R : Q ∥ !P ⊳ !P ⟹α ≺ P'' ∥ !P" using ‹guarded P›
by(rule weakBang)
hence "Ψ : R ∥ (Q ∥ !P) ⊳ R ∥ !P ⟹α ≺ R ∥ (P'' ∥ !P)"
using FrR ‹bn α ♯* R› ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Q›‹A⇩R ♯* P› ‹A⇩R ♯* α› ‹A⇩R ♯* α›
by(rule_tac weakPar2) auto
moreover have "insertAssertion (extractFrame(R ∥ !Q)) Ψ ↪⇩F insertAssertion (extractFrame(R ∥ (Q ∥ !P))) Ψ"
proof -
have "insertAssertion (extractFrame(R ∥ !P)) Ψ = ⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ 𝟭⟩" using FrR ‹A⇩R ♯* Ψ›
by auto
moreover from ‹Ψ⇩Q ≃ 𝟭› have "⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ 𝟭⟩ ≃⇩F ⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩"
by(rule_tac frameResChainPres, auto) (metis Identity compositionSym AssertionStatEqTrans AssertionStatEqSym)
moreover have "⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩ ≃⇩F ⦇ν*A⇩Q⦈(⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩)" using ‹A⇩Q ♯* Ψ› ‹A⇩Q ♯* Ψ⇩Q› ‹A⇩Q ♯* Ψ⇩R› ‹A⇩Q ♯* A⇩R› freshCompChain
by(subst frameResFreshChain[where xvec=A⇩Q, THEN FrameStatEqSym]) auto
moreover have "⦇ν*A⇩Q⦈(⟨A⇩R, Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩) ≃⇩F ⦇ν*A⇩R⦈(⟨A⇩Q, Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩)"
by(rule frameResChainComm)
moreover have "insertAssertion (extractFrame(R ∥ (Q ∥ !P))) Ψ = ⟨(A⇩R@A⇩Q), Ψ ⊗ Ψ⇩R ⊗ Ψ⇩Q ⊗ 𝟭⟩"
using FrR FrQ ‹A⇩R ♯* Ψ› ‹A⇩Q ♯* Ψ› ‹A⇩Q ♯* A⇩R› ‹A⇩Q ♯* Ψ⇩R› ‹A⇩R ♯* Ψ⇩Q› freshCompChain
by auto
ultimately have "insertAssertion (extractFrame(R ∥ !P)) Ψ ≃⇩F insertAssertion (extractFrame(R ∥ (Q ∥ !P))) Ψ"
by(auto simp add: frameChainAppend) (blast dest: FrameStatEqTrans)
thus ?thesis by(simp add: FrameStatEq_def)
qed
ultimately have "Ψ : R ∥ !Q ⊳ R ∥ !P ⟹α ≺ R ∥ (P'' ∥ !P)"
by(rule weakTransitionFrameImp)
moreover from PTrans ‹A⇩R ♯* P› ‹A⇩R ♯* α› ‹bn α ♯* subject α› ‹distinct(bn α)›
have "A⇩R ♯* P''" by(force dest: weakFreshChainDerivative)
with P''Chain have "A⇩R ♯* S" by(force dest: tauChainFreshChain)
from ‹Ψ ⊗ Ψ⇩R ⊳ Q ⟼α ≺ T› ‹A⇩R ♯* Q› ‹A⇩R ♯* α› ‹bn α ♯* subject α› ‹distinct(bn α)› have "A⇩R ♯* T"
by(force dest: freeFreshChainDerivative)
from P''Chain have "((Ψ ⊗ Ψ') ⊗ Ψ⇩R) ⊗ 𝟭 ⊳ P'' ⟹⇧^⇩τ S"
by(rule tauChainStatEq) (metis Associativity Commutativity Composition AssertionStatEqTrans AssertionStatEqSym Identity)
hence "(Ψ ⊗ Ψ') ⊗ Ψ⇩R ⊳ P'' ∥ !P ⟹⇧^⇩τ S ∥ !P"
by(rule_tac tauChainPar1) auto
hence "Ψ ⊗ Ψ' ⊳ R ∥ (P'' ∥ !P) ⟹⇧^⇩τ R ∥ (S ∥ !P)" using FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ'› ‹A⇩R ♯* P''› ‹A⇩R ♯* P›
by(rule_tac tauChainPar2) auto
moreover have "(Ψ ⊗ Ψ', R ∥ (S ∥ !P), R ∥ Q') ∈ Rel''"
proof -
from ‹((Ψ ⊗ Ψ⇩R) ⊗ Ψ', S, T) ∈ Rel› have "((Ψ ⊗ Ψ') ⊗ Ψ⇩R, S, T) ∈ Rel"
by(rule StatEq) (metis Associativity Commutativity Composition AssertionStatEqTrans AssertionStatEqSym)
with FrR ‹A⇩R ♯* Ψ› ‹A⇩R ♯* Ψ'› ‹A⇩R ♯* S› ‹A⇩R ♯* T› have "(Ψ ⊗ Ψ', R ∥ S, R ∥ T) ∈ Rel"
by(rule_tac FrameParPres) auto
hence "(Ψ ⊗ Ψ', R ∥ T, R ∥ S) ∈ Rel" by(rule cSym)
hence "(Ψ ⊗ Ψ', (R ∥ T) ∥ !P, (R ∥ S) ∥ !P) ∈ Rel" by(rule ParPres)
hence "(Ψ ⊗ Ψ', (R ∥ S) ∥ !P, (R ∥ T) ∥ !P) ∈ Rel" by(rule cSym)
hence "(Ψ ⊗ Ψ', R ∥ (S ∥ !P), (R ∥ T) ∥ !P) ∈ Rel" by(metis Trans Assoc)
moreover from ‹(Ψ, P, Q) ∈ Rel› have "(Ψ ⊗ Ψ', P, Q) ∈ Rel" by(rule cExt)
hence "(Ψ ⊗ Ψ', (R ∥ T) ∥ !P, (R ∥ T) ∥ !Q) ∈ Rel''" using ‹guarded P› ‹guarded Q› by(rule C1)
moreover from ‹(𝟭, Q', T ∥ !Q) ∈ Rel'› have "(𝟭 ⊗ Ψ ⊗ Ψ', Q', T ∥ !Q) ∈ Rel'" by(rule cExt')
hence "(Ψ ⊗ Ψ', Q', T ∥ !Q) ∈ Rel'"
by(rule StatEq') (metis Identity AssertionStatEqSym Commutativity AssertionStatEqTrans)
hence "(Ψ ⊗ Ψ', R ∥ Q', R ∥ (T ∥ !Q)) ∈ Rel'" by(rule ParPres')
hence "(Ψ ⊗ Ψ', R ∥ Q', (R ∥ T) ∥ !Q) ∈ Rel'" by(metis Trans' Assoc')
hence "(Ψ ⊗ Ψ', (R ∥ T) ∥ !Q, R ∥ Q') ∈ Rel'" by(