Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
alphaLib
Commits
57c56262
Commit
57c56262
authored
Feb 15, 2017
by
POTTIER Francois
Browse files
A working version of telescopes in terms of [Unbound].
parent
6af0a79a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Unbound.ml
View file @
57c56262
...
...
@@ -25,6 +25,9 @@ type 't outer =
type
(
'
p
,
'
t
)
rebind
=
'
p
*
'
t
type
(
'
p
,
'
t
)
bind
=
((
'
p
,
'
t
outer
)
rebind
)
abstraction
(* = 'p * 't *)
(*
type 't inner =
't
...
...
@@ -77,6 +80,18 @@ class virtual ['self] libmap = object (self : 'self)
let
q2
=
visit_q
penv
q1
in
p2
,
q2
(* could in principle be generated, if [visitors] supported dealing with
type parameters via functions, instead of via virtual methods. Future work. *)
method
private
visit_bind
:
'
p1
'
p2
'
t1
'
t2
.
(
'
env
outside_rec_penv
->
'
p1
->
'
p2
)
->
(
'
env
->
'
t1
->
'
t2
)
->
'
env
->
(
'
p1
,
'
t1
)
rebind
->
(
'
p2
,
'
t2
)
rebind
=
fun
visit_p
visit_t
env
pt1
->
self
#
visit_abstraction
(
self
#
visit_rebind
visit_p
(
self
#
visit_outer
visit_t
))
env
pt1
(*
method private visit_inner: 't1 't2 .
('env -> 't1 -> 't2) ->
...
...
@@ -103,32 +118,13 @@ class virtual ['self] libmap = object (self : 'self)
end
type
(
'
p
,
'
t
)
bind
=
((
'
p
,
'
t
outer
)
rebind
)
abstraction
[
@@
deriving
visitors
{
variety
=
"map"
;
name
=
"bind_map"
;
ancestors
=
[
"libmap"
];
public
=
[]
}]
type
(
'
bn
,
'
term
)
tele
=
type
(
'
bn
,
'
fn
)
tele
=
|
TeleNil
|
TeleCons
of
(
'
bn
binder
*
'
term
outer
,
(
'
bn
,
'
term
)
tele
)
rebind
[
@@
deriving
visitors
{
variety
=
"map"
;
name
=
"tele_map"
;
ancestors
=
[
"libmap"
];
public
=
[]
}]
type
(
'
bn
,
'
fn
)
term
=
|
TVar
of
'
fn
|
TPi
of
((
'
bn
,
(
'
bn
,
'
fn
)
term
)
tele
,
(
'
bn
,
'
fn
)
term
)
bind
(*
type 'bn pat =
| PZero
| POne
| PVar of 'bn
| PTuple of 'bn pat list
| PConj of 'bn pat * 'bn pat
| PDisj of 'bn pat * 'bn pat
and ('bn, 'fn) expr =
| EVar of 'fn
| EAdd of ('bn, 'fn) expr * ('bn, 'fn) expr
| ELet of ('bn pat, ('bn, 'fn) expr) bind
|
TeleCons
of
(
'
bn
binder
*
(
'
bn
,
'
fn
)
term
outer
,
(
'
bn
,
'
fn
)
tele
)
rebind
and
(
'
bn
,
'
fn
)
term
=
|
Var
of
'
fn
|
Pi
of
((
'
bn
,
'
fn
)
tele
,
(
'
bn
,
'
fn
)
term
)
bind
|
Lam
of
((
'
bn
,
'
fn
)
tele
,
(
'
bn
,
'
fn
)
term
)
bind
|
App
of
(
'
bn
,
'
fn
)
term
*
(
'
bn
,
'
fn
)
term
list
[
@@
deriving
visitors
{
variety
=
"map"
;
ancestors
=
[
"libmap"
]
}]
*)
Write
Preview
Supports
Markdown
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