Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alphaLib
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
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
POTTIER Francois
alphaLib
Commits
77240a60
Commit
77240a60
authored
Feb 03, 2017
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming.
parent
40990b1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
src/KitSubst.ml
src/KitSubst.ml
+11
-11
No files found.
src/KitSubst.ml
View file @
77240a60
(* This kit serves to construct a [subst] function for terms -- a function
that substitutes things (possibly terms) for atoms. *)
(* An environment is a map
[sigma] of atoms to things. We require every binder
[x] encountered along the way to be fresh with respect to [sigma
]. *)
(* An environment is a map
of atoms to things. We require every binder [x]
encountered along the way to be fresh with respect to [env
]. *)
type
'
thing
env
=
'
thing
Atom
.
Map
.
t
let
extend
x
sigma
=
(* We would like to check that [x] is fresh for [
sigma
], but can only
let
extend
x
env
=
(* We would like to check that [x] is fresh for [
env
], but can only
perform the domain check. The codomain check cannot be performed
since the type of things is abstract here. *)
assert
(
not
(
Atom
.
Map
.
mem
x
sigma
));
(* Since [x] is fresh for [
sigma
], no capture is possible. Thus, no
assert
(
not
(
Atom
.
Map
.
mem
x
env
));
(* Since [x] is fresh for [
env
], no capture is possible. Thus, no
freshening of the bound name is required. Thus, we can keep the
substitution [
sigma
], unchanged, under the binder. *)
x
,
sigma
substitution [
env
], unchanged, under the binder. *)
x
,
env
class
[
'
self
]
map
=
object
(
_
:
'
self
)
method
private
extend
=
extend
(* [visit_'fn] is not implemented, as it is up to the user to identify
variable nodes and replace them. This requires overriding a suitable
visitor method. *)
method
private
visit_'fn
_
sigma
_x
=
assert
false
method
private
visit_'fn
_
env
_x
=
assert
false
end
let
apply
(
copy
:
'
thing
->
'
thing
)
(
sigma
:
'
thing
env
)
(
env
:
'
thing
env
)
(
this
:
'
thing
)
(
x
:
Atom
.
t
)
:
'
thing
=
match
Atom
.
Map
.
find
x
sigma
with
match
Atom
.
Map
.
find
x
env
with
|
u
->
(* Copy the term that is grafted, so as to maintain global uniqueness. *)
copy
u
...
...
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