Library prosa.analysis.facts.busy_interval.pi_cond
This file relates the general notion of cumulative_priority_inversion with
the more specialized notion cumulative_priority_inversion_cond.
Consider any type of jobs.
Consider any arrival sequence with consistent arrivals ...
Variable arr_seq : arrival_sequence Job.
Hypothesis H_valid_arrivals : valid_arrival_sequence arr_seq.
Hypothesis H_valid_arrivals : valid_arrival_sequence arr_seq.
... and any valid ideal uniprocessor schedule of this arrival sequence.
Context {PState : ProcessorState Job}.
Hypothesis H_uni : uniprocessor_model PState.
Variable sched : schedule PState.
Hypothesis H_valid_schedule_of_arrivals : valid_schedule_of_arrivals sched arr_seq.
Hypothesis H_uni : uniprocessor_model PState.
Variable sched : schedule PState.
Hypothesis H_valid_schedule_of_arrivals : valid_schedule_of_arrivals sched arr_seq.
Consider a JLFP policy that indicates a higher-or-equal priority relation,
and assume that the relation is reflexive and transitive.
Context {JLFP : JLFP_policy Job}.
Hypothesis H_priority_is_reflexive : reflexive_job_priorities JLFP.
Hypothesis H_priority_is_transitive : transitive_job_priorities JLFP.
Hypothesis H_priority_is_reflexive : reflexive_job_priorities JLFP.
Hypothesis H_priority_is_transitive : transitive_job_priorities JLFP.
Consider a valid preemption model.
Context `{JobPreemptable Job}.
Hypothesis H_valid_preemption_model : valid_preemption_model arr_seq sched.
Hypothesis H_valid_preemption_model : valid_preemption_model arr_seq sched.
Further, allow for any work-bearing notion of job readiness.
Context {RM : JobReady Job PState}.
Hypothesis H_job_ready : work_bearing_readiness RM arr_seq sched.
Hypothesis H_job_ready : work_bearing_readiness RM arr_seq sched.
Assume that the schedule respects the scheduling policy at every preemption point.
Variable j : Job.
Hypothesis H_j_arrives : arrives_in arr_seq j.
Hypothesis H_job_cost_positive : job_cost_positive j.
Hypothesis H_j_arrives : arrives_in arr_seq j.
Hypothesis H_job_cost_positive : job_cost_positive j.
Consider any busy interval prefix
[t1, t2) of job j.
Variable t1 t2 : instant.
Hypothesis H_busy_interval_prefix :
busy_interval_prefix arr_seq sched j t1 t2.
Hypothesis H_busy_interval_prefix :
busy_interval_prefix arr_seq sched j t1 t2.
We establish a technical rewriting lemma that allows us to replace
cumulative_priority_inversion with
cumulative_priority_inversion_cond by exploiting the observation
that a single job remains scheduled throughout the interval in which job
j suffers priority inversion.
Lemma cum_task_pi_eq :
∀ (jlp : Job) (P : pred Job),
scheduled_at sched jlp t1 →
P jlp →
cumulative_priority_inversion arr_seq sched j t1 t2
= cumulative_priority_inversion_cond arr_seq sched j P t1 t2.
Proof.
move⇒ jlp P SCHED Pjlp.
apply: eq_big_nat ⇒ // t /andP [t1t tt2].
f_equal; apply/andb_id2l ⇒ NSCHED.
have suff:
∀ j',
j' \in scheduled_jobs_at arr_seq sched t →
~~ hep_job j' j →
P j'.
{ move⇒ SUFF.
apply: eq_in_has ⇒ j' SCHED' /=.
have [_|NHEP] := boolP (hep_job j' j); first by rewrite andbF.
by rewrite andbT SUFF. }
{ apply ⇒ j' SCHED' NHEP.
move: SCHED'; rewrite scheduled_jobs_at_iff // ⇒ SCHED''.
have PI: priority_inversion arr_seq sched j t by apply /uni_priority_inversion_P.
have j't1: scheduled_at sched j' t1
by apply: (pi_job_remains_scheduled arr_seq) =>//; apply /andP.
have → // : j' = jlp.
{ apply /eqP/contraT ⇒ NEQ; move: SCHED; apply /contraLR ⇒ _.
by apply scheduled_job_at_neq with (j:= j'). } }
Qed.
End CondPI.
∀ (jlp : Job) (P : pred Job),
scheduled_at sched jlp t1 →
P jlp →
cumulative_priority_inversion arr_seq sched j t1 t2
= cumulative_priority_inversion_cond arr_seq sched j P t1 t2.
Proof.
move⇒ jlp P SCHED Pjlp.
apply: eq_big_nat ⇒ // t /andP [t1t tt2].
f_equal; apply/andb_id2l ⇒ NSCHED.
have suff:
∀ j',
j' \in scheduled_jobs_at arr_seq sched t →
~~ hep_job j' j →
P j'.
{ move⇒ SUFF.
apply: eq_in_has ⇒ j' SCHED' /=.
have [_|NHEP] := boolP (hep_job j' j); first by rewrite andbF.
by rewrite andbT SUFF. }
{ apply ⇒ j' SCHED' NHEP.
move: SCHED'; rewrite scheduled_jobs_at_iff // ⇒ SCHED''.
have PI: priority_inversion arr_seq sched j t by apply /uni_priority_inversion_P.
have j't1: scheduled_at sched j' t1
by apply: (pi_job_remains_scheduled arr_seq) =>//; apply /andP.
have → // : j' = jlp.
{ apply /eqP/contraT ⇒ NEQ; move: SCHED; apply /contraLR ⇒ _.
by apply scheduled_job_at_neq with (j:= j'). } }
Qed.
End CondPI.