Commit d3c64ee5 authored by Sergey Bozhko's avatar Sergey Bozhko Committed by Sergey Bozhko

Add new definitions and lemmas to service and workload files

parent 58d8d0ab
Require Import rt.model.time rt.model.arrival.basic.task.
Require Import rt.model.time rt.model.arrival.basic.task rt.model.arrival.basic.arrival_sequence.
From mathcomp Require Import ssrnat ssrbool eqtype.
(* Properties of different types of job: *)
Module Job.
Import Time.
Import Time ArrivalSequence.
(* 1) Basic Job *)
Section ValidJob.
......@@ -19,7 +19,7 @@ Module Job.
End ValidJob.
(* 2) real-time job (with a deadline) *)
(* 2) Real-time job (with a deadline) *)
Section ValidRealtimeJob.
Context {Job: eqType}.
......@@ -38,7 +38,7 @@ Module Job.
job_deadline_positive.
End ValidRealtimeJob.
(* 3) Job of sporadic task *)
Section ValidSporadicTaskJob.
......@@ -68,4 +68,26 @@ Module Job.
End ValidSporadicTaskJob.
(* 4) Job of task *)
Section ValidTaskJob.
Context {Task: eqType}.
Variable task_cost: Task -> time.
Context {Job: eqType}.
Variable job_cost: Job -> time.
Variable job_task: Job -> Task.
(* Consider any arrival sequence. *)
Variable arr_seq: arrival_sequence Job.
(* The job cost from the arrival sequence
cannot be larger than the task cost. *)
Definition cost_of_jobs_from_arrival_sequence_le_task_cost :=
forall j,
arrives_in arr_seq j ->
job_cost_le_task_cost task_cost job_cost job_task j.
End ValidTaskJob.
End Job.
\ No newline at end of file
......@@ -54,7 +54,11 @@ Module TaskArrival.
(* ...we can identify the jobs of tsk that arrived in any interval [t1, t2) ... *)
Definition arrivals_of_task_between (t1 t2: time) :=
[seq j <- arrivals_between t1 t2 | is_job_of_task j].
(* ...we define the jobs of tsk that arrived before some time instant t ... *)
Definition arrivals_of_task_before (t: time) :=
arrivals_of_task_between 0 t.
(* ...and also count the number of job arrivals. *)
Definition num_arrivals_of_task (t1 t2: time) :=
size (arrivals_of_task_between t1 t2).
......
......@@ -271,7 +271,7 @@ Module UniprocessorSchedule.
(* Let j be any job. *)
Variable j: Job.
(* First, we show that if job j is scheduled, then it must be pending. *)
(* We show that if job j is scheduled, then it must be pending. *)
Lemma scheduled_implies_pending:
forall t,
scheduled_at sched j t ->
......@@ -291,6 +291,22 @@ Module UniprocessorSchedule.
by rewrite /service_at SCHED.
Qed.
(* Consider any arrival sequence. *)
Variable arr_seq: arrival_sequence Job.
(* Then we prove that the job is pending at the moment of its arrival. *)
Lemma job_pending_at_arrival:
arrives_in arr_seq j ->
job_cost j > 0 ->
pending job_arrival job_cost sched j (job_arrival j).
Proof.
intros ARR POS.
apply/andP; split; first by rewrite /has_arrived.
rewrite neq_ltn; apply/orP; left.
rewrite /service /service_during (ignore_service_before_arrival); try done.
by rewrite big_geq; eauto 2.
Qed.
End Pending.
(* In this section we show that the schedule is unique at any point. *)
......
This diff is collapsed.
......@@ -77,5 +77,60 @@ Module Workload.
End PerJobPriority.
End WorkloadDefs.
(* We also define the workload of a task. *)
Section TaskWorkload.
Context {Task: eqType}.
Context {Job: eqType}.
Variable job_arrival: Job -> time.
Variable job_cost: Job -> time.
Variable job_task: Job -> Task.
(* Consider any job arrival sequence. *)
Variable arr_seq: arrival_sequence Job.
(* Let tsk be the task to be analyzed. *)
Variable tsk: Task.
(* Recall the notion of a job of task tsk. *)
Let of_task_tsk j := job_task j == tsk.
(* We define the task workload as the workload of jobs of task tsk. *)
Definition task_workload jobs := workload_of_jobs job_cost jobs of_task_tsk.
(* Next, we recall the definition of the task workload in interval [t1, t2). *)
Definition task_workload_between (t1 t2: time) :=
task_workload (jobs_arrived_between arr_seq t1 t2).
End TaskWorkload.
(* In this section, we prove a few basic lemmas about the workload. *)
Section BasicLemmas.
Context {Job: eqType}.
Variable job_arrival: Job -> time.
Variable job_cost: Job -> time.
(* Consider any job arrival sequence... *)
Variable arr_seq: arrival_sequence Job.
(* For simplicity, let's define some local names. *)
Let arrivals_between := jobs_arrived_between arr_seq.
(* We prove that workload can be splited into two parts. *)
Lemma workload_of_jobs_cat:
forall t t1 t2 P,
t1 <= t <= t2 ->
workload_of_jobs job_cost (arrivals_between t1 t2) P =
workload_of_jobs job_cost (arrivals_between t1 t) P
+ workload_of_jobs job_cost (arrivals_between t t2) P.
Proof.
move => t t1 t2 P /andP [GE LE].
rewrite /workload_of_jobs /arrivals_between.
by rewrite (job_arrived_between_cat _ _ t) // big_cat.
Qed.
End BasicLemmas.
End Workload.
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment