Commit 49036f00 authored by Sergey Bozhko's avatar Sergey Bozhko

Improve readability of analysis

parent 5fc2e7dd
...@@ -59,11 +59,11 @@ Section BusyIntervalJLFP. ...@@ -59,11 +59,11 @@ Section BusyIntervalJLFP.
End BusyInterval. End BusyInterval.
(** In this section we define the computational (** In this section we define the computational
version of the notion of quiet time. *) version of the notion of quiet time. *)
Section DecidableQuietTime. Section DecidableQuietTime.
(** We say that t is a quiet time for j iff every higher-priority job from (** We say that t is a quiet time for j iff every higher-priority job from
the arrival sequence that arrived before t has completed by that time. *) the arrival sequence that arrived before t has completed by that time. *)
Definition quiet_time_dec (j : Job) (t : instant) := Definition quiet_time_dec (j : Job) (t : instant) :=
all all
(fun j_hp => hep_job j_hp j ==> (completed_by sched j_hp t)) (fun j_hp => hep_job j_hp j ==> (completed_by sched j_hp t))
......
Require Export prosa.behavior.all. Require Export prosa.behavior.all.
From mathcomp Require Export eqtype ssrnat.
(** In this section, we introduce properties of a job. *) (** In this section, we introduce properties of a job. *)
Section PropertiesOfJob. Section PropertiesOfJob.
......
Require Export prosa.analysis.definitions.busy_interval. Require Export prosa.analysis.definitions.busy_interval.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop.
(** * Cumulative Priority Inversion for JLFP-models *) (** * Cumulative Priority Inversion for JLFP-models *)
(** In this module we define the notion of cumulative priority inversion for uni-processor for JLFP schedulers. *) (** In this module we define the notion of cumulative priority inversion for uni-processor for JLFP schedulers. *)
Section CumulativePriorityInversion. Section CumulativePriorityInversion.
......
...@@ -6,6 +6,7 @@ Require Export prosa.analysis.facts.behavior.service. ...@@ -6,6 +6,7 @@ Require Export prosa.analysis.facts.behavior.service.
conversely a notion of a lack of progress. *) conversely a notion of a lack of progress. *)
Section Progress. Section Progress.
(** Consider any type of jobs with a known cost... *) (** Consider any type of jobs with a known cost... *)
Context {Job : JobType}. Context {Job : JobType}.
Context `{JobCost Job}. Context `{JobCost Job}.
......
...@@ -6,8 +6,6 @@ Require Export prosa.model.priority.classes. ...@@ -6,8 +6,6 @@ Require Export prosa.model.priority.classes.
could be generalized in future work. *) could be generalized in future work. *)
Require Import prosa.analysis.facts.model.ideal_schedule. Require Import prosa.analysis.facts.model.ideal_schedule.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq path fintype bigop.
(** * Request Bound Function (RBF) *) (** * Request Bound Function (RBF) *)
(** We define the notion of a task's request-bound function (RBF), as well as (** We define the notion of a task's request-bound function (RBF), as well as
...@@ -47,7 +45,8 @@ Section TaskWorkloadBoundedByArrivalCurves. ...@@ -47,7 +45,8 @@ Section TaskWorkloadBoundedByArrivalCurves.
Variable delta : duration. Variable delta : duration.
(** We define the following workload bound for the task. *) (** We define the following workload bound for the task. *)
Definition task_request_bound_function := task_cost tsk * max_arrivals tsk delta. Definition task_request_bound_function :=
task_cost tsk * max_arrivals tsk delta.
End SingleTask. End SingleTask.
......
Require Export prosa.analysis.facts.behavior.completion. Require Export prosa.analysis.facts.behavior.completion.
Require Import prosa.model.task.absolute_deadline. Require Import prosa.model.task.absolute_deadline.
(** * Schedulability *)
(** In the following section we define the notion of schedulable
task. *)
Section Task. Section Task.
(** Consider any type of tasks, ... *)
Context {Task : TaskType}. Context {Task : TaskType}.
Context {Job: JobType}.
Context `{JobArrival Job} `{JobCost Job} `{JobTask Job Task}. (** ... any type of jobs associated with these tasks, ... *)
Context {Job: JobType}.
Context `{JobArrival Job}.
Context `{JobCost Job}.
Context `{JobDeadline Job}. Context `{JobDeadline Job}.
Context `{JobTask Job Task}.
(** ... and any kind of processor state. *)
Context {PState : Type}. Context {PState : Type}.
Context `{ProcessorState Job PState}. Context `{ProcessorState Job PState}.
...@@ -37,43 +47,27 @@ Section Task. ...@@ -37,43 +47,27 @@ Section Task.
arrives_in arr_seq j -> arrives_in arr_seq j ->
job_task j = tsk -> job_task j = tsk ->
job_meets_deadline sched j. job_meets_deadline sched j.
End Task. End Task.
Section TaskSet. (** In this section we infer schedulability from a response-time bound
Context {Task : TaskType}. of a task. *)
Context {Job: JobType}. Section Schedulability.
Context `{JobArrival Job} `{JobCost Job} `{JobTask Job Task}.
Context `{JobDeadline Job}.
Context {PState : Type}.
Context `{ProcessorState Job PState}.
Variable ts : {set Task}.
(** Consider any job arrival sequence... *)
Variable arr_seq: arrival_sequence Job.
(** ...and any schedule of these jobs. *)
Variable sched: schedule PState.
(** We say that a task set is schedulable if all its tasks are schedulable *)
Definition schedulable_taskset :=
forall tsk, tsk \in ts -> schedulable_task arr_seq sched tsk.
End TaskSet.
Section Schedulability.
(** We can infer schedulability from a response-time bound of a task. *)
(** Consider any type of tasks, ... *)
Context {Task : TaskType}. Context {Task : TaskType}.
Context {Job: JobType}.
Context `{TaskDeadline Task}. Context `{TaskDeadline Task}.
Context `{JobArrival Job} `{JobCost Job} `{JobTask Job Task}.
(** ... any type of jobs associated with these tasks, ... *)
Context {Job: JobType}.
Context `{JobArrival Job}.
Context `{JobCost Job}.
Context `{JobTask Job Task}.
(** ... and any kind of processor state. *)
Context {PState : Type}. Context {PState : Type}.
Context `{ProcessorState Job PState}. Context `{ProcessorState Job PState}.
(** Consider any job arrival sequence... *) (** Consider any job arrival sequence... *)
Variable arr_seq: arrival_sequence Job. Variable arr_seq: arrival_sequence Job.
...@@ -112,9 +106,12 @@ End Schedulability. ...@@ -112,9 +106,12 @@ End Schedulability.
given schedule and one w.r.t. all jobs that arrive in a given given schedule and one w.r.t. all jobs that arrive in a given
arrival sequence. *) arrival sequence. *)
Section AllDeadlinesMet. Section AllDeadlinesMet.
(** Consider any given type of jobs... *) (** Consider any given type of jobs... *)
Context {Job : JobType} `{JobCost Job} `{JobDeadline Job} `{JobArrival Job}. Context {Job : JobType}.
Context `{JobArrival Job}.
Context `{JobCost Job}.
Context `{JobDeadline Job}.
(** ... any given type of processor states. *) (** ... any given type of processor states. *)
Context {PState: eqType}. Context {PState: eqType}.
...@@ -151,8 +148,8 @@ Section AllDeadlinesMet. ...@@ -151,8 +148,8 @@ Section AllDeadlinesMet.
End DeadlinesOfArrivals. End DeadlinesOfArrivals.
(** We observe that the latter definition, assuming a schedule in (** We observe that the latter definition, assuming a schedule in
which all jobs come from the arrival sequence, implies the former which all jobs come from the arrival sequence, implies the
definition. *) former definition. *)
Lemma all_deadlines_met_in_valid_schedule: Lemma all_deadlines_met_in_valid_schedule:
forall arr_seq sched, forall arr_seq sched,
jobs_come_from_arrival_sequence sched arr_seq -> jobs_come_from_arrival_sequence sched arr_seq ->
......
Require Export prosa.model.task.concept. Require Export prosa.model.task.concept.
Require Export prosa.model.processor.ideal.
(** Due to historical reasons this file defines the notion of a schedule of (** Due to historical reasons this file defines the notion of a
a task for the ideal uni-processor model. This is not a fundamental limitation schedule of a task for the ideal uni-processor model. This is not
and the notion can be further generalized to an arbitrary model. *) a fundamental limitation and the notion can be further generalized
to an arbitrary model. *)
Require Export prosa.model.processor.ideal.
(** * Schedule of task *) (** * Schedule of task *)
(** In this section we define properties of schedule of a task *) (** In this section we define properties of schedule of a task *)
...@@ -22,29 +23,25 @@ Section ScheduleOfTask. ...@@ -22,29 +23,25 @@ Section ScheduleOfTask.
(** Let [sched] be any ideal uni-processor schedule. *) (** Let [sched] be any ideal uni-processor schedule. *)
Variable sched : schedule (ideal.processor_state Job). Variable sched : schedule (ideal.processor_state Job).
Section TaskProperties. (** Let [tsk] be any task. *)
Variable tsk : Task.
(** Let [tsk] be any task. *)
Variable tsk : Task. (** Next we define whether a task is scheduled at time [t], ... *)
Definition task_scheduled_at (t : instant) :=
(** Next we define whether a task is scheduled at time [t], ... *) if sched t is Some j then
Definition task_scheduled_at (t : instant) := job_task j == tsk
if sched t is Some j then else false.
job_task j == tsk
else false.
(** ...which also corresponds to the instantaneous service it receives. *) (** ...which also corresponds to the instantaneous service it receives. *)
Definition task_service_at (t : instant) := task_scheduled_at t. Definition task_service_at (t : instant) := task_scheduled_at t.
(** Based on the notion of instantaneous service, we define the (** Based on the notion of instantaneous service, we define the
cumulative service received by [tsk] during any interval [t1, t2)... *) cumulative service received by [tsk] during any interval [t1, t2)... *)
Definition task_service_during (t1 t2 : instant) := Definition task_service_during (t1 t2 : instant) :=
\sum_(t1 <= t < t2) task_service_at t. \sum_(t1 <= t < t2) task_service_at t.
(** ...and the cumulative service received by [tsk] up to time t2, (** ...and the cumulative service received by [tsk] up to time t2,
i.e., in the interval [0, t2). *) i.e., in the interval [0, t2). *)
Definition task_service (t2 : instant) := task_service_during 0 t2. Definition task_service (t2 : instant) := task_service_during 0 t2.
End TaskProperties.
End ScheduleOfTask. End ScheduleOfTask.
This diff is collapsed.
Require Export prosa.analysis.facts.behavior.service. Require Export prosa.analysis.facts.behavior.service.
Require Export prosa.analysis.facts.behavior.arrivals. Require Export prosa.analysis.facts.behavior.arrivals.
(** In this file, we establish basic facts about job completions. *) (** * Completion *)
(** In this file, we establish basic facts about job completions. *)
Section CompletionFacts. Section CompletionFacts.
(** Consider any job type,...*) (** Consider any job type,...*)
Context {Job: JobType}. Context {Job: JobType}.
Context `{JobCost Job}. Context `{JobCost Job}.
...@@ -35,8 +37,7 @@ Section CompletionFacts. ...@@ -35,8 +37,7 @@ Section CompletionFacts.
Lemma less_service_than_cost_is_incomplete: Lemma less_service_than_cost_is_incomplete:
forall t, forall t,
service sched j t < job_cost j service sched j t < job_cost j
<-> <-> ~~ completed_by sched j t.
~~ completed_by sched j t.
Proof. Proof.
move=> t. by split; rewrite /completed_by; [rewrite -ltnNge // | rewrite ltnNge //]. move=> t. by split; rewrite /completed_by; [rewrite -ltnNge // | rewrite ltnNge //].
Qed. Qed.
...@@ -45,8 +46,7 @@ Section CompletionFacts. ...@@ -45,8 +46,7 @@ Section CompletionFacts.
Lemma incomplete_is_positive_remaining_cost: Lemma incomplete_is_positive_remaining_cost:
forall t, forall t,
~~ completed_by sched j t ~~ completed_by sched j t
<-> <-> remaining_cost sched j t > 0.
remaining_cost sched j t > 0.
Proof. Proof.
move=> t. by split; rewrite /remaining_cost -less_service_than_cost_is_incomplete subn_gt0 //. move=> t. by split; rewrite /remaining_cost -less_service_than_cost_is_incomplete subn_gt0 //.
Qed. Qed.
...@@ -112,11 +112,10 @@ Section CompletionFacts. ...@@ -112,11 +112,10 @@ Section CompletionFacts.
End CompletionFacts. End CompletionFacts.
(** In this section, we establish some facts that are really about service,
Section ServiceAndCompletionFacts. but are also related to completion and rely on some of the above lemmas.
(** In this section, we establish some facts that are really about service, Hence they are in this file rather than in the service facts file. *)
but are also related to completion and rely on some of the above lemmas. Section ServiceAndCompletionFacts.
Hence they are in this file rather than in the service facts file. *)
(** Consider any job type,...*) (** Consider any job type,...*)
Context {Job: JobType}. Context {Job: JobType}.
...@@ -133,7 +132,7 @@ Section ServiceAndCompletionFacts. ...@@ -133,7 +132,7 @@ Section ServiceAndCompletionFacts.
Hypothesis H_completed_jobs: Hypothesis H_completed_jobs:
completed_jobs_dont_execute sched. completed_jobs_dont_execute sched.
(** Let j be any job that is to be scheduled. *) (** Let [j] be any job that is to be scheduled. *)
Variable j: Job. Variable j: Job.
(** Assume that a scheduled job receives exactly one time unit of service. *) (** Assume that a scheduled job receives exactly one time unit of service. *)
...@@ -171,7 +170,7 @@ Section ServiceAndCompletionFacts. ...@@ -171,7 +170,7 @@ Section ServiceAndCompletionFacts.
by apply service_at_most_cost. by apply service_at_most_cost.
Qed. Qed.
(** We show that the service received by job j in any interval is no larger (** We show that the service received by job [j] in any interval is no larger
than its cost. *) than its cost. *)
Lemma cumulative_service_le_job_cost: Lemma cumulative_service_le_job_cost:
forall t t', forall t t',
...@@ -183,8 +182,8 @@ Section ServiceAndCompletionFacts. ...@@ -183,8 +182,8 @@ Section ServiceAndCompletionFacts.
rewrite /service. rewrite -(service_during_cat sched j 0 t t') // leq_addl //. rewrite /service. rewrite -(service_during_cat sched j 0 t t') // leq_addl //.
Qed. Qed.
(** If a job isn't complete at time t, it can't be completed at time (t + (** If a job isn't complete at time [t], it can't be completed at time [t +
remaining_cost j t - 1). *) remaining_cost j t - 1]. *)
Lemma job_doesnt_complete_before_remaining_cost: Lemma job_doesnt_complete_before_remaining_cost:
forall t, forall t,
~~ completed_by sched j t -> ~~ completed_by sched j t ->
...@@ -227,9 +226,9 @@ Section ServiceAndCompletionFacts. ...@@ -227,9 +226,9 @@ Section ServiceAndCompletionFacts.
End ServiceAndCompletionFacts. End ServiceAndCompletionFacts.
(** In this section, we establish facts that on jobs with non-zero costs that
must arrive to execute. *)
Section PositiveCost. Section PositiveCost.
(** In this section, we establish facts that on jobs with non-zero costs that
must arrive to execute. *)
(** Consider any type of jobs with cost and arrival-time attributes,...*) (** Consider any type of jobs with cost and arrival-time attributes,...*)
Context {Job: JobType}. Context {Job: JobType}.
...@@ -243,11 +242,11 @@ Section PositiveCost. ...@@ -243,11 +242,11 @@ Section PositiveCost.
(** ...and a given schedule. *) (** ...and a given schedule. *)
Variable sched: schedule PState. Variable sched: schedule PState.
(** Let j be any job that is to be scheduled. *) (** Let [j] be any job that is to be scheduled. *)
Variable j: Job. Variable j: Job.
(** We assume that job j has positive cost, from which we can (** We assume that job [j] has positive cost, from which we can
infer that there always is a time in which j is pending, ... *) infer that there always is a time in which [j] is pending, ... *)
Hypothesis H_positive_cost: job_cost j > 0. Hypothesis H_positive_cost: job_cost j > 0.
(** ...and that jobs must arrive to execute. *) (** ...and that jobs must arrive to execute. *)
...@@ -283,6 +282,7 @@ Section PositiveCost. ...@@ -283,6 +282,7 @@ Section PositiveCost.
End PositiveCost. End PositiveCost.
Section CompletedJobs. Section CompletedJobs.
(** Consider any kinds of jobs and any kind of processor state. *) (** Consider any kinds of jobs and any kind of processor state. *)
Context {Job : JobType} {PState : Type}. Context {Job : JobType} {PState : Type}.
Context `{ProcessorState Job PState}. Context `{ProcessorState Job PState}.
......
Require Export prosa.analysis.facts.behavior.completion. Require Export prosa.analysis.facts.behavior.completion.
(** * Deadlines *)
(** In this file, we observe basic properties of the behavioral job (** In this file, we observe basic properties of the behavioral job
model w.r.t. deadlines. *) model w.r.t. deadlines. *)
Section DeadlineFacts. Section DeadlineFacts.
(** Consider any given type of jobs with costs and deadlines... *) (** Consider any given type of jobs with costs and deadlines... *)
Context {Job : JobType} `{JobCost Job} `{JobDeadline Job}. Context {Job : JobType} `{JobCost Job} `{JobDeadline Job}.
(** ... any given type of processor states. *) (** ... any given type of processor states. *)
Context {PState: eqType}. Context {PState: eqType}.
Context `{ProcessorState Job PState}. Context `{ProcessorState Job PState}.
......
...@@ -2,15 +2,15 @@ Require Export prosa.util.all. ...@@ -2,15 +2,15 @@ Require Export prosa.util.all.
Require Export prosa.behavior.all. Require Export prosa.behavior.all.
Require Export prosa.model.processor.platform_properties. Require Export prosa.model.processor.platform_properties.
From mathcomp Require Import ssrnat ssrbool fintype. (** * Service *)
(** In this file, we establish basic facts about the service received by (** In this file, we establish basic facts about the service received by
jobs. *) jobs. *)
Section Composition. (** To begin with, we provide some simple but handy rewriting rules for
(** To begin with, we provide some simple but handy rewriting rules for
[service] and [service_during]. *) [service] and [service_during]. *)
Section Composition.
(** Consider any job type and any processor state. *) (** Consider any job type and any processor state. *)
Context {Job: JobType}. Context {Job: JobType}.
Context {PState: Type}. Context {PState: Type}.
...@@ -130,10 +130,9 @@ Section Composition. ...@@ -130,10 +130,9 @@ Section Composition.
End Composition. End Composition.
(** As a common special case, we establish facts about schedules in which a
job receives either 1 or 0 service units at all times. *)
Section UnitService. Section UnitService.
(** As a common special case, we establish facts about schedules in which a
job receives either 1 or 0 service units at all times. *)
(** Consider any job type and any processor state. *) (** Consider any job type and any processor state. *)
Context {Job: JobType}. Context {Job: JobType}.
...@@ -146,7 +145,7 @@ Section UnitService. ...@@ -146,7 +145,7 @@ Section UnitService.
(** ...and a given schedule. *) (** ...and a given schedule. *)
Variable sched: schedule PState. Variable sched: schedule PState.
(** Let j be any job that is to be scheduled. *) (** Let [j] be any job that is to be scheduled. *)
Variable j: Job. Variable j: Job.
(** First, we prove that the instantaneous service cannot be greater than 1, ... *) (** First, we prove that the instantaneous service cannot be greater than 1, ... *)
...@@ -156,7 +155,7 @@ Section UnitService. ...@@ -156,7 +155,7 @@ Section UnitService.
by move=> t; rewrite /service_at. by move=> t; rewrite /service_at.
Qed. Qed.
(** ...which implies that the cumulative service received by job j in any (** ...which implies that the cumulative service received by job [j] in any
interval of length delta is at most delta. *) interval of length delta is at most delta. *)
Lemma cumulative_service_le_delta: Lemma cumulative_service_le_delta:
forall t delta, forall t delta,
...@@ -170,7 +169,7 @@ Section UnitService. ...@@ -170,7 +169,7 @@ Section UnitService.
Section ServiceIsAStepFunction. Section ServiceIsAStepFunction.
(** We show that the service received by any job j is a step function. *) (** We show that the service received by any job [j] is a step function. *)
Lemma service_is_a_step_function: Lemma service_is_a_step_function:
is_step_function (service sched j). is_step_function (service sched j).
Proof. Proof.
...@@ -179,15 +178,15 @@ Section UnitService. ...@@ -179,15 +178,15 @@ Section UnitService.
apply service_at_most_one. apply service_at_most_one.
Qed. Qed.
(** Next, consider any time t... *) (** Next, consider any time [t]... *)
Variable t: instant. Variable t: instant.
(** ...and let s0 be any value less than the service received (** ...and let [s0] be any value less than the service received
by job j by time t. *) by job [j] by time [t]. *)
Variable s0: duration. Variable s0: duration.
Hypothesis H_less_than_s: s0 < service sched j t. Hypothesis H_less_than_s: s0 < service sched j t.
(** Then, we show that there exists an earlier time t0 where job j had s0 (** Then, we show that there exists an earlier time [t0] where job [j] had [s0]
units of service. *) units of service. *)
Corollary exists_intermediate_service: Corollary exists_intermediate_service:
exists t0, exists t0,
...@@ -205,8 +204,8 @@ Section UnitService. ...@@ -205,8 +204,8 @@ Section UnitService.
End UnitService. End UnitService.
(** We establish a basic fact about the monotonicity of service. *)
Section Monotonicity. Section Monotonicity.
(** We establish a basic fact about the monotonicity of service. *)
(** Consider any job type and any processor model. *) (** Consider any job type and any processor model. *)
Context {Job: JobType}. Context {Job: JobType}.
...@@ -231,8 +230,9 @@ Section Monotonicity. ...@@ -231,8 +230,9 @@ Section Monotonicity.
End Monotonicity. End Monotonicity.
(** Consider any job type and any processor model. *)
Section RelationToScheduled. Section RelationToScheduled.
(** Consider any job type and any processor model. *)
Context {Job: JobType}. Context {Job: JobType}.
Context {PState: Type}. Context {PState: Type}.
Context `{ProcessorState Job PState}. Context `{ProcessorState Job PState}.
...@@ -313,7 +313,7 @@ Section RelationToScheduled. ...@@ -313,7 +313,7 @@ Section RelationToScheduled.
Qed. Qed.