Library prosa.analysis.facts.delay_propagation

Propagation of Delays in Arrival Curves

In this module, we prove properties of the generic delay propagation definitions provided in prosa.analysis.definitions.delay_propagation.

Section ACPropFacts.

Consider two kinds of tasks...
  Context {Task1 Task2 : TaskType}.

... and their associated kinds of jobs.
  Context {Job1 Job2 : JobType}
    `{JobTask Job1 Task1} `{JobTask Job2 Task2}
    (JA1 : JobArrival Job1) (JA2 : JobArrival Job2).

Suppose we are given a mapping of jobs (resp., tasks) of the second kind to jobs (resp., tasks) of the first kind.
  Variable job1_of : Job2 Job1.
  Variable task1_of : Task2 Task1.

Furthermore, suppose we also have a reverse mapping from jobs of the first kind to the associated jobs of the second kind.
  Variable job2_of : Job1 seq Job2.

The relation of the jobs is as follows: a job j2 : Job2 arrives exactly arrival_delay j2 time units after the arrival of its corresponding job job1_of j2, where the maximum possible delay is bounded by delay_bound (job_task j2).
  Variable arrival_delay : Job2 duration.
  Variable delay_bound : Task2 duration.

Consider any set of type-two tasks.
  Variable ts2 : seq Task2.

If the mapping of type-two tasks to type-one tasks is valid for the tasks in the considered task set, ...
... and we are given an arrival curve for the first kind of tasks, ...
  Context {max_arrivals1 : MaxArrivals Task1}.

... then we obtain a derived (or propagated) arrival curve for tasks of the second kind.
Additionally, given an arbitrary arrival sequence of type-one jobs,
  Variable arr_seq1 : arrival_sequence Job1.

... if the mapping of type-two jobs to type-one jobs is valid, ...
... it induces a derived arrival sequence of type-two jobs.

Arrival Sequence Validity Properties

In the following, we establish that the derived arrival sequence is structurally valid.
First, the induced arrival sequence is consistent with the arrival times of type-two jobs.
Second, the induced arrival sequence does not duplicate any jobs.
Taken together, the above two lemmas imply that the derived arrival sequence is valid if the reference arrival sequence is valid.
A job of the second kind j2 : Job2 is part of the derived arrival sequence if its associated job of the first kind job1_of j2 is part of the given reference arrival sequence.
Conversely, a job of the second kind j2 : Job2 is part of the derived arrival sequence only if its associated job of the first kind job1_of j2 is part of the given reference arrival sequence.

Correctness of the Propagated Arrival Curve

Next, we establish the correctness of the propagated arrival curve.
To this end, we first observe that the defined function satisfies the structural requirements for arrival curves.
In the following, let ts1 denote the set of type-one tasks that the type-two tasks in ts2 are mapped to (by task1_of).
  Let ts1 := [seq task1_of tsk2 | tsk2 <- ts2].

To establish correctness, we make the assumption that each job of the first kind has at most one associated job of the second kind.
Generalizations to multiple successors are possible, but the current definition of propagated_arrival_curve works only under this restriction.
  Hypothesis H_job2_of_singleton :
    ( tsk1,
        tsk1 \in ts1 j1,
            job_task j1 = tsk1
            size (job2_of j1) 1).

Suppose the given type-one arrival sequence and arrival curve are valid.
In preparation of the correctness argument, we next establish a couple of "stepping stone" lemmas that sketch the main thrust of the correctness argument.
Consider an interval [t1, t2) ...
    Variable t1 t2 : instant.
    Hypothesis H_ordered : t1 t2.

... and any type-two task in the given task set.
    Variable tsk2 : Task2.
    Hypothesis H_in_ts : tsk2 \in ts2.

Let tsk2_arrivals denote the jobs of tsk2 that arrive in the interval [t1, t2) ...
... and let trigger_jobs denote the corresponding type-one jobs.
First, note that the arrival times of the jobs in trigger_jobs necessarily fall into the window [t1 - delay_bound tsk2, t2).
    Lemma trigger_job_arrival_bounded :
       j1,
        j1 \in trigger_jobs
        (t1 - delay_bound tsk2) job_arrival j1 < t2.

Let tsk1 denote the associated type-one task of tsk1...
    Let tsk1 := task1_of tsk2.

... and let tsk1_arrivals denote its jobs in the window during which triggering jobs may arrive.
The triggering jobs are hence a subset of all of tsk1's arrivals.
Additionally, from the assumption that each type-one job has at most one type-two successor (H_job2_of_singleton), we have that job1_of is injective (for the jobs in the arrival sequence).
Finally, the sequence of triggering jobs contains no duplicates since it is part of the valid arrival sequence arr_seq1.
Taken together, the above facts allow us to conclude that the magnitude of trigger_jobs is upper-bounded by the total number of jobs released by tsk1 during [t1 - delay_bound tsk2, t2], i.e., the count of jobs in tsk1_arrivals.
Assuming that the given arrival sequence for type-one tasks correctly bounds the arrivals of triggering jobs, trigger_job_size implies that the derived arrival curve correctly bounds the arrivals of type-two job since size tsk1_arrivals is then bounded by the given arrival curve max_arrivals1.