Skip to content
Snippets Groups Projects
Commit eb957144 authored by Björn Brandenburg's avatar Björn Brandenburg
Browse files

fix fallout from definition change in facts/completion.v

parent 0ceae791
No related branches found
No related tags found
No related merge requests found
From rt.restructuring.behavior Require Export schedule. From rt.restructuring.behavior Require Export schedule.
From rt.restructuring.behavior.facts Require Export service. From rt.restructuring.behavior.facts Require Export service.
From rt.util Require Import nat.
(** In this file, we establish basic facts about job completions. *) (** In this file, we establish basic facts about job completions. *)
Section CompletionFacts. Section CompletionFacts.
...@@ -63,10 +65,9 @@ Section CompletionFacts. ...@@ -63,10 +65,9 @@ Section CompletionFacts.
remaining_cost sched j t > 0. remaining_cost sched j t > 0.
Proof. Proof.
move=> t SERVICE. move=> t SERVICE.
rewrite subn_gt0 /service /service_during. rewrite -incomplete_is_positive_remaining_cost -less_service_than_cost_is_incomplete.
apply leq_trans with (\sum_(0 <= t0 < t.+1) service_at sched j t0); apply H_completed_jobs.
last by rewrite H_completed_jobs. by apply service_at_implies_scheduled_at.
by rewrite big_nat_recr //= -addn1 leq_add2l.
Qed. Qed.
(* Consequently, if we have a have processor model where scheduled jobs (* Consequently, if we have a have processor model where scheduled jobs
...@@ -92,16 +93,11 @@ Section CompletionFacts. ...@@ -92,16 +93,11 @@ Section CompletionFacts.
completed_by sched j t -> completed_by sched j t ->
~~ scheduled_at sched j t. ~~ scheduled_at sched j t.
Proof. Proof.
rename H_completed_jobs into COMP. move=> t COMP.
unfold completed_jobs_dont_execute in *. apply contra with (b := ~~ completed_by sched j t);
intros t COMPLETED. last by apply /negPn.
apply/negP; red; intro SCHED. move=> SCHED. move: (H_completed_jobs j t SCHED).
have BUG := COMP j t.+1. by rewrite less_service_than_cost_is_incomplete.
rewrite leqNgt in BUG; move: BUG => /negP BUG; apply BUG.
rewrite /service /service_during big_nat_recr // /= -addn1.
apply leq_add.
- by rewrite -/(service_during sched j 0 t) -/(completed_by sched j t).
- by rewrite /service_at; apply: H_scheduled_implies_serviced; rewrite -/(scheduled_at _ _ _).
Qed. Qed.
(* ... and that a scheduled job cannot be completed. *) (* ... and that a scheduled job cannot be completed. *)
...@@ -116,15 +112,6 @@ Section CompletionFacts. ...@@ -116,15 +112,6 @@ Section CompletionFacts.
by rewrite -less_service_than_cost_is_incomplete. by rewrite -less_service_than_cost_is_incomplete.
Qed. Qed.
(* We further observe that [service] and [remaining_cost] are complements of
one another. *)
Lemma service_cost_invariant:
forall t,
(service sched j t) + (remaining_cost sched j t) = job_cost j.
Proof.
move=> t. rewrite /remaining_cost subnKC //.
Qed.
End CompletionFacts. End CompletionFacts.
...@@ -154,63 +141,49 @@ Section ServiceAndCompletionFacts. ...@@ -154,63 +141,49 @@ Section ServiceAndCompletionFacts.
(* Assume that a scheduled job receives exactly one time unit of service. *) (* Assume that a scheduled job receives exactly one time unit of service. *)
Hypothesis H_unit_service: unit_service_proc_model. Hypothesis H_unit_service: unit_service_proc_model.
Section GuaranteedService. (* To begin with, we establish that the cumulative service never exceeds a
job's total cost if service increases only by one at each step since
(* Assume a scheduled job always receives some positive service. *) completed jobs don't execute. *)
Hypothesis H_scheduled_implies_serviced: ideal_progress_proc_model. Lemma service_at_most_cost:
forall t,
(* Then we can easily show that the service never exceeds the total cost of service sched j t <= job_cost j.
the job. *) Proof.
Lemma service_le_cost: move=> t.
forall t, elim: t => [|t]; first by rewrite service0.
service sched j t <= job_cost j. rewrite -service_last_plus_before.
Proof. rewrite leq_eqVlt => /orP [/eqP EQ|LT].
elim => [| n IH]; first by rewrite service0 //. - rewrite not_scheduled_implies_no_service;
rewrite leq_eqVlt in IH. first by rewrite addn0 EQ.
case/orP: IH => [EQ | LT]; rewrite -service_last_plus_before. apply completed_implies_not_scheduled => //.
- rewrite not_scheduled_implies_no_service; first by rewrite addn0 //. by rewrite /completed_by EQ.
apply: completed_implies_not_scheduled; auto. unfold unit_service_proc_model in H_unit_service. - apply leq_trans with (n := service sched j t + 1);
move /eqP in EQ. last by rewrite addn1.
rewrite /completed_by EQ //. rewrite leq_add2l.
- apply leq_trans with (n := service sched j n + 1). by apply H_unit_service.
+ rewrite leq_add2l /service_at //. Qed.
+ rewrite -(ltnS (service sched j n + 1) _) -(addn1 (job_cost j)) ltn_add2r //.
Qed.
(* We show that the service received by job j in any interval is no larger
than its cost. *)
Lemma cumulative_service_le_job_cost:
forall t t',
service_during sched j t t' <= job_cost j.
Proof.
move=> t t'.
case/orP: (leq_total t t') => [tt'|tt']; last by rewrite service_during_geq //.
apply leq_trans with (n := service sched j t'); last by apply: service_le_cost.
rewrite /service. rewrite -(service_during_cat sched j 0 t t') // leq_addl //.
Qed.
Section ProperReleases. (* This lets us conclude that [service] and [remaining_cost] are complements
Context `{JobArrival Job}. of one another. *)
Lemma service_cost_invariant:
(* Assume that jobs are not released early. *) forall t,
Hypothesis H_jobs_must_arrive: (service sched j t) + (remaining_cost sched j t) = job_cost j.
jobs_must_arrive_to_execute sched. Proof.
move=> t.
(* We show that if job j is scheduled, then it must be pending. *) rewrite /remaining_cost subnKC //.
Lemma scheduled_implies_pending: by apply service_at_most_cost.
forall t, Qed.
scheduled_at sched j t ->
pending sched j t.
Proof.
move=> t SCHED.
rewrite /pending.
apply /andP; split;
first by apply: H_jobs_must_arrive => //.
apply: scheduled_implies_not_completed => //.
Qed.
End ProperReleases. (* We show that the service received by job j in any interval is no larger
End GuaranteedService. than its cost. *)
Lemma cumulative_service_le_job_cost:
forall t t',
service_during sched j t t' <= job_cost j.
Proof.
move=> t t'.
case/orP: (leq_total t t') => [tt'|tt']; last by rewrite service_during_geq //.
apply leq_trans with (n := service sched j t'); last by apply: service_at_most_cost.
rewrite /service. rewrite -(service_during_cat sched j 0 t t') // leq_addl //.
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). *)
...@@ -230,6 +203,29 @@ Section ServiceAndCompletionFacts. ...@@ -230,6 +203,29 @@ Section ServiceAndCompletionFacts.
by apply leq_ltn_trans with (n := service sched j t). by apply leq_ltn_trans with (n := service sched j t).
Qed. Qed.
Section GuaranteedService.
(* Assume a scheduled job always receives some positive service. *)
Hypothesis H_scheduled_implies_serviced: ideal_progress_proc_model.
(* Assume that jobs are not released early. *)
Context `{JobArrival Job}.
Hypothesis H_jobs_must_arrive: jobs_must_arrive_to_execute sched.
(* We show that if job j is scheduled, then it must be pending. *)
Lemma scheduled_implies_pending:
forall t,
scheduled_at sched j t ->
pending sched j t.
Proof.
move=> t SCHED.
rewrite /pending.
apply /andP; split;
first by apply: H_jobs_must_arrive => //.
by apply: scheduled_implies_not_completed => //.
Qed.
End GuaranteedService.
End ServiceAndCompletionFacts. End ServiceAndCompletionFacts.
Section PositiveCost. Section PositiveCost.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment