Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROSA - Formally Proven Schedulability Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lasse Blaauwbroek
PROSA - Formally Proven Schedulability Analysis
Commits
ac2a288c
Commit
ac2a288c
authored
3 years ago
by
Sergey Bozhko
Browse files
Options
Downloads
Patches
Plain Diff
clean up in util/lcmseq.v
parent
c68ae072
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
analysis/facts/hyperperiod.v
+1
-5
1 addition, 5 deletions
analysis/facts/hyperperiod.v
util/lcmseq.v
+20
-30
20 additions, 30 deletions
util/lcmseq.v
with
21 additions
and
35 deletions
analysis/facts/hyperperiod.v
+
1
−
5
View file @
ac2a288c
...
@@ -20,11 +20,7 @@ Section Hyperperiod.
...
@@ -20,11 +20,7 @@ Section Hyperperiod.
Lemma
hyperperiod_int_mult_of_any_task
:
Lemma
hyperperiod_int_mult_of_any_task
:
exists
(
k
:
nat
),
exists
(
k
:
nat
),
hyperperiod
ts
=
k
*
task_period
tsk
.
hyperperiod
ts
=
k
*
task_period
tsk
.
Proof
.
Proof
.
by
apply
/
dvdnP
;
apply
lcm_seq_is_mult_of_all_ints
,
map_f
,
H_tsk_in_ts
.
Qed
.
apply
lcm_seq_is_mult_of_all_ints
.
apply
map_f
.
now
apply
H_tsk_in_ts
.
Qed
.
End
Hyperperiod
.
End
Hyperperiod
.
...
...
This diff is collapsed.
Click to expand it.
util/lcmseq.v
+
20
−
30
View file @
ac2a288c
...
@@ -2,47 +2,41 @@ From mathcomp Require Export ssreflect seq div ssrbool ssrnat eqtype ssrfun.
...
@@ -2,47 +2,41 @@ From mathcomp Require Export ssreflect seq div ssrbool ssrnat eqtype ssrfun.
Require
Export
prosa
.
util
.
tactics
.
Require
Export
prosa
.
util
.
tactics
.
(** A function to calculate the least common multiple
(** A function to calculate the least common multiple
of all integers in a sequence [xs], denoted by [lcml xs]
*
*)
of all integers in a sequence [xs], denoted by [lcml xs]
.
*)
Definition
lcml
(
xs
:
seq
nat
)
:
nat
:=
foldr
lcmn
1
xs
.
Definition
lcml
(
xs
:
seq
nat
)
:
nat
:=
foldr
lcmn
1
xs
.
(**
Any integer [a] that is contained in the sequence
[x
s
] divides [lcml xs].
*
*)
(**
First we show that
[x] divides [lcml
(x :: xs)] for any [x] and [
xs]. *)
Lemma
int_divides_lcm_in_seq
:
Lemma
int_divides_lcm_in_seq
:
forall
(
a
:
nat
)
(
xs
:
seq
nat
),
a
%|
lcml
(
a
::
xs
)
.
forall
(
x
:
nat
)
(
xs
:
seq
nat
),
x
%|
lcml
(
x
::
xs
)
.
Proof
.
Proof
.
intros
.
induction
xs
.
rewrite
/
lcml
.
-
by
apply
dvdn_lcml
.
induction
xs
.
-
rewrite
/
lcml
-
cat1s
foldr_cat
/
foldr
.
-
rewrite
/
foldr
.
now
apply
dvdn_lcml
.
-
rewrite
-
cat1s
.
rewrite
foldr_cat
/
foldr
.
by
apply
dvdn_lcml
.
by
apply
dvdn_lcml
.
Qed
.
Qed
.
(**
Also
, [lcml xs
1
] divides [lcml
xs2] if [
xs
2
]
contains one extra element as compared to
[xs
1
]. *)
(**
Similarly
, [lcml xs] divides [lcml
(x ::
xs
)
]
for any [x] and
[xs]. *)
Lemma
lcm_seq_divides_lcm_super
:
Lemma
lcm_seq_divides_lcm_super
:
forall
(
x
:
nat
)
(
xs
:
seq
nat
),
forall
(
x
:
nat
)
(
xs
:
seq
nat
),
lcml
xs
%|
lcml
(
x
::
xs
)
.
lcml
xs
%|
lcml
(
x
::
xs
)
.
Proof
.
Proof
.
intros
.
rewrite
/
lcml
.
induction
xs
;
first
by
auto
.
induction
xs
;
first
by
auto
.
rewrite
-
cat1s
foldr_cat
/
foldr
.
rewrite
/
lcml
-
cat1s
foldr_cat
/
foldr
.
by
apply
dvdn_lcmr
.
by
apply
dvdn_lcmr
.
Qed
.
Qed
.
(**
All integers i
n a sequence [xs] divide [lcml xs]. *)
(**
Give
n a sequence [xs]
, any integer [x \in xs]
divide
s
[lcml xs]. *)
Lemma
lcm_seq_is_mult_of_all_ints
:
Lemma
lcm_seq_is_mult_of_all_ints
:
forall
(
sq
:
seq
nat
)
(
a
:
nat
),
a
\
in
s
q
->
exists
k
,
lcml
sq
=
k
*
a
.
forall
(
x
:
nat
)
(
xs
:
seq
nat
),
x
\
in
x
s
->
x
%|
lcml
xs
.
Proof
.
Proof
.
intros
x
s
x
IN
.
intros
x
x
s
IN
;
apply
/
dvdnP
.
induction
xs
as
[
|
z
sq
IH_DIV
IDES
];
first
by
easy
.
induction
xs
as
[
|
z
sq
IH_DIV
];
first
by
done
.
rewrite
in_cons
in
IN
.
rewrite
in_cons
in
IN
.
move
:
IN
=>
/
orP
[
/
eqP
EQ
|
IN
]
.
move
:
IN
=>
/
orP
[
/
eqP
EQ
|
IN
]
.
+
apply
/
dvdnP
.
-
apply
/
dvdnP
.
rewrite
EQ
/
lcml
.
rewrite
EQ
/
lcml
.
by
apply
int_divides_lcm_in_seq
.
by
apply
int_divides_lcm_in_seq
.
+
move
:
(
IH_DIV
IDES
IN
)
=>
[
k
EQ
]
.
+
move
:
(
IH_DIV
IN
)
=>
[
k
EQ
]
.
exists
((
foldr
lcmn
1
(
z
::
sq
))
%/
(
foldr
lcmn
1
sq
)
*
k
)
.
exists
((
foldr
lcmn
1
(
z
::
sq
))
%/
(
foldr
lcmn
1
sq
)
*
k
)
.
rewrite
-
mulnA
-
EQ
divnK
/
lcml
//.
rewrite
-
mulnA
-
EQ
divnK
/
lcml
//.
by
apply
lcm_seq_divides_lcm_super
.
by
apply
lcm_seq_divides_lcm_super
.
...
@@ -51,18 +45,14 @@ Qed.
...
@@ -51,18 +45,14 @@ Qed.
(** The LCM of all elements in a sequence with only positive elements is positive. *)
(** The LCM of all elements in a sequence with only positive elements is positive. *)
Lemma
all_pos_implies_lcml_pos
:
Lemma
all_pos_implies_lcml_pos
:
forall
(
xs
:
seq
nat
),
forall
(
xs
:
seq
nat
),
(
forall
b
,
b
\
in
xs
->
b
>
0
)
->
(
forall
x
,
x
\
in
xs
->
x
>
0
)
->
lcml
xs
>
0
.
lcml
xs
>
0
.
Proof
.
Proof
.
intros
*
POS
.
intros
*
POS
.
induction
xs
;
first
by
easy
.
induction
xs
;
first
by
easy
.
rewrite
/
lcml
-
cat1s
=>
//.
rewrite
/
lcml
-
cat1s
//=
lcmn_gt0
.
simpl
;
rewrite
lcmn_gt0
.
apply
/
andP
;
split
=>
//.
apply
/
andP
;
split
=>
//.
-
by
apply
POS
;
rewrite
in_cons
eq_refl
.
+
apply
POS
;
rewrite
in_cons
;
apply
/
orP
;
left
.
-
apply
:
IHxs
;
intros
b
B_IN
.
now
apply
/
eqP
.
by
apply
POS
;
rewrite
in_cons
;
apply
/
orP
;
right
=>
//.
+
feed_n
1
IHxs
.
-
intros
b
B_IN
.
now
apply
POS
;
rewrite
in_cons
;
apply
/
orP
;
right
=>
//.
-
now
rewrite
/
lcml
in
IHxs
.
Qed
.
Qed
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment