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
a9f17aea
Commit
a9f17aea
authored
Nov 10, 2008
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extensional exercise
parent
caedb995
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
Extensional.v
src/Extensional.v
+20
-6
Intro.v
src/Intro.v
+1
-1
toc.html
src/toc.html
+1
-1
No files found.
src/Extensional.v
View file @
a9f17aea
...
@@ -16,7 +16,7 @@ Set Implicit Arguments.
...
@@ -16,7 +16,7 @@ Set Implicit Arguments.
(
*
end
hide
*
)
(
*
end
hide
*
)
(
**
%
\
chapter
{
Certifying
Extensional
Transformations
}%
*
)
(
**
%
\
chapter
{
Extensional
Transformations
}%
*
)
(
**
TODO
:
Prose
for
this
chapter
*
)
(
**
TODO
:
Prose
for
this
chapter
*
)
...
@@ -108,22 +108,22 @@ Module STLC.
...
@@ -108,22 +108,22 @@ Module STLC.
Variables
var1
var2
:
type
->
Type
.
Variables
var1
var2
:
type
->
Type
.
Inductive
exp_equiv
:
list
{
t
:
type
&
var1
t
*
var2
t
}%
type
->
forall
t
,
exp
var1
t
->
exp
var2
t
->
Prop
:=
Inductive
exp_equiv
:
list
{
t
:
type
&
var1
t
*
var2
t
}%
type
->
forall
t
,
exp
var1
t
->
exp
var2
t
->
Prop
:=
|
Eq
E
Var
:
forall
G
t
(
v1
:
var1
t
)
v2
,
|
EqVar
:
forall
G
t
(
v1
:
var1
t
)
v2
,
In
(
existT
_
t
(
v1
,
v2
))
G
In
(
existT
_
t
(
v1
,
v2
))
G
->
exp_equiv
G
(#
v1
)
(#
v2
)
->
exp_equiv
G
(#
v1
)
(#
v2
)
|
Eq
E
Const
:
forall
G
n
,
|
EqConst
:
forall
G
n
,
exp_equiv
G
(
^
n
)
(
^
n
)
exp_equiv
G
(
^
n
)
(
^
n
)
|
Eq
E
Plus
:
forall
G
x1
y1
x2
y2
,
|
EqPlus
:
forall
G
x1
y1
x2
y2
,
exp_equiv
G
x1
x2
exp_equiv
G
x1
x2
->
exp_equiv
G
y1
y2
->
exp_equiv
G
y1
y2
->
exp_equiv
G
(
x1
+^
y1
)
(
x2
+^
y2
)
->
exp_equiv
G
(
x1
+^
y1
)
(
x2
+^
y2
)
|
Eq
E
App
:
forall
G
t1
t2
(
f1
:
exp
_
(
t1
-->
t2
))
(
x1
:
exp
_
t1
)
f2
x2
,
|
EqApp
:
forall
G
t1
t2
(
f1
:
exp
_
(
t1
-->
t2
))
(
x1
:
exp
_
t1
)
f2
x2
,
exp_equiv
G
f1
f2
exp_equiv
G
f1
f2
->
exp_equiv
G
x1
x2
->
exp_equiv
G
x1
x2
->
exp_equiv
G
(
f1
@
x1
)
(
f2
@
x2
)
->
exp_equiv
G
(
f1
@
x1
)
(
f2
@
x2
)
|
Eq
E
Abs
:
forall
G
t1
t2
(
f1
:
var1
t1
->
exp
var1
t2
)
f2
,
|
EqAbs
:
forall
G
t1
t2
(
f1
:
var1
t1
->
exp
var1
t2
)
f2
,
(
forall
v1
v2
,
exp_equiv
(
existT
_
t1
(
v1
,
v2
)
::
G
)
(
f1
v1
)
(
f2
v2
))
(
forall
v1
v2
,
exp_equiv
(
existT
_
t1
(
v1
,
v2
)
::
G
)
(
f1
v1
)
(
f2
v2
))
->
exp_equiv
G
(
Abs
f1
)
(
Abs
f2
)
.
->
exp_equiv
G
(
Abs
f1
)
(
Abs
f2
)
.
End
exp_equiv
.
End
exp_equiv
.
...
@@ -1003,3 +1003,17 @@ Module PatMatch.
...
@@ -1003,3 +1003,17 @@ Module PatMatch.
Qed
.
Qed
.
End
PatMatch
.
End
PatMatch
.
(
**
*
Exercises
*
)
(
**
%
\
begin
{
enumerate
}%
#
<
ol
>
#
%
\
item
%
#
<
li
>
#
When
in
the
last
chapter
we
implemented
constant
folding
for
simply
-
typed
lambda
calculus
,
it
may
have
seemed
natural
to
try
applying
beta
reductions
.
This
would
have
been
a
lot
more
trouble
than
is
apparent
at
first
,
because
we
would
have
needed
to
convince
Coq
that
our
normalizing
function
always
terminated
.
It
might
also
seem
that
beta
reduction
is
a
lost
cause
because
we
have
no
effective
way
of
substituting
in
the
[
exp
]
type
;
we
only
managed
to
write
a
substitution
function
for
the
parametric
[
Exp
]
type
.
This
is
not
as
big
of
a
problem
as
it
seems
.
For
instance
,
for
the
language
we
built
by
extending
simply
-
typed
lambda
calculus
with
products
and
sums
,
it
also
appears
that
we
need
substitution
for
simplifying
[
case
]
expressions
whose
discriminees
are
known
to
be
[
inl
]
or
[
inr
]
,
but
the
function
is
still
implementable
.
For
this
exercise
,
extend
the
products
and
sums
constant
folder
from
the
last
chapter
so
that
it
simplifies
[
case
]
expressions
as
well
,
by
checking
if
the
discriminee
is
a
known
[
inl
]
or
known
[
inr
]
.
Also
extend
the
correctness
theorem
to
apply
to
your
new
definition
.
You
will
probably
want
to
assert
an
axiom
relating
to
an
expression
equivalence
relation
like
the
one
defined
in
this
chapter
.
#
</
li
>
#
#
</
ol
>
#
%
\
end
{
enumerate
}%
*
)
src/Intro.v
View file @
a9f17aea
...
@@ -209,7 +209,7 @@ Higher-Order Abstract Syntax & \texttt{Hoas.v} \\
...
@@ -209,7 +209,7 @@ Higher-Order Abstract Syntax & \texttt{Hoas.v} \\
\
hline
\
hline
Type
-
Theoretic
Interpreters
&
\
texttt
{
Interps
.
v
}
\
\
Type
-
Theoretic
Interpreters
&
\
texttt
{
Interps
.
v
}
\
\
\
hline
\
hline
Certifying
Extensional
Transformations
&
\
texttt
{
Extensional
.
v
}
\
\
Extensional
Transformations
&
\
texttt
{
Extensional
.
v
}
\
\
\
hline
\
hline
\
end
{
tabular
}
\
end
{
center
}
\
end
{
tabular
}
\
end
{
center
}
...
...
src/toc.html
View file @
a9f17aea
...
@@ -18,6 +18,6 @@
...
@@ -18,6 +18,6 @@
<li><a
href=
"Firstorder.html"
>
First-Order Abstract Syntax
</a>
<li><a
href=
"Firstorder.html"
>
First-Order Abstract Syntax
</a>
<li><a
href=
"Hoas.html"
>
Higher-Order Abstract Syntax
</a>
<li><a
href=
"Hoas.html"
>
Higher-Order Abstract Syntax
</a>
<li><a
href=
"Interps.html"
>
Type-Theoretic Interpreters
</a>
<li><a
href=
"Interps.html"
>
Type-Theoretic Interpreters
</a>
<li><a
href=
"Extensional.html"
>
Certifying
Extensional Transformations
</a>
<li><a
href=
"Extensional.html"
>
Extensional Transformations
</a>
</body></html>
</body></html>
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