leanprover / leanprover/lean4

RFC: disjunction of guard conditions for grind_pattern

Open
#11,602 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

I propose extending grind_pattern so that it can take conjunctive normal form (conjunction of disjunctions) of side-conditions. Currently grind_pattern can take a list of side-conditions. The list is interpreted as a conjunction.

The motivating example for the change was mod_eq_of_lt: a < b -> a % b = a. It's desirable to guard against using this lemma on completely concrete examples like 2 % 1024. However, both 2 % b and a % 1024 can benefit from the lemma. [edit: but I realized that the a % 1024 case is already solvable by lia]

To distinguish the wanted case and unwanted case, the precise guard would look like

grind_pattern mod_eq_of_lt => a % b where
  not_value a <|> not_value b
  guard a < b

with disjunction <|>.

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

Start by reading the existing grind_pattern handling of side-condition lists and the motivating example in pull request 11584. Define how the proposed <|> disjunction combines with guard conditions, while preserving the current conjunction behavior, and verify the mod_eq_of_lt example demonstrates the intended result.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.