Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Jan
stdpp
Commits
848e15e7
Commit
848e15e7
authored
6 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
No more `Typeclasses Opaque` for `equiv`.
parent
80b3d10e
Branches
robbert/tc_opaque
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
theories/base.v
+15
-18
15 additions, 18 deletions
theories/base.v
theories/option.v
+1
-1
1 addition, 1 deletion
theories/option.v
theories/streams.v
+3
-3
3 additions, 3 deletions
theories/streams.v
with
19 additions
and
22 deletions
theories/base.v
+
15
−
18
View file @
848e15e7
...
@@ -191,7 +191,11 @@ Proof. split; repeat intro; congruence. Qed.
...
@@ -191,7 +191,11 @@ Proof. split; repeat intro; congruence. Qed.
"canonical" equivalence for a type. The typeclass is tied to the \equiv
"canonical" equivalence for a type. The typeclass is tied to the \equiv
symbol. This is based on (Spitters/van der Weegen, 2011). *)
symbol. This is based on (Spitters/van der Weegen, 2011). *)
Class
Equiv
A
:=
equiv
:
relation
A
.
Class
Equiv
A
:=
equiv
:
relation
A
.
Typeclasses
Opaque
equiv
.
(* No Typeclasses Opaque because we often rely on [≡] being unified with [=] in
case of types with Leibniz equality as [≡].
Typeclasses Opaque equiv. *)
(* No Hint Mode set because of Coq bug #5735
(* No Hint Mode set because of Coq bug #5735
Hint Mode Equiv ! : typeclass_instances. *)
Hint Mode Equiv ! : typeclass_instances. *)
...
@@ -239,8 +243,6 @@ Ltac unfold_leibniz := repeat
...
@@ -239,8 +243,6 @@ Ltac unfold_leibniz := repeat
end
.
end
.
Definition
equivL
{
A
}
:
Equiv
A
:=
(
=
)
.
Definition
equivL
{
A
}
:
Equiv
A
:=
(
=
)
.
Instance
equivL_equivalence
{
A
}
:
Equivalence
(
@
equiv
A
equivL
)
.
Proof
.
unfold
equiv
;
apply
_
.
Qed
.
(** A [Params f n] instance forces the setoid rewriting mechanism not to
(** A [Params f n] instance forces the setoid rewriting mechanism not to
rewrite in the first [n] arguments of the function [f]. We will declare such
rewrite in the first [n] arguments of the function [f]. We will declare such
...
@@ -663,14 +665,12 @@ Section prod_relation.
...
@@ -663,14 +665,12 @@ Section prod_relation.
End
prod_relation
.
End
prod_relation
.
Instance
prod_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
*
B
)
:=
prod_relation
(
≡
)
(
≡
)
.
Instance
prod_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
*
B
)
:=
prod_relation
(
≡
)
(
≡
)
.
Instance
pair_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(
@
pair
A
B
)
.
Instance
pair_proper
`{
Equiv
A
,
Equiv
B
}
:
Proof
.
apply
pair_proper'
.
Qed
.
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(
@
pair
A
B
)
:=
_
.
Instance
pair_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj2
(
≡
)
(
≡
)
(
≡
)
(
@
pair
A
B
)
.
Instance
pair_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj2
(
≡
)
(
≡
)
(
≡
)
(
@
pair
A
B
)
:=
_
.
Proof
.
apply
pair_inj'
.
Qed
.
Instance
fst_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
fst
A
B
)
:=
_
.
Instance
fst_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
fst
A
B
)
.
Instance
snd_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
snd
A
B
)
:=
_
.
Proof
.
apply
fst_proper'
.
Qed
.
Typeclasses
Opaque
prod_equiv
.
Instance
snd_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
snd
A
B
)
.
Proof
.
apply
snd_proper'
.
Qed
.
Instance
prod_leibniz
`{
LeibnizEquiv
A
,
LeibnizEquiv
B
}
:
LeibnizEquiv
(
A
*
B
)
.
Instance
prod_leibniz
`{
LeibnizEquiv
A
,
LeibnizEquiv
B
}
:
LeibnizEquiv
(
A
*
B
)
.
Proof
.
intros
[??]
[??]
[??];
f_equal
;
apply
leibniz_equiv
;
auto
.
Qed
.
Proof
.
intros
[??]
[??]
[??];
f_equal
;
apply
leibniz_equiv
;
auto
.
Qed
.
...
@@ -724,14 +724,11 @@ Section sum_relation.
...
@@ -724,14 +724,11 @@ Section sum_relation.
End
sum_relation
.
End
sum_relation
.
Instance
sum_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
+
B
)
:=
sum_relation
(
≡
)
(
≡
)
.
Instance
sum_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
+
B
)
:=
sum_relation
(
≡
)
(
≡
)
.
Instance
inl_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
inl
A
B
)
.
Instance
inl_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
inl
A
B
)
:=
_
.
Proof
.
apply
inl_proper'
.
Qed
.
Instance
inr_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
inr
A
B
)
:=
_
.
Instance
inr_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
inr
A
B
)
.
Instance
inl_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj
(
≡
)
(
≡
)
(
@
inl
A
B
)
:=
_
.
Proof
.
apply
inr_proper'
.
Qed
.
Instance
inl_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj
(
≡
)
(
≡
)
(
@
inl
A
B
)
.
Proof
.
apply
inl_inj'
.
Qed
.
Instance
inr_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj
(
≡
)
(
≡
)
(
@
inr
A
B
)
:=
_
.
Instance
inr_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj
(
≡
)
(
≡
)
(
@
inr
A
B
)
:=
_
.
Proof
.
apply
inr_inj'
.
Qed
.
Typeclasses
Opaque
sum_equiv
.
(** ** Option *)
(** ** Option *)
Instance
option_inhabited
{
A
}
:
Inhabited
(
option
A
)
:=
populate
None
.
Instance
option_inhabited
{
A
}
:
Inhabited
(
option
A
)
:=
populate
None
.
...
...
This diff is collapsed.
Click to expand it.
theories/option.v
+
1
−
1
View file @
848e15e7
...
@@ -122,7 +122,7 @@ Section setoids.
...
@@ -122,7 +122,7 @@ Section setoids.
Global
Instance
option_equivalence
:
Global
Instance
option_equivalence
:
Equivalence
(
≡@
{
A
})
→
Equivalence
(
≡@
{
option
A
})
.
Equivalence
(
≡@
{
A
})
→
Equivalence
(
≡@
{
option
A
})
.
Proof
.
apply
option_Forall2_equiv
.
Qed
.
Proof
.
apply
_
.
Qed
.
Global
Instance
Some_proper
:
Proper
((
≡
)
==>
(
≡@
{
option
A
}))
Some
.
Global
Instance
Some_proper
:
Proper
((
≡
)
==>
(
≡@
{
option
A
}))
Some
.
Proof
.
by
constructor
.
Qed
.
Proof
.
by
constructor
.
Qed
.
Global
Instance
Some_equiv_inj
:
Inj
(
≡
)
(
≡@
{
option
A
})
Some
.
Global
Instance
Some_equiv_inj
:
Inj
(
≡
)
(
≡@
{
option
A
})
Some
.
...
...
This diff is collapsed.
Click to expand it.
theories/streams.v
+
3
−
3
View file @
848e15e7
...
@@ -40,9 +40,9 @@ Lemma scons_equiv s1 s2 : shead s1 = shead s2 → stail s1 ≡ stail s2 → s1
...
@@ -40,9 +40,9 @@ Lemma scons_equiv s1 s2 : shead s1 = shead s2 → stail s1 ≡ stail s2 → s1
Proof
.
by
constructor
.
Qed
.
Proof
.
by
constructor
.
Qed
.
Global
Instance
equal_equivalence
:
Equivalence
(
≡@
{
stream
A
})
.
Global
Instance
equal_equivalence
:
Equivalence
(
≡@
{
stream
A
})
.
Proof
.
Proof
.
unfold
equiv
,
stream_equiv
.
split
.
split
.
-
cofix
FIX
;
intros
[??];
by
constructor
.
-
now
cofix
FIX
;
intros
[??];
constructor
.
-
cofix
FIX
;
intros
??
[??];
by
constructor
.
-
now
cofix
FIX
;
intros
??
[??];
constructor
.
-
cofix
FIX
;
intros
???
[??]
[??];
constructor
;
etrans
;
eauto
.
-
cofix
FIX
;
intros
???
[??]
[??];
constructor
;
etrans
;
eauto
.
Qed
.
Qed
.
Global
Instance
scons_proper
x
:
Proper
((
≡
)
==>
(
≡
))
(
scons
x
)
.
Global
Instance
scons_proper
x
:
Proper
((
≡
)
==>
(
≡
))
(
scons
x
)
.
...
...
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