rocq-prover / rocq-prover/stdlib

Declare `Hint Mode` for `Reflexive`, `Symmetric`, `Equivalence`, ...

Open
#38 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rocq Prover
Stars
42
Forks
38
Avg merge
14h 6m
Merged PRs (30d)
3

Description

I noticed that as part of the type class inference performed by setoid rewrite, Coq's often performing a wild goose chase on trying to find instances like:

Reflexive A ?R

i.e. Coq is trying to find an arbitrary reflexive relation on a given type.

I think this should be avoided, since:

  1. It leads to enormous amounts of backtracking, hence poor performance.
  2. It's possible to get loops by adding instances like Reflexive A R → Reflexive A (foo R).

The obvious choice to avoid this is to set Hint Modes like:

Hint Mode Symmetric ! ! : typeclass_instances.
Hint Mode Transitive ! ! : typeclass_instances.
Hint Mode Equivalence ! ! : typeclass_instances.
Hint Mode PreOrder ! ! : typeclass_instances.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the declarations for Reflexive, Symmetric, Transitive, Equivalence, and PreOrder, then inspect their typeclass inference hints. Check how setoid rewrite searches for these instances and verify that the requested Hint Modes prevent unconstrained relation searches without breaking valid inference.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.