Skip to content

fix: fixes #1926#2732

Merged
leodemoura merged 2 commits intomasterfrom
issue1926
Oct 23, 2023
Merged

fix: fixes #1926#2732
leodemoura merged 2 commits intomasterfrom
issue1926

Conversation

@leodemoura
Copy link
Copy Markdown
Member

No description provided.

@leodemoura
Copy link
Copy Markdown
Member Author

!bench

@leodemoura leodemoura changed the title Closes issue #1926 fix: fixes #1926 Oct 21, 2023
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 66d516b.
There were no significant changes against commit 52f1000.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Oct 22, 2023
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Oct 22, 2023
@ghost ghost added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Oct 22, 2023
@ghost
Copy link
Copy Markdown

ghost commented Oct 22, 2023

@ghost ghost added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Oct 23, 2023
Comment on lines +44 to +48
theorem forall_prop_domain_congr {p₁ p₂ : Prop} {q₁ : p₁ → Prop} {q₂ : p₂ → Prop}
(h₁ : p₁ = p₂)
(h₂ : ∀ a : p₂, q₁ (h₁.substr a) = q₂ a)
: (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a) := by
subst h₁; simp [← h₂]
Copy link
Copy Markdown
Contributor

@eric-wieser eric-wieser Oct 23, 2023

Choose a reason for hiding this comment

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

This is true more generally for Sort u:

Suggested change
theorem forall_prop_domain_congr {p₁ p₂ : Prop} {q₁ : p₁ → Prop} {q₂ : p₂ → Prop}
(h₁ : p₁ = p₂)
(h₂ : ∀ a : p₂, q₁ (h₁.substr a) = q₂ a)
: (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a) := by
subst h₁; simp [← h₂]
theorem forall_domain_congr {p₁ p₂ : Sort u} {q₁ : p₁ → Sort v} {q₂ : p₂ → Sort v}
(h₁ : p₁ = p₂)
(h₂ : ∀ a : p₂, q₁ (h₁.mpr a) = q₂ a)
: (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a) := by
subst h₁
have : q₁ = q₂ := funext h₂
subst this
rfl

Comment on lines +735 to +744
/- Using
```
theorem forall_prop_domain_congr {p₁ p₂ : Prop} {q₁ : p₁ → Prop} {q₂ : p₂ → Prop}
(h₁ : p₁ = p₂)
(h₂ : ∀ a : p₂, q₁ (h₁.substr a) = q₂ a)
: (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a)
```
Remark: we should consider whether we want to add congruence lemma support for arbitrary `forall`-expressions.
Then, the theroem above can be marked as `@[congr]` and the following code deleted.
-/
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.

Probably you already saw #1926 (comment), but in case you didn't; I stumbled across what might be a neat trick to enable this behavior (and probably also arrow support in calc); define

-- an alias for `∀` to thwart checks that complain that `∀` is not a function
def Forall {α} (β : α → Sort _) := ∀ a, β a

and temporarily replace with Forall when looking for congruence lemmas / Trans instances, such that the existing code-path for Expr.app can be reused.

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

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants