Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
why3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Why3
why3
Commits
29b9e23a
Commit
29b9e23a
authored
13 years ago
by
MARCHE Claude
Browse files
Options
Downloads
Patches
Plain Diff
A few more lemmas for Euclidean Division
parent
285bc3e0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/coq/int/EuclideanDivision.v
+68
-0
68 additions, 0 deletions
lib/coq/int/EuclideanDivision.v
theories/int.why
+11
-0
11 additions, 0 deletions
theories/int.why
with
79 additions
and
0 deletions
lib/coq/int/EuclideanDivision.v
+
68
−
0
View file @
29b9e23a
...
@@ -89,6 +89,38 @@ elim H.
...
@@ -89,6 +89,38 @@ elim H.
now
rewrite
Zmod_small
.
now
rewrite
Zmod_small
.
Qed
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Div_inf_neg
:
forall
(
x
:
Z
)
(
y
:
Z
),
((
0
%
Z
<
x
)
%
Z
/
\
(
x
<=
y
)
%
Z
)
->
((
div
(
-
x
)
%
Z
y
)
=
(
-
1
%
Z
)
%
Z
).
intros
x
y
Hxy
.
assert
(
h
:
(
x
<
y
\
/
x
=
y
)
%
Z
)
by
omega
.
destruct
h
.
(
*
case
0
<
x
<
y
*
)
assert
(
h1
:
(
x
mod
y
=
x
)
%
Z
).
rewrite
Zmod_small
;
auto
with
zarith
.
assert
(
h2
:
((
-
x
)
mod
y
=
y
-
x
)
%
Z
).
rewrite
Z_mod_nz_opp_full
.
rewrite
h1
;
auto
.
rewrite
h1
;
auto
with
zarith
.
unfold
div
.
case
Z_le_dec
;
auto
with
zarith
.
intros
h3
.
rewrite
Z_div_nz_opp_full
;
auto
with
zarith
.
rewrite
Zdiv_small
;
auto
with
zarith
.
(
*
case
x
=
y
*
)
subst
.
assert
(
h1
:
(
y
mod
y
=
0
)
%
Z
).
rewrite
Z_mod_same_full
;
auto
with
zarith
.
assert
(
h2
:
((
-
y
)
mod
y
=
0
)
%
Z
).
rewrite
Z_mod_zero_opp_full
;
auto
with
zarith
.
unfold
div
.
case
Z_le_dec
;
rewrite
h2
;
auto
with
zarith
.
intro
.
rewrite
Z_div_zero_opp_full
;
auto
with
zarith
.
rewrite
Z_div_same_full
;
auto
with
zarith
.
Qed
.
(
*
Why3
goal
*
)
(
*
Why3
goal
*
)
Lemma
Mod_0
:
forall
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
((
mod1
0
%
Z
y
)
=
0
%
Z
).
Lemma
Mod_0
:
forall
(
y
:
Z
),
(
~
(
y
=
0
%
Z
))
->
((
mod1
0
%
Z
y
)
=
0
%
Z
).
intros
y
Hy
.
intros
y
Hy
.
...
@@ -98,4 +130,40 @@ simpl.
...
@@ -98,4 +130,40 @@ simpl.
now
rewrite
Zdiv_0_l
,
Zmult_0_r
.
now
rewrite
Zdiv_0_l
,
Zmult_0_r
.
Qed
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Div_1_left
:
forall
(
y
:
Z
),
(
1
%
Z
<
y
)
%
Z
->
((
div
1
%
Z
y
)
=
0
%
Z
).
intros
y
Hy
.
rewrite
Div_inf
;
auto
with
zarith
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Div_minus1_left
:
forall
(
y
:
Z
),
(
1
%
Z
<
y
)
%
Z
->
((
div
(
-
1
%
Z
)
%
Z
y
)
=
(
-
1
%
Z
)
%
Z
).
intros
y
Hy
.
unfold
div
.
assert
(
h1
:
(
1
mod
y
=
1
)
%
Z
).
apply
Zmod_1_l
;
auto
.
assert
(
h2
:
((
-
(
1
))
mod
y
=
y
-
1
)
%
Z
).
rewrite
Z_mod_nz_opp_full
;
auto
with
zarith
.
case
Z_le_dec
;
auto
with
zarith
.
intro
.
rewrite
Z_div_nz_opp_full
;
auto
with
zarith
.
rewrite
Zdiv_small
;
auto
with
zarith
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Mod_1_left
:
forall
(
y
:
Z
),
(
1
%
Z
<
y
)
%
Z
->
((
mod1
1
%
Z
y
)
=
1
%
Z
).
intros
y
Hy
.
unfold
mod1
.
rewrite
Div_1_left
;
auto
with
zarith
.
Qed
.
(
*
Why3
goal
*
)
Lemma
Mod_minus1_left
:
forall
(
y
:
Z
),
(
1
%
Z
<
y
)
%
Z
->
((
mod1
(
-
1
%
Z
)
%
Z
y
)
=
(
y
-
1
%
Z
)
%
Z
).
intros
y
Hy
.
unfold
mod1
.
rewrite
Div_minus1_left
;
auto
with
zarith
.
Qed
.
This diff is collapsed.
Click to expand it.
theories/int.why
+
11
−
0
View file @
29b9e23a
...
@@ -93,8 +93,19 @@ theory EuclideanDivision
...
@@ -93,8 +93,19 @@ theory EuclideanDivision
lemma Div_inf: forall x y:int. 0 <= x < y -> div x y = 0
lemma Div_inf: forall x y:int. 0 <= x < y -> div x y = 0
lemma Div_inf_neg: forall x y:int. 0 < x <= y -> div (-x) y = -1
lemma Mod_0: forall y:int. y <> 0 -> mod 0 y = 0
lemma Mod_0: forall y:int. y <> 0 -> mod 0 y = 0
lemma Div_1_left: forall y:int. y > 1 -> div 1 y = 0
lemma Div_minus1_left: forall y:int. y > 1 -> div (-1) y = -1
lemma Mod_1_left: forall y:int. y > 1 -> mod 1 y = 1
lemma Mod_minus1_left: forall y:int. y > 1 -> mod (-1) y = y - 1
end
end
(** {2 Division by 2}
(** {2 Division by 2}
...
...
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