Skip to content

Out-param inprocessing and subgoal reordering in TC search - #2117

Closed
gebner wants to merge 6 commits into
leanprover:masterfrom
gebner:outparaminproc
Closed

gebner wants to merge 6 commits into
leanprover:masterfrom
gebner:outparaminproc

Conversation

@gebner

@gebner gebner commented Feb 22, 2023 •

Copy link
Copy Markdown
Member

See #1901. This PR implements several changes:

  1. Out-parameters are replaced by metavariables during TC search (and not just at the beginning). This reduces the amount of badly-conditioned nested TC problems.
  2. The order in which subgoals are synthesized is automatically determined when adding an instance to the environment. If you have subgoals like [Monoid A] [Monoid B] [MulHomClass F A B], then they are processed in the order 2, 0, 1. This removes the need to mark arguments to instances as implicit instead of instance-implicit.
  3. To make it possible to compute this order, we add an additional semiOutParam gadget. One way to think of it is "like an out-param, but with multiple results." It means that all instances of the class need to provide a concrete value for this parameter. For example, the first argument of Coe is a semi-out-param, so instance : Coe α Nat where coe _ := 42 is not a valid instance because it does not assign the α (the instance needs to be a CoeHead instead).

@gebner gebner changed the title Out-param inprocessing and subgoal reordering Out-param inprocessing and subgoal reordering in TC search Feb 22, 2023
@gebner gebner self-assigned this Feb 22, 2023
@gebner

gebner commented Feb 24, 2023

Copy link
Copy Markdown
Member Author

!bench

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 88e6d57.
There were no significant changes against commit 7992ce6.

@gebner
gebner force-pushed the outparaminproc branch 2 times, most recently from 68a6ecb to 8e5a588 Compare March 2, 2023 22:29
@gebner gebner mentioned this pull request Mar 8, 2023
@gebner

gebner commented Mar 27, 2023

Copy link
Copy Markdown
Member Author

!bench

@gebner

gebner commented Mar 27, 2023

Copy link
Copy Markdown
Member Author

!bench

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit fc29435.
There were significant changes against commit 5495a4f:

  Benchmark   Metric                  Change
  ====================================================
- stdlib      attribute application     3.3% (338.6 σ)
- stdlib      tactic execution          3.1%  (23.0 σ)
- stdlib      task-clock                1.9%  (57.9 σ)
- stdlib      type checking             1.6%  (47.6 σ)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 7dba372.
There were significant changes against commit 5495a4f:

  Benchmark   Metric                  Change
  ====================================================
- stdlib      attribute application     3.3%  (24.1 σ)
- stdlib      tactic execution          2.7%  (15.4 σ)
- stdlib      task-clock                1.8%  (28.5 σ)
- stdlib      type checking             1.5% (196.0 σ)
- stdlib      wall-clock                4.8%  (35.5 σ)

@gebner

gebner commented Mar 31, 2023

Copy link
Copy Markdown
Member Author

Closing in favor of #2174.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants