Theory Introduction
chapter‹A Gentle Introduction to TESL›
theory Introduction
imports Main
begin
section ‹Context›
text‹
The design of complex systems involves different formalisms for modeling their different parts or
aspects. The global model of a system may therefore consist of a coordination of concurrent
sub-models that use different paradigms such as differential equations, state machines,
synchronous data-flow networks,
discrete event models and so on, as illustrated in \autoref{fig:het-timed-system}.
This raises the interest in architectural composition languages
that allow for ``bolting the respective sub-models together'', along their various interfaces, and
specifying the various ways of collaboration and coordination~@{cite "nguyenvan:hal-01583815"}.
We are interested in languages that allow for specifying the timed coordination of subsystems by
addressing the following conceptual issues:
▪ events may occur in different sub-systems at unrelated times, leading to ∗‹polychronous› systems,
which do not necessarily have a common base clock,
▪ the behavior of the sub-systems is observed only at a series of discrete instants, and time
coordination has to take this ∗‹discretization› into account,
▪ the instants at which a system is observed may be arbitrary and should not change its behavior
(∗‹stuttering invariance›),
▪ coordination between subsystems involves causality, so the occurrence of an event may enforce
the occurrence of other events, possibly after a certain duration has elapsed or an event has
occurred a given number of times,
▪ the domain of time (discrete, rational, continuous. . . ) may be different in the subsystems,
leading to ∗‹polytimed› systems,
▪ the time frames of different sub-systems may be related (for instance, time in a GPS satellite
and in a GPS receiver on Earth are related although they are not the same).
›
text‹
\begin{figure}[htbp]
\centering
\includegraphics{glue.pdf}
\caption{A Heterogeneous Timed System Model}
\label{fig:het-timed-system}
\end{figure}›
consts dummyInfty :: ‹'a ⇒ 'a›
consts dummyTESLSTAR :: ‹'a›
consts dummyFUN :: ‹'a set ⇒ 'b set ⇒ 'c set›
consts dummyCLOCK :: ‹'a set›
consts dummyBOOL :: ‹bool set›
consts dummyTIMES :: ‹'a set›
consts dummyLEQ :: ‹'a ⇒ 'a ⇒ bool›
notation dummyInfty (‹(_⇧∞)› [1000] 999)
notation dummyTESLSTAR (‹TESL⇧*›)
notation dummyFUN (infixl ‹→› 100)
notation dummyCLOCK (‹𝒦›)
notation dummyBOOL (‹𝔹›)
notation dummyTIMES (‹𝒯›)
notation dummyLEQ (infixl ‹≤⇩𝒯› 100)
text‹
In order to tackle the heterogeneous nature of the subsystems, we abstract their behavior as clocks.
Each clock models an event, i.e., something that can occur or not at a given time. This time is measured
in a time frame associated with each clock, and the nature of time (integer, rational, real, or any
type with a linear order) is specific to each clock.
When the event associated with a clock occurs, the clock ticks. In order to support any kind of
behavior for the subsystems, we are only interested in specifying what we can observe at a series
of discrete instants. There are two constraints on observations: a clock may tick only at an
observation instant, and the time on any clock cannot decrease from an instant to the next one.
However, it is always possible to add arbitrary observation instants, which allows for stuttering
and modular composition of systems.
As a consequence, the key concept of our setting is the notion of a clock-indexed Kripke model:
@{term ‹Σ⇧∞ = ℕ → 𝒦 → (𝔹 × 𝒯)›}, where @{term ‹𝒦›} is an enumerable set of clocks, @{term ‹𝔹›}
is the set of booleans – used to indicate that a clock ticks at a given instant – and @{term ‹𝒯›}
is a universal metric time space for which we only assume that it is large enough to contain all
individual time spaces of clocks and that it is ordered by some linear ordering @{term ‹(≤⇩𝒯)›}.
›
text‹
The elements of @{term ‹Σ⇧∞›} are called runs. A specification language is a set of
operators that constrains the set of possible monotonic runs. Specifications are composed by
intersecting the denoted run sets of constraint operators.
Consequently, such specification languages do not limit the number of clocks used to model a
system (as long as it is finite) and it is always possible to add clocks to a specification.
Moreover, they are ∗‹compositional› by construction since the composition of specifications
consists of the conjunction of their constraints.
›
text‹
This work provides the following contributions:
▪ defining the non-trivial language @{term ‹TESL⇧*›} in terms of clock-indexed Kripke models,
▪ proving that this denotational semantics is stuttering invariant,
▪ defining an adapted form of symbolic primitives and presenting the set of operational
semantic rules,
▪ presenting formal proofs for soundness, completeness, and progress of the latter.
›
section‹The TESL Language›
text‹
The TESL language @{cite "BouJacHarPro2014MEMOCODE"} was initially designed to coordinate the
execution of heterogeneous components during the simulation of a system. We define here a minimal
kernel of operators that will form the basis of a family of specification languages, including the
original TESL language, which is described at \url{http://wdi.supelec.fr/software/TESL/}.
›
subsection‹Instantaneous Causal Operators›
text‹
TESL has operators to deal with instantaneous causality, i.e., to react to an event occurrence
in the very same observation instant.
▪ ▩‹c1 implies c2› means that at any instant where ▩‹c1› ticks, ▩‹c2› has to tick too.
▪ ▩‹c1 implies not c2› means that at any instant where ▩‹c1› ticks, ▩‹c2› cannot tick.
▪ ▩‹c1 kills c2› means that at any instant where ▩‹c1› ticks, and at any future instant,
▩‹c2› cannot tick.
›
subsection‹Temporal Operators›
text‹
TESL also has chronometric temporal operators that deal with dates and chronometric delays.
▪ ▩‹c sporadic t› means that clock ▩‹c› must have a tick at time ▩‹t› on its own time scale.
▪ ▩‹c1 sporadic t on c2› means that clock ▩‹c1› must have a tick at an instant where the time
on ▩‹c2› is ▩‹t›.
▪ ▩‹c1 time delayed by d on m implies c2› means that every time clock ▩‹c1› ticks, ▩‹c2› must have
a tick at the first instant where the time on ▩‹m› is ▩‹d› later than it was when ▩‹c1› had ticked.
This means that every tick on ▩‹c1› is followed by a tick on ▩‹c2› after a delay ▩‹d› measured
on the time scale of clock ▩‹m›.
▪ ▩‹time relation (c1, c2) in R› means that at every instant, the current time on clocks ▩‹c1›
and ▩‹c2› must be in relation ▩‹R›. By default, the time lines of different clocks are
independent. This operator allows us to link two time lines, for instance to model the fact
that time in a GPS satellite and time in a GPS receiver on Earth are not the same but are
related. Time being polymorphic in TESL, this can also be used to model the fact that the
angular position on the camshaft of an engine moves twice as fast as the angular position
on the crankshaft~⁋‹See \url{http://wdi.supelec.fr/software/TESL/GalleryEngine} for more details›.
We may consider only linear arithmetic relations to restrict the problem to a domain where
the resolution is decidable.›
subsection‹Asynchronous Operators›
text‹
The last category of TESL operators allows the specification of asynchronous relations between
event occurrences. They do not specify the precise instants at which ticks have to occur,
they only put bounds on the set of instants at which they should occur.
▪ ▩‹c1 weakly precedes c2› means that for each tick on ▩‹c2›, there must be at least one tick
on ▩‹c1› at a previous or at the same instant. This can also be expressed by stating
that at each instant, the number of ticks since the beginning of the run must be lower or
equal on ▩‹c2› than on ▩‹c1›.
▪ ▩‹c1 strictly precedes c2› means that for each tick on ▩‹c2›, there must be at least one tick
on ▩‹c1› at a previous instant. This can also be expressed by saying that at each instant,
the number of ticks on ▩‹c2› from the beginning of the run to this instant, must be lower or
equal to the number of ticks on ▩‹c1› from the beginning of the run to the previous instant.
›
no_notation dummyInfty (‹(_⇧∞)› )
no_notation dummyTESLSTAR (‹TESL⇧*›)
no_notation dummyFUN (infixl ‹→› 100)
no_notation dummyCLOCK (‹𝒦›)
no_notation dummyBOOL (‹𝔹›)
no_notation dummyTIMES (‹𝒯›)
no_notation dummyLEQ (infixl ‹≤⇩𝒯› 100)
end
Theory TESL
text‹\chapter[Core TESL: Syntax and Basics]{The Core of the TESL Language: Syntax and Basics}›
theory TESL
imports Main
begin
section‹Syntactic Representation›
text‹
We define here the syntax of TESL specifications.
›
subsection‹Basic elements of a specification›
text‹
The following items appear in specifications:
▪ Clocks, which are identified by a name.
▪ Tag constants are just constants of a type which denotes the metric time space.
›
datatype clock = Clk ‹string›
type_synonym instant_index = ‹nat›
datatype 'τ tag_const = TConst (the_tag_const : 'τ) (‹τ⇩c⇩s⇩t›)
subsection‹Operators for the TESL language›
text‹
The type of atomic TESL constraints, which can be combined to form specifications.
›
datatype 'τ TESL_atomic =
SporadicOn ‹clock› ‹'τ tag_const› ‹clock› (‹_ sporadic _ on _› 55)
| TagRelation ‹clock› ‹clock› ‹('τ tag_const × 'τ tag_const) ⇒ bool›
(‹time-relation ⌊_, _⌋ ∈ _› 55)
| Implies ‹clock› ‹clock› (infixr ‹implies› 55)
| ImpliesNot ‹clock› ‹clock› (infixr ‹implies not› 55)
| TimeDelayedBy ‹clock› ‹'τ tag_const› ‹clock› ‹clock›
(‹_ time-delayed by _ on _ implies _› 55)
| WeaklyPrecedes ‹clock› ‹clock› (infixr ‹weakly precedes› 55)
| StrictlyPrecedes ‹clock› ‹clock› (infixr ‹strictly precedes› 55)
| Kills ‹clock› ‹clock› (infixr ‹kills› 55)
text‹
A TESL formula is just a list of atomic constraints, with implicit conjunction
for the semantics.
›
type_synonym 'τ TESL_formula = ‹'τ TESL_atomic list›
text‹
We call ∗‹positive atoms› the atomic constraints that create ticks from nothing.
Only sporadic constraints are positive in the current version of TESL.
›
fun positive_atom :: ‹'τ TESL_atomic ⇒ bool› where
‹positive_atom (_ sporadic _ on _) = True›
| ‹positive_atom _ = False›
text‹
The @{term ‹NoSporadic›} function removes sporadic constraints from a TESL formula.
›
abbreviation NoSporadic :: ‹'τ TESL_formula ⇒ 'τ TESL_formula›
where
‹NoSporadic f ≡ (List.filter (λf⇩a⇩t⇩o⇩m. case f⇩a⇩t⇩o⇩m of
_ sporadic _ on _ ⇒ False
| _ ⇒ True) f)›
subsection‹Field Structure of the Metric Time Space›
text‹
In order to handle tag relations and delays, tags must belong to a field.
We show here that this is the case when the type parameter of @{typ ‹'τ tag_const›}
is itself a field.
›
instantiation tag_const ::(field)field
begin
fun inverse_tag_const
where ‹inverse (τ⇩c⇩s⇩t t) = τ⇩c⇩s⇩t (inverse t)›
fun divide_tag_const
where ‹divide (τ⇩c⇩s⇩t t⇩1) (τ⇩c⇩s⇩t t⇩2) = τ⇩c⇩s⇩t (divide t⇩1 t⇩2)›
fun uminus_tag_const
where ‹uminus (τ⇩c⇩s⇩t t) = τ⇩c⇩s⇩t (uminus t)›
fun minus_tag_const
where ‹minus (τ⇩c⇩s⇩t t⇩1) (τ⇩c⇩s⇩t t⇩2) = τ⇩c⇩s⇩t (minus t⇩1 t⇩2)›
definition ‹one_tag_const ≡ τ⇩c⇩s⇩t 1›
fun times_tag_const
where ‹times (τ⇩c⇩s⇩t t⇩1) (τ⇩c⇩s⇩t t⇩2) = τ⇩c⇩s⇩t (times t⇩1 t⇩2)›
definition ‹zero_tag_const ≡ τ⇩c⇩s⇩t 0›
fun plus_tag_const
where ‹plus (τ⇩c⇩s⇩t t⇩1) (τ⇩c⇩s⇩t t⇩2) = τ⇩c⇩s⇩t (plus t⇩1 t⇩2)›
instance proof
text‹Multiplication is associative.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
and c::‹'τ::field tag_const›
obtain u v w where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› and ‹c = τ⇩c⇩s⇩t w›
using tag_const.exhaust by metis
thus ‹a * b * c = a * (b * c)›
by (simp add: TESL.times_tag_const.simps)
next
text‹Multiplication is commutative.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
obtain u v where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› using tag_const.exhaust by metis
thus ‹ a * b = b * a›
by (simp add: TESL.times_tag_const.simps)
next
text‹One is neutral for multiplication.›
fix a::‹'τ::field tag_const›
obtain u where ‹a = τ⇩c⇩s⇩t u› using tag_const.exhaust by blast
thus ‹1 * a = a›
by (simp add: TESL.times_tag_const.simps one_tag_const_def)
next
text‹Addition is associative.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
and c::‹'τ::field tag_const›
obtain u v w where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› and ‹c = τ⇩c⇩s⇩t w›
using tag_const.exhaust by metis
thus ‹a + b + c = a + (b + c)›
by (simp add: TESL.plus_tag_const.simps)
next
text‹Addition is commutative.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
obtain u v where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› using tag_const.exhaust by metis
thus ‹a + b = b + a›
by (simp add: TESL.plus_tag_const.simps)
next
text‹Zero is neutral for addition.›
fix a::‹'τ::field tag_const›
obtain u where ‹a = τ⇩c⇩s⇩t u› using tag_const.exhaust by blast
thus ‹0 + a = a›
by (simp add: TESL.plus_tag_const.simps zero_tag_const_def)
next
text‹The sum of an element and its opposite is zero.›
fix a::‹'τ::field tag_const›
obtain u where ‹a = τ⇩c⇩s⇩t u› using tag_const.exhaust by blast
thus ‹-a + a = 0›
by (simp add: TESL.plus_tag_const.simps
TESL.uminus_tag_const.simps
zero_tag_const_def)
next
text‹Subtraction is adding the opposite.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
obtain u v where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› using tag_const.exhaust by metis
thus ‹a - b = a + -b›
by (simp add: TESL.minus_tag_const.simps
TESL.plus_tag_const.simps
TESL.uminus_tag_const.simps)
next
text‹Distributive property of multiplication over addition.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
and c::‹'τ::field tag_const›
obtain u v w where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› and ‹c = τ⇩c⇩s⇩t w›
using tag_const.exhaust by metis
thus ‹(a + b) * c = a * c + b * c›
by (simp add: TESL.plus_tag_const.simps
TESL.times_tag_const.simps
ring_class.ring_distribs(2))
next
text‹The neutral elements are distinct.›
show ‹(0::('τ::field tag_const)) ≠ 1›
by (simp add: one_tag_const_def zero_tag_const_def)
next
text‹The product of an element and its inverse is 1.›
fix a::‹'τ::field tag_const› assume h:‹a ≠ 0›
obtain u where ‹a = τ⇩c⇩s⇩t u› using tag_const.exhaust by blast
moreover with h have ‹u ≠ 0› by (simp add: zero_tag_const_def)
ultimately show ‹inverse a * a = 1›
by (simp add: TESL.inverse_tag_const.simps
TESL.times_tag_const.simps
one_tag_const_def)
next
text‹Dividing is multiplying by the inverse.›
fix a::‹'τ::field tag_const› and b::‹'τ::field tag_const›
obtain u v where ‹a = τ⇩c⇩s⇩t u› and ‹b = τ⇩c⇩s⇩t v› using tag_const.exhaust by metis
thus ‹a div b = a * inverse b›
by (simp add: TESL.divide_tag_const.simps
TESL.inverse_tag_const.simps
TESL.times_tag_const.simps
divide_inverse)
next
text‹Zero is its own inverse.›
show ‹inverse (0::('τ::field tag_const)) = 0›
by (simp add: TESL.inverse_tag_const.simps zero_tag_const_def)
qed
end
text‹
For comparing dates (which are represented by tags) on clocks, we need an order on tags.
›
instantiation tag_const :: (order)order
begin
inductive less_eq_tag_const :: ‹'a tag_const ⇒ 'a tag_const ⇒ bool›
where
Int_less_eq[simp]: ‹n ≤ m ⟹ (TConst n) ≤ (TConst m)›
definition less_tag: ‹(x::'a tag_const) < y ⟷ (x ≤ y) ∧ (x ≠ y)›
instance proof
show ‹⋀x y :: 'a tag_const. (x < y) = (x ≤ y ∧ ¬ y ≤ x)›
using less_eq_tag_const.simps less_tag by auto
next
fix x::‹'a tag_const›
from tag_const.exhaust obtain x⇩0::'a where ‹x = TConst x⇩0› by blast
with Int_less_eq show ‹x ≤ x› by simp
next
show ‹⋀x y z :: 'a tag_const. x ≤ y ⟹ y ≤ z ⟹ x ≤ z›
using less_eq_tag_const.simps by auto
next
show ‹⋀x y :: 'a tag_const. x ≤ y ⟹ y ≤ x ⟹ x = y›
using less_eq_tag_const.simps by auto
qed
end
text‹
For ensuring that time does never flow backwards, we need a total order on tags.
›
instantiation tag_const :: (linorder)linorder
begin
instance proof
fix x::‹'a tag_const› and y::‹'a tag_const›
from tag_const.exhaust obtain x⇩0::'a where ‹x = TConst x⇩0› by blast
moreover from tag_const.exhaust obtain y⇩0::'a where ‹y = TConst y⇩0› by blast
ultimately show ‹x ≤ y ∨ y ≤ x› using less_eq_tag_const.simps by fastforce
qed
end
end
Theory Run
section ‹ Defining Runs ›
theory Run
imports TESL
begin
text ‹
Runs are sequences of instants, and each instant maps a clock to a pair
@{term ‹(h, t)›} where @{term ‹h›} indicates whether the clock ticks or not,
and @{term ‹t›} is the current time on this clock.
The first element of the pair is called the ∗‹hamlet› of the clock (to tick or
not to tick), the second element is called the ∗‹time›.
›
abbreviation hamlet where ‹hamlet ≡ fst›
abbreviation time where ‹time ≡ snd›
type_synonym 'τ instant = ‹clock ⇒ (bool × 'τ tag_const)›
text‹
Runs have the additional constraint that time cannot go backwards on any clock
in the sequence of instants.
Therefore, for any clock, the time projection of a run is monotonous.
›
typedef (overloaded) 'τ::linordered_field run =
‹{ ρ::nat ⇒ 'τ instant. ∀c. mono (λn. time (ρ n c)) }›
proof
show ‹(λ_ _. (True, τ⇩c⇩s⇩t 0)) ∈ {ρ. ∀c. mono (λn. time (ρ n c))}›
unfolding mono_def by blast
qed
lemma Abs_run_inverse_rewrite:
‹∀c. mono (λn. time (ρ n c)) ⟹ Rep_run (Abs_run ρ) = ρ›
by (simp add: Abs_run_inverse)
text ‹
A ∗‹dense› run is a run in which something happens (at least one clock ticks)
at every instant.
›
definition ‹dense_run ρ ≡ (∀n. ∃c. hamlet ((Rep_run ρ) n c))›
text‹
@{term ‹run_tick_count ρ K n›} counts the number of ticks on clock @{term ‹K›}
in the interval ▩‹[0, n]› of run @{term ‹ρ›}.
›
fun run_tick_count :: ‹('τ::linordered_field) run ⇒ clock ⇒ nat ⇒ nat›
(‹#⇩≤ _ _ _›)
where
‹(#⇩≤ ρ K 0) = (if hamlet ((Rep_run ρ) 0 K)
then 1
else 0)›
| ‹(#⇩≤ ρ K (Suc n)) = (if hamlet ((Rep_run ρ) (Suc n) K)
then 1 + (#⇩≤ ρ K n)
else (#⇩≤ ρ K n))›
text‹
@{term ‹run_tick_count_strictly ρ K n›} counts the number of ticks on
clock @{term ‹K›} in the interval ▩‹[0, n[› of run @{term ‹ρ›}.
›
fun run_tick_count_strictly :: ‹('τ::linordered_field) run ⇒ clock ⇒ nat ⇒ nat›
(‹#⇩< _ _ _›)
where
‹(#⇩< ρ K 0) = 0›
| ‹(#⇩< ρ K (Suc n)) = #⇩≤ ρ K n›
text‹
@{term ‹first_time ρ K n τ›} tells whether instant @{term ‹n›} in run @{term‹ρ›}
is the first one where the time on clock @{term ‹K›} reaches @{term ‹τ›}.
›
definition first_time :: ‹'a::linordered_field run ⇒ clock ⇒ nat ⇒ 'a tag_const
⇒ bool›
where
‹first_time ρ K n τ ≡ (time ((Rep_run ρ) n K) = τ)
∧ (∄n'. n' < n ∧ time ((Rep_run ρ) n' K) = τ)›
text‹
The time on a clock is necessarily less than @{term ‹τ›} before the first instant
at which it reaches @{term ‹τ›}.
›
lemma before_first_time:
assumes ‹first_time ρ K n τ›
and ‹m < n›
shows ‹time ((Rep_run ρ) m K) < τ›
proof -
have ‹mono (λn. time (Rep_run ρ n K))› using Rep_run by blast
moreover from assms(2) have ‹m ≤ n› using less_imp_le by simp
moreover have ‹mono (λn. time (Rep_run ρ n K))› using Rep_run by blast
ultimately have ‹time ((Rep_run ρ) m K) ≤ time ((Rep_run ρ) n K)›
by (simp add:mono_def)
moreover from assms(1) have ‹time ((Rep_run ρ) n K) = τ›
using first_time_def by blast
moreover from assms have ‹time ((Rep_run ρ) m K) ≠ τ›
using first_time_def by blast
ultimately show ?thesis by simp
qed
text‹
This leads to an alternate definition of @{term ‹first_time›}:
›
lemma alt_first_time_def:
assumes ‹∀m < n. time ((Rep_run ρ) m K) < τ›
and ‹time ((Rep_run ρ) n K) = τ›
shows ‹first_time ρ K n τ›
proof -
from assms(1) have ‹∀m < n. time ((Rep_run ρ) m K) ≠ τ›
by (simp add: less_le)
with assms(2) show ?thesis by (simp add: first_time_def)
qed
end
Theory Denotational
chapter ‹Denotational Semantics›
theory Denotational
imports
TESL
Run
begin
text‹
The denotational semantics maps TESL formulae to sets of satisfying runs.
Firstly, we define the semantics of atomic formulae (basic constructs of the
TESL language), then we define the semantics of compound formulae as the
intersection of the semantics of their components: a run must satisfy all
the individual formulae of a compound formula.
›
section ‹Denotational interpretation for atomic TESL formulae›
consts dummyT0 ::‹'τ tag_const›
consts dummyDeltaT ::‹'τ tag_const›
notation dummyT0 (‹t⇩0›)
notation dummyDeltaT (‹δt›)
fun TESL_interpretation_atomic
:: ‹('τ::linordered_field) TESL_atomic ⇒ 'τ run set› (‹⟦ _ ⟧⇩T⇩E⇩S⇩L›)
where
‹⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L =
{ρ. ∃n::nat. hamlet ((Rep_run ρ) n K⇩1) ∧ time ((Rep_run ρ) n K⇩2) = τ}›
| ‹⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. R (time ((Rep_run ρ) n K⇩1), time ((Rep_run ρ) n K⇩2))}›
| ‹⟦ master implies slave ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. hamlet ((Rep_run ρ) n master) ⟶ hamlet ((Rep_run ρ) n slave)}›
| ‹⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. hamlet ((Rep_run ρ) n master) ⟶ ¬hamlet ((Rep_run ρ) n slave)}›
| ‹⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n. hamlet ((Rep_run ρ) n master) ⟶
(let measured_time = time ((Rep_run ρ) n measuring) in
∀m ≥ n. first_time ρ measuring m (measured_time + δτ)
⟶ hamlet ((Rep_run ρ) m slave)
)
}›
| ‹⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count ρ K⇩1 n)}›
| ‹⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count_strictly ρ K⇩1 n)}›
| ‹⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L =
{ρ. ∀n::nat. hamlet ((Rep_run ρ) n K⇩1)
⟶ (∀m≥n. ¬ hamlet ((Rep_run ρ) m K⇩2))}›
section ‹Denotational interpretation for TESL formulae›
text‹
To satisfy a formula, a run has to satisfy the conjunction of its atomic
formulae. Therefore, the interpretation of a formula is the intersection
of the interpretations of its components.
›
fun TESL_interpretation :: ‹('τ::linordered_field) TESL_formula ⇒ 'τ run set›
(‹⟦⟦ _ ⟧⟧⇩T⇩E⇩S⇩L›)
where
‹⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L = {_. True}›
| ‹⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦ φ ⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
lemma TESL_interpretation_homo:
‹⟦ φ ⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L›
by simp
subsection ‹Image interpretation lemma›
theorem TESL_interpretation_image:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L) ` set Φ)›
by (induction Φ, simp+)
subsection ‹Expansion law›
text ‹Similar to the expansion laws of lattices.›
theorem TESL_interp_homo_append:
‹⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩1 ⟧⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L›
by (induction Φ⇩1, simp, auto)
section ‹Equational laws for the denotation of TESL formulae›
lemma TESL_interp_assoc:
‹⟦⟦ (Φ⇩1 @ Φ⇩2) @ Φ⇩3 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩1 @ (Φ⇩2 @ Φ⇩3) ⟧⟧⇩T⇩E⇩S⇩L›
by auto
lemma TESL_interp_commute:
shows ‹⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩2 @ Φ⇩1 ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: TESL_interp_homo_append inf_sup_aci(1))
lemma TESL_interp_left_commute:
‹⟦⟦ Φ⇩1 @ (Φ⇩2 @ Φ⇩3) ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩2 @ (Φ⇩1 @ Φ⇩3) ⟧⟧⇩T⇩E⇩S⇩L›
unfolding TESL_interp_homo_append by auto
lemma TESL_interp_idem:
‹⟦⟦ Φ @ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_homo_append by auto
lemma TESL_interp_left_idem:
‹⟦⟦ Φ⇩1 @ (Φ⇩1 @ Φ⇩2) ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_homo_append by auto
lemma TESL_interp_right_idem:
‹⟦⟦ (Φ⇩1 @ Φ⇩2) @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L›
unfolding TESL_interp_homo_append by auto
lemmas TESL_interp_aci = TESL_interp_commute
TESL_interp_assoc
TESL_interp_left_commute
TESL_interp_left_idem
text ‹The empty formula is the identity element.›
lemma TESL_interp_neutral1:
‹⟦⟦ [] @ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
by simp
lemma TESL_interp_neutral2:
‹⟦⟦ Φ @ [] ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
by simp
section ‹Decreasing interpretation of TESL formulae›
text‹
Adding constraints to a TESL formula reduces the number of satisfying runs.
›
lemma TESL_sem_decreases_head:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L›
by simp
lemma TESL_sem_decreases_tail:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ Φ @ [φ] ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: TESL_interp_homo_append)
text ‹
Repeating a formula in a specification does not change the specification.
›
lemma TESL_interp_formula_stuttering:
assumes ‹φ ∈ set Φ›
shows ‹⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
proof -
have ‹φ # Φ = [φ] @ Φ› by simp
hence ‹⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ [φ] ⟧⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_homo_append by simp
thus ?thesis using assms TESL_interpretation_image by fastforce
qed
text ‹
Removing duplicate formulae in a specification does not change the specification.
›
lemma TESL_interp_remdups_absorb:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ remdups Φ ⟧⟧⇩T⇩E⇩S⇩L›
proof (induction Φ)
case Cons
thus ?case using TESL_interp_formula_stuttering by auto
qed simp
text ‹
Specifications that contain the same formulae have the same semantics.
›
lemma TESL_interp_set_lifting:
assumes ‹set Φ = set Φ'›
shows ‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ' ⟧⟧⇩T⇩E⇩S⇩L›
proof -
have ‹set (remdups Φ) = set (remdups Φ')›
by (simp add: assms)
moreover have fxpntΦ: ‹⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L) ` set Φ) = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: TESL_interpretation_image)
moreover have fxpntΦ': ‹⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L) ` set Φ') = ⟦⟦ Φ' ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: TESL_interpretation_image)
moreover have ‹⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L) ` set Φ) = ⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L) ` set Φ')›
by (simp add: assms)
ultimately show ?thesis using TESL_interp_remdups_absorb by auto
qed
text ‹
The semantics of specifications is contravariant with respect to their inclusion.
›
theorem TESL_interp_decreases_setinc:
assumes ‹set Φ ⊆ set Φ'›
shows ‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ Φ' ⟧⟧⇩T⇩E⇩S⇩L›
proof -
obtain Φ⇩r where decompose: ‹set (Φ @ Φ⇩r) = set Φ'› using assms by auto
hence ‹set (Φ @ Φ⇩r) = set Φ'› using assms by blast
moreover have ‹(set Φ) ∪ (set Φ⇩r) = set Φ'›
using assms decompose by auto
moreover have ‹⟦⟦ Φ' ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ @ Φ⇩r ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_set_lifting decompose by blast
moreover have ‹⟦⟦ Φ @ Φ⇩r ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ⇩r ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: TESL_interp_homo_append)
moreover have ‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ Φ⇩r ⟧⟧⇩T⇩E⇩S⇩L› by simp
ultimately show ?thesis by simp
qed
lemma TESL_interp_decreases_add_head:
assumes ‹set Φ ⊆ set Φ'›
shows ‹⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ φ # Φ' ⟧⟧⇩T⇩E⇩S⇩L›
using assms TESL_interp_decreases_setinc by auto
lemma TESL_interp_decreases_add_tail:
assumes ‹set Φ ⊆ set Φ'›
shows ‹⟦⟦ Φ @ [φ] ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦⟦ Φ' @ [φ] ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_decreases_setinc[OF assms]
by (simp add: TESL_interpretation_image dual_order.trans)
lemma TESL_interp_absorb1:
assumes ‹set Φ⇩1 ⊆ set Φ⇩2›
shows ‹⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L›
by (simp add: Int_absorb1 TESL_interp_decreases_setinc
TESL_interp_homo_append assms)
lemma TESL_interp_absorb2:
assumes ‹set Φ⇩2 ⊆ set Φ⇩1›
shows ‹⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ⇩1 ⟧⟧⇩T⇩E⇩S⇩L›
using TESL_interp_absorb1 TESL_interp_commute assms by blast
section ‹Some special cases›
lemma NoSporadic_stable [simp]:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ⊆ ⟦⟦ NoSporadic Φ ⟧⟧⇩T⇩E⇩S⇩L›
proof -
from filter_is_subset have ‹set (NoSporadic Φ) ⊆ set Φ› .
from TESL_interp_decreases_setinc[OF this] show ?thesis .
qed
lemma NoSporadic_idem [simp]:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L ∩ ⟦⟦ NoSporadic Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L›
using NoSporadic_stable by blast
lemma NoSporadic_setinc:
‹set (NoSporadic Φ) ⊆ set Φ›
by (rule filter_is_subset)
no_notation dummyT0 (‹t⇩0›)
no_notation dummyDeltaT (‹δt›)
end
Theory SymbolicPrimitive
chapter ‹Symbolic Primitives for Building Runs›
theory SymbolicPrimitive
imports Run
begin
text‹
We define here the primitive constraints on runs, towards which we translate
TESL specifications in the operational semantics.
These constraints refer to a specific symbolic run and can therefore access
properties of the run at particular instants (for instance, the fact that a clock
ticks at instant @{term ‹n›} of the run, or the time on a given clock at
that instant).
In the previous chapters, we had no reference to particular instants of a run
because the TESL language should be invariant by stuttering in order to allow
the composition of specifications: adding an instant where no clock ticks to
a run that satisfies a formula should yield another run that satisfies the
same formula. However, when constructing runs that satisfy a formula, we
need to be able to refer to the time or hamlet of a clock at a given instant.
›
text‹
Counter expressions are used to get the number of ticks of a clock up to
(strictly or not) a given instant index.
›
datatype cnt_expr =
TickCountLess ‹clock› ‹instant_index› (‹#⇧<›)
| TickCountLeq ‹clock› ‹instant_index› (‹#⇧≤›)
subsection‹ Symbolic Primitives for Runs ›
text‹
Tag values are used to refer to the time on a clock at a given instant index.
›
datatype tag_val =
TSchematic ‹clock * instant_index› (‹τ⇩v⇩a⇩r›)
datatype 'τ constr =
Timestamp ‹clock› ‹instant_index› ‹'τ tag_const› (‹_ ⇓ _ @ _›)
| TimeDelay ‹clock› ‹instant_index› ‹'τ tag_const› ‹clock› (‹_ @ _ ⊕ _ ⇒ _›)
| Ticks ‹clock› ‹instant_index› (‹_ ⇑ _›)
| NotTicks ‹clock› ‹instant_index› (‹_ ¬⇑ _›)
| NotTicksUntil ‹clock› ‹instant_index› (‹_ ¬⇑ < _›)
| NotTicksFrom ‹clock› ‹instant_index› (‹_ ¬⇑ ≥ _›)
| TagArith ‹tag_val› ‹tag_val› ‹('τ tag_const × 'τ tag_const) ⇒ bool› (‹⌊_, _⌋ ∈ _›)
| TickCntArith ‹cnt_expr› ‹cnt_expr› ‹(nat × nat) ⇒ bool› (‹⌈_, _⌉ ∈ _›)
| TickCntLeq ‹cnt_expr› ‹cnt_expr› (‹_ ≼ _›)
type_synonym 'τ system = ‹'τ constr list›
text ‹
The abstract machine has configurations composed of:
▪ the past @{term‹Γ›}, which captures choices that have already be made as a
list of symbolic primitive constraints on the run;
▪ the current index @{term ‹n›}, which is the index of the present instant;
▪ the present @{term‹Ψ›}, which captures the formulae that must be satisfied
in the current instant;
▪ the future @{term‹Φ›}, which captures the constraints on the future of the run.
›
type_synonym 'τ config =
‹'τ system * instant_index * 'τ TESL_formula * 'τ TESL_formula›
section ‹Semantics of Primitive Constraints ›
text‹
The semantics of the primitive constraints is defined in a way similar to
the semantics of TESL formulae.
›
fun counter_expr_eval :: ‹('τ::linordered_field) run ⇒ cnt_expr ⇒ nat›
(‹⟦ _ ⊢ _ ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r›)
where
‹⟦ ρ ⊢ #⇧< clk indx ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r = run_tick_count_strictly ρ clk indx›
| ‹⟦ ρ ⊢ #⇧≤ clk indx ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r = run_tick_count ρ clk indx›
fun symbolic_run_interpretation_primitive
::‹('τ::linordered_field) constr ⇒ 'τ run set› (‹⟦ _ ⟧⇩p⇩r⇩i⇩m›)
where
‹⟦ K ⇑ n ⟧⇩p⇩r⇩i⇩m = {ρ. hamlet ((Rep_run ρ) n K) }›
| ‹⟦ K @ n⇩0 ⊕ δt ⇒ K' ⟧⇩p⇩r⇩i⇩m =
{ρ. ∀n ≥ n⇩0. first_time ρ K n (time ((Rep_run ρ) n⇩0 K) + δt)
⟶ hamlet ((Rep_run ρ) n K')}›
| ‹⟦ K ¬⇑ n ⟧⇩p⇩r⇩i⇩m = {ρ. ¬hamlet ((Rep_run ρ) n K) }›
| ‹⟦ K ¬⇑ < n ⟧⇩p⇩r⇩i⇩m = {ρ. ∀i < n. ¬ hamlet ((Rep_run ρ) i K)}›
| ‹⟦ K ¬⇑ ≥ n ⟧⇩p⇩r⇩i⇩m = {ρ. ∀i ≥ n. ¬ hamlet ((Rep_run ρ) i K) }›
| ‹⟦ K ⇓ n @ τ ⟧⇩p⇩r⇩i⇩m = {ρ. time ((Rep_run ρ) n K) = τ }›
| ‹⟦ ⌊τ⇩v⇩a⇩r(K⇩1, n⇩1), τ⇩v⇩a⇩r(K⇩2, n⇩2)⌋ ∈ R ⟧⇩p⇩r⇩i⇩m =
{ ρ. R (time ((Rep_run ρ) n⇩1 K⇩1), time ((Rep_run ρ) n⇩2 K⇩2)) }›
| ‹⟦ ⌈e⇩1, e⇩2⌉ ∈ R ⟧⇩p⇩r⇩i⇩m = { ρ. R (⟦ ρ ⊢ e⇩1 ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r, ⟦ ρ ⊢ e⇩2 ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r) }›
| ‹⟦ cnt_e⇩1 ≼ cnt_e⇩2 ⟧⇩p⇩r⇩i⇩m = { ρ. ⟦ ρ ⊢ cnt_e⇩1 ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r ≤ ⟦ ρ ⊢ cnt_e⇩2 ⟧⇩c⇩n⇩t⇩e⇩x⇩p⇩r }›
text‹
The composition of primitive constraints is their conjunction, and we get the
set of satisfying runs by intersection.
›
fun symbolic_run_interpretation
::‹('τ::linordered_field) constr list ⇒ ('τ::linordered_field) run set›
(‹⟦⟦ _ ⟧⟧⇩p⇩r⇩i⇩m›)
where
‹⟦⟦ [] ⟧⟧⇩p⇩r⇩i⇩m = {ρ. True }›
| ‹⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦ γ ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
lemma symbolic_run_interp_cons_morph:
‹⟦ γ ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m›
by auto
definition consistent_context :: ‹('τ::linordered_field) constr list ⇒ bool›
where
‹consistent_context Γ ≡ ( ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ≠ {}) ›
subsection ‹Defining a method for witness construction›
text‹
In order to build a run, we can start from an initial run in which no clock
ticks and the time is always 0 on any clock.
›
abbreviation initial_run :: ‹('τ::linordered_field) run› (‹ρ⇩⊙›) where
‹ρ⇩⊙ ≡ Abs_run ((λ_ _. (False, τ⇩c⇩s⇩t 0)) ::nat ⇒ clock ⇒ (bool × 'τ tag_const))›
text‹
To help avoiding that time flows backward, setting the time on a clock at a given
instant sets it for the future instants too.
›
fun time_update
:: ‹nat ⇒ clock ⇒ ('τ::linordered_field) tag_const ⇒ (nat ⇒ 'τ instant)
⇒ (nat ⇒ 'τ instant)›
where
‹time_update n K τ ρ = (λn' K'. if K = K' ∧ n ≤ n'
then (hamlet (ρ n K), τ)
else ρ n' K')›
section ‹Rules and properties of consistence›
lemma context_consistency_preservationI:
‹consistent_context ((γ::('τ::linordered_field) constr)#Γ) ⟹ consistent_context Γ›
unfolding consistent_context_def by auto
inductive context_independency
::‹('τ::linordered_field) constr ⇒ 'τ constr list ⇒ bool› (‹_ ⨝ _›)
where
NotTicks_independency:
‹(K ⇑ n) ∉ set Γ ⟹ (K ¬⇑ n) ⨝ Γ›
| Ticks_independency:
‹(K ¬⇑ n) ∉ set Γ ⟹ (K ⇑ n) ⨝ Γ›
| Timestamp_independency:
‹(∄τ'. τ' = τ ∧ (K ⇓ n @ τ) ∈ set Γ) ⟹ (K ⇓ n @ τ) ⨝ Γ›
section‹Major Theorems›
subsection ‹Interpretation of a context›
text‹
The interpretation of a context is the intersection of the interpretation
of its components.
›
theorem symrun_interp_fixpoint:
‹⋂ ((λγ. ⟦ γ ⟧⇩p⇩r⇩i⇩m) ` set Γ) = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by (induction Γ, simp+)
subsection ‹Expansion law›
text ‹Similar to the expansion laws of lattices›
theorem symrun_interp_expansion:
‹⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩1 ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m›
by (induction Γ⇩1, simp, auto)
section ‹Equations for the interpretation of symbolic primitives›
subsection ‹General laws›
lemma symrun_interp_assoc:
‹⟦⟦ (Γ⇩1 @ Γ⇩2) @ Γ⇩3 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩1 @ (Γ⇩2 @ Γ⇩3) ⟧⟧⇩p⇩r⇩i⇩m›
by auto
lemma symrun_interp_commute:
‹⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩2 @ Γ⇩1 ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: symrun_interp_expansion inf_sup_aci(1))
lemma symrun_interp_left_commute:
‹⟦⟦ Γ⇩1 @ (Γ⇩2 @ Γ⇩3) ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩2 @ (Γ⇩1 @ Γ⇩3) ⟧⟧⇩p⇩r⇩i⇩m›
unfolding symrun_interp_expansion by auto
lemma symrun_interp_idem:
‹⟦⟦ Γ @ Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_expansion by auto
lemma symrun_interp_left_idem:
‹⟦⟦ Γ⇩1 @ (Γ⇩1 @ Γ⇩2) ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_expansion by auto
lemma symrun_interp_right_idem:
‹⟦⟦ (Γ⇩1 @ Γ⇩2) @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m›
unfolding symrun_interp_expansion by auto
lemmas symrun_interp_aci = symrun_interp_commute
symrun_interp_assoc
symrun_interp_left_commute
symrun_interp_left_idem
lemma symrun_interp_neutral1:
‹⟦⟦ [] @ Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by simp
lemma symrun_interp_neutral2:
‹⟦⟦ Γ @ [] ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by simp
subsection ‹Decreasing interpretation of symbolic primitives›
text‹
Adding constraints to a context reduces the number of satisfying runs.
›
lemma TESL_sem_decreases_head:
‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m›
by simp
lemma TESL_sem_decreases_tail:
‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ Γ @ [γ] ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: symrun_interp_expansion)
text‹
Adding a constraint that is already in the context does not change the
interpretation of the context.
›
lemma symrun_interp_formula_stuttering:
assumes ‹γ ∈ set Γ›
shows ‹⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
proof -
have ‹γ # Γ = [γ] @ Γ› by simp
hence ‹⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ [γ] ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_expansion by simp
thus ?thesis using assms symrun_interp_fixpoint by fastforce
qed
text‹
Removing duplicate constraints from a context does not change the
interpretation of the context.
›
lemma symrun_interp_remdups_absorb:
‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ remdups Γ ⟧⟧⇩p⇩r⇩i⇩m›
proof (induction Γ)
case Cons
thus ?case using symrun_interp_formula_stuttering by auto
qed simp
text‹
Two identical sets of constraints have the same interpretation,
the order in the context does not matter.
›
lemma symrun_interp_set_lifting:
assumes ‹set Γ = set Γ'›
shows ‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ' ⟧⟧⇩p⇩r⇩i⇩m›
proof -
have ‹set (remdups Γ) = set (remdups Γ')›
by (simp add: assms)
moreover have fxpntΓ: ‹⋂ ((λγ. ⟦ γ ⟧⇩p⇩r⇩i⇩m) ` set Γ) = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: symrun_interp_fixpoint)
moreover have fxpntΓ': ‹⋂ ((λγ. ⟦ γ ⟧⇩p⇩r⇩i⇩m) ` set Γ') = ⟦⟦ Γ' ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: symrun_interp_fixpoint)
moreover have ‹⋂ ((λγ. ⟦ γ ⟧⇩p⇩r⇩i⇩m) ` set Γ) = ⋂ ((λγ. ⟦ γ ⟧⇩p⇩r⇩i⇩m) ` set Γ')›
by (simp add: assms)
ultimately show ?thesis using symrun_interp_remdups_absorb by auto
qed
text‹
The interpretation of contexts is contravariant with regard to set inclusion.
›
theorem symrun_interp_decreases_setinc:
assumes ‹set Γ ⊆ set Γ'›
shows ‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ Γ' ⟧⟧⇩p⇩r⇩i⇩m›
proof -
obtain Γ⇩r where decompose: ‹set (Γ @ Γ⇩r) = set Γ'› using assms by auto
hence ‹set (Γ @ Γ⇩r) = set Γ'› using assms by blast
moreover have ‹(set Γ) ∪ (set Γ⇩r) = set Γ'› using assms decompose by auto
moreover have ‹⟦⟦ Γ' ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ @ Γ⇩r ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_set_lifting decompose by blast
moreover have ‹⟦⟦ Γ @ Γ⇩r ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ⇩r ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: symrun_interp_expansion)
moreover have ‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ⇩r ⟧⟧⇩p⇩r⇩i⇩m› by simp
ultimately show ?thesis by simp
qed
lemma symrun_interp_decreases_add_head:
assumes ‹set Γ ⊆ set Γ'›
shows ‹⟦⟦ γ # Γ ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ γ # Γ' ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_decreases_setinc assms by auto
lemma symrun_interp_decreases_add_tail:
assumes ‹set Γ ⊆ set Γ'›
shows ‹⟦⟦ Γ @ [γ] ⟧⟧⇩p⇩r⇩i⇩m ⊇ ⟦⟦ Γ' @ [γ] ⟧⟧⇩p⇩r⇩i⇩m›
proof -
from symrun_interp_decreases_setinc[OF assms] have ‹⟦⟦ Γ' ⟧⟧⇩p⇩r⇩i⇩m ⊆ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m› .
thus ?thesis by (simp add: symrun_interp_expansion dual_order.trans)
qed
lemma symrun_interp_absorb1:
assumes ‹set Γ⇩1 ⊆ set Γ⇩2›
shows ‹⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m›
by (simp add: Int_absorb1 symrun_interp_decreases_setinc
symrun_interp_expansion assms)
lemma symrun_interp_absorb2:
assumes ‹set Γ⇩2 ⊆ set Γ⇩1›
shows ‹⟦⟦ Γ⇩1 @ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m = ⟦⟦ Γ⇩1 ⟧⟧⇩p⇩r⇩i⇩m›
using symrun_interp_absorb1 symrun_interp_commute assms by blast
end
Theory Operational
chapter ‹Operational Semantics›
text‹\label{chap:operational_semantics}›
theory Operational
imports
SymbolicPrimitive
begin
text‹
The operational semantics defines rules to build symbolic runs from a TESL
specification (a set of TESL formulae).
Symbolic runs are described using the symbolic primitives presented in the
previous chapter.
Therefore, the operational semantics compiles a set of constraints on runs,
as defined by the denotational semantics, into a set of symbolic constraints
on the instants of the runs. Concrete runs can then be obtained by solving the
constraints at each instant.
›
section‹Operational steps›
text ‹
We introduce a notation to describe configurations:
▪ @{term ‹Γ›} is the context, the set of symbolic constraints on past instants of the run;
▪ @{term ‹n›} is the index of the current instant, the present;
▪ @{term ‹Ψ›} is the TESL formula that must be satisfied at the current instant (present);
▪ @{term ‹Φ›} is the TESL formula that must be satisfied for the following instants (the future).
›
abbreviation uncurry_conf
::‹('τ::linordered_field) system ⇒ instant_index ⇒ 'τ TESL_formula ⇒ 'τ TESL_formula
⇒ 'τ config› (‹_, _ ⊢ _ ▹ _› 80)
where
‹Γ, n ⊢ Ψ ▹ Φ ≡ (Γ, n, Ψ, Φ)›
text ‹
The only introduction rule allows us to progress to the next instant
when there are no more constraints to satisfy for the present instant.
›
inductive operational_semantics_intro
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇩i _› 70)
where
instant_i:
‹(Γ, n ⊢ [] ▹ Φ) ↪⇩i (Γ, Suc n ⊢ Φ ▹ [])›
text ‹
The elimination rules describe how TESL formulae for the present are transformed
into constraints on the past and on the future.
›
inductive operational_semantics_elim
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇩e _› 70)
where
sporadic_on_e1:
‹(Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪⇩e (Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ))›
| sporadic_on_e2:
‹(Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ)›
| tagrel_e:
‹(Γ, n ⊢ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ) ▹ Φ)
↪⇩e (((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ))›
| implies_e1:
‹(Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
| implies_e2:
‹(Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
| implies_not_e1:
‹(Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
| implies_not_e2:
‹(Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
| timedelayed_e1:
‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
| timedelayed_e2:
‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
| weakly_precedes_e:
‹(Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ)
↪⇩e (((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ))›
| strictly_precedes_e:
‹(Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ)
↪⇩e (((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ))›
| kills_e1:
‹(Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ))›
| kills_e2:
‹(Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ)
↪⇩e (((K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ))›
text ‹
A step of the operational semantics is either the application of the introduction
rule or the application of an elimination rule.
›
inductive operational_semantics_step
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪ _› 70)
where
intro_part:
‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪⇩i (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)
⟹ (Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪ (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)›
| elims_part:
‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪⇩e (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)
⟹ (Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪ (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)›
text ‹
We introduce notations for the reflexive transitive closure of the operational
semantic step, its transitive closure and its reflexive closure.
›
abbreviation operational_semantics_step_rtranclp
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇧*⇧* _› 70)
where
‹𝒞⇩1 ↪⇧*⇧* 𝒞⇩2 ≡ operational_semantics_step⇧*⇧* 𝒞⇩1 𝒞⇩2›
abbreviation operational_semantics_step_tranclp
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇧+⇧+ _› 70)
where
‹𝒞⇩1 ↪⇧+⇧+ 𝒞⇩2 ≡ operational_semantics_step⇧+⇧+ 𝒞⇩1 𝒞⇩2›
abbreviation operational_semantics_step_reflclp
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇧=⇧= _› 70)
where
‹𝒞⇩1 ↪⇧=⇧= 𝒞⇩2 ≡ operational_semantics_step⇧=⇧= 𝒞⇩1 𝒞⇩2›
abbreviation operational_semantics_step_relpowp
::‹('τ::linordered_field) config ⇒ nat ⇒ 'τ config ⇒ bool› (‹_ ↪⇗_⇖ _› 70)
where
‹𝒞⇩1 ↪⇗n⇖ 𝒞⇩2 ≡ (operational_semantics_step ^^ n) 𝒞⇩1 𝒞⇩2›
definition operational_semantics_elim_inv
::‹('τ::linordered_field) config ⇒ 'τ config ⇒ bool› (‹_ ↪⇩e⇧← _› 70)
where
‹𝒞⇩1 ↪⇩e⇧← 𝒞⇩2 ≡ 𝒞⇩2 ↪⇩e 𝒞⇩1›
section‹Basic Lemmas›
text ‹
If a configuration can be reached in @{term ‹m›} steps from a configuration that
can be reached in @{term ‹n›} steps from an original configuration, then it can be
reached in @{term ‹n+m›} steps from the original configuration.
›
lemma operational_semantics_trans_generalized:
assumes ‹𝒞⇩1 ↪⇗n⇖ 𝒞⇩2›
assumes ‹𝒞⇩2 ↪⇗m⇖ 𝒞⇩3›
shows ‹𝒞⇩1 ↪⇗n + m⇖ 𝒞⇩3›
using relcompp.relcompI[of ‹operational_semantics_step ^^ n› _ _
‹operational_semantics_step ^^ m›, OF assms]
by (simp add: relpowp_add)
text ‹
We consider the set of configurations that can be reached in one operational
step from a given configuration.
›
abbreviation Cnext_solve
::‹('τ::linordered_field) config ⇒ 'τ config set› (‹𝒞⇩n⇩e⇩x⇩t _›)
where
‹𝒞⇩n⇩e⇩x⇩t 𝒮 ≡ { 𝒮'. 𝒮 ↪ 𝒮' }›
text ‹
Advancing to the next instant is possible when there are no more constraints
on the current instant.
›
lemma Cnext_solve_instant:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ [] ▹ Φ)) ⊇ { Γ, Suc n ⊢ Φ ▹ [] }›
by (simp add: operational_semantics_step.simps operational_semantics_intro.instant_i)
text ‹
The following lemmas state that the configurations produced by the elimination
rules of the operational semantics belong to the configurations that can be
reached in one step.
›
lemma Cnext_solve_sporadicon:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ))
⊇ { Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ),
((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ }›
by (simp add: operational_semantics_step.simps
operational_semantics_elim.sporadic_on_e1
operational_semantics_elim.sporadic_on_e2)
lemma Cnext_solve_tagrel:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ) ▹ Φ))
⊇ { ((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ),n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ) }›
by (simp add: operational_semantics_step.simps operational_semantics_elim.tagrel_e)
lemma Cnext_solve_implies:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ))
⊇ { ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ),
((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) }›
by (simp add: operational_semantics_step.simps operational_semantics_elim.implies_e1
operational_semantics_elim.implies_e2)
lemma Cnext_solve_implies_not:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ))
⊇ { ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ),
((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) }›
by (simp add: operational_semantics_step.simps
operational_semantics_elim.implies_not_e1
operational_semantics_elim.implies_not_e2)
lemma Cnext_solve_timedelayed:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ))
⊇ { ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ),
((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) }›
by (simp add: operational_semantics_step.simps
operational_semantics_elim.timedelayed_e1
operational_semantics_elim.timedelayed_e2)
lemma Cnext_solve_weakly_precedes:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ))
⊇ { ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) }›
by (simp add: operational_semantics_step.simps
operational_semantics_elim.weakly_precedes_e)
lemma Cnext_solve_strictly_precedes:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ))
⊇ { ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) }›
by (simp add: operational_semantics_step.simps
operational_semantics_elim.strictly_precedes_e)
lemma Cnext_solve_kills:
‹(𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ))
⊇ { ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ),
((K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ) }›
by (simp add: operational_semantics_step.simps operational_semantics_elim.kills_e1
operational_semantics_elim.kills_e2)
text ‹
An empty specification can be reduced to an empty specification for
an arbitrary number of steps.
›
lemma empty_spec_reductions:
‹([], 0 ⊢ [] ▹ []) ↪⇗k⇖ ([], k ⊢ [] ▹ [])›
proof (induct k)
case 0 thus ?case by simp
next
case Suc thus ?case
using instant_i operational_semantics_step.simps by fastforce
qed
end
Theory Corecursive_Prop
text‹\chapter[Semantics Equivalence]{Equivalence of the Operational and Denotational Semantics}›
theory Corecursive_Prop
imports
SymbolicPrimitive
Operational
Denotational
begin
section ‹Stepwise denotational interpretation of TESL atoms›
text ‹
In order to prove the equivalence of the denotational and operational semantics,
we need to be able to ignore the past (for which the constraints are encoded
in the context) and consider only the satisfaction of the constraints from
a given instant index.
For this purpose, we define an interpretation of TESL formulae for a suffix of a run.
That interpretation is closely related to the denotational semantics as
defined in the preceding chapters.
›
fun TESL_interpretation_atomic_stepwise
:: ‹('τ::linordered_field) TESL_atomic ⇒ nat ⇒ 'τ run set› (‹⟦ _ ⟧⇩T⇩E⇩S⇩L⇗≥ _⇖›)
where
‹⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∃n≥i. hamlet ((Rep_run ρ) n K⇩1) ∧ time ((Rep_run ρ) n K⇩2) = τ}›
| ‹⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. R (time ((Rep_run ρ) n K⇩1), time ((Rep_run ρ) n K⇩2))}›
| ‹⟦ master implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. hamlet ((Rep_run ρ) n master) ⟶ hamlet ((Rep_run ρ) n slave)}›
| ‹⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. hamlet ((Rep_run ρ) n master) ⟶ ¬ hamlet ((Rep_run ρ) n slave)}›
| ‹⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. hamlet ((Rep_run ρ) n master) ⟶
(let measured_time = time ((Rep_run ρ) n measuring) in
∀m ≥ n. first_time ρ measuring m (measured_time + δτ)
⟶ hamlet ((Rep_run ρ) m slave)
)
}›
| ‹⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count ρ K⇩1 n)}›
| ‹⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count_strictly ρ K⇩1 n)}›
| ‹⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ i⇖ =
{ρ. ∀n≥i. hamlet ((Rep_run ρ) n K⇩1) ⟶ (∀m≥n. ¬ hamlet ((Rep_run ρ) m K⇩2))}›
text ‹
The denotational interpretation of TESL formulae can be unfolded into the
stepwise interpretation.
›
lemma TESL_interp_unfold_stepwise_sporadicon:
‹⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L = ⋃ {Y. ∃n::nat. Y = ⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_tagrelgen:
‹⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat. Y = ⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_implies:
‹⟦ master implies slave ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat. Y = ⟦ master implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_implies_not:
‹⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat. Y = ⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_timedelayed:
‹⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat.
Y = ⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_weakly_precedes:
‹⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat. Y = ⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_strictly_precedes:
‹⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L
= ⋂ {Y. ∃n::nat. Y = ⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
lemma TESL_interp_unfold_stepwise_kills:
‹⟦ master kills slave ⟧⇩T⇩E⇩S⇩L = ⋂ {Y. ∃n::nat. Y = ⟦ master kills slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
by auto
text ‹
Positive atomic formulae (the ones that create ticks from nothing) are unfolded
as the union of the stepwise interpretations.
›
theorem TESL_interp_unfold_stepwise_positive_atoms:
assumes ‹positive_atom φ›
shows ‹⟦ φ::'τ::linordered_field TESL_atomic ⟧⇩T⇩E⇩S⇩L
= ⋃ {Y. ∃n::nat. Y = ⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
proof -
from positive_atom.elims(2)[OF assms]
obtain u v w where ‹φ = (u sporadic v on w)› by blast
with TESL_interp_unfold_stepwise_sporadicon show ?thesis by simp
qed
text ‹
Negative atomic formulae are unfolded
as the intersection of the stepwise interpretations.
›
theorem TESL_interp_unfold_stepwise_negative_atoms:
assumes ‹¬ positive_atom φ›
shows ‹⟦ φ ⟧⇩T⇩E⇩S⇩L = ⋂ {Y. ∃n::nat. Y = ⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖}›
proof (cases φ)
case SporadicOn thus ?thesis using assms by simp
next
case TagRelation
thus ?thesis using TESL_interp_unfold_stepwise_tagrelgen by simp
next
case Implies
thus ?thesis using TESL_interp_unfold_stepwise_implies by simp
next
case ImpliesNot
thus ?thesis using TESL_interp_unfold_stepwise_implies_not by simp
next
case TimeDelayedBy
thus ?thesis using TESL_interp_unfold_stepwise_timedelayed by simp
next
case WeaklyPrecedes
thus ?thesis
using TESL_interp_unfold_stepwise_weakly_precedes by simp
next
case StrictlyPrecedes
thus ?thesis
using TESL_interp_unfold_stepwise_strictly_precedes by simp
next
case Kills
thus ?thesis
using TESL_interp_unfold_stepwise_kills by simp
qed
text ‹
Some useful lemmas for reasoning on properties of sequences.
›
lemma forall_nat_expansion:
‹(∀n ≥ (n⇩0::nat). P n) = (P n⇩0 ∧ (∀n ≥ Suc n⇩0. P n))›
proof -
have ‹(∀n ≥ (n⇩0::nat). P n) = (∀n. (n = n⇩0 ∨ n > n⇩0) ⟶ P n)›
using le_less by blast
also have ‹... = (P n⇩0 ∧ (∀n > n⇩0. P n))› by blast
finally show ?thesis using Suc_le_eq by simp
qed
lemma exists_nat_expansion:
‹(∃n ≥ (n⇩0::nat). P n) = (P n⇩0 ∨ (∃n ≥ Suc n⇩0. P n))›
proof -
have ‹(∃n ≥ (n⇩0::nat). P n) = (∃n. (n = n⇩0 ∨ n > n⇩0) ∧ P n)›
using le_less by blast
also have ‹... = (∃n. (P n⇩0) ∨ (n > n⇩0 ∧ P n))› by blast
finally show ?thesis using Suc_le_eq by simp
qed
lemma forall_nat_set_suc:‹{x. ∀m ≥ n. P x m} = {x. P x n} ∩ {x. ∀m ≥ Suc n. P x m}›
proof
{ fix x assume h:‹x ∈ {x. ∀m ≥ n. P x m}›
hence ‹P x n› by simp
moreover from h have ‹x ∈ {x. ∀m ≥ Suc n. P x m}› by simp
ultimately have ‹x ∈ {x. P x n} ∩ {x. ∀m ≥ Suc n. P x m}› by simp
} thus ‹{x. ∀m ≥ n. P x m} ⊆ {x. P x n} ∩ {x. ∀m ≥ Suc n. P x m}› ..
next
{ fix x assume h:‹x ∈ {x. P x n} ∩ {x. ∀m ≥ Suc n. P x m}›
hence ‹P x n› by simp
moreover from h have ‹∀m ≥ Suc n. P x m› by simp
ultimately have ‹∀m ≥ n. P x m› using forall_nat_expansion by blast
hence ‹x ∈ {x. ∀m ≥ n. P x m}› by simp
} thus ‹{x. P x n} ∩ {x. ∀m ≥ Suc n. P x m} ⊆ {x. ∀m ≥ n. P x m}› ..
qed
lemma exists_nat_set_suc:‹{x. ∃m ≥ n. P x m} = {x. P x n} ∪ {x. ∃m ≥ Suc n. P x m}›
proof
{ fix x assume h:‹x ∈ {x. ∃m ≥ n. P x m}›
hence ‹x ∈ {x. ∃m. (m = n ∨ m ≥ Suc n) ∧ P x m}›
using Suc_le_eq antisym_conv2 by fastforce
hence ‹x ∈ {x. P x n} ∪ {x. ∃m ≥ Suc n. P x m}› by blast
} thus ‹{x. ∃m ≥ n. P x m} ⊆ {x. P x n} ∪ {x. ∃m ≥ Suc n. P x m}› ..
next
{ fix x assume h:‹x ∈ {x. P x n} ∪ {x. ∃m ≥ Suc n. P x m}›
hence ‹x ∈ {x. ∃m ≥ n. P x m}› using Suc_leD by blast
} thus ‹{x. P x n} ∪ {x. ∃m ≥ Suc n. P x m} ⊆ {x. ∃m ≥ n. P x m}› ..
qed
section ‹Coinduction Unfolding Properties›
text ‹
The following lemmas show how to shorten a suffix, i.e. to unfold one instant
in the construction of a run. They correspond to the rules of the operational
semantics.
›
lemma TESL_interp_stepwise_sporadicon_coind_unfold:
‹⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ⇓ n @ τ ⟧⇩p⇩r⇩i⇩m
∪ ⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
unfolding TESL_interpretation_atomic_stepwise.simps(1)
symbolic_run_interpretation_primitive.simps(1,6)
using exists_nat_set_suc[of ‹n› ‹λρ n. hamlet (Rep_run ρ n K⇩1)
∧ time (Rep_run ρ n K⇩2) = τ›]
by (simp add: Collect_conj_eq)
lemma TESL_interp_stepwise_tagrel_coind_unfold:
‹⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
⟦ ⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R ⟧⇩p⇩r⇩i⇩m
∩ ⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
have ‹{ρ. ∀m≥n. R (time ((Rep_run ρ) m K⇩1), time ((Rep_run ρ) m K⇩2))}
= {ρ. R (time ((Rep_run ρ) n K⇩1), time ((Rep_run ρ) n K⇩2))}
∩ {ρ. ∀m≥Suc n. R (time ((Rep_run ρ) m K⇩1), time ((Rep_run ρ) m K⇩2))}›
using forall_nat_set_suc[of ‹n› ‹λx y. R (time ((Rep_run x) y K⇩1),
time ((Rep_run x) y K⇩2))›] by simp
thus ?thesis by auto
qed
lemma TESL_interp_stepwise_implies_coind_unfold:
‹⟦ master implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
( ⟦ master ¬⇑ n ⟧⇩p⇩r⇩i⇩m
∪ ⟦ master ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ slave ⇑ n ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ master implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
have ‹{ρ. ∀m≥n. hamlet ((Rep_run ρ) m master) ⟶ hamlet ((Rep_run ρ) m slave)}
= {ρ. hamlet ((Rep_run ρ) n master) ⟶ hamlet ((Rep_run ρ) n slave)}
∩ {ρ. ∀m≥Suc n. hamlet ((Rep_run ρ) m master)
⟶ hamlet ((Rep_run ρ) m slave)}›
using forall_nat_set_suc[of ‹n› ‹λx y. hamlet ((Rep_run x) y master)
⟶ hamlet ((Rep_run x) y slave)›] by simp
thus ?thesis by auto
qed
lemma TESL_interp_stepwise_implies_not_coind_unfold:
‹⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
( ⟦ master ¬⇑ n ⟧⇩p⇩r⇩i⇩m
∪ ⟦ master ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ slave ¬⇑ n ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ master implies not slave ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
have ‹{ρ. ∀m≥n. hamlet ((Rep_run ρ) m master) ⟶ ¬ hamlet ((Rep_run ρ) m slave)}
= {ρ. hamlet ((Rep_run ρ) n master) ⟶ ¬ hamlet ((Rep_run ρ) n slave)}
∩ {ρ. ∀m≥Suc n. hamlet ((Rep_run ρ) m master)
⟶ ¬ hamlet ((Rep_run ρ) m slave)}›
using forall_nat_set_suc[of ‹n› ‹λx y. hamlet ((Rep_run x) y master)
⟶ ¬hamlet ((Rep_run x) y slave)›] by simp
thus ?thesis by auto
qed
lemma TESL_interp_stepwise_timedelayed_coind_unfold:
‹⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
( ⟦ master ¬⇑ n ⟧⇩p⇩r⇩i⇩m
∪ (⟦ master ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ measuring @ n ⊕ δτ ⇒ slave ⟧⇩p⇩r⇩i⇩m))
∩ ⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
let ?prop = ‹λρ m. hamlet ((Rep_run ρ) m master) ⟶
(let measured_time = time ((Rep_run ρ) m measuring) in
∀p ≥ m. first_time ρ measuring p (measured_time + δτ)
⟶ hamlet ((Rep_run ρ) p slave))›
have ‹{ρ. ∀m ≥ n. ?prop ρ m} = {ρ. ?prop ρ n} ∩ {ρ. ∀m ≥ Suc n. ?prop ρ m}›
using forall_nat_set_suc[of ‹n› ?prop] by blast
also have ‹... = {ρ. ?prop ρ n}
∩ ⟦ master time-delayed by δτ on measuring implies slave ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
finally show ?thesis by auto
qed
lemma TESL_interp_stepwise_weakly_precedes_coind_unfold:
‹⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
⟦ (⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) ⟧⇩p⇩r⇩i⇩m
∩ ⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
have ‹{ρ. ∀p≥n. (run_tick_count ρ K⇩2 p) ≤ (run_tick_count ρ K⇩1 p)}
= {ρ. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count ρ K⇩1 n)}
∩ {ρ. ∀p≥Suc n. (run_tick_count ρ K⇩2 p) ≤ (run_tick_count ρ K⇩1 p)}›
using forall_nat_set_suc[of ‹n› ‹λρ n. (run_tick_count ρ K⇩2 n)
≤ (run_tick_count ρ K⇩1 n)›]
by simp
thus ?thesis by auto
qed
lemma TESL_interp_stepwise_strictly_precedes_coind_unfold:
‹⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
⟦ (⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) ⟧⇩p⇩r⇩i⇩m
∩ ⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
have ‹{ρ. ∀p≥n. (run_tick_count ρ K⇩2 p) ≤ (run_tick_count_strictly ρ K⇩1 p)}
= {ρ. (run_tick_count ρ K⇩2 n) ≤ (run_tick_count_strictly ρ K⇩1 n)}
∩ {ρ. ∀p≥Suc n. (run_tick_count ρ K⇩2 p) ≤ (run_tick_count_strictly ρ K⇩1 p)}›
using forall_nat_set_suc[of ‹n› ‹λρ n. (run_tick_count ρ K⇩2 n)
≤ (run_tick_count_strictly ρ K⇩1 n)›]
by simp
thus ?thesis by auto
qed
lemma TESL_interp_stepwise_kills_coind_unfold:
‹⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ =
( ⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m
∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ¬⇑ ≥ n ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
proof -
let ?kills = ‹λn ρ. ∀p≥n. hamlet ((Rep_run ρ) p K⇩1)
⟶ (∀m≥p. ¬ hamlet ((Rep_run ρ) m K⇩2))›
let ?ticks = ‹λn ρ c. hamlet ((Rep_run ρ) n c)›
let ?dead = ‹λn ρ c. ∀m ≥ n. ¬hamlet ((Rep_run ρ) m c)›
have ‹⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = {ρ. ?kills n ρ}› by simp
also have ‹... = ({ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ})
∪ ({ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2})›
proof
{ fix ρ::‹'τ::linordered_field run›
assume ‹ρ ∈ {ρ. ?kills n ρ}›
hence ‹?kills n ρ› by simp
hence ‹(?ticks n ρ K⇩1 ∧ ?dead n ρ K⇩2) ∨ (¬?ticks n ρ K⇩1 ∧ ?kills (Suc n) ρ)›
using Suc_leD by blast
hence ‹ρ ∈ ({ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2})
∪ ({ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ})›
by blast
} thus ‹{ρ. ?kills n ρ}
⊆ {ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ}
∪ {ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2}› by blast
next
{ fix ρ::‹'τ::linordered_field run›
assume ‹ρ ∈ ({ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ})
∪ ({ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2})›
hence ‹¬ ?ticks n ρ K⇩1 ∧ ?kills (Suc n) ρ
∨ ?ticks n ρ K⇩1 ∧ ?dead n ρ K⇩2› by blast
moreover have ‹((¬ ?ticks n ρ K⇩1) ∧ (?kills (Suc n) ρ)) ⟶ ?kills n ρ›
using dual_order.antisym not_less_eq_eq by blast
ultimately have ‹?kills n ρ ∨ ?ticks n ρ K⇩1 ∧ ?dead n ρ K⇩2› by blast
hence ‹?kills n ρ› using le_trans by blast
} thus ‹({ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ})
∪ ({ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2})
⊆ {ρ. ?kills n ρ}› by blast
qed
also have ‹... = {ρ. ¬ ?ticks n ρ K⇩1} ∩ {ρ. ?kills (Suc n) ρ}
∪ {ρ. ?ticks n ρ K⇩1} ∩ {ρ. ?dead n ρ K⇩2} ∩ {ρ. ?kills (Suc n) ρ}›
using Collect_cong Collect_disj_eq by auto
also have ‹... = ⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖
∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ¬⇑ ≥ n ⟧⇩p⇩r⇩i⇩m
∩ ⟦ K⇩1 kills K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
finally show ?thesis by blast
qed
text ‹
The stepwise interpretation of a TESL formula is the intersection of the
interpretation of its atomic components.
›
fun TESL_interpretation_stepwise
::‹'τ::linordered_field TESL_formula ⇒ nat ⇒ 'τ run set›
(‹⟦⟦ _ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ _⇖›)
where
‹⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = {ρ. True}›
| ‹⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = ⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
lemma TESL_interpretation_stepwise_fixpoint:
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = ⋂ ((λφ. ⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖) ` set Φ)›
by (induction Φ, simp, auto)
text ‹
The global interpretation of a TESL formula is its interpretation starting
at the first instant.
›
lemma TESL_interpretation_stepwise_zero:
‹⟦ φ ⟧⇩T⇩E⇩S⇩L = ⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ 0⇖›
by (induction φ, simp+)
lemma TESL_interpretation_stepwise_zero':
‹⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ 0⇖›
by (induction Φ, simp, simp add: TESL_interpretation_stepwise_zero)
lemma TESL_interpretation_stepwise_cons_morph:
‹⟦ φ ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = ⟦⟦ φ # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
by auto
theorem TESL_interp_stepwise_composition:
shows ‹⟦⟦ Φ⇩1 @ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = ⟦⟦ Φ⇩1 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
by (induction Φ⇩1, simp, auto)
section ‹Interpretation of configurations›
text ‹
The interpretation of a configuration of the operational semantics abstract
machine is the intersection of:
▪ the interpretation of its context (the past),
▪ the interpretation of its present from the current instant,
▪ the interpretation of its future from the next instant.
›
fun HeronConf_interpretation
::‹'τ::linordered_field config ⇒ 'τ run set› (‹⟦ _ ⟧⇩c⇩o⇩n⇩f⇩i⇩g› 71)
where
‹⟦ Γ, n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
lemma HeronConf_interp_composition:
‹⟦ Γ⇩1, n ⊢ Ψ⇩1 ▹ Φ⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ∩ ⟦ Γ⇩2, n ⊢ Ψ⇩2 ▹ Φ⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ (Γ⇩1 @ Γ⇩2), n ⊢ (Ψ⇩1 @ Ψ⇩2) ▹ (Φ⇩1 @ Φ⇩2) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using TESL_interp_stepwise_composition symrun_interp_expansion
by (simp add: TESL_interp_stepwise_composition
symrun_interp_expansion inf_assoc inf_left_commute)
text ‹
When there are no remaining constraints on the present, the interpretation of
a configuration is the same as the configuration at the next instant of its future.
This corresponds to the introduction rule of the operational semantics.
›
lemma HeronConf_interp_stepwise_instant_cases:
‹⟦ Γ, n ⊢ [] ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g = ⟦ Γ, Suc n ⊢ Φ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ [] ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g = ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ Γ, Suc n ⊢ Φ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
ultimately show ?thesis by blast
qed
text ‹
The following lemmas use the unfolding properties of the stepwise denotational
semantics to give rewriting rules for the interpretation of configurations that
match the elimination rules of the operational semantics.
›
lemma HeronConf_interp_stepwise_sporadicon_cases:
‹⟦ Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 sporadic τ on K⇩2) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 sporadic τ on K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 sporadic τ on K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ) ⟧⟧⇩p⇩r⇩i⇩m
∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
ultimately show ?thesis
proof -
have ‹(⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ⇓ n @ τ ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)
∩ (⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖)
= ⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m)›
using TESL_interp_stepwise_sporadicon_coind_unfold by blast
hence ‹⟦⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ) ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∪ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦ K⇩1 sporadic τ on K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖
= ⟦⟦ (K⇩1 sporadic τ on K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m› by auto
thus ?thesis by auto
qed
qed
lemma HeronConf_interp_stepwise_tagrel_cases:
‹⟦ Γ, n ⊢ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
ultimately show ?thesis
proof -
have ‹⟦ ⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R ⟧⇩p⇩r⇩i⇩m
∩ ⟦ time-relation ⌊K⇩1, K⇩2⌋ ∈ R ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖
∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ = ⟦⟦ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
using TESL_interp_stepwise_tagrel_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
thus ?thesis by auto
qed
qed
lemma HeronConf_interp_stepwise_implies_cases:
‹⟦ Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 implies K⇩2) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 implies K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 implies K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ) ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 implies K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
ultimately show ?thesis
proof -
have f1: ‹(⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ⇑ n ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ K⇩1 implies K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)
= ⟦⟦ (K⇩1 implies K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
using TESL_interp_stepwise_implies_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
have ‹⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩2 ⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ⇑ n ⟧⇩p⇩r⇩i⇩m) ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by force
hence ‹⟦ Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩2 ⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m)
∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ (K⇩1 implies K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)›
using f1 by (simp add: inf_left_commute inf_assoc)
thus ?thesis by (simp add: Int_Un_distrib2 inf_assoc)
qed
qed
lemma HeronConf_interp_stepwise_implies_not_cases:
‹⟦ Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 implies not K⇩2) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 implies not K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 implies not K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ) ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 implies not K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
ultimately show ?thesis
proof -
have f1: ‹(⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ¬⇑ n ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ K⇩1 implies not K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖
∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)
= ⟦⟦ (K⇩1 implies not K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
using TESL_interp_stepwise_implies_not_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
have ‹⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩2 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 ¬⇑ n ⟧⇩p⇩r⇩i⇩m) ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m›
by force
then have ‹⟦ Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m
∩ ⟦⟦ (K⇩2 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m) ∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 implies not K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)›
using f1 by (simp add: inf_left_commute inf_assoc)
thus ?thesis by (simp add: Int_Un_distrib2 inf_assoc)
qed
qed
lemma HeronConf_interp_stepwise_timedelayed_cases:
‹⟦ Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have 1:‹⟦ Γ, n ⊢ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ ((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
ultimately show ?thesis
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ (⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖)›
using 1 by blast
hence ‹⟦ Γ, n ⊢ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 @ n ⊕ δτ ⇒ K⇩3 ⟧⇩p⇩r⇩i⇩m)
∩ (⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ (⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖))›
using TESL_interpretation_stepwise_cons_morph
TESL_interp_stepwise_timedelayed_coind_unfold
proof -
have ‹⟦⟦ (K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
= (⟦ K⇩1 ¬⇑ n ⟧⇩p⇩r⇩i⇩m ∪ ⟦ K⇩1 ⇑ n ⟧⇩p⇩r⇩i⇩m ∩ ⟦ K⇩2 @ n ⊕ δτ ⇒ K⇩3 ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ K⇩1 time-delayed by δτ on K⇩2 implies K⇩3 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
using TESL_interp_stepwise_timedelayed_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
then show ?thesis
by (simp add: Int_assoc Int_left_commute)
qed
then show ?thesis by (simp add: inf_assoc inf_sup_distrib2)
qed
qed
lemma HeronConf_interp_stepwise_weakly_precedes_cases:
‹⟦ Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 weakly precedes K⇩2) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 weakly precedes K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ ⟧⟧⇩p⇩r⇩i⇩m
∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ (K⇩1 weakly precedes K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
ultimately show ?thesis
proof -
have ‹⟦ ⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x,y). x≤y) ⟧⇩p⇩r⇩i⇩m
∩ ⟦ K⇩1 weakly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
= ⟦⟦ (K⇩1 weakly precedes K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
using TESL_interp_stepwise_weakly_precedes_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
thus ?thesis by auto
qed
qed
lemma HeronConf_interp_stepwise_strictly_precedes_cases:
‹⟦ Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ (K⇩1 strictly precedes K⇩2) # Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 strictly precedes K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y)) # Γ ⟧⟧⇩p⇩r⇩i⇩m
∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 strictly precedes K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
ultimately show ?thesis
proof -
have ‹⟦ ⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x,y). x≤y) ⟧⇩p⇩r⇩i⇩m
∩ ⟦ K⇩1 strictly precedes K⇩2 ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
= ⟦⟦ (K⇩1 strictly precedes K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
using TESL_interp_stepwise_strictly_precedes_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
thus ?thesis by auto
qed
qed
lemma HeronConf_interp_stepwise_kills_cases:
‹⟦ Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦ Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ (K⇩1 kills K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖ ∩ ⟦⟦ Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖›
by simp
moreover have ‹⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ¬⇑ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 kills K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
moreover have ‹⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦⟦ (K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
∩ ⟦⟦ (K⇩1 kills K⇩2) # Φ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖› by simp
ultimately show ?thesis
proof -
have ‹⟦⟦ (K⇩1 kills K⇩2) # Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖
= (⟦ (K⇩1 ¬⇑ n) ⟧⇩p⇩r⇩i⇩m ∪ ⟦ (K⇩1 ⇑ n) ⟧⇩p⇩r⇩i⇩m ∩ ⟦ (K⇩2 ¬⇑ ≥ n) ⟧⇩p⇩r⇩i⇩m)
∩ ⟦ (K⇩1 kills K⇩2) ⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇖ ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇖›
using TESL_interp_stepwise_kills_coind_unfold
TESL_interpretation_stepwise_cons_morph by blast
thus ?thesis by auto
qed
qed
end
Theory Hygge_Theory
chapter‹Main Theorems›
theory Hygge_Theory
imports
Corecursive_Prop
begin
text ‹
Using the properties we have shown about the interpretation of configurations
and the stepwise unfolding of the denotational semantics, we can now prove
several important results about the construction of runs from a specification.
›
section ‹Initial configuration›
text ‹
The denotational semantics of a specification @{term ‹Ψ›} is the interpretation
at the first instant of a configuration which has @{term ‹Ψ›} as its present.
This means that we can start to build a run that satisfies a specification by
starting from this configuration.
›
theorem solve_start:
shows ‹⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L = ⟦ [], 0 ⊢ Ψ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L = ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ 0⇖›
by (simp add: TESL_interpretation_stepwise_zero')
moreover have ‹⟦ [], 0 ⊢ Ψ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g =
⟦⟦ [] ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L⇗≥ 0⇖ ∩ ⟦⟦ [] ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc 0⇖›
by simp
ultimately show ?thesis by auto
qed
section ‹Soundness›
text ‹
The interpretation of a configuration @{term ‹𝒮⇩2›} that is a refinement of a
configuration @{term ‹𝒮⇩1›} is contained in the interpretation of @{term ‹𝒮⇩1›}.
This means that by making successive choices in building the instants of a run,
we preserve the soundness of the constructed run with regard to the original
specification.
›
lemma sound_reduction:
assumes ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪ (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)›
shows ‹⟦⟦ Γ⇩1 ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ⇩1 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇩1⇖ ∩ ⟦⟦ Φ⇩1 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇩1⇖
⊇ ⟦⟦ Γ⇩2 ⟧⟧⇩p⇩r⇩i⇩m ∩ ⟦⟦ Ψ⇩2 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ n⇩2⇖ ∩ ⟦⟦ Φ⇩2 ⟧⟧⇩T⇩E⇩S⇩L⇗≥ Suc n⇩2⇖› (is ?P)
proof -
from assms consider
(a) ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪⇩i (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)›
| (b) ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) ↪⇩e (Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)›
using operational_semantics_step.simps by blast
thus ?thesis
proof (cases)
case a
thus ?thesis by (simp add: operational_semantics_intro.simps)
next
case b thus ?thesis
proof (rule operational_semantics_elim.cases)
fix Γ n K⇩1 τ K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ (K⇩1 sporadic τ on K⇩2) # Ψ ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_sporadicon_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 τ K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ (K⇩1 sporadic τ on K⇩2) # Ψ ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ)›
thus ?P using HeronConf_interp_stepwise_sporadicon_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 R Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((⌊τ⇩v⇩a⇩r (K⇩1, n), τ⇩v⇩a⇩r (K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ))›
thus ?P using HeronConf_interp_stepwise_tagrel_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ (K⇩1 implies K⇩2) # Ψ ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_implies_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_implies_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_implies_not_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_implies_not_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 δτ K⇩2 K⇩3 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) =
(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) =
(((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
thus ?P using HeronConf_interp_stepwise_timedelayed_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 δτ K⇩2 K⇩3 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) =
(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2)
= (((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
thus ?P using HeronConf_interp_stepwise_timedelayed_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_weakly_precedes_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_strictly_precedes_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) = (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_kills_cases
HeronConf_interpretation.simps by blast
next
fix Γ n K⇩1 K⇩2 Ψ Φ
assume ‹(Γ⇩1, n⇩1 ⊢ Ψ⇩1 ▹ Φ⇩1) = (Γ, n ⊢ ((K⇩1 kills K⇩2) # Ψ) ▹ Φ)›
and ‹(Γ⇩2, n⇩2 ⊢ Ψ⇩2 ▹ Φ⇩2) =
(((K⇩1 ⇑ n) # (K⇩2 ¬⇑ ≥ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 kills K⇩2) # Φ))›
thus ?P using HeronConf_interp_stepwise_kills_cases
HeronConf_interpretation.simps by blast
qed
qed
qed
inductive_cases step_elim:‹𝒮⇩1 ↪ 𝒮⇩2›
lemma sound_reduction':
assumes ‹𝒮⇩1 ↪ 𝒮⇩2›
shows ‹⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊇ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
have ‹∀s⇩1 s⇩2. (⟦ s⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊆ ⟦ s⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g) ∨ ¬(s⇩1 ↪ s⇩2)›
using sound_reduction by fastforce
thus ?thesis using assms by blast
qed
lemma sound_reduction_generalized:
assumes ‹𝒮⇩1 ↪⇗k⇖ 𝒮⇩2›
shows ‹⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊇ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
from assms show ?thesis
proof (induction k arbitrary: 𝒮⇩2)
case 0
hence *: ‹𝒮⇩1 ↪⇗0⇖ 𝒮⇩2 ⟹ 𝒮⇩1 = 𝒮⇩2› by auto
moreover have ‹𝒮⇩1 = 𝒮⇩2› using * "0.prems" by linarith
ultimately show ?case by auto
next
case (Suc k)
thus ?case
proof -
fix k :: nat
assume ff: ‹𝒮⇩1 ↪⇗Suc k⇖ 𝒮⇩2›
assume hi: ‹⋀𝒮⇩2. 𝒮⇩1 ↪⇗k⇖ 𝒮⇩2 ⟹ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊆ ⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
obtain 𝒮⇩n where red_decomp: ‹(𝒮⇩1 ↪⇗k⇖ 𝒮⇩n) ∧ (𝒮⇩n ↪ 𝒮⇩2)› using ff by auto
hence ‹⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊇ ⟦ 𝒮⇩n ⟧⇩c⇩o⇩n⇩f⇩i⇩g› using hi by simp
also have ‹⟦ 𝒮⇩n ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊇ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by (simp add: red_decomp sound_reduction')
ultimately show ‹⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊇ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by simp
qed
qed
qed
text ‹
From the initial configuration, a configuration @{term ‹𝒮›} obtained after any
number @{term ‹k›} of reduction steps denotes runs from the
initial specification @{term ‹Ψ›}.
›
theorem soundness:
assumes ‹([], 0 ⊢ Ψ ▹ []) ↪⇗k⇖ 𝒮›
shows ‹⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L ⊇ ⟦ 𝒮 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using assms sound_reduction_generalized solve_start by blast
section ‹Completeness›
text ‹
We will now show that any run that satisfies a specification can be derived
from the initial configuration, at any number of steps.
We start by proving that any run that is denoted by a configuration @{term ‹𝒮›}
is necessarily denoted by at least one of the configurations that can be reached
from @{term ‹𝒮›}.
›
lemma complete_direct_successors:
shows ‹⟦ Γ, n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊆ (⋃X∈𝒞⇩n⇩e⇩x⇩t (Γ, n ⊢ Ψ ▹ Φ). ⟦ X ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
proof (induct Ψ)
case Nil
show ?case
using HeronConf_interp_stepwise_instant_cases operational_semantics_step.simps
operational_semantics_intro.instant_i
by fastforce
next
case (Cons ψ Ψ) thus ?case
proof (cases ψ)
case (SporadicOn K1 τ K2) thus ?thesis
using HeronConf_interp_stepwise_sporadicon_cases
[of ‹Γ› ‹n› ‹K1› ‹τ› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_sporadicon[of ‹Γ› ‹n› ‹Ψ› ‹K1› ‹τ› ‹K2› ‹Φ›] by blast
next
case (TagRelation K⇩1 K⇩2 R) thus ?thesis
using HeronConf_interp_stepwise_tagrel_cases
[of ‹Γ› ‹n› ‹K⇩1› ‹K⇩2› ‹R› ‹Ψ› ‹Φ›]
Cnext_solve_tagrel[of ‹K⇩1› ‹n› ‹K⇩2› ‹R› ‹Γ› ‹Ψ› ‹Φ›] by blast
next
case (Implies K1 K2) thus ?thesis
using HeronConf_interp_stepwise_implies_cases
[of ‹Γ› ‹n› ‹K1› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_implies[of ‹K1› ‹n› ‹Γ› ‹Ψ› ‹K2› ‹Φ›] by blast
next
case (ImpliesNot K1 K2) thus ?thesis
using HeronConf_interp_stepwise_implies_not_cases
[of ‹Γ› ‹n› ‹K1› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_implies_not[of ‹K1› ‹n› ‹Γ› ‹Ψ› ‹K2› ‹Φ›] by blast
next
case (TimeDelayedBy Kmast τ Kmeas Kslave) thus ?thesis
using HeronConf_interp_stepwise_timedelayed_cases
[of ‹Γ› ‹n› ‹Kmast› ‹τ› ‹Kmeas› ‹Kslave› ‹Ψ› ‹Φ›]
Cnext_solve_timedelayed
[of ‹Kmast› ‹n› ‹Γ› ‹Ψ› ‹τ› ‹Kmeas› ‹Kslave› ‹Φ›] by blast
next
case (WeaklyPrecedes K1 K2) thus ?thesis
using HeronConf_interp_stepwise_weakly_precedes_cases
[of ‹Γ› ‹n› ‹K1› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_weakly_precedes[of ‹K2› ‹n› ‹K1› ‹Γ› ‹Ψ› ‹Φ›]
by blast
next
case (StrictlyPrecedes K1 K2) thus ?thesis
using HeronConf_interp_stepwise_strictly_precedes_cases
[of ‹Γ› ‹n› ‹K1› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_strictly_precedes[of ‹K2› ‹n› ‹K1› ‹Γ› ‹Ψ› ‹Φ›]
by blast
next
case (Kills K1 K2) thus ?thesis
using HeronConf_interp_stepwise_kills_cases[of ‹Γ› ‹n› ‹K1› ‹K2› ‹Ψ› ‹Φ›]
Cnext_solve_kills[of ‹K1› ‹n› ‹Γ› ‹Ψ› ‹K2› ‹Φ›] by blast
qed
qed
lemma complete_direct_successors':
shows ‹⟦ 𝒮 ⟧⇩c⇩o⇩n⇩f⇩i⇩g ⊆ (⋃X∈𝒞⇩n⇩e⇩x⇩t 𝒮. ⟦ X ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
proof -
from HeronConf_interpretation.cases obtain Γ n Ψ Φ
where ‹𝒮 = (Γ, n ⊢ Ψ ▹ Φ)› by blast
with complete_direct_successors[of ‹Γ› ‹n› ‹Ψ› ‹Φ›] show ?thesis by simp
qed
text ‹
Therefore, if a run belongs to a configuration, it necessarily belongs to a
configuration derived from it.
›
lemma branch_existence:
assumes ‹ρ ∈ ⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
shows ‹∃𝒮⇩2. (𝒮⇩1 ↪ 𝒮⇩2) ∧ (ρ ∈ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
proof -
from assms complete_direct_successors' have ‹ρ ∈ (⋃X∈𝒞⇩n⇩e⇩x⇩t 𝒮⇩1. ⟦ X ⟧⇩c⇩o⇩n⇩f⇩i⇩g)› by blast
hence ‹∃s∈𝒞⇩n⇩e⇩x⇩t 𝒮⇩1. ρ ∈ ⟦ s ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by simp
thus ?thesis by blast
qed
lemma branch_existence':
assumes ‹ρ ∈ ⟦ 𝒮⇩1 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
shows ‹∃𝒮⇩2. (𝒮⇩1 ↪⇗k⇖ 𝒮⇩2) ∧ (ρ ∈ ⟦ 𝒮⇩2 ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
proof (induct k)
case 0
thus ?case by (simp add: assms)
next
case (Suc k)
thus ?case
using branch_existence relpowp_Suc_I[of ‹k› ‹operational_semantics_step›]
by blast
qed
text‹
Any run that belongs to the original specification @{term ‹Ψ›} has a corresponding
configuration @{term ‹𝒮›} at any number @{term ‹k›} of reduction steps
from the initial configuration. Therefore, any run that satisfies a specification
can be derived from the initial configuration at any level of reduction.
›
theorem completeness:
assumes ‹ρ ∈ ⟦⟦ Ψ ⟧⟧⇩T⇩E⇩S⇩L›
shows ‹∃𝒮. (([], 0 ⊢ Ψ ▹ []) ↪⇗k⇖ 𝒮)
∧ ρ ∈ ⟦ 𝒮 ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using assms branch_existence' solve_start by blast
section ‹Progress›
text ‹
Reduction steps do not guarantee that the construction of a run progresses in the
sequence of instants. We need to show that it is always possible to reach the next
instant, and therefore any future instant, through a number of steps.
›
lemma instant_index_increase:
assumes ‹ρ ∈ ⟦ Γ, n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
shows ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ Ψ ▹ Φ) ↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof (insert assms, induct Ψ arbitrary: Γ Φ)
case (Nil Γ Φ)
then show ?case
proof -
have ‹(Γ, n ⊢ [] ▹ Φ) ↪⇗1⇖ (Γ, Suc n ⊢ Φ ▹ [])›
using instant_i intro_part by fastforce
moreover have ‹⟦ Γ, n ⊢ [] ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g = ⟦ Γ, Suc n ⊢ Φ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
by auto
moreover have ‹ρ ∈ ⟦ Γ, Suc n ⊢ Φ ▹ [] ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using assms Nil.prems calculation(2) by blast
ultimately show ?thesis by blast
qed
next
case (Cons ψ Ψ)
then show ?case
proof (induct ψ)
case (SporadicOn K⇩1 τ K⇩2)
have branches: ‹⟦ Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_sporadicon_cases by simp
have br1: ‹ρ ∈ ⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k.
((Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h1: ‹ρ ∈ ⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
hence ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ (ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
using h1 SporadicOn.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k where
fp:‹((Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have
‹(Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪ (Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ))›
by (simp add: elims_part sporadic_on_e1)
with fp relpowp_Suc_I2 have
‹((Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))› by auto
thus ?thesis using fp by blast
qed
have br2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
hence ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h2 SporadicOn.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k
where fp:‹((((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have pc:‹(Γ, n ⊢ ((K⇩1 sporadic τ on K⇩2) # Ψ) ▹ Φ)
↪ (((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ)›
by (simp add: elims_part sporadic_on_e2)
hence ‹(Γ, n ⊢ (K⇩1 sporadic τ on K⇩2) # Ψ ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
from branches SporadicOn.prems(2) have
‹ρ ∈ ⟦ Γ, n ⊢ Ψ ▹ ((K⇩1 sporadic τ on K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇓ n @ τ) # Γ), n ⊢ Ψ ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
by simp
with br1 br2 show ?case by blast
next
case (TagRelation K⇩1 K⇩2 R)
have branches: ‹⟦ Γ, n ⊢ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_tagrel_cases by simp
thus ?case
proof -
have ‹∃Γ⇩k Ψ⇩k Φ⇩k k.
((((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)) ∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using TagRelation.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k
where fp:‹((((⌊τ⇩v⇩a⇩r(K⇩1, n), τ⇩v⇩a⇩r(K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have pc:‹(Γ, n ⊢ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ) ▹ Φ)
↪ (((⌊τ⇩v⇩a⇩r (K⇩1, n), τ⇩v⇩a⇩r (K⇩2, n)⌋ ∈ R) # Γ), n
⊢ Ψ ▹ ((time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Φ))›
by (simp add: elims_part tagrel_e)
hence ‹(Γ, n ⊢ (time-relation ⌊K⇩1, K⇩2⌋ ∈ R) # Ψ ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
next
case (Implies K⇩1 K⇩2)
have branches: ‹⟦ Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_implies_cases by simp
moreover have br1: ‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h1: ‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k.
((((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h1 Implies.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k where
fp:‹((((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have pc:‹(Γ, n ⊢ (K⇩1 implies K⇩2) # Ψ ▹ Φ)
↪ (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
by (simp add: elims_part implies_e1)
hence ‹(Γ, n ⊢ (K⇩1 implies K⇩2) # Ψ ▹ Φ) ↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
moreover have br2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k. (
(((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)
) ∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h2 Implies.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k where
fp:‹(((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have ‹(Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ)
↪ (((K⇩1 ⇑ n) # (K⇩2 ⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies K⇩2) # Φ))›
by (simp add: elims_part implies_e2)
hence ‹(Γ, n ⊢ ((K⇩1 implies K⇩2) # Ψ) ▹ Φ) ↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
ultimately show ?case using Implies.prems(2) by blast
next
case (ImpliesNot K⇩1 K⇩2)
have branches: ‹⟦ Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_implies_not_cases by simp
moreover have br1: ‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h1: ‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k.
((((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h1 ImpliesNot.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k where
fp:‹((((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have pc:‹(Γ, n ⊢ (K⇩1 implies not K⇩2) # Ψ ▹ Φ)
↪ (((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
by (simp add: elims_part implies_not_e1)
hence ‹(Γ, n ⊢ (K⇩1 implies not K⇩2) # Ψ ▹ Φ) ↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
moreover have br2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k. (
(((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ)) ↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)
) ∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h2 ImpliesNot.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k where
fp:‹(((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have ‹(Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪ (((K⇩1 ⇑ n) # (K⇩2 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 implies not K⇩2) # Φ))›
by (simp add: elims_part implies_not_e2)
hence ‹(Γ, n ⊢ ((K⇩1 implies not K⇩2) # Ψ) ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
ultimately show ?case using ImpliesNot.prems(2) by blast
next
case (TimeDelayedBy K⇩1 δτ K⇩2 K⇩3)
have branches:
‹⟦ Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g
= ⟦ ((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
∪ ⟦ ((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_timedelayed_cases by simp
moreover have br1:
‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k.
((Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h1: ‹ρ ∈ ⟦ ((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k.
((((K⇩1 ¬⇑ n) # Γ), n ⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h1 TimeDelayedBy.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k
where fp:‹(((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have ‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪ (((K⇩1 ¬⇑ n) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
by (simp add: elims_part timedelayed_e1)
hence ‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
using fp relpowp_Suc_I2 by auto
with rc show ?thesis by blast
qed
moreover have br2:
‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ ∃Γ⇩k Ψ⇩k Φ⇩k k.
((Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
proof -
assume h2: ‹ρ ∈ ⟦ ((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
then have ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using h2 TimeDelayedBy.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k
where fp:‹(((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have ‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪ (((K⇩1 ⇑ n) # (K⇩2 @ n ⊕ δτ ⇒ K⇩3) # Γ), n
⊢ Ψ ▹ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Φ))›
by (simp add: elims_part timedelayed_e2)
with fp relpowp_Suc_I2 have
‹(Γ, n ⊢ ((K⇩1 time-delayed by δτ on K⇩2 implies K⇩3) # Ψ) ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
by auto
with rc show ?thesis by blast
qed
ultimately show ?case using TimeDelayedBy.prems(2) by blast
next
case (WeaklyPrecedes K⇩1 K⇩2)
have ‹⟦ Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g =
⟦ ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_weakly_precedes_cases by simp
moreover have ‹ρ ∈ ⟦ ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ (∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ (ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g))›
proof -
assume ‹ρ ∈ ⟦ ((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
hence ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ (ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g)›
using WeaklyPrecedes.prems by simp
from this obtain Γ⇩k Ψ⇩k Φ⇩k k
where fp:‹(((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ))
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
and rc:‹ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g› by blast
have ‹(Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ)
↪ (((⌈#⇧≤ K⇩2 n, #⇧≤ K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 weakly precedes K⇩2) # Φ))›
by (simp add: elims_part weakly_precedes_e)
with fp relpowp_Suc_I2 have ‹(Γ, n ⊢ ((K⇩1 weakly precedes K⇩2) # Ψ) ▹ Φ)
↪⇗Suc k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k)›
by auto
with rc show ?thesis by blast
qed
ultimately show ?case using WeaklyPrecedes.prems(2) by blast
next
case (StrictlyPrecedes K⇩1 K⇩2)
have ‹⟦ Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ ⟧⇩c⇩o⇩n⇩f⇩i⇩g =
⟦ ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
using HeronConf_interp_stepwise_strictly_precedes_cases by simp
moreover have ‹ρ ∈ ⟦ ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g
⟹ (∃Γ⇩k Ψ⇩k Φ⇩k k. ((Γ, n ⊢ ((K⇩1 strictly precedes K⇩2) # Ψ) ▹ Φ)
↪⇗k⇖ (Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k))
∧ (ρ ∈ ⟦ Γ⇩k, Suc n ⊢ Ψ⇩k ▹ Φ⇩k ⟧⇩c⇩o⇩n⇩f⇩i⇩g))›
proof -
assume ‹ρ ∈ ⟦ ((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ), n
⊢ Ψ ▹ ((K⇩1 strictly precedes K⇩2) # Φ) ⟧⇩c⇩o⇩n⇩f⇩i⇩g›
hence ‹∃Γ⇩k Ψ⇩k Φ⇩k k. ((((⌈#⇧≤ K⇩2 n, #⇧< K⇩1 n⌉ ∈ (λ(x, y). x ≤ y)) # Γ