Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cpdt
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
research
cpdt
Commits
78351055
Commit
78351055
authored
Nov 10, 2010
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PC changes to Equality and Generic
parent
b5ce592e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
Equality.v
src/Equality.v
+1
-1
Generic.v
src/Generic.v
+4
-4
No files found.
src/Equality.v
View file @
78351055
(
*
Copyright
(
c
)
2008
,
Adam
Chlipala
(
*
Copyright
(
c
)
2008
-
2010
,
Adam
Chlipala
*
*
This
work
is
licensed
under
a
*
Creative
Commons
Attribution
-
Noncommercial
-
No
Derivative
Works
3.0
...
...
src/Generic.v
View file @
78351055
(
*
Copyright
(
c
)
2008
-
20
09
,
Adam
Chlipala
(
*
Copyright
(
c
)
2008
-
20
10
,
Adam
Chlipala
*
*
This
work
is
licensed
under
a
*
Creative
Commons
Attribution
-
Noncommercial
-
No
Derivative
Works
3.0
...
...
@@ -18,7 +18,7 @@ Set Implicit Arguments.
(
**
%
\
chapter
{
Generic
Programming
}%
*
)
(
**
%
\
textit
{%
#
<
i
>
#
Generic
programming
#
</
i
>
#
%}%
makes
it
possible
to
write
functions
that
operate
over
different
types
of
data
.
Parametric
polymorphism
in
ML
and
Haskell
is
one
of
the
simplest
examples
.
ML
-
style
module
systems
and
Haskell
type
classes
are
more
flexible
cases
.
These
language
features
are
often
not
as
powerful
so
we
would
like
.
For
instance
,
while
Haskell
includes
a
type
class
classifying
those
types
whose
values
can
be
pretty
-
printed
,
per
-
type
pretty
-
printing
is
usually
either
implemented
manually
or
implemented
via
a
[
deriving
]
clause
,
which
triggers
ad
-
hoc
code
generation
.
Some
clever
encoding
tricks
have
been
used
to
achieve
better
within
Haskell
and
other
languages
,
but
we
can
do
datatype
-
generic
programming
much
more
cleanly
with
dependent
types
.
Thanks
to
the
expressive
power
of
CIC
,
we
need
no
special
language
support
.
(
**
%
\
textit
{%
#
<
i
>
#
Generic
programming
#
</
i
>
#
%}%
makes
it
possible
to
write
functions
that
operate
over
different
types
of
data
.
Parametric
polymorphism
in
ML
and
Haskell
is
one
of
the
simplest
examples
.
ML
-
style
module
systems
and
Haskell
type
classes
are
more
flexible
cases
.
These
language
features
are
often
not
as
powerful
as
we
would
like
.
For
instance
,
while
Haskell
includes
a
type
class
classifying
those
types
whose
values
can
be
pretty
-
printed
,
per
-
type
pretty
-
printing
is
usually
either
implemented
manually
or
implemented
via
a
[
deriving
]
clause
,
which
triggers
ad
-
hoc
code
generation
.
Some
clever
encoding
tricks
have
been
used
to
achieve
better
within
Haskell
and
other
languages
,
but
we
can
do
datatype
-
generic
programming
much
more
cleanly
with
dependent
types
.
Thanks
to
the
expressive
power
of
CIC
,
we
need
no
special
language
support
.
Generic
programming
can
often
be
very
useful
in
Coq
developments
,
so
we
devote
this
chapter
to
studying
it
.
In
a
proof
assistant
,
there
is
the
new
possibility
of
generic
proofs
about
generic
programs
,
which
we
also
devote
some
space
to
.
*
)
...
...
@@ -38,7 +38,7 @@ Record constructor : Type := Con {
recursive
:
nat
}.
(
**
The
idea
is
that
a
constructor
represented
as
[
Con
T
n
]
has
[
n
]
arguments
of
the
type
that
we
are
defining
.
Additionally
,
all
of
the
other
,
non
-
recursive
arguments
can
be
encoded
in
the
type
[
T
]
.
When
there
are
no
non
-
recursive
arguments
,
[
T
]
can
be
[
unit
]
.
When
there
are
two
non
-
recursive
arguments
,
of
types
[
A
]
and
[
B
]
,
[
T
]
can
be
[
A
*
B
]
.
We
can
generalize
r
to
any
number
of
arguments
via
tupling
.
(
**
The
idea
is
that
a
constructor
represented
as
[
Con
T
n
]
has
[
n
]
arguments
of
the
type
that
we
are
defining
.
Additionally
,
all
of
the
other
,
non
-
recursive
arguments
can
be
encoded
in
the
type
[
T
]
.
When
there
are
no
non
-
recursive
arguments
,
[
T
]
can
be
[
unit
]
.
When
there
are
two
non
-
recursive
arguments
,
of
types
[
A
]
and
[
B
]
,
[
T
]
can
be
[
A
*
B
]
.
We
can
generalize
to
any
number
of
arguments
via
tupling
.
With
this
definition
,
it
as
easy
to
define
a
datatype
representation
in
terms
of
lists
of
constructors
.
*
)
...
...
@@ -80,7 +80,7 @@ Section denote.
(
**
We
write
that
a
constructor
is
represented
as
a
function
returning
a
[
T
]
.
Such
a
function
takes
two
arguments
,
which
pack
together
the
non
-
recursive
and
recursive
arguments
of
the
constructor
.
We
represent
a
tuple
of
all
recursive
arguments
using
the
length
-
indexed
list
type
[
ilist
]
that
we
met
in
Chapter
7.
*
)
Definition
datatypeDenote
:=
hlist
constructorDenote
.
(
**
Finally
,
the
evidence
for
type
[
T
]
is
a
hetergeneous
list
,
including
a
constructor
denotation
for
every
constructor
encoding
in
a
datatype
encoding
.
Recall
that
,
since
we
are
inside
a
section
binding
[
T
]
as
a
variable
,
[
constructorDenote
]
is
automatically
parameterized
by
[
T
]
.
*
)
(
**
Finally
,
the
evidence
for
type
[
T
]
is
a
heter
o
geneous
list
,
including
a
constructor
denotation
for
every
constructor
encoding
in
a
datatype
encoding
.
Recall
that
,
since
we
are
inside
a
section
binding
[
T
]
as
a
variable
,
[
constructorDenote
]
is
automatically
parameterized
by
[
T
]
.
*
)
End
denote
.
(
*
end
thide
*
)
...
...
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