[Merged by Bors] - chore: more squeeze_simps arising from linter#11259
[Merged by Bors] - chore: more squeeze_simps arising from linter#11259
squeeze_simps arising from linter#11259Conversation
|
Thanks! 🎉 |
The squeezing continues! All found by the linter at #11246.
|
Pull request successfully merged into master. Build succeeded: |
squeeze_simps arising from lintersqueeze_simps arising from linter
The squeezing continues! All found by the linter at #11246.
YaelDillies
left a comment
There was a problem hiding this comment.
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.
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] |
| · simp only [foldr_cons, ih, cons_bind, append_assoc] | ||
| rw [← permutationsAux2_append] |
There was a problem hiding this comment.
| · simp only [foldr_cons, ih, cons_bind, append_assoc] | |
| rw [← permutationsAux2_append] | |
| · simp [ih, ← permutationsAux2_append] |
There was a problem hiding this comment.
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.
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.
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.
| -- Porting note: `exists_and_left` should be excluded. |
| 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.
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.
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) : PropI 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.
I'm honestly not sure this kind of changes is an improvement
There was a problem hiding this comment.
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.
This is a false positive. norm_cast is a simp-like tactic, hence the simp is not terminal. Please revert.
adomani
left a comment
There was a problem hiding this comment.
@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.
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.
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. | |||
| 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.
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) : PropI 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.
I reverted this change.
| · simp only [zpow_negSucc, conj_pow, mul_inv_rev, inv_inv] | ||
| rw [mul_assoc] |
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.