-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - feat(data/dfinsupp): Add dfinsupp.single_eq_single_iff, and subtype.heq_iff_coe_eq #4810
Conversation
…xt_iff_heq This ought to make working with dfinsupps over subtypes easier
614b31a
to
2b36292
Compare
…eq_iff_coe_eq This ought to make working with dfinsupps over subtypes easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this seems like a fine use of heq
.
bors d+
@@ -313,6 +313,28 @@ by simp only [single_apply, dif_neg h] | |||
lemma single_injective {i} : function.injective (single i : β i → Π₀ i, β i) := | |||
λ x y H, congr_fun (mk_injective _ H) ⟨i, by simp⟩ | |||
|
|||
/-- Like `finsupp.single_eq_single_iff`, but with a `heq` due to dependent types -/ | |||
lemma single_eq_single_iff (i j : ι) (xi : β i) (xj : β j) : | |||
dfinsupp.single i xi = dfinsupp.single j xj ↔ i = j ∧ xi == xj ∨ xi = 0 ∧ xj = 0 := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a lemma like this I tend to also want a lemma of the form i = j → xi == xj → dfinsupp.single i xi = dfinsupp.single j xj
(the most common case that dfinsupp.single
are equal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that if I want that case, I can just use congr
. Is the lemma form still worthwhile?
@@ -43,6 +43,10 @@ protected theorem forall' {q : ∀x, p x → Prop} : | |||
lemma ext_iff {a1 a2 : {x // p x}} : a1 = a2 ↔ (a1 : α) = (a2 : α) := | |||
⟨congr_arg _, subtype.ext⟩ | |||
|
|||
lemma heq_iff_coe_eq (h : ∀ x, p x ↔ q x) {a1 : {x // p x}} {a2 : {x // q x}} : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemma heq_iff_coe_eq (h : ∀ x, p x ↔ q x) {a1 : {x // p x}} {a2 : {x // q x}} : | |
@[simp] lemma heq_iff_coe_eq (h : ∀ x, p x ↔ q x) {a1 : {x // p x}} {a2 : {x // q x}} : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do that then this lemma takes priority over the stronger heq_iff_eq
. Note also that this is a conditional lemma, so probably shouldn't be simp
✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with |
Ok, I agree with both your comments. bors merge Btw: you can use |
…eq_iff_coe_eq (#4810) This ought to make working with dfinsupps over subtypes easier
Pull request successfully merged into master. Build succeeded: |
…eq_iff_coe_eq (leanprover-community#4810) This ought to make working with dfinsupps over subtypes easier
This ought to make working with dfinsupps over subtypes easier
With thanks to @kckennylau for pointing me in the right direction in https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Difficulty.20with.20dependent.20rewrites/near/214824136