Skip to content

feat(Logic/Relation): some EqvGen API#40606

Closed
mathlib-splicebot[bot] wants to merge 1 commit into
masterfrom
splice-bot/pr-38086-Mathlib-Logic-Relation.lean-ce7aa243bb-qcqlaam
Closed

feat(Logic/Relation): some EqvGen API#40606
mathlib-splicebot[bot] wants to merge 1 commit into
masterfrom
splice-bot/pr-38086-Mathlib-Logic-Relation.lean-ce7aa243bb-qcqlaam

Conversation

@mathlib-splicebot

Copy link
Copy Markdown
Contributor

This PR was automatically created from PR #38086 by @dagurtomas via a review comment by @dagurtomas.

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

PR summary 71b974ca1f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ idempotent
+ map

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 71b974c).

  • +2 new declarations
  • −0 removed declarations
+Relation.EqvGen.idempotent
+Relation.EqvGen.map

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 71b974ca1f
Reference commit 26a595e711

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/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-logic Logic (model theory, etc) label Jun 14, 2026
@dagurtomas

Copy link
Copy Markdown
Contributor

This is not needed anymore in #38086, but might be useful regardless

@dagurtomas dagurtomas changed the title chore(Logic/Relation): automated extraction from #38086 feat(Logic/Relation): some EqvGen API Jun 14, 2026
| trans => apply EqvGen.trans <;> assumption

@[simp]
lemma idempotent (r : α → α → Prop) : EqvGen (EqvGen r) = EqvGen r := by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that if placed at the very end of this module, we can write:

lemma idempotent (r : α → α → Prop) : EqvGen (EqvGen r) = EqvGen r :=
  Equivalence.eqvGen_eq (EqvGen.is_equivalence r)

I'm not 100% sure about the naming and statement. The analogous Relation.reflTransGen_idem uses a different naming, but this is also deprecated for the more general Relation.reflTransGen_eq_self. I think the situation is slightly different here because of Equivalence not being a typeclass that is inferred. If this were using IsEquiv, it'd be straightforward to just keep the generalization, but maybe here we need both.

Comment on lines +805 to +811
lemma map (f : α → β) (r : β → β → Prop) (x y : α)
(h : EqvGen (fun x y ↦ r (f x) (f y)) x y) : EqvGen r (f x) (f y) := by
induction h with
| rel => apply EqvGen.rel; assumption
| refl => exact EqvGen.refl _
| symm => apply EqvGen.symm; assumption
| trans => apply EqvGen.trans <;> assumption

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The convention seems to suggest:

theorem lift {p : β → β → Prop} {a b : α} (f : α → β) (h : ∀ a b, r a b → p (f a) (f b))
    (hab : EqvGen r a b) : EqvGen p (f a) (f b) := sorry

theorem lift' {p : β → β → Prop} {a b : α} (f : α → β) (h : ∀ a b, r a b → EqvGen p (f a) (f b))
    (hab : EqvGen r a b) : EqvGen p (f a) (f b) := sorry

@dagurtomas dagurtomas added the please-adopt Inactive PR (would be valuable to adopt) label Jun 15, 2026
@dagurtomas

Copy link
Copy Markdown
Contributor

@chenson2018 your suggestions seem very reasonable -- you or anyone else should feel free to take over this PR as I don't need it anymore and don't have time to work on it.

@chenson2018

Copy link
Copy Markdown
Contributor

@chenson2018 your suggestions seem very reasonable -- you or anyone else should feel free to take over this PR as I don't need it anymore and don't have time to work on it.

Thanks, I've opened a new PR.

@dagurtomas

Copy link
Copy Markdown
Contributor

See #40626

@dagurtomas dagurtomas closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please-adopt Inactive PR (would be valuable to adopt) t-logic Logic (model theory, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants