aboutsummaryrefslogtreecommitdiff
path: root/theories/Sorting
diff options
context:
space:
mode:
authorAnton Trunov2020-08-13 18:30:48 +0300
committerAnton Trunov2020-08-13 18:30:48 +0300
commit422e2ec9cc902bfb3f6ea78045e8490328acbd20 (patch)
tree65d428676588b2b43a0d5c69df6cb957a653c877 /theories/Sorting
parent226ed2069d9874fe845a1995053783f811ace9ae (diff)
parent94bb6fa0152ea61661f2e5d990f8d46cbdcdf9cf (diff)
Merge PR #12799: [stdlib] [List] Additional statements about List.repeat
Reviewed-by: anton-trunov
Diffstat (limited to 'theories/Sorting')
-rw-r--r--theories/Sorting/Permutation.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/theories/Sorting/Permutation.v b/theories/Sorting/Permutation.v
index 026cf32ceb..2f445c341a 100644
--- a/theories/Sorting/Permutation.v
+++ b/theories/Sorting/Permutation.v
@@ -522,6 +522,18 @@ Proof.
repeat red; eauto using Permutation_NoDup.
Qed.
+Lemma Permutation_repeat x n l :
+ Permutation l (repeat x n) -> l = repeat x n.
+Proof.
+ revert n; induction l as [|y l IHl] ; simpl; intros n HP; auto.
+ - now apply Permutation_nil in HP; inversion HP.
+ - assert (y = x) as Heq by (now apply repeat_spec with n, (Permutation_in _ HP); left); subst.
+ destruct n; simpl; simpl in HP.
+ + symmetry in HP; apply Permutation_nil in HP; inversion HP.
+ + f_equal; apply IHl.
+ now apply Permutation_cons_inv with x.
+Qed.
+
End Permutation_properties.
Section Permutation_map.