feat(Data/List/SplitBy): characterization of List.splitBy#16837
feat(Data/List/SplitBy): characterization of List.splitBy#16837
List.splitBy#16837Conversation
PR summary b4ec708ec6
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Data.List.SplitBy | 279 | 281 | +2 (+0.72%) |
Import changes for all files
| Files | Import difference |
|---|---|
Mathlib.Data.List.SplitBy |
2 |
Declarations diff
+ getLast_eq_of_mem_getLast?
+ getLast_flatten_of_getLast_ne_nil
+ getLast_getLast_splitBy
+ head_eq_of_mem_head?
+ head_flatten_of_head_ne_nil
+ head_head_splitBy
+ splitBy_append
+ splitBy_append_cons
+ splitBy_eq_iff
+ splitBy_eq_nil_iff
+ splitBy_flatten
+ splitBy_ne_nil_iff
+ splitBy_of_chain'
+ splitBy_singleton
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
This PR/issue depends on: |
List.groupByList.splitBy
List.splitByList.splitBy
|
I managed to prove the result on A lot of the proofs in this PR are very complicated. If someone can figure a way to simplify them it'd be greatly appreciated. |
YaelDillies
left a comment
There was a problem hiding this comment.
I've golfed your proofs a bit. simp_all is a good tactic for you to learn.
|
|
||
| variable {α : Type*} {m : List α} | ||
|
|
||
| theorem head_eq_of_mem_head? {x} (hx : x ∈ m.head?) : |
There was a problem hiding this comment.
| theorem head_eq_of_mem_head? {x} (hx : x ∈ m.head?) : | |
| theorem head_of_mem_head? {x} (hx : x ∈ m.head?) : |
| · contradiction | ||
| · simpa using hx | ||
|
|
||
| theorem getLast_eq_of_mem_getLast? {x} (hx : x ∈ m.getLast?) : |
There was a problem hiding this comment.
| theorem getLast_eq_of_mem_getLast? {x} (hx : x ∈ m.getLast?) : | |
| theorem getLast_of_mem_getLast? {x} (hx : x ∈ m.getLast?) : |
| | cons _ _ => flatten_splitByLoop | ||
|
|
||
| @[simp] | ||
| theorem splitBy_eq_nil_iff {r : α → α → Bool} {l : List α} : l.splitBy r = [] ↔ l = [] := by |
There was a problem hiding this comment.
| theorem splitBy_eq_nil_iff {r : α → α → Bool} {l : List α} : l.splitBy r = [] ↔ l = [] := by | |
| theorem splitBy_eq_nil {r : α → α → Bool} {l : List α} : l.splitBy r = [] ↔ l = [] := by |
| · rintro rfl | ||
| rfl | ||
|
|
||
| theorem splitBy_ne_nil_iff {r : α → α → Bool} {l : List α} : l.splitBy r ≠ [] ↔ l ≠ [] := |
There was a problem hiding this comment.
| theorem splitBy_ne_nil_iff {r : α → α → Bool} {l : List α} : l.splitBy r ≠ [] ↔ l ≠ [] := | |
| theorem splitBy_ne_nil {r : α → α → Bool} {l : List α} : l.splitBy r ≠ [] ↔ l ≠ [] := |
List.GroupBy#16818