Built with Alectryon, running Coq+SerAPI v8.20.0+0.20.0. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
[Loading ML file ring_plugin.cmxs (using legacy method) ... done]
[Loading ML file ssrmatching_plugin.cmxs (using legacy method) ... done]
[Loading ML file ssreflect_plugin.cmxs (using legacy method) ... done]
Serlib plugin: coq-elpi.elpi is not available: serlib support is missing.
Incremental checking for commands in this plugin will be impacted.
[Loading ML file coq-elpi.elpi ... done]
[Loading ML file zify_plugin.cmxs (using legacy method) ... done]
[Loading ML file micromega_core_plugin.cmxs (using legacy method) ... done]
[Loading ML file micromega_plugin.cmxs (using legacy method) ... done]
[Loading ML file btauto_plugin.cmxs (using legacy method) ... done]
Serlib plugin: coq-paramcoq.plugin is not available: serlib support is missing.
Incremental checking for commands in this plugin will be impacted.
[Loading ML file paramcoq.cmxs (using legacy method) ... done]
Notation"_ + _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ - _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ <= _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ < _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ >= _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ > _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ <= _ <= _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ < _ <= _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ <= _ < _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ < _ < _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ * _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notations "[ eta _ ]" defined at level0and"[ TASK id: _ cost: _ deadline: _ arrival: _ priority: _ ]"
defined at level6have incompatible prefixes.
One of them will likely not work.
[notation-incompatible-prefix,parsing,default]
Notations "[ eta _ ]" defined at level0and"[ PERIODIC-TASK id: _ cost: _ deadline: _ period: _ priority: _ ]"
defined at level6have incompatible prefixes.
One of them will likely not work.
[notation-incompatible-prefix,parsing,default]
Notations "[ eta _ ]" defined at level0and"[ SPORADIC-TASK id: _ cost: _ deadline: _ separation: _ priority: _ ]"
defined at level6have incompatible prefixes.
One of them will likely not work.
[notation-incompatible-prefix,parsing,default]
Notations "[ eta _ ]" defined at level0and"[ CURVE horizon: _ steps: _ ]" defined at level6have incompatible prefixes.
One of them will likely not work.
[notation-incompatible-prefix,parsing,default]
Require Export prosa.implementation.refinements.arrival_bound.(** Throughout this file, we work with Prosa's fixed-priority policy implementation. *)#[local] Existing InstanceNumericFPAscending.(** We begin by defining a generic version of the functions we seek to define. *)SectionDefinitions.(** Consider a generic type T supporting basic arithmetic operations, neutral elements, and comparisons. *)Context `{T : Type}.Context `{!zero_of T, !one_of T, !sub_of T, !add_of T, !mul_of T,
!div_of T, !mod_of T, !eq_of T, !leq_of T, !lt_of T}.Context `{!eq_of (seq T)}.Context {eq_of2 : eq_of (@task_T T)}.(** We define a generic version of higher-or-equal priority task, ... *)Definitionhep_task_Ttsk_otsk := (task_priority_T tsk <= @task_priority_T T tsk_o)%C.(** ... of total request-bound function of higher-or-equal priority task, ... *)Definitiontotal_hep_rbf_T (ts : seq task_T) (tsk : task_T) (Δ : T) : T :=
lethep_ts := filter (funtsk' => hep_task_T tsk' tsk) ts inletwork_ts := map (funtsk' => task_rbf_T tsk' Δ) hep_ts in
foldr +%C 0%C work_ts.(** ... an analogous version of [hep_task] in without symmetry, ... *)Definitionohep_task_Ttsk_otsk :=
(hep_task_T tsk_o tsk) && (~~ (eq_of2 tsk_o tsk)%C).(** ... with a respective cumulative version. *)Definitiontotal_ohep_rbf_T (ts : seq task_T) (tsk : task_T) (Δ : T) : T :=
lethep_ts := filter (funtsk' => ohep_task_T tsk' tsk) ts inletwork_ts := map (funtsk' => task_rbf_T tsk' Δ) hep_ts in
foldr +%C 0%C work_ts.(** Next, we define a generic version of [check_point_FP], ... *)Definitioncheck_point_FP_T (ts : seq task_T) (tsk : task_T) (R : T) (P : T * T) : bool :=
(task_rbf_T tsk (P.1 + 1) +
total_ohep_rbf_T ts tsk (P.1 + P.2) <= P.1 + P.2)%C && (P.2 <= R)%C.(** ... a generic version of [blocking_bound_NP], ... *)Definitionblocking_bound_NP_T (ts : seq task_T) (tsk : task_T) :=
letlp_ts := filter (funtsk_o => ~~ hep_task_T tsk_o tsk) ts inletblock_ts := map (funtsk_o => task_cost_T tsk_o - 1)%C lp_ts in
foldr maxn_T 0%C block_ts.(** ... and of [check_point_NP]. *)Definitioncheck_point_NP_T (ts : seq task_T) (tsk : task_T) (R : T) (P : T * T) : bool :=
(blocking_bound_NP_T ts tsk
+ (task_rbf_T tsk (P.1 + 1) - (task_cost_T tsk - 1))
+ total_ohep_rbf_T ts tsk (P.1 + P.2) <= P.1 + P.2)%C
&& (P.2 + (task_cost_T tsk - 1) <= R)%C.EndDefinitions.(** In this section, we introduce some functions operating on binary numbers. *)SectionDefinitionsN.(** We provide a definition of [iota], ... *)Definitioniota_N (aΔ : N) := iota_T a Δ.(** ... of [search_space_emax_FP_h], ... *)Definitionsearch_space_emax_FP_h_N (tsk : task_T) (lr : N) : seq N :=
leth := get_horizon_of_task_T tsk inletoffsets := map (N.mul h) (iota_N l r) inletemax_offsets := repeat_steps_with_offset_T tsk offsets in
map predn_T emax_offsets.(** ... and of [search_space_emax_FP]. *)Definitionsearch_space_emax_FP_N (tsk : task_T) (L : N) :=
leth := get_horizon_of_task_T tsk in
search_space_emax_FP_h_N tsk 0 (((L %/ h)+1))%C.EndDefinitionsN.(** ** Refinements *)(** We now establish the desired refinements. *)(** First, we prove a refinement for the [search_space_emax_h] function. *)
tsk: Task tsk': task_T Rtsk: Rtask tsk tsk' l: nat l': N Rl: Rnat l l' r: nat r': N Rr: Rnat r r'
list_R Rnat (search_space_emax_FP_h tsk l r)
(search_space_emax_FP_h_N tsk' l' r')
tsk: Task tsk': task_T Rtsk: Rtask tsk tsk' l: nat l': N Rl: Rnat l l' r: nat r': N Rr: Rnat r r'
refines (list_R Rnat)
[seq i.-1
| i <- repeat_steps_with_offset tsk
[seq get_horizon_of_task tsk * i
| i <- iota l r]]
[seq predn_T i
| i <- repeat_steps_with_offset_T tsk'
[seq (get_horizon_of_task_T tsk' * i)%num
| i <- iota_N l' r']]
by refines_apply; refines_abstr.Qed.(** Next, we prove a refinement for the [search_space_emax_FP] function. *)
forall (a : Task) (b : task_T),
refines Rtask a b ->
forall (a' : Task) (b' : task_T),
refines Rtask a' b' ->
refines bool_R (hep_task a a') (hep_task_T b b')
forall (a : Task) (b : task_T),
refines Rtask a b ->
forall (a' : Task) (b' : task_T),
refines Rtask a' b' ->
refines bool_R (task_priority a' <= task_priority a)
(task_priority_T b' <= task_priority_T b)%C
byapply refines_abstr; move => tsk1 tsk1' Rtsk1; tc.Qed.(** Next, we prove a special-case refinement for the [total_hep_rbf] function when applied to a refined task set and a refined task. This special case is required to guide the typeclass engine. *)
byapply Rtsk.Qed.(** Next, we provide equality comparisons between different pairs of objects manipulated in Poet's certificates. *)Global Instanceeq_listN : eq_of (seq N) := funxy => x == y.Global Instanceeq_listNN : eq_of (seq (prod N N)) := funxy => x == y.Global Instanceeq_NlistNN : eq_of (prod N (seq (prod N N))) := funxy => x == y.Global Instanceeq_taskab : eq_of (@task_arrivals_bound_T N) := taskab_eqdef_T.Global Instanceeq_task : eq_of (@task_T N) := task_eqdef_T.(** Next, we prove a refinement for the [task_eqdef] function. *)
forall (a : Task) (b : task_T),
refines Rtask a b ->
forall (a' : Task) (b' : task_T),
refines Rtask a' b' ->
refines bool_R (task_eqdef a a') (task_eqdef_T b b')
a: Task a': task_T Ra: refines Rtask a a' b: Task b': task_T Rb: refines Rtask b b'
refines bool_R (task_eqdef a b) (task_eqdef_T a' b')
a: Task a': task_T Ra: refines Rtask a a' b: Task b': task_T Rb: refines Rtask b b'
refines bool_R
((task_id a == task_id b) &&
(task_cost a == task_cost b) &&
(task_arrival a == task_arrival b) &&
(task_deadline a == task_deadline b) &&
(task_priority a == task_priority b))
((task_id_T a' == task_id_T b')%C &&
(task_cost_T a' == task_cost_T b')%C &&
(task_arrival_T a' == task_arrival_T b')%C &&
(task_deadline_T a' == task_deadline_T b')%C &&
(task_priority_T a' == task_priority_T b')%C)
byrewrite refinesE; repeatapply andb_R; apply refinesP; refines_apply.Qed.(** Next, we prove a refinement for the [ohep_task] function. *)
forall (a : Task) (b : task_T),
refines Rtask a b ->
forall (a' : Task) (b' : task_T),
refines Rtask a' b' ->
refines bool_R (ohep_task a a') (ohep_task_T b b')
forall (a : Task) (b : task_T),
refines Rtask a b ->
forall (a' : Task) (b' : task_T),
refines Rtask a' b' ->
refines bool_R (hep_task a a' && (a != a'))
(hep_task_T b b' && ~~ eq_task b b')
ts: seq Task ts': seq task_T Rts: list_R Rtask ts ts' tsk: Task tsk': task_T Rtsk: Rtask tsk tsk' l: nat l': N Rl: Rnat l l' p: (nat * nat)%type p': (N * N)%type Rp: prod_R Rnat Rnat p p'
bool_R (check_point_FP ts tsk l p)
(check_point_FP_T ts' tsk' l' p')
byunfold check_point_FP, check_point_FP_T; apply andb_R; apply refinesP; tc.Qed.(** Next, we prove a special-case refinement for the [check_point_FP] function when applied to a refined task set and a refined task. This special case is required to guide the typeclass engine. *)
byapply refines_abstr; move => tsk1 tsk1' Rtsk1; tc.Qed.(** Next, we prove a special-case refinement for the [blocking_bound_NP] function when applied to a refined task set and a refined task. This special case is required to guide the typeclass engine. *)
ts: seq Task ts': seq task_T Rts: list_R Rtask ts ts' tsk: Task tsk': task_T Rtsk: Rtask tsk tsk' l: nat l': N Rl: Rnat l l' p: (nat * nat)%type p': (N * N)%type Rp: prod_R Rnat Rnat p p'
bool_R (check_point_NP ts tsk l p)
(check_point_NP_T ts' tsk' l' p')
byunfold check_point_NP, check_point_NP_T; apply andb_R; apply refinesP; tc.Qed.(** Finally, we prove a special-case refinement for the [check_point_NP] function when applied to a refined task set and a refined task. This special case is required to guide the typeclass engine. *)