]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/path_reverse.ma
046404f0375e4b32f626794cb2c0e81b243000e4
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / path_reverse.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "delayed_updating/syntax/path.ma".
16 include "delayed_updating/notation/functions/nec_r_1.ma".
17
18 (* REVERSE FOR PATH *********************************************************)
19
20 rec definition reverse (p) on p: path ≝
21 match p with
22 [ list_empty     ⇒ 𝐞
23 | list_lcons l q ⇒ (reverse q)◖l
24 ].
25
26 interpretation
27   "reverse (path)"
28   'NEcR p = (reverse p).
29
30 (* Basic constructions ******************************************************)
31
32 lemma reverse_empty: 𝐞 = 𝐞ᴿ.
33 // qed.
34
35 lemma reverse_lcons (p) (l): pᴿ◖l = (l◗p)ᴿ.
36 // qed.
37
38 (* Main constructions *******************************************************)
39
40 theorem reverse_append (p1) (p2):
41         (p2ᴿ)●(p1ᴿ) = (p1●p2)ᴿ.
42 #p1 elim p1 -p1 //
43 #l1 #p1 #IH #p2
44 <list_append_lcons_sn <reverse_lcons <reverse_lcons //
45 qed.
46
47 (* Constructions with list_rcons ********************************************)
48
49 lemma reverse_rcons (p) (l):
50       l◗(pᴿ) = (p◖l)ᴿ.
51 #p #l
52 <reverse_append //
53 qed.
54
55 (* Main constructions *******************************************************)
56
57 theorem reverse_revrse (p):
58         p = pᴿᴿ.
59 #p elim p -p //
60 #l #p #IH
61 <reverse_lcons <reverse_rcons //
62 qed.