Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
d21fa51e
Commit
d21fa51e
authored
Dec 04, 2012
by
Guillaume Melquiond
Browse files
Introduce the concept of decidable equality into Coq realizations.
parent
86385555
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/coq/BuiltIn.v
View file @
d21fa51e
Require
Export
ZArith
.
Require
Export
Rbase
.
Class
WhyType
T
:=
why_inhabitant
:
T
.
Class
WhyType
T
:=
{
why_inhabitant
:
T
;
why_decidable_eq
:
forall
x
y
:
T
,
{
x
=
y
}
+
{
x
<>
y
}
}
.
Notation
int
:=
Z
.
Global
Instance
int_WhyType
:
WhyType
int
.
Proof
.
split
.
exact
Z0
.
exact
Z_eq_dec
.
Qed
.
Notation
real
:=
R
.
Global
Instance
real_WhyType
:
WhyType
real
.
Proof
.
split
.
exact
R0
.
intros
x
y
.
destruct
(
total_order_T
x
y
)
as
[[
H
|
H
]
|
H
]
;
try
(
left
;
exact
H
)
;
right
.
now
apply
Rlt_not_eq
.
now
apply
Rgt_not_eq
.
Qed
.
Global
Instance
tuple_WhyType
:
forall
T
{
T
'
:
WhyType
T
}
U
{
U
'
:
WhyType
U
}
,
WhyType
(
T
*
U
).
now
split
.
Proof
.
intros
T
WT
U
WU
.
split
.
split
;
apply
why_inhabitant
.
intros
(
x1
,
x2
)
(
y1
,
y2
).
destruct
(
why_decidable_eq
x1
y1
)
as
[
H1
|
H1
].
destruct
(
why_decidable_eq
x2
y2
)
as
[
H2
|
H2
].
left
.
now
apply
f_equal2
.
right
.
now
injection
.
right
.
now
injection
.
Qed
.
Global
Instance
unit_WhyType
:
WhyType
unit
.
Proof
.
split
.
exact
tt
.
intros
[]
[].
now
left
.
Qed
.
Global
Instance
bool_WhyType
:
WhyType
bool
.
Proof
.
split
.
exact
false
.
exact
Bool
.
bool_dec
.
Qed
.
lib/coq/set/Set.v
View file @
d21fa51e
...
...
@@ -20,7 +20,10 @@ Defined.
Global
Instance
set_WhyType
:
forall
(
a
:
Type
)
{
a_WT
:
WhyType
a
}
,
WhyType
(
set
a
).
Proof
.
intros
.
split
.
exact
(
fun
_
=>
False
).
intros
x
y
.
apply
excluded_middle_informative
.
Qed
.
(
*
Why3
goal
*
)
...
...
@@ -176,7 +179,7 @@ Qed.
(
*
Why3
goal
*
)
Definition
choose
:
forall
{
a
:
Type
}
{
a_WT
:
WhyType
a
}
,
(
set
a
)
->
a
.
intros
a
a_WT
s
.
assert
(
i
:
inhabited
a
)
by
(
apply
inhabits
;
assumption
).
assert
(
i
:
inhabited
a
)
by
(
apply
inhabits
,
why_inhabitant
).
exact
(
epsilon
i
(
fun
x
=>
mem
x
s
)).
Defined
.
...
...
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