Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
ModuresErl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Software
ModuresErl
Commits
ca5dad93
Commit
ca5dad93
authored
Jul 15, 2016
by
Paul Wild
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update levels of headings
parent
cb0161db
Changes
12
Hide whitespace changes
Inline
Sidebyside
Showing
12 changed files
with
75 additions
and
68 deletions
+75
68
project/Binary/Compatibility.v
project/Binary/Compatibility.v
+1
3
project/Binary/LogRel.v
project/Binary/LogRel.v
+3
1
project/Binary/Parametricity.v
project/Binary/Parametricity.v
+6
5
project/Binary/QueueDefinitions.v
project/Binary/QueueDefinitions.v
+21
19
project/BinaryTyped/Compatibility.v
project/BinaryTyped/Compatibility.v
+0
2
project/BinaryTyped/LogRel.v
project/BinaryTyped/LogRel.v
+1
1
project/BinaryTyped/WeakSubSyntactic.v
project/BinaryTyped/WeakSubSyntactic.v
+1
1
project/Common/Language.v
project/Common/Language.v
+1
1
project/Common/Lib.v
project/Common/Lib.v
+1
1
project/Common/Tactics.v
project/Common/Tactics.v
+37
32
project/Makefile
project/Makefile
+1
1
project/Unary/LogRel.v
project/Unary/LogRel.v
+2
1
No files found.
project/Binary/Compatibility.v
View file @
ca5dad93
...
...
@@ 3,9 +3,7 @@ Require Import ModuRes.Constr ModuRes.UPred ModuRes.COFE.
Require
Import
Omega
.
Require
Import
Common
.
Language
Common
.
Lib
Binary
.
LogRel
Binary
.
WeakSub
.
(
**
*
Compatibility
Lemmas
Having
proven
the
Weakening
and
Substitution
properties
we
can
now
(
**
Having
proven
the
Weakening
and
Substitution
properties
we
can
now
turn
to
the
proof
of
the
Fundamental
property
,
which
is
that
every
well

typed
term
is
logically
related
to
itself
.
On
the
road
to
that
proof
we
once
more
encounter
the
Compatibility
lemmas
,
which
are
...
...
project/Binary/LogRel.v
View file @
ca5dad93
...
...
@@ 16,7 +16,9 @@ Proof.
intros
e
e
'
HS
HI
;
unfold
flip
in
HS
;
simpl
in
HS
;
subst
;
assumption
.
Qed
.
(
**
**
Constructions
(
**
*
Chapter
2.
A
binary
logical
relation
for
contextual
approximation
**
Constructions
We
now
turn
to
building
a
LR
for
contextual
approximation
,
which
is
going
to
be
binary
.
As
in
the
unary
case
,
we
first
need
to
consider
what
the
space
[
T
]
of
...
...
project/Binary/Parametricity.v
View file @
ca5dad93
...
...
@@ 3,13 +3,14 @@ Require Import ModuRes.Constr ModuRes.UPred ModuRes.COFE.
Require
Import
Omega
List
.
Require
Import
Common
.
Language
Common
.
Lib
Binary
.
LogRel
Binary
.
WeakSub
Binary
.
Compatibility
.
(
**
In
this
file
,
we
prove
a
very
simple
free
theorem
using
our
logical
relation
:
(
**
**
A
parametricity
result
In
this
file
,
we
prove
a
very
simple
free
theorem
using
our
logical
relation
:

If
[
e
]
is
a
well

typed
term
of
type
[
∀
##
0
→
##
0
],
then
it
approximates
the
(
polymorphic
)
identity
function
[
id
=
Λ
(
λ
#
0
)].

If
[
e
]
is
a
well

typed
term
of
type
[
∀
##
0
→
##
0
],
then
it
approximates
the
(
polymorphic
)
identity
function
[
id
=
Λ
(
λ
#
0
)].
We
will
prove
that
for
such
[
e
],
[
logrel
0
∅
(
e
•
@
v
)
v
t
]
for
any
[
v
]
of
type
[
t
].
We
will
prove
that
for
such
[
e
],
[
logrel
0
∅
(
e
•
@
v
)
v
t
]
for
any
[
v
]
of
type
[
t
].
*
)
Open
Scope
lang_scope
.
...
...
project/Binary/QueueDefinitions.v
View file @
ca5dad93
Require
Import
DBLib
.
DeBruijn
DBLib
.
Environments
.
Require
Import
Common
.
Language
Common
.
Lib
Common
.
Tactics
.
(
**
As
an
example
application
of
the
logical
relation
we
are
going
to
give
a
Coq
solution
to
exercise
2
from
homework
sheet
4
of
Lars
Birkedal
'
s
course
on
"Semantics of programming languages"
.
In
it
,
we
are
given
two
implementations
of
an
abstract
queue
datatype
and
need
to
show
that
one
approximates
the
other
.
In
this
file
,
we
first
formalize
the
two
implementations
as
faithfully
as
possible
in
our
object
language
,
and
use
the
[
check_type
]
tactic
from
[
Tactics
.
v
]
to
show
that
the
so
defined
expressions
have
the
correct
types
.
(
**
An
example
with
queues
As
an
example
application
of
the
logical
relation
we
are
going
to
give
a
Coq
solution
to
exercise
2
from
homework
sheet
4
of
Lars
Birkedal
'
s
course
on
"Semantics of programming languages"
.
In
it
,
we
are
given
two
implementations
of
an
abstract
queue
datatype
and
need
to
show
that
one
approximates
the
other
.
In
this
file
,
we
first
formalize
the
two
implementations
as
faithfully
as
possible
in
our
object
language
,
and
use
the
[
check_type
]
tactic
from
[
Tactics
.
v
]
to
show
that
the
so
defined
expressions
have
the
correct
types
.
*
)
Open
Scope
lang_scope
.
(
**
We
begin
with
a
Cbv
fixed
point
combinator
for
functions
with
two
arguments
:
[
fix2
f
(
x
)(
y
).
e
:=
λ
y
.
(
unfold
v
)
v
y
where
v
:=
fold
(
λ
z
.
(
λ
f
.
λ
x
.
λ
y
.
e
)
(
λ
y
.
(
unfold
z
)
z
y
))]
This
is
a
version
of
the
combinator
given
in
the
LSLR
paper
adapted
for
two
argument
functions
.
(
**
***
Definitions
We
begin
with
a
Cbv
fixed
point
combinator
for
functions
with
two
arguments
:
[
fix2
f
(
x
)(
y
).
e
:=
λ
y
.
(
unfold
v
)
v
y
where
v
:=
fold
(
λ
z
.
(
λ
f
.
λ
x
.
λ
y
.
e
)
(
λ
y
.
(
unfold
z
)
z
y
))]
This
is
a
version
of
the
combinator
given
in
the
LSLR
paper
adapted
for
two
argument
functions
.
*
)
Definition
efix2
e
:=
let
v
:=
efold
(
λ
((
λ
λ
λ
e
)
@
(
λ
(
eunfold
(#
1
)
@
#
1
@
#
0
))))
...
...
project/BinaryTyped/Compatibility.v
View file @
ca5dad93
...
...
@@ 4,8 +4,6 @@ Require Import Omega.
Require
Import
Common
.
Language
Common
.
Lib
.
Require
Import
BinaryTyped
.
WeakSubSyntactic
BinaryTyped
.
LogRel
BinaryTyped
.
WeakSub
.
(
**
*
Compatibility
Lemmas
*
)
Lemma
eval_step2
{
k
}
(
t
:
typ
)
{
HC
:
closed
k
t
}
η
n
e1
e2
e2
'
(
HS
:
e2
↦
e2
'
)
:
E
[[
t
]]
η
n
(
e1
,
e2
)
==
E
[[
t
]]
η
n
(
e1
,
e2
'
).
...
...
project/BinaryTyped/LogRel.v
View file @
ca5dad93
...
...
@@ 168,7 +168,7 @@ Section Constructions.
clear
EQtp
;
simpl
in
EQR
;
clear_dups
end
.
(
**
**
*
From
Semantic
to
syntactic
type
variable
contexts
(
**
**
From
Semantic
to
syntactic
type
variable
contexts
Now
that
we
have
our
semantic
notion
of
a
type
variable
context
([
TCRel
n
],
a
map
from
the
finite
type
[
Fin
.
t
n
]
to
[
T
]),
we
need
...
...
project/BinaryTyped/WeakSubSyntactic.v
View file @
ca5dad93
...
...
@@ 4,7 +4,7 @@ Require Import Common.Language Common.Lib.
Open
Scope
lang_scope
.
(
**
*
Another
Binary
Logical
Relation
for
Contextual
Approxim
ation
(
**
*
Chapter
3.
Another
binary
logical
rel
ation
Our
third
(
and
final
)
logical
relation
will
be
another
LR
that
is
sound
with
respect
to
contextual
approximation
,
but
we
now
want
the
...
...
project/Common/Language.v
View file @
ca5dad93
(
**
*
Language
(
**
*
Chapter
0.
Language
and
common
definitions
This
file
contains
the
definition
of
the
object
language
,
i
.
e
.
the
inductive
definitions
of
types
,
expressions
,
values
as
well
as
the
typing
rules
and
the
...
...
project/Common/Lib.v
View file @
ca5dad93
...
...
@@ 19,7 +19,7 @@ Ltac commute_env ρ :=
rewrite
IH
ρ
;
simpl_subst_goal
;
reflexivity

_
=>
fail
"Can only be used on an environment."
end
.
(
**
**
Substitution
lemmas
*
)
Section
EnvSubstsCommute
.
Open
Scope
lang_scope
.
...
...
project/Common/Tactics.v
View file @
ca5dad93
...
...
@@ 3,14 +3,21 @@ Require Import Common.Language Common.Lib.
Open
Scope
lang_scope
.
(
**
**
Type
checker
and
interpreter
tactics
This
file
contains
several
tactic
definitions
that
will
be
used
when
proving
logical
approximations
between
terms
of
the
language
.
They
are
meant
to
be
used
when
the
full
structure
of
the
term
is
used

i
.
e
.
they
do
not
contain
Coq
variables

or
the
Coq
variables
they
contain
are
known
to
be
closed
and
/
or
values
.
Two
stronger
versions
of
the
[
construction_closed
]
tactic
,
to
disspell
closedness
obligations
:
*
)
Ltac
construction_closed
'
:=
try
construction_closed
;
solve
[
unfold
closed
in
*
;
simpl_lift_goal
;
repeat
(
f_equal
;
eauto
with
shift_closed
)
].
(
*
Ltac
construction_closed
'
:=
solve
[
unfold
closed
in
*
;
simpl_lift_goal
;
try
(
simpl
;
lift_idx
);
repeat
(
rewrite
<
lift_lift
);
try
congruence
;
eauto
with
omega
construction_closed
].
*
)
Ltac
construction_closed_inserts
:=
repeat
match
goal
with

[

closed
_
(
insert
0
_
_
)
]
=>
...
...
@@ 20,6 +27,11 @@ Ltac construction_closed_inserts :=
Create
HintDb
typings
.
(
**
A
simple
type

checking
tactic
.
As
the
term
language
does
not
contain
types
and
therefore
does
not
admit
unique
typing
,
this
won
'
t
always
be
enough
to
prove
any
typing
obligations
.
*
)
Ltac
check_type_rec
:=
simpl_subst_goal
;
eauto
with
typings
;
...
...
@@ 30,17 +42,8 @@ Ltac check_type_rec :=
end
;
try
check_type_rec
.
Ltac
check_type
:=
check_type_rec
;
construction_closed_inserts
.
(
*
Ltac
check_type
:=
repeat
(
eauto
with
typings
;
match
goal
with

[

[
_

_
⊢
_
:::
_
]
]
=>
econstructor

[

context
[
subst
_
_
_
]
]
=>
simpl_subst_goal
;
repeat
(
rewrite
subst_lift
)

[

closed
_
_
]
=>
construction_closed_inserts
(
*
construction_closed_inserts

solve
[
inversion_closed
;
construction_closed_inserts
]
*
)

[

lookup
_
(
insert
_
_
_
)
=
_
]
=>
repeat
lookup_insert
;
reflexivity
end
).
*
)
(
**
Do
a
step
,
depending
on
the
structure
of
the
term
.
*
)
Ltac
comp_step
:=
match
goal
with

[

π
1
〈
?
e1
,
?
e2
〉↦
_
]
=>
let
v1
:=
valify
e1
in
let
v2
:=
valify
e2
in
...
...
@@ 73,6 +76,12 @@ Ltac comp_step :=

[

eunfold
?
e
↦
_
]
=>
eapply
SCunfold
;
comp_step
end
.
(
**
This
is
a
counterpart
to
the
[
valify
]
tactic
from
[
Lib
.
v
].
We
need
to
use
it
sometimes
to
change
values
back
into
expressions
to
make
some
of
the
matches
of
[
comp_step
]
go
through
.
For
example
,
[
val_to_exp
(
vinl
v
)]
does
not
match
[
ι
l
(
val_to_exp
v
)].
*
)
Ltac
unvalify
:=
repeat
match
goal
with

[

context
[
val_to_exp
?
v
]
]
=>
...
...
@@ 88,14 +97,13 @@ Ltac unvalify :=

vfold
?
v1
=>
change
(
val_to_exp
v
)
with
(
efold
(
val_to_exp
v1
))
end
end
.
(
*
Hint
Extern
1
=>
match
goal
with

[
H
:
closed
0
?
e

context
[
shift
0
?
e
]
]
=>
rewrite
H

[
H
:
closed
0
?
e

context
[
subst
_
0
?
e
]
]
=>
rewrite
(
closed_subst_invariant
0
);
[

apply
H

omega
]
end
:
substexp
.
(
**
A
tactic
that
combines
[
simpl_lift_goal
]
and
[
simpl_subst_goal
]
that
also
recognizes
that
some
[
lift
]
s
and
[
subst
]
have
no
effect
by
checking
whether
the
term
in
question
is
closed
.
*
)
Ltac
simpl_subst_lift_goal
'
:=
autounfold
with
typings
;
unvalify
;
simpl_subst_goal
;
simpl_lift_goal
;
repeat
match
goal
with
...
...
@@ 111,6 +119,12 @@ Ltac simpl_subst_lift_goal :=

_
=>
simpl_subst_lift_goal
'
end
.
(
**
Two
tactics
to
prove
goals
of
the
form
[
e1
↦
*
e2
].
The
first
one
is
meant
to
be
used
if
[
e1
]
and
[
e2
]
are
known
,
the
second
one
should
be
used
if
there
is
a
Coq
existential
variable
in
place
of
[
e2
].
*
)
Ltac
comp_min_steps
:=
autounfold
with
typings
;
repeat
match
goal
with
...
...
@@ 125,12 +139,3 @@ Ltac comp_max_steps :=

[

mstep
_
_
]
=>
eapply
mstep0
end
.
(
*
Ltac
comp_max_steps
:=
match
goal
with

[

mstep
_
_
]
=>
simpl
;
simpl_subst_goal
;
simpl_lift_goal
;
eapply
mstepS
;
[
comp_step

];
comp_max_steps

[

mstep
_
_
]
=>
solve
[
simpl
;
simpl_subst_goal
;
simpl_lift_goal
;
eapply
mstep0
]

_
=>
idtac
end
.
*
)
project/Makefile
View file @
ca5dad93
...
...
@@ 63,7 +63,7 @@ OPT?=
COQDEP
?=
$(COQBIN)
coqdep
c
COQFLAGS
?=
q
$(OPT)
$(COQLIBS)
$(OTHERFLAGS)
$(COQ_XML)
COQCHKFLAGS
?=
silent
o
COQDOCFLAGS
?=
interpolate
utf8
COQDOCFLAGS
?=

s

interpolate
utf8
COQC
?=
$(COQBIN)
coqc
GALLINA
?=
$(COQBIN)
gallina
COQDOC
?=
$(COQBIN)
coqdoc
...
...
project/Unary/LogRel.v
View file @
ca5dad93
...
...
@@ 16,7 +16,8 @@ Proof.
intros
e
e
'
HS
HI
;
unfold
flip
in
HS
;
simpl
in
HS
;
subst
;
assumption
.
Qed
.
(
**
**
Constructions
(
**
*
Chapter
1.
A
unary
logical
relation
for
type
safety
**
Constructions
_
We
now
reach
the
interesting
part
of
the
proof
:
the
definition
of
the
logical
relation
.
As
is
usual
in
this
type
of
argument
,
we
...
...
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