]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/ground_2/relocation/trace.ma
colength and identity relocation
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / relocation / trace.ma
index 680e89dbb3a1891f8dd8f14a8f3d3571cc74fd4c..699942e056864b7196cb729e6982f1f87c497ac1 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
+include "ground_2/notation/functions/norm_1.ma".
 include "ground_2/lib/bool.ma".
 include "ground_2/lib/list.ma".
 
 (* RELOCATION TRACE *********************************************************)
 
 definition trace: Type[0] ≝ list bool.
+
+let rec colength (cs:trace) on cs ≝ match cs with
+[ nil       ⇒ 0
+| cons b tl ⇒ match b with [ true ⇒  ⫯(colength tl) | false ⇒ colength tl ] 
+].
+
+interpretation "colength (trace)"
+   'Norm cs = (colength cs).
+
+(* basic properties *********************************************************)
+
+lemma colength_empty: ∥◊∥ = 0.
+// qed.
+
+lemma colength_true: ∀cs. ∥Ⓣ@cs∥ = ⫯∥cs∥.
+// qed.
+
+lemma colength_false: ∀cs. ∥Ⓕ@cs∥ = ∥cs∥.
+// qed.
+
+lemma colength_cons: ∀cs1,cs2. ∥cs1∥ = ∥cs2∥ →
+                     ∀b. ∥b@cs1∥ = ∥b@cs2∥.
+#cs1 #cs2 #H * /2 width=1 by/
+qed.
+
+lemma colength_le: ∀cs. ∥cs∥ ≤ |cs|.
+#cs elim cs -cs //
+* /2 width=1 by le_S_S, le_S/
+qed.