Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
stdpp
Commits
9054147a
Commit
9054147a
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Binders library that's used in many Iris developments.
parent
809e0d1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!67
Binders library that's used in many Iris developments.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
theories/binders.v
+49
-0
49 additions, 0 deletions
theories/binders.v
with
50 additions
and
0 deletions
_CoqProject
+
1
−
0
View file @
9054147a
...
...
@@ -44,3 +44,4 @@ theories/infinite.v
theories/nat_cancel.v
theories/namespaces.v
theories/telescopes.v
theories/binders.v
This diff is collapsed.
Click to expand it.
theories/binders.v
0 → 100644
+
49
−
0
View file @
9054147a
(* Copyright (c) 2012-2019, Coq-std++ developers. *)
(* This file is distributed under the terms of the BSD license. *)
(** This file implements a type [binder] with elements [BAnon] for the
anonymous binder, and [BNamed] for named binders. This type is isomorphic to
[option string], but we use a special type so that we can define [BNamed] as
a coercion.
This library is used in various Iris developments, like heap-lang, LambdaRust,
Iron, Fairis. *)
From
stdpp
Require
Export
strings
.
From
stdpp
Require
Import
sets
countable
finite
.
Inductive
binder
:=
BAnon
|
BNamed
:>
string
→
binder
.
Bind
Scope
binder_scope
with
binder
.
Delimit
Scope
binder_scope
with
binder
.
Notation
"<>"
:=
BAnon
:
binder_scope
.
Instance
binder_dec_eq
:
EqDecision
binder
.
Proof
.
solve_decision
.
Defined
.
Instance
binder_inhabited
:
Inhabited
binder
:=
populate
BAnon
.
Instance
binder_countable
:
Countable
binder
.
Proof
.
refine
(
inj_countable'
(
λ
mx
,
match
mx
with
BAnon
=>
None
|
BNamed
x
=>
Some
x
end
)
(
λ
mx
,
match
mx
with
None
=>
BAnon
|
Some
x
=>
BNamed
x
end
)
_);
by
intros
[]
.
Qed
.
(** The functions [cons_binder mx X] and [app_binder mxs X] are typically used
to collect the free variables of an expression. Here [X] is the current list of
free variables, and [mx], respectively [mxs], are the binders that are being
added. *)
Definition
cons_binder
(
mx
:
binder
)
(
X
:
list
string
)
:
list
string
:=
match
mx
with
BAnon
=>
X
|
BNamed
x
=>
x
::
X
end
.
Infix
":b:"
:=
cons_binder
(
at
level
60
,
right
associativity
)
.
Fixpoint
app_binder
(
mxs
:
list
binder
)
(
X
:
list
string
)
:
list
string
:=
match
mxs
with
[]
=>
X
|
b
::
mxs
=>
b
:
b
:
app_binder
mxs
X
end
.
Infix
"+b+"
:=
app_binder
(
at
level
60
,
right
associativity
)
.
Instance
set_unfold_cons_binder
x
mx
X
P
:
SetUnfoldElemOf
x
X
P
→
SetUnfoldElemOf
x
(
mx
:
b
:
X
)
(
BNamed
x
=
mx
∨
P
)
.
Proof
.
constructor
.
rewrite
<-
(
set_unfold
(
x
∈
X
)
P
)
.
destruct
mx
;
simpl
;
rewrite
?elem_of_cons
;
naive_solver
.
Qed
.
Instance
set_unfold_app_binder
x
mxl
X
P
:
SetUnfoldElemOf
x
X
P
→
SetUnfoldElemOf
x
(
mxl
+
b
+
X
)
(
BNamed
x
∈
mxl
∨
P
)
.
Proof
.
constructor
.
rewrite
<-
(
set_unfold
(
x
∈
X
)
P
)
.
induction
mxl
;
set_solver
.
Qed
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment