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
529da1b1
Commit
529da1b1
authored
Jan 18, 2013
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass through Chapter 3
parent
2c49c95d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
InductiveTypes.v
src/InductiveTypes.v
+3
-3
No files found.
src/InductiveTypes.v
View file @
529da1b1
...
...
@@ -69,7 +69,7 @@ One of the first types we introduce will be [bool], with constructors [true] and
(
**
*
Enumerations
*
)
(
**
Coq
inductive
types
generalize
the
%
\
index
{
algebraic
datatypes
}%
algebraic
datatypes
found
in
%
\
index
{
Haskell
}%
Haskell
and
%
\
index
{
ML
}%
ML
.
Confusingly
enough
,
inductive
types
also
generalize
%
\
index
{
generalized
algebraic
datatypes
}%
generalized
algebraic
datatypes
(
GADTs
)
,
by
adding
the
possibility
for
type
dependency
.
Even
so
,
it
is
worth
backing
up
from
the
examples
of
the
last
chapter
and
going
over
basic
,
algebraic
datatype
uses
of
inductive
datatypes
,
because
the
chance
to
prove
things
about
the
values
of
these
types
adds
new
wrinkles
beyond
usual
practice
in
Haskell
and
ML
.
(
**
Coq
inductive
types
generalize
the
%
\
index
{
algebraic
datatypes
}%
algebraic
datatypes
found
in
%
\
index
{
Haskell
}%
Haskell
and
%
\
index
{
ML
}%
ML
.
Confusingly
enough
,
inductive
types
also
generalize
%
\
index
{
generalized
algebraic
datatypes
}%
generalized
algebraic
datatypes
(
GADTs
)
,
by
adding
the
possibility
for
type
dependency
.
Even
so
,
it
is
worth
backing
up
from
the
examples
of
the
last
chapter
and
going
over
basic
,
algebraic
-
datatype
uses
of
inductive
datatypes
,
because
the
chance
to
prove
things
about
the
values
of
these
types
adds
new
wrinkles
beyond
usual
practice
in
Haskell
and
ML
.
The
singleton
type
[
unit
]
is
an
inductive
type
:%
\
index
{
Gallina
terms
!
unit
}
\
index
{
Gallina
terms
!
tt
}%
*
)
...
...
@@ -151,7 +151,7 @@ We can also apply this get-out-of-jail-free card programmatically. Here is a la
Definition
e2u
(
e
:
Empty_set
)
:
unit
:=
match
e
with
end
.
(
**
We
employ
[
match
]
pattern
matching
as
in
the
last
chapter
.
Since
we
match
on
a
value
whose
type
has
no
constructors
,
there
is
no
need
to
provide
any
branches
.
This
idiom
may
look
familiar
;
we
employed
it
with
proofs
of
[
False
]
in
the
last
section
.
In
fact
,
[
Empty_set
]
is
the
Curry
-
Howard
equivalent
of
[
False
]
.
As
for
why
[
Empty_set
]
starts
with
a
capital
letter
and
not
a
lowercase
letter
like
[
unit
]
does
,
we
must
refer
the
reader
to
the
authors
of
the
Coq
standard
library
,
to
which
we
try
to
be
faithful
.
(
**
We
employ
[
match
]
pattern
matching
as
in
the
last
chapter
.
Since
we
match
on
a
value
whose
type
has
no
constructors
,
there
is
no
need
to
provide
any
branches
.
It
turns
out
that
[
Empty_set
]
is
the
Curry
-
Howard
equivalent
of
[
False
]
.
As
for
why
[
Empty_set
]
starts
with
a
capital
letter
and
not
a
lowercase
letter
like
[
unit
]
does
,
we
must
refer
the
reader
to
the
authors
of
the
Coq
standard
library
,
to
which
we
try
to
be
faithful
.
%
\
medskip
%
...
...
@@ -801,7 +801,7 @@ fix F (n : nat) : P n :=
P
O
->
(
forall
n
:
nat
,
P
n
->
P
(
S
n
))
->
forall
n
:
nat
,
P
n
]]
The
only
new
wrinkle
heres
are
,
first
,
an
anonymous
recursive
function
definition
,
using
the
%
\
index
{
Gallina
terms
!
fix
}%
[
fix
]
keyword
of
Gallina
(
which
is
like
[
fun
]
with
recursion
supported
)
;
and
,
second
,
the
annotations
on
the
[
match
]
expression
.
This
is
a
%
\
index
{
dependent
pattern
matching
}%
_
dependently
typed_
pattern
match
,
because
the
_
type_
of
the
expression
depends
on
the
_
value_
being
matched
on
.
We
will
meet
more
involved
examples
later
,
especially
in
Part
II
of
the
book
.
The
only
new
wrinkle
s
here
are
,
first
,
an
anonymous
recursive
function
definition
,
using
the
%
\
index
{
Gallina
terms
!
fix
}%
[
fix
]
keyword
of
Gallina
(
which
is
like
[
fun
]
with
recursion
supported
)
;
and
,
second
,
the
annotations
on
the
[
match
]
expression
.
This
is
a
%
\
index
{
dependent
pattern
matching
}%
_
dependently
typed_
pattern
match
,
because
the
_
type_
of
the
expression
depends
on
the
_
value_
being
matched
on
.
We
will
meet
more
involved
examples
later
,
especially
in
Part
II
of
the
book
.
%
\
index
{
type
inference
}%
Type
inference
for
dependent
pattern
matching
is
undecidable
,
which
can
be
proved
by
reduction
from
%
\
index
{
higher
-
order
unification
}%
higher
-
order
unification
%~
\
cite
{
HOU
}%.
Thus
,
we
often
find
ourselves
needing
to
annotate
our
programs
in
a
way
that
explains
dependencies
to
the
type
checker
.
In
the
example
of
[
nat_rect
]
,
we
have
an
%
\
index
{
Gallina
terms
!
as
}%
[
as
]
clause
,
which
binds
a
name
for
the
discriminee
;
and
a
%
\
index
{
Gallina
terms
!
return
}%
[
return
]
clause
,
which
gives
a
way
to
compute
the
[
match
]
result
type
as
a
function
of
the
discriminee
.
...
...
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