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] - chore: more squeeze_simp
s arising from linter
#11259
Conversation
Thanks! 🎉 |
The squeezing continues! All found by the linter at #11246.
Pull request successfully merged into master. Build succeeded: |
squeeze_simp
s arising from lintersqueeze_simp
s arising from linter
The squeezing continues! All found by the linter at #11246.
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.
Would you mind opening a PR addressing my comments?
· simp only [zpow_negSucc, conj_pow, mul_inv_rev, inv_inv] | ||
rw [mul_assoc] |
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.
Make the proof more robust by not squeezing the simp:
· simp only [zpow_negSucc, conj_pow, mul_inv_rev, inv_inv] | |
rw [mul_assoc] | |
· simp [zpow_negSucc, conj_pow, mul_assoc] |
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.
Done.
· simp only [foldr_cons, ih, cons_bind, append_assoc] | ||
rw [← permutationsAux2_append] |
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.
· simp only [foldr_cons, ih, cons_bind, append_assoc] | |
rw [← permutationsAux2_append] | |
· simp [ih, ← permutationsAux2_append] |
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.
This says
tactic 'simp' failed, nested error:
maximum recursion depth has been reached (use `set_option maxRecDepth <num>` to increase limit)
· simp at h | ||
simp [*] |
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.
Sure that's a golf, but please reassure me that your linter does not flag this as a non-terminal simp!
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 am still working on the internal mechanics of the linter. The first simp
was indeed flagged, but a newer version of the linter will hopefully be aware of the tactic immediately following a simp
and will use this information to decide whether a simp
is considered terminal or not. So,
- I will not revert this change,
- I agree with you that this should not have been flagged,
- I do think that the current version is more robust than what it was before, though!
😄
@@ -1157,7 +1159,7 @@ theorem liftRel_flatten {R : α → β → Prop} {c1 : Computation (WSeq α)} {c | |||
match s, t, h with | |||
| _, _, ⟨c1, c2, rfl, rfl, h⟩ => by | |||
-- Porting note: `exists_and_left` should be excluded. |
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.
-- Porting note: `exists_and_left` should be excluded. |
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.
Removed the note.
destruct_eq_think <| by | ||
unfold toList | ||
simp only [toList'_cons, Computation.destruct_think, Sum.inr.injEq] | ||
rw [toList'_map] | ||
simp only [List.reverse_cons, List.reverse_nil, List.nil_append, List.singleton_append] | ||
rfl |
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.
This looks like a symptom of the simp bug that was fixed by letting simp not resynthesize everything anymore. Hence I'm pretty sure something like this will work:
destruct_eq_think <| by | |
unfold toList | |
simp only [toList'_cons, Computation.destruct_think, Sum.inr.injEq] | |
rw [toList'_map] | |
simp only [List.reverse_cons, List.reverse_nil, List.nil_append, List.singleton_append] | |
rfl | |
destruct_eq_think <| by unfold toList; simp [toList'_map]; rfl |
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.
Literally what you suggest gives
type mismatch
HEq.rfl
has type
HEq ?m.129498 ?m.129498 : Prop
but is expected to have type
Computation.destruct (toList (cons a s)) = Sum.inr (List.cons a <$> toList s) : Prop
I could not find a better proof...
simp [head]; cases Seq.head s <;> rfl | ||
simp only [head, Option.map_eq_map, destruct_ofSeq, Computation.map_pure, Option.map_map] | ||
cases Seq.head s <;> rfl |
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'm honestly not sure this kind of changes is an improvement
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 reverted this change.
| _, _, _, _, _, σh, ⟨rfl⟩, ⟨rfl⟩, h => ⟨by | ||
simp only [Nat.cast_id, σh, Rat.ofScientific_false_def, Nat.cast_mul, Nat.cast_pow, | ||
Nat.cast_ofNat, h, Nat.mul_eq] | ||
norm_cast⟩ |
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.
This is a false positive. norm_cast
is a simp-like tactic, hence the simp is not terminal. Please revert.
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.
@YaelDillies I addressed the comments that I could in #11455.
· simp only [foldr_cons, ih, cons_bind, append_assoc] | ||
rw [← permutationsAux2_append] |
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.
This says
tactic 'simp' failed, nested error:
maximum recursion depth has been reached (use `set_option maxRecDepth <num>` to increase limit)
· simp at h | ||
simp [*] |
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 am still working on the internal mechanics of the linter. The first simp
was indeed flagged, but a newer version of the linter will hopefully be aware of the tactic immediately following a simp
and will use this information to decide whether a simp
is considered terminal or not. So,
- I will not revert this change,
- I agree with you that this should not have been flagged,
- I do think that the current version is more robust than what it was before, though!
😄
@@ -1157,7 +1159,7 @@ theorem liftRel_flatten {R : α → β → Prop} {c1 : Computation (WSeq α)} {c | |||
match s, t, h with | |||
| _, _, ⟨c1, c2, rfl, rfl, h⟩ => by | |||
-- Porting note: `exists_and_left` should be excluded. |
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.
Removed the note.
destruct_eq_think <| by | ||
unfold toList | ||
simp only [toList'_cons, Computation.destruct_think, Sum.inr.injEq] | ||
rw [toList'_map] | ||
simp only [List.reverse_cons, List.reverse_nil, List.nil_append, List.singleton_append] | ||
rfl |
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.
Literally what you suggest gives
type mismatch
HEq.rfl
has type
HEq ?m.129498 ?m.129498 : Prop
but is expected to have type
Computation.destruct (toList (cons a s)) = Sum.inr (List.cons a <$> toList s) : Prop
I could not find a better proof...
simp [head]; cases Seq.head s <;> rfl | ||
simp only [head, Option.map_eq_map, destruct_ofSeq, Computation.map_pure, Option.map_map] | ||
cases Seq.head s <;> rfl |
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 reverted this change.
· simp only [zpow_negSucc, conj_pow, mul_inv_rev, inv_inv] | ||
rw [mul_assoc] |
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.
Done.
The squeezing continues! All found by the linter at #11246.
The squeezing continues! All found by the linter at #11246.
The squeezing continues! All found by the linter at #11246.
The squeezing continues! All found by the linter at #11246.
The squeezing continues! All found by the linter at #11246.
The squeezing continues! All found by the linter at #11246.