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
47e0eddc
Commit
47e0eddc
authored
1 year ago
by
Robbert Krebbers
Browse files
Options
Downloads
Plain Diff
Merge branch 'robbert/tcsimpl' into 'master'
Add `TCSimpl` type class. See merge request
!521
parents
f9f5b73b
ab6bf9f9
No related branches found
No related tags found
1 merge request
!521
Add `TCSimpl` type class.
Pipeline
#91001
passed
1 year ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+2
-1
2 additions, 1 deletion
CHANGELOG.md
stdpp/base.v
+14
-0
14 additions, 0 deletions
stdpp/base.v
tests/typeclasses.ref
+8
-0
8 additions, 0 deletions
tests/typeclasses.ref
tests/typeclasses.v
+13
-1
13 additions, 1 deletion
tests/typeclasses.v
with
37 additions
and
2 deletions
CHANGELOG.md
+
2
−
1
View file @
47e0eddc
...
@@ -3,7 +3,8 @@ API-breaking change is listed.
...
@@ -3,7 +3,8 @@ API-breaking change is listed.
## std++ master
## std++ master
(nothing yet)
-
Add
`TCSimpl`
type class that is similar to
`TCEq`
but performs
`simpl`
before proving the goal by reflexivity.
## std++ 1.9.0 (2023-10-11)
## std++ 1.9.0 (2023-10-11)
...
...
This diff is collapsed.
Click to expand it.
stdpp/base.v
+
14
−
0
View file @
47e0eddc
...
@@ -209,6 +209,20 @@ Global Hint Mode TCEq ! - - : typeclass_instances.
...
@@ -209,6 +209,20 @@ Global Hint Mode TCEq ! - - : typeclass_instances.
Lemma
TCEq_eq
{
A
}
(
x1
x2
:
A
)
:
TCEq
x1
x2
↔
x1
=
x2
.
Lemma
TCEq_eq
{
A
}
(
x1
x2
:
A
)
:
TCEq
x1
x2
↔
x1
=
x2
.
Proof
.
split
;
destruct
1
;
reflexivity
.
Qed
.
Proof
.
split
;
destruct
1
;
reflexivity
.
Qed
.
(** The [TCSimpl x y] type class is similar to [TCEq] but performs [simpl]
before proving the goal by reflexivity. Similar to [TCEq], the argument [x]
is the input and [y] the output. When solving [TCEq x y], the argument [x]
should be a concrete term and [y] an evar for the [simpl]ed result. *)
Class
TCSimpl
{
A
}
(
x
x'
:
A
)
:=
TCSimpl_TCEq
:
TCEq
x
x'
.
Global
Hint
Extern
0
(
TCSimpl
_
_)
=>
(* Since the second argument should be an evar, we can call [simpl] on the
whole goal. *)
simpl
;
notypeclasses
refine
(
TCEq_refl
_)
:
typeclass_instances
.
Global
Hint
Mode
TCSimpl
!
-
-
:
typeclass_instances
.
Lemma
TCSimpl_eq
{
A
}
(
x1
x2
:
A
)
:
TCSimpl
x1
x2
↔
x1
=
x2
.
Proof
.
apply
TCEq_eq
.
Qed
.
Inductive
TCDiag
{
A
}
(
C
:
A
→
Prop
)
:
A
→
A
→
Prop
:=
Inductive
TCDiag
{
A
}
(
C
:
A
→
Prop
)
:
A
→
A
→
Prop
:=
|
TCDiag_diag
x
:
C
x
→
TCDiag
C
x
x
.
|
TCDiag_diag
x
:
C
x
→
TCDiag
C
x
x
.
Existing
Class
TCDiag
.
Existing
Class
TCDiag
.
...
...
This diff is collapsed.
Click to expand it.
tests/typeclasses.ref
+
8
−
0
View file @
47e0eddc
"tc_simpl_test"
: string
1 goal
P : nat → Prop
y : nat
============================
P (S (S (S (S (S (S y))))))
This diff is collapsed.
Click to expand it.
tests/typeclasses.v
+
13
−
1
View file @
47e0eddc
From
stdpp
Require
Import
prelude
.
From
stdpp
Require
Import
strings
.
Lemma
tc_simpl_test_lemma
(
P
:
nat
→
Prop
)
x
y
:
TCSimpl
x
y
→
P
x
→
P
y
.
Proof
.
by
intros
->%
TCSimpl_eq
.
Qed
.
Check
"tc_simpl_test"
.
Lemma
tc_simpl_test
(
P
:
nat
→
Prop
)
y
:
P
(
5
+
S
y
)
.
Proof
.
apply
(
tc_simpl_test_lemma
_
_
_
_)
.
(* would be nicer with ssr [apply:] *)
Show
.
Abort
.
(** Check that [@Reflexive Prop ?r] picks the instance setoid_rewrite needs.
(** Check that [@Reflexive Prop ?r] picks the instance setoid_rewrite needs.
Really, we want to set [Hint Mode Reflexive] in a way that this fails, but
Really, we want to set [Hint Mode Reflexive] in a way that this fails, but
...
...
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