Skip to content

[Merged by Bors] - chore: fix implicit-reducible diamonds in Primrec#38305

Closed
sgouezel wants to merge 1 commit intoleanprover-community:masterfrom
sgouezel:SG_lintPrimrec
Closed

[Merged by Bors] - chore: fix implicit-reducible diamonds in Primrec#38305
sgouezel wants to merge 1 commit intoleanprover-community:masterfrom
sgouezel:SG_lintPrimrec

Conversation

@sgouezel
Copy link
Copy Markdown
Contributor

The following examples fail on master, work with the PR:

example : (Primcodable.ulower.toEncodable : Encodable (ULower α)) =
    instEncodableULower := by
  with_reducible_and_instances rfl
example : (Primcodable.vector.toEncodable : Encodable (List.Vector
α n)) =
    Encodable.List.Vector.encodable := by
  with_reducible_and_instances rfl

Open in Gitpod

@github-actions
Copy link
Copy Markdown

PR summary cc26c21489

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the t-computability Computability theory (TMs, DFAs, languages, grammars, etc) label Apr 20, 2026
theorem vector_toList_iff {n} {f : α → List.Vector β n} :
(Primrec fun a => (f a).toList) ↔ Primrec f :=
subtype_val_iff
subtype_val_iff (hp := (@Primrec.eq ℕ _).comp list_length (const _))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a little disappointing. Are we missing some API or something?

Copy link
Copy Markdown
Contributor Author

@sgouezel sgouezel Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. The whole API was relying on defeq abuse, hoping that hp would be somehow embedded in an instance. It's not any more the case when we break the defeq abuse, so we have to give this argument that it couldn't guess otherwise -- but it makes sense.

@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Apr 21, 2026

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Apr 21, 2026
The following examples fail on master, work with the PR:
```lean
example : (Primcodable.ulower.toEncodable : Encodable (ULower α)) =
    instEncodableULower := by
  with_reducible_and_instances rfl
```

```lean
example : (Primcodable.vector.toEncodable : Encodable (List.Vector
α n)) =
    Encodable.List.Vector.encodable := by
  with_reducible_and_instances rfl
```

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
@mathlib-triage mathlib-triage bot added the ready-to-merge This PR has been sent to bors. label Apr 21, 2026
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 21, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore: fix implicit-reducible diamonds in Primrec [Merged by Bors] - chore: fix implicit-reducible diamonds in Primrec Apr 21, 2026
@mathlib-bors mathlib-bors bot closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-computability Computability theory (TMs, DFAs, languages, grammars, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants