X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Flibrary%2Flist%2Flist.ma;h=bb341d245fad82a43657e4e427956968fac8b3c2;hb=7f82161596bdfccc1179f5edcc0bfd76d34516b5;hp=ffa2c8ef9ac106c007f701cef1cf21b589f51a19;hpb=7f2444c2670cadafddd8785b687ef312158376b0;p=helm.git diff --git a/matita/library/list/list.ma b/matita/library/list/list.ma index ffa2c8ef9..bb341d245 100644 --- a/matita/library/list/list.ma +++ b/matita/library/list/list.ma @@ -92,6 +92,29 @@ theorem cons_append_commute: reflexivity; qed. +inductive permutation (A:Set) : list A -> list A -> Prop \def + | refl : \forall l:list A. permutation ? l l + | swap : \forall l:list A. \forall x,y:A. + permutation ? (x :: y :: l) (y :: x :: l) + | trans : \forall l1,l2,l3:list A. + permutation ? l1 l2 -> permut1 ? l2 l3 -> permutation ? l1 l3 +with permut1 : list A -> list A -> Prop \def + | step : \forall l1,l2:list A. \forall x,y:A. + permut1 ? (l1 @ (x :: y :: l2)) (l1 @ (y :: x :: l2)). + +include "nat/nat.ma". + +definition x1 \def S O. +definition x2 \def S x1. +definition x3 \def S x2. + +theorem tmp : permutation nat (x1 :: x2 :: x3 :: []) (x1 :: x3 :: x2 :: []). + apply (trans ? (x1 :: x2 :: x3 :: []) (x1 :: x2 :: x3 :: []) ?). + apply refl. + apply (step ? (x1::[]) [] x2 x3). + qed. + + (* theorem nil_append_nil_both: \forall A:Set.\forall l1,l2:list A.