Add `TCSimpl` type class.
1 unresolved thread
1 unresolved thread
See comment and test case for usage.
Merge request reports
Activity
added 2 commits
- Resolved by Ralf Jung
- Resolved by Robbert Krebbers
added 15 commits
-
7e9e788c...f9f5b73b - 11 commits from branch
master
- 903bfaa4 - Add `TCSimpl` type class.
- df663290 - Test case for `TCSimpl`.
- f162b8df - CHANGELOG.
- ab6bf9f9 - Comment.
Toggle commit list-
7e9e788c...f9f5b73b - 11 commits from branch
enabled an automatic merge when the pipeline for ab6bf9f9 succeeds
mentioned in commit 47e0eddc
209 209 Lemma TCEq_eq {A} (x1 x2 : A) : TCEq x1 x2 ↔ x1 = x2. 210 210 Proof. split; destruct 1; reflexivity. Qed. 211 211 212 (** The [TCSimpl x y] type class is similar to [TCEq] but performs [simpl] 213 before proving the goal by reflexivity. Similar to [TCEq], the argument [x] 214 is the input and [y] the output. When solving [TCEq x y], the argument [x] 215 should be a concrete term and [y] an evar for the [simpl]ed result. *) 216 Class TCSimpl {A} (x x' : A) := TCSimpl_TCEq : TCEq x x'. 217 Global Hint Extern 0 (TCSimpl _ _) => 218 (* Since the second argument should be an evar, we can call [simpl] on the 219 whole goal. *) 220 simpl; notypeclasses refine (TCEq_refl _) : typeclass_instances. - Comment on lines +218 to +220
simpl
reduces in evar substitutions so callingsimpl
on the entire goal here can trigger nontrivial and unintended reduction. I would recommend binding the argument to be reduced and usinglet res := eval simpl in arg in ..
instead.That being said, it's not clear to me when exactly evar substitutions would actually come about during TC search. AFAICT
simpl
does not perform reduction in the original evar context (which is an identity mapping of the coq context at the time the evar was created) so for fresh evars it might actually be fine to callsimpl
on the entire goal.
Please register or sign in to reply