Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
121
Issues
121
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
2347a6e6
Commit
2347a6e6
authored
Feb 17, 2013
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
int.EuclideanDivision: more lemmas
parent
619709ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
lib/coq/int/EuclideanDivision.v
lib/coq/int/EuclideanDivision.v
+26
-0
theories/int.why
theories/int.why
+12
-2
No files found.
lib/coq/int/EuclideanDivision.v
View file @
2347a6e6
...
...
@@ -166,4 +166,30 @@ unfold mod1.
rewrite
Div_minus1_left
;
auto
with
zarith
.
Qed
.
Require
ZArith
.
Zquot
.
Open
Scope
Z_scope
.
(
*
Why3
goal
*
)
Lemma
Div_mult
:
forall
(
x
:
Z
)
(
y
:
Z
)
(
z
:
Z
),
(
0
%
Z
<
x
)
%
Z
->
((
div
((
x
*
y
)
%
Z
+
z
)
%
Z
x
)
=
(
y
+
(
div
z
x
))
%
Z
).
intros
x
y
z
h
.
unfold
div
.
destruct
(
Z_le_dec
0
(
z
mod
x
)).
destruct
(
Z_le_dec
0
((
x
*
y
+
z
)
mod
x
)).
rewrite
Zmult_comm
.
rewrite
Z_div_plus_full_l
;
auto
with
zarith
.
generalize
(
Z_mod_lt
(
x
*
y
+
z
)
x
);
auto
with
zarith
.
generalize
(
Z_mod_lt
z
x
);
auto
with
zarith
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Mod_mult
:
forall
(
x
:
Z
)
(
y
:
Z
)
(
z
:
Z
),
(
0
%
Z
<
x
)
%
Z
->
((
mod1
((
x
*
y
)
%
Z
+
z
)
%
Z
x
)
=
(
mod1
z
x
)).
intros
x
y
z
h
.
unfold
mod1
.
rewrite
Div_mult
.
ring
.
auto
with
zarith
.
Qed
.
theories/int.why
View file @
2347a6e6
...
...
@@ -64,8 +64,11 @@ end
(** {2 Euclidean Division}
Division and modulo operators with the convention that division
rounds down, and thus modulo is always non-negative
Division and modulo operators with the convention
that modulo is always non-negative.
It implies that division rounds down when divisor is positive, and
rounds up when divisor is negative.
*)
...
...
@@ -105,6 +108,13 @@ theory EuclideanDivision
lemma Mod_minus1_left: forall y:int. y > 1 -> mod (-1) y = y - 1
lemma Div_mult: forall x y z:int [div (x * y + z) x].
x > 0 ->
div (x * y + z) x = y + div z x
lemma Mod_mult: forall x y z:int [mod (x * y + z) x].
x > 0 ->
mod (x * y + z) x = mod z x
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment