Update
This commit is contained in:
parent
33fde1883f
commit
1e18bbe495
@ -155,6 +155,7 @@ Lemma perm_max_insert : forall (l1 l2: list nat),
|
|||||||
permutation (l1 ++ l2) <-> permutation (l1 ++ [ length (l1++l2) ] ++ l2).
|
permutation (l1 ++ l2) <-> permutation (l1 ++ [ length (l1++l2) ] ++ l2).
|
||||||
Proof.
|
Proof.
|
||||||
intros l1 l2. split; intro H.
|
intros l1 l2. split; intro H.
|
||||||
|
(* first part of the proof *)
|
||||||
unfold permutation. intro k. intro I.
|
unfold permutation. intro k. intro I.
|
||||||
rewrite app_length in I. simpl in I. rewrite Nat.add_succ_r in I.
|
rewrite app_length in I. simpl in I. rewrite Nat.add_succ_r in I.
|
||||||
rewrite Nat.lt_succ_r in I. rewrite <- app_length in I.
|
rewrite Nat.lt_succ_r in I. rewrite <- app_length in I.
|
||||||
@ -163,6 +164,7 @@ Proof.
|
|||||||
assumption. rewrite in_app_iff. right. apply in_cons. assumption.
|
assumption. rewrite in_app_iff. right. apply in_cons. assumption.
|
||||||
rewrite <- H0. rewrite in_app_iff. right. apply in_eq.
|
rewrite <- H0. rewrite in_app_iff. right. apply in_eq.
|
||||||
|
|
||||||
|
(* second part of the proof *)
|
||||||
assert (I: incl (seq 0 (length (l1++l2))) (l1++l2)).
|
assert (I: incl (seq 0 (length (l1++l2))) (l1++l2)).
|
||||||
assert (incl ([length (l1++l2)]++l2++l1) (l1++[length (l1++l2)]++l2)).
|
assert (incl ([length (l1++l2)]++l2++l1) (l1++[length (l1++l2)]++l2)).
|
||||||
unfold incl. intro a. intro J. rewrite app_assoc in J.
|
unfold incl. intro a. intro J. rewrite app_assoc in J.
|
||||||
@ -184,7 +186,6 @@ Proof.
|
|||||||
rewrite Nat.add_succ_r in H. rewrite seq_S in H. apply incl_app_inv in H.
|
rewrite Nat.add_succ_r in H. rewrite seq_S in H. apply incl_app_inv in H.
|
||||||
destruct H. rewrite app_length at 1. assumption.
|
destruct H. rewrite app_length at 1. assumption.
|
||||||
easy. apply Add_app.
|
easy. apply Add_app.
|
||||||
|
|
||||||
unfold incl in I. unfold permutation.
|
unfold incl in I. unfold permutation.
|
||||||
intro k. intro. apply I. apply in_seq.
|
intro k. intro. apply I. apply in_seq.
|
||||||
split. apply Nat.le_0_l. assumption.
|
split. apply Nat.le_0_l. assumption.
|
||||||
|
Loading…
Reference in New Issue
Block a user