From 357c53bcf4e2d3d4ffb8ea7ee8bc5e22acfdd05c Mon Sep 17 00:00:00 2001 From: Thomas Baruchel Date: Wed, 6 Dec 2023 08:59:48 +0100 Subject: [PATCH] Update --- src/subsequences2.v | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/subsequences2.v b/src/subsequences2.v index 9ade6a0..f918b58 100644 --- a/src/subsequences2.v +++ b/src/subsequences2.v @@ -384,30 +384,24 @@ Qed. Theorem Subsequence_in {X: Type} : forall (u: list X) a, In a u <-> Subsequence u [a]. Proof. - intros u a. rewrite Subsequence_flat_map. split. - induction u; intro H. apply in_nil in H. contradiction. - destruct H. rewrite H. exists nil. exists [u]. split. reflexivity. - simpl. rewrite app_nil_r. reflexivity. - rewrite <- Subsequence_flat_map. apply Subsequence_cons_l. - apply Subsequence_flat_map. apply IHu. assumption. - intro H. destruct H. destruct H. destruct H. rewrite H0. apply in_or_app. - right. destruct x0. apply PeanoNat.Nat.neq_succ_0 in H. contradiction. - left. reflexivity. + intros u a. split. induction u; intro H. + apply in_nil in H. contradiction. + destruct H. rewrite H. exists nil. exists u. + split. reflexivity. apply Subsequence_nil_r. + apply Subsequence_cons_l. apply IHu. assumption. + intro H. destruct H. destruct H. destruct H. rewrite H. + apply in_or_app. right. apply in_eq. Qed. - - - - -Theorem subsequence_rev {X: Type} : - forall (u v: list X), subsequence u v <-> subsequence (rev u) (rev v). +Theorem Subsequence_rev {X: Type} : + forall (u v: list X), Subsequence u v <-> Subsequence (rev u) (rev v). Proof. assert (MAIN: forall (u v: list X), - subsequence u v -> subsequence (rev u) (rev v)). + Subsequence u v -> Subsequence (rev u) (rev v)). intros u v. intro H. - apply subsequence_eq_def_3. apply subsequence_eq_def_2. - apply subsequence_eq_def_1 in H. destruct H. destruct H. + apply Subsequence_bools. apply Subsequence_bools in H. + destruct H. destruct H. exists (rev x). split. rewrite rev_length. rewrite rev_length. assumption. rewrite H0. @@ -439,6 +433,9 @@ Proof. Qed. + + + Theorem subsequence_map {X Y: Type} : forall (u v: list X) (f: X -> Y), subsequence u v -> subsequence (map f u) (map f v).