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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
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
Adam
stdpp
Commits
f8749520
Commit
f8749520
authored
3 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
`Proper` instances for `curry` and friends.
parent
9128b1f7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/base.v
+70
-15
70 additions, 15 deletions
theories/base.v
with
70 additions
and
15 deletions
theories/base.v
+
70
−
15
View file @
f8749520
...
@@ -718,36 +718,91 @@ Definition prod_relation {A B} (R1 : relation A) (R2 : relation B) :
...
@@ -718,36 +718,91 @@ Definition prod_relation {A B} (R1 : relation A) (R2 : relation B) :
relation
(
A
*
B
)
:=
λ
x
y
,
R1
(
x
.
1
)
(
y
.
1
)
∧
R2
(
x
.
2
)
(
y
.
2
)
.
relation
(
A
*
B
)
:=
λ
x
y
,
R1
(
x
.
1
)
(
y
.
1
)
∧
R2
(
x
.
2
)
(
y
.
2
)
.
Section
prod_relation
.
Section
prod_relation
.
Context
`{
R
1
:
relation
A
,
R
2
:
relation
B
}
.
Context
`{
R
A
:
relation
A
,
R
B
:
relation
B
}
.
Global
Instance
prod_relation_refl
:
Global
Instance
prod_relation_refl
:
Reflexive
R
1
→
Reflexive
R
2
→
Reflexive
(
prod_relation
R
1
R
2
)
.
Reflexive
R
A
→
Reflexive
R
B
→
Reflexive
(
prod_relation
R
A
R
B
)
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
prod_relation_sym
:
Global
Instance
prod_relation_sym
:
Symmetric
R
1
→
Symmetric
R
2
→
Symmetric
(
prod_relation
R
1
R
2
)
.
Symmetric
R
A
→
Symmetric
R
B
→
Symmetric
(
prod_relation
R
A
R
B
)
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
prod_relation_trans
:
Global
Instance
prod_relation_trans
:
Transitive
R
1
→
Transitive
R
2
→
Transitive
(
prod_relation
R
1
R
2
)
.
Transitive
R
A
→
Transitive
R
B
→
Transitive
(
prod_relation
R
A
R
B
)
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
prod_relation_equiv
:
Global
Instance
prod_relation_equiv
:
Equivalence
R
1
→
Equivalence
R
2
→
Equivalence
(
prod_relation
R
1
R
2
)
.
Equivalence
R
A
→
Equivalence
R
B
→
Equivalence
(
prod_relation
R
A
R
B
)
.
Proof
.
split
;
apply
_
.
Qed
.
Proof
.
split
;
apply
_
.
Qed
.
Global
Instance
pair_proper'
:
Proper
(
R
1
==>
R
2
==>
prod_relation
R
1
R
2
)
pair
.
Global
Instance
pair_proper'
:
Proper
(
R
A
==>
R
B
==>
prod_relation
R
A
R
B
)
pair
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
pair_inj'
:
Inj2
R
1
R
2
(
prod_relation
R
1
R
2
)
pair
.
Global
Instance
pair_inj'
:
Inj2
R
A
R
B
(
prod_relation
R
A
R
B
)
pair
.
Proof
.
inversion_clear
1
;
eauto
.
Qed
.
Proof
.
inversion_clear
1
;
eauto
.
Qed
.
Global
Instance
fst_proper'
:
Proper
(
prod_relation
R1
R2
==>
R1
)
fst
.
Global
Instance
fst_proper'
:
Proper
(
prod_relation
RA
RB
==>
RA
)
fst
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
snd_proper'
:
Proper
(
prod_relation
RA
RB
==>
RB
)
snd
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
curry_proper'
`{
RC
:
relation
C
}
:
Proper
((
prod_relation
RA
RB
==>
RC
)
==>
RA
==>
RB
==>
RC
)
curry
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
snd_proper'
:
Proper
(
prod_relation
R1
R2
==>
R2
)
snd
.
Global
Instance
uncurry_proper'
`{
RC
:
relation
C
}
:
Proper
((
RA
==>
RB
==>
RC
)
==>
prod_relation
RA
RB
==>
RC
)
uncurry
.
Proof
.
intros
f1
f2
Hf
[
x1
y1
]
[
x2
y2
]
[];
apply
Hf
;
assumption
.
Qed
.
Global
Instance
curry3_proper'
`{
RC
:
relation
C
,
RD
:
relation
D
}
:
Proper
((
prod_relation
(
prod_relation
RA
RB
)
RC
==>
RD
)
==>
RA
==>
RB
==>
RC
==>
RD
)
curry3
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
uncurry3_proper'
`{
RC
:
relation
C
,
RD
:
relation
D
}
:
Proper
((
RA
==>
RB
==>
RC
==>
RD
)
==>
prod_relation
(
prod_relation
RA
RB
)
RC
==>
RD
)
uncurry3
.
Proof
.
intros
f1
f2
Hf
[[??]
?]
[[??]
?]
[[??]
?];
apply
Hf
;
assumption
.
Qed
.
Global
Instance
curry4_proper'
`{
RC
:
relation
C
,
RD
:
relation
D
,
RE
:
relation
E
}
:
Proper
((
prod_relation
(
prod_relation
(
prod_relation
RA
RB
)
RC
)
RD
==>
RE
)
==>
RA
==>
RB
==>
RC
==>
RD
==>
RE
)
curry4
.
Proof
.
firstorder
eauto
.
Qed
.
Proof
.
firstorder
eauto
.
Qed
.
Global
Instance
uncurry5_proper'
`{
RC
:
relation
C
,
RD
:
relation
D
,
RE
:
relation
E
}
:
Proper
((
RA
==>
RB
==>
RC
==>
RD
==>
RE
)
==>
prod_relation
(
prod_relation
(
prod_relation
RA
RB
)
RC
)
RD
==>
RE
)
uncurry4
.
Proof
.
intros
f1
f2
Hf
[[[??]
?]
?]
[[[??]
?]
?]
[[[??]
?]
?];
apply
Hf
;
assumption
.
Qed
.
End
prod_relation
.
End
prod_relation
.
Global
Instance
prod_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
*
B
)
:=
prod_relation
(
≡
)
(
≡
)
.
Global
Instance
prod_equiv
`{
Equiv
A
,
Equiv
B
}
:
Equiv
(
A
*
B
)
:=
Global
Instance
pair_proper
`{
Equiv
A
,
Equiv
B
}
:
prod_relation
(
≡
)
(
≡
)
.
Proper
((
≡
)
==>
(
≡
)
==>
(
≡
))
(
@
pair
A
B
)
:=
_
.
Global
Instance
pair_equiv_inj
`{
Equiv
A
,
Equiv
B
}
:
Inj2
(
≡
)
(
≡
)
(
≡
)
(
@
pair
A
B
)
:=
_
.
Section
prod_setoid
.
Global
Instance
fst_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
fst
A
B
)
:=
_
.
Context
`{
Equiv
A
,
Equiv
B
}
.
Global
Instance
snd_proper
`{
Equiv
A
,
Equiv
B
}
:
Proper
((
≡
)
==>
(
≡
))
(
@
snd
A
B
)
:=
_
.
Global
Instance
prod_equivalence
:
Equivalence
(
≡@
{
A
})
→
Equivalence
(
≡@
{
B
})
→
Equivalence
(
≡@
{
A
*
B
})
:=
_
.
Global
Instance
pair_proper
:
Proper
((
≡
)
==>
(
≡
)
==>
(
≡@
{
A
*
B
}))
pair
:=
_
.
Global
Instance
pair_equiv_inj
:
Inj2
(
≡
)
(
≡
)
(
≡@
{
A
*
B
})
pair
:=
_
.
Global
Instance
fst_proper
:
Proper
((
≡@
{
A
*
B
})
==>
(
≡
))
fst
:=
_
.
Global
Instance
snd_proper
:
Proper
((
≡@
{
A
*
B
})
==>
(
≡
))
snd
:=
_
.
Global
Instance
curry_proper
`{
Equiv
C
}
:
Proper
(((
≡@
{
A
*
B
})
==>
(
≡@
{
C
}))
==>
(
≡
)
==>
(
≡
)
==>
(
≡
))
curry
:=
_
.
Global
Instance
uncurry_proper
`{
Equiv
C
}
:
Proper
(((
≡
)
==>
(
≡
)
==>
(
≡
))
==>
(
≡@
{
A
*
B
})
==>
(
≡@
{
C
}))
uncurry
:=
_
.
Global
Instance
curry3_proper
`{
Equiv
C
,
Equiv
D
}
:
Proper
(((
≡@
{
A
*
B
*
C
})
==>
(
≡@
{
D
}))
==>
(
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
))
curry3
:=
_
.
Global
Instance
uncurry3_proper
`{
Equiv
C
,
Equiv
D
}
:
Proper
(((
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
))
==>
(
≡@
{
A
*
B
*
C
})
==>
(
≡@
{
D
}))
uncurry3
:=
_
.
Global
Instance
curry4_proper
`{
Equiv
C
,
Equiv
D
,
Equiv
E
}
:
Proper
(((
≡@
{
A
*
B
*
C
*
D
})
==>
(
≡@
{
E
}))
==>
(
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
))
curry4
:=
_
.
Global
Instance
uncurry4_proper
`{
Equiv
C
,
Equiv
D
,
Equiv
E
}
:
Proper
(((
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
)
==>
(
≡
))
==>
(
≡@
{
A
*
B
*
C
*
D
})
==>
(
≡@
{
E
}))
uncurry4
:=
_
.
End
prod_setoid
.
Typeclasses
Opaque
prod_equiv
.
Typeclasses
Opaque
prod_equiv
.
Global
Instance
prod_leibniz
`{
LeibnizEquiv
A
,
LeibnizEquiv
B
}
:
Global
Instance
prod_leibniz
`{
LeibnizEquiv
A
,
LeibnizEquiv
B
}
:
...
...
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