Library prosa.analysis.facts.hyperperiod
Require Export prosa.analysis.definitions.hyperperiod.
Require Export prosa.analysis.facts.periodic.task_arrivals_size.
Require Export prosa.analysis.facts.sporadic.arrival_bound.
Require Export prosa.analysis.facts.model.workload.
Require Export prosa.analysis.facts.model.task_cost.
Require Export prosa.util.div_mod.
Require Export prosa.util.tactics.
Require Export prosa.analysis.facts.periodic.task_arrivals_size.
Require Export prosa.analysis.facts.sporadic.arrival_bound.
Require Export prosa.analysis.facts.model.workload.
Require Export prosa.analysis.facts.model.task_cost.
Require Export prosa.util.div_mod.
Require Export prosa.util.tactics.
In this file we prove some simple properties of hyperperiods of periodic tasks.
Consider any type of periodic tasks, ...
... any task set ts, ...
... and any task tsk that belongs to this task set.
A task set's hyperperiod is an integral multiple
of each task's period in the task set.
Lemma hyperperiod_int_mult_of_any_task :
∃ (k : nat),
hyperperiod ts = k × task_period tsk.
End Hyperperiod.
∃ (k : nat),
hyperperiod ts = k × task_period tsk.
End Hyperperiod.
In this section we show a property of hyperperiod in context
of task sets with valid periods.
Consider any type of periodic tasks ...
... and any task set ts ...
... such that all tasks in ts have valid periods.
We show that the hyperperiod of task set ts
is positive.
In this section we prove some lemmas about the hyperperiod
in context of the periodic model.
Consider any type of tasks, ...
... any type of jobs, ...
... and a consistent arrival sequence with non-duplicate arrivals.
Variable arr_seq : arrival_sequence Job.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Variable tsk : Task.
Hypothesis H_task_in_ts : tsk \in ts.
Hypothesis H_valid_offset : valid_offset arr_seq tsk.
Hypothesis H_valid_period : valid_period tsk.
Hypothesis H_periodic_task : respects_periodic_task_model arr_seq tsk.
Hypothesis H_task_in_ts : tsk \in ts.
Hypothesis H_valid_offset : valid_offset arr_seq tsk.
Hypothesis H_valid_period : valid_period tsk.
Hypothesis H_periodic_task : respects_periodic_task_model arr_seq tsk.
Each task in ts continues releasing jobs indefinitely.
Let O_max denote the maximum task offset in ts and let
HP denote the hyperperiod of all tasks in ts.
We show that the job corresponding to any job j1 in any other
hyperperiod is a job of the same task as j1.
Lemma corresponding_jobs_have_same_task :
∀ j1 j2,
job_task (corresponding_job_in_hyperperiod ts arr_seq j1
(starting_instant_of_corresponding_hyperperiod ts j2) (job_task j1)) = job_task j1.
∀ j1 j2,
job_task (corresponding_job_in_hyperperiod ts arr_seq j1
(starting_instant_of_corresponding_hyperperiod ts j2) (job_task j1)) = job_task j1.
We show that if a job j lies in the hyperperiod starting
at instant t then j arrives in the interval
[t, t + HP).
Lemma all_jobs_arrive_within_hyperperiod :
∀ j t,
j \in jobs_in_hyperperiod ts arr_seq t tsk →
t ≤ job_arrival j < t + HP.
∀ j t,
j \in jobs_in_hyperperiod ts arr_seq t tsk →
t ≤ job_arrival j < t + HP.
We show that the number of jobs in a hyperperiod starting at n1 × HP + O_max
is the same as the number of jobs in a hyperperiod starting at n2 × HP + O_max given
that n1 is less than or equal to n2.
Lemma eq_size_hyp_lt :
∀ n1 n2,
n1 ≤ n2 →
size (jobs_in_hyperperiod ts arr_seq (n1 × HP + O_max) tsk)
= size (jobs_in_hyperperiod ts arr_seq (n2 × HP + O_max) tsk).
∀ n1 n2,
n1 ≤ n2 →
size (jobs_in_hyperperiod ts arr_seq (n1 × HP + O_max) tsk)
= size (jobs_in_hyperperiod ts arr_seq (n2 × HP + O_max) tsk).
We generalize the above lemma by lifting the condition on
n1 and n2.
Lemma eq_size_of_arrivals_in_hyperperiod :
∀ n1 n2,
size (jobs_in_hyperperiod ts arr_seq (n1 × HP + O_max) tsk)
= size (jobs_in_hyperperiod ts arr_seq (n2 × HP + O_max) tsk).
∀ n1 n2,
size (jobs_in_hyperperiod ts arr_seq (n1 × HP + O_max) tsk)
= size (jobs_in_hyperperiod ts arr_seq (n2 × HP + O_max) tsk).
Consider any two jobs j1 and j2 that stem from the arrival sequence
arr_seq such that j1 is of task tsk.
Variable j1 : Job.
Variable j2 : Job.
Hypothesis H_j1_from_arr_seq : arrives_in arr_seq j1.
Hypothesis H_j2_from_arr_seq : arrives_in arr_seq j2.
Hypothesis H_j1_task : job_task j1 = tsk.
Variable j2 : Job.
Hypothesis H_j1_from_arr_seq : arrives_in arr_seq j1.
Hypothesis H_j2_from_arr_seq : arrives_in arr_seq j2.
Hypothesis H_j1_task : job_task j1 = tsk.
Hypothesis H_j1_arr_after_O_max : O_max ≤ job_arrival j1.
Hypothesis H_j2_arr_after_O_max : O_max ≤ job_arrival j2.
Hypothesis H_j2_arr_after_O_max : O_max ≤ job_arrival j2.
We show that any job j that arrives in task arrivals in the same
hyperperiod as j2 also arrives in task arrivals up to job_arrival j2 + HP.
Lemma job_in_hp_arrives_in_task_arrivals_up_to :
∀ j,
j \in jobs_in_hyperperiod ts arr_seq ((job_arrival j2 - O_max) %/ HP × HP + O_max) tsk →
j \in task_arrivals_up_to arr_seq tsk (job_arrival j2 + HP).
∀ j,
j \in jobs_in_hyperperiod ts arr_seq ((job_arrival j2 - O_max) %/ HP × HP + O_max) tsk →
j \in task_arrivals_up_to arr_seq tsk (job_arrival j2 + HP).
We show that job j1 arrives in its own hyperperiod.
Lemma job_in_own_hp :
j1 \in jobs_in_hyperperiod ts arr_seq ((job_arrival j1 - O_max) %/ HP × HP + O_max) tsk.
j1 \in jobs_in_hyperperiod ts arr_seq ((job_arrival j1 - O_max) %/ HP × HP + O_max) tsk.
We show that the corresponding_job_in_hyperperiod of j1 in j2's hyperperiod
arrives in task arrivals up to job_arrival j2 + HP.
Lemma corr_job_in_task_arrivals_up_to :
corresponding_job_in_hyperperiod ts arr_seq j1 (starting_instant_of_corresponding_hyperperiod ts j2) tsk \in
task_arrivals_up_to arr_seq tsk (job_arrival j2 + HP).
corresponding_job_in_hyperperiod ts arr_seq j1 (starting_instant_of_corresponding_hyperperiod ts j2) tsk \in
task_arrivals_up_to arr_seq tsk (job_arrival j2 + HP).
Finally, we show that the corresponding_job_in_hyperperiod of j1 in j2's hyperperiod
arrives in the arrival sequence arr_seq.
Lemma corresponding_job_arrives :
arrives_in arr_seq (corresponding_job_in_hyperperiod ts arr_seq j1 (starting_instant_of_corresponding_hyperperiod ts j2) tsk).
End PeriodicLemmas.
arrives_in arr_seq (corresponding_job_in_hyperperiod ts arr_seq j1 (starting_instant_of_corresponding_hyperperiod ts j2) tsk).
End PeriodicLemmas.
Consider periodic tasks, their jobs, ...
Context {Task : TaskType} `{PeriodicModel Task}.
Context {Job : JobType} `{JobTask Job Task} `{JobArrival Job}.
Context {Job : JobType} `{JobTask Job Task} `{JobArrival Job}.
... and a valid arrival sequence of such jobs.
Variable arr_seq : arrival_sequence Job.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Consider a given task set ...
... and any valid periodic task in this set.
Variable tsk : Task.
Hypothesis H_task_in_ts : tsk \in ts.
Hypothesis H_valid_period : valid_period tsk.
Hypothesis H_periodic_task : respects_periodic_task_model arr_seq tsk.
Hypothesis H_task_in_ts : tsk \in ts.
Hypothesis H_valid_period : valid_period tsk.
Hypothesis H_periodic_task : respects_periodic_task_model arr_seq tsk.
Trivially, the hyperperiod can be expressed in terms of the task's period.
By definition, the task stays the same going forwards ...
... and also backwards.
The list of task-specific arrivals is a singleton list.
Local Fact prev_next_hyperperiod_job_selection :
∀ j j' t,
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = t →
[seq j'' <- arr_seq t | same_task j'' j] = [::j'].
∀ j j' t,
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = t →
[seq j'' <- arr_seq t | same_task j'' j] = [::j'].
We can identify the next job based on its arrival time.
Lemma next_hyperperiod_job_from_arrival :
∀ j j',
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = job_arrival j + hyperperiod ts →
next_hyperperiod_job ts arr_seq j = j'.
∀ j j',
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = job_arrival j + hyperperiod ts →
next_hyperperiod_job ts arr_seq j = j'.
We can also identify the previous job based on its arrival time.
Lemma prev_hyperperiod_job_from_arrival :
∀ j j',
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = job_arrival j - hyperperiod ts →
prev_hyperperiod_job ts arr_seq j = j'.
∀ j j',
arrives_in arr_seq j' →
job_task j = tsk →
job_task j' = tsk →
job_arrival j' = job_arrival j - hyperperiod ts →
prev_hyperperiod_job ts arr_seq j = j'.
Suppose tsk releases jobs indefinitely.
Consider any job of the task under analysis.
We establish some basic facts about the "matching" job in the next
hyperperiod in one go, which we then expose as individual facts.
Local Fact next_hyperperiod_job_properties :
let
j' := next_hyperperiod_job ts arr_seq j
in
[/\ arrives_in arr_seq j'
, job_task j' = tsk
, job_arrival j' = job_arrival j + hyperperiod ts
& job_index arr_seq j' = job_index arr_seq j + jobs_per_hyperperiod ts tsk].
let
j' := next_hyperperiod_job ts arr_seq j
in
[/\ arrives_in arr_seq j'
, job_task j' = tsk
, job_arrival j' = job_arrival j + hyperperiod ts
& job_index arr_seq j' = job_index arr_seq j + jobs_per_hyperperiod ts tsk].
The successor belongs to the arrival sequence, ...
... has an arrival time exactly one hyperperiod apart, ...
Fact next_hyperperiod_job_arrival :
job_arrival (next_hyperperiod_job ts arr_seq j)
= job_arrival j + hyperperiod ts.
job_arrival (next_hyperperiod_job ts arr_seq j)
= job_arrival j + hyperperiod ts.
... and the obvious job index.
Fact next_hyperperiod_job_index :
job_index arr_seq (next_hyperperiod_job ts arr_seq j)
= job_index arr_seq j + jobs_per_hyperperiod ts tsk.
job_index arr_seq (next_hyperperiod_job ts arr_seq j)
= job_index arr_seq j + jobs_per_hyperperiod ts tsk.
The "prev" and "next" operations cancel out.
Fact prev_next_hyperperiod_job :
prev_hyperperiod_job ts arr_seq (next_hyperperiod_job ts arr_seq j)
= j.
End ForwardCorrespondence.
prev_hyperperiod_job ts arr_seq (next_hyperperiod_job ts arr_seq j)
= j.
End ForwardCorrespondence.
Consider a job of the task with at least one hyperperiod's worth
of earlier releases.
Variable j : Job.
Hypothesis H_arrives : arrives_in arr_seq j.
Hypothesis H_tsk : job_task j = tsk.
Hypothesis H_index : jobs_per_hyperperiod ts tsk ≤ job_index arr_seq j.
Hypothesis H_arrives : arrives_in arr_seq j.
Hypothesis H_tsk : job_task j = tsk.
Hypothesis H_index : jobs_per_hyperperiod ts tsk ≤ job_index arr_seq j.
We establish the properties of the matching job in the previous
hyperperiod together, then expose them individually.
Local Fact prev_hyperperiod_job_properties :
let j' := prev_hyperperiod_job ts arr_seq j in
[/\ arrives_in arr_seq j'
, job_task j' = tsk
, job_arrival j' + hyperperiod ts = job_arrival j
& job_index arr_seq j' = job_index arr_seq j - jobs_per_hyperperiod ts tsk].
let j' := prev_hyperperiod_job ts arr_seq j in
[/\ arrives_in arr_seq j'
, job_task j' = tsk
, job_arrival j' + hyperperiod ts = job_arrival j
& job_index arr_seq j' = job_index arr_seq j - jobs_per_hyperperiod ts tsk].
The predecessor belongs to the arrival sequence, ...
... arrives exactly one hyperperiod earlier, ...
Lemma prev_hyperperiod_job_arrival :
job_arrival (prev_hyperperiod_job ts arr_seq j)
= job_arrival j - hyperperiod ts.
job_arrival (prev_hyperperiod_job ts arr_seq j)
= job_arrival j - hyperperiod ts.
... and has the preceding hyperperiod's job index.
Fact prev_hyperperiod_job_index :
job_index arr_seq (prev_hyperperiod_job ts arr_seq j)
= job_index arr_seq j - jobs_per_hyperperiod ts tsk.
job_index arr_seq (prev_hyperperiod_job ts arr_seq j)
= job_index arr_seq j - jobs_per_hyperperiod ts tsk.
The "next" and "prev" operations cancel out.
Fact next_prev_hyperperiod_job :
next_hyperperiod_job ts arr_seq (prev_hyperperiod_job ts arr_seq j) = j.
End BackwardCorrespondence.
End AdjacentHyperperiodJobs.
next_hyperperiod_job ts arr_seq (prev_hyperperiod_job ts arr_seq j) = j.
End BackwardCorrespondence.
End AdjacentHyperperiodJobs.
Consider periodic tasks with worst-case execution costs ...
... and their jobs.
Consider a given set of such periodic tasks ...
... and a corresponding valid arrival sequence.
Variable arr_seq : arrival_sequence Job.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Hypothesis H_periodic_arrivals : taskset_respects_periodic_task_model arr_seq ts.
Hypothesis H_all_jobs_from_taskset : all_jobs_from_taskset arr_seq ts.
Hypothesis H_valid_arrival_sequence : valid_arrival_sequence arr_seq.
Hypothesis H_periodic_arrivals : taskset_respects_periodic_task_model arr_seq ts.
Hypothesis H_all_jobs_from_taskset : all_jobs_from_taskset arr_seq ts.
If task WCETs bound the execution requirements of arriving jobs, ...
... then the total workload in any hyperperiod-sized interval
is upper-bounded by the hyperperiod workload.