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
Package registry
Model registry
Operate
Terraform modules
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
Thibaut Pérami
stdpp
Commits
66e94d20
Commit
66e94d20
authored
1 year ago
by
Thibaut Pérami
Browse files
Options
Downloads
Patches
Plain Diff
Allow patterns and type annotations in propset notation
parent
cafd7113
No related branches found
No related tags found
No related merge requests found
Pipeline
#97891
canceled
1 year ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
stdpp/propset.v
+6
-1
6 additions, 1 deletion
stdpp/propset.v
tests/propset.ref
+0
-0
0 additions, 0 deletions
tests/propset.ref
tests/propset.v
+20
-0
20 additions, 0 deletions
tests/propset.v
with
28 additions
and
1 deletion
CHANGELOG.md
+
2
−
0
View file @
66e94d20
...
@@ -27,6 +27,8 @@ Coq 8.19 is newly supported by this version of std++.
...
@@ -27,6 +27,8 @@ Coq 8.19 is newly supported by this version of std++.
These tactics support both named hypotheses (
`inv H`
) and using a number
These tactics support both named hypotheses (
`inv H`
) and using a number
to refer to a hypothesis on the goal (
`inv 1`
).
to refer to a hypothesis on the goal (
`inv 1`
).
-
Add
`prod_swap : A * B → B * A`
and some basic theory about it.
-
Add
`prod_swap : A * B → B * A`
and some basic theory about it.
-
Allow pattern and type annotations in propset notation, e.g.
`{[ (x, y) : nat * nat | x = y ]}`
The following
`sed`
script should perform most of the renaming
The following
`sed`
script should perform most of the renaming
(on macOS, replace
`sed`
by
`gsed`
, installed via e.g.
`brew install gnu-sed`
).
(on macOS, replace
`sed`
by
`gsed`
, installed via e.g.
`brew install gnu-sed`
).
...
...
This diff is collapsed.
Click to expand it.
stdpp/propset.v
+
6
−
1
View file @
66e94d20
...
@@ -6,8 +6,13 @@ Record propset (A : Type) : Type := PropSet { propset_car : A → Prop }.
...
@@ -6,8 +6,13 @@ Record propset (A : Type) : Type := PropSet { propset_car : A → Prop }.
Add
Printing
Constructor
propset
.
Add
Printing
Constructor
propset
.
Global
Arguments
PropSet
{_}
_
:
assert
.
Global
Arguments
PropSet
{_}
_
:
assert
.
Global
Arguments
propset_car
{_}
_
_
:
assert
.
Global
Arguments
propset_car
{_}
_
_
:
assert
.
(** Here we are using the notation "at level 200 as pattern" because we want to
be compatible with all the rules that start with [ {[ TERM ] such as
records, singletons, and map singletons. See
https://coq.inria.fr/refman/user-extensions/syntax-extensions.html#binders-bound-in-the-notation-and-parsed-as-terms
and https://gitlab.mpi-sws.org/iris/stdpp/-/merge_requests/533#note_98003 *)
Notation
"{[ x | P ]}"
:=
(
PropSet
(
λ
x
,
P
))
Notation
"{[ x | P ]}"
:=
(
PropSet
(
λ
x
,
P
))
(
at
level
1
,
format
"{[ x | P ]}"
)
:
stdpp_scope
.
(
at
level
1
,
x
at
level
200
as
pattern
,
format
"{[ x | P ]}"
)
:
stdpp_scope
.
Global
Instance
propset_elem_of
{
A
}
:
ElemOf
A
(
propset
A
)
:=
λ
x
X
,
propset_car
X
x
.
Global
Instance
propset_elem_of
{
A
}
:
ElemOf
A
(
propset
A
)
:=
λ
x
X
,
propset_car
X
x
.
...
...
This diff is collapsed.
Click to expand it.
tests/propset.ref
0 → 100644
+
0
−
0
View file @
66e94d20
This diff is collapsed.
Click to expand it.
tests/propset.v
0 → 100644
+
20
−
0
View file @
66e94d20
From
stdpp
Require
Import
propset
.
Lemma
diagonal
:
{[
(
a
,
b
)
:
nat
*
nat
|
a
=
b
]}
≡
(
λ
x
,
(
x
,
x
))
<$>
⊤
.
Proof
.
set_unfold
.
intros
[]
.
naive_solver
.
Qed
.
Lemma
diagonal2
:
{[
(
a
,
b
)
|
a
=@
{
nat
}
b
]}
≡
{[
x
|
x
.
1
=
x
.
2
]}
.
Proof
.
set_unfold
.
intros
[]
.
naive_solver
.
Qed
.
Lemma
firstis42
:
{[
(
x
,
_)
:
nat
*
nat
|
x
=
42
]}
≡
(
42
,.)
<$>
⊤
.
Proof
.
set_unfold
.
intros
[]
.
naive_solver
.
Qed
.
Inductive
foo
:=
Foo
(
n
:
nat
)
.
Definition
set_of_positive_foos
:
{[
Foo
x
|
x
≠
0
]}
≡
Foo
<$>
(
Pos
.
to_nat
<$>
⊤
)
.
Proof
.
set_unfold
.
intros
[[]];
naive_solver
by
(
rewrite
SuccNat2Pos
.
id_succ
||
lia
)
.
Qed
.
Lemma
simple_pattern_does_not_match
:
{[
x
:
nat
|
x
=
x
]}
=
PropSet
(
λ
x
,
x
=
x
)
.
Proof
.
exact
eq_refl
.
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