\ / GNU General Public License Version 2
V_______________________________________________________________ *)
-include "basics/types.ma".
-include "arithmetics/nat.ma".
+include "basics/bool.ma".
+(* include "arithmetics/nat.ma". *)
inductive list (A:Type[0]) : Type[0] :=
| nil: list A
//; nqed. *)
theorem append_cons:∀A.∀a:A.∀l,l1.l@(a::l1)=(l@[a])@l1.
-/2/ qed.
+/\ 5span class="autotactic"\ 62\ 5span class="autotrace"\ 6 trace trans_eq\ 5/span\ 6\ 5/span\ 6/ qed.
theorem nil_append_elim: ∀A.∀l1,l2: list A.∀P:?→?→Prop.
l1@l2=[] → P (nil A) (nil A) → P l1 l2.
theorem nil_to_nil: ∀A.∀l1,l2:list A.
l1@l2 = [] → l1 = [] ∧ l2 = [].
-#A #l1 #l2 #isnil @(nil_append_elim A l1 l2) /2/
+#A #l1 #l2 #isnil @(nil_append_elim A l1 l2) /\ 5span class="autotactic"\ 62\ 5span class="autotrace"\ 6 trace conj\ 5/span\ 6\ 5/span\ 6/
qed.
(* iterators *)
theorem eq_map : ∀A,B,f,g,l. (∀x.f x = g x) → map A B f l = map A B g l.
#A #B #f #g #l #eqfg (elim l) normalize // qed.
+(*
let rec dprodl (A:Type[0]) (f:A→Type[0]) (l1:list A) (g:(∀a:A.list (f a))) on l1 ≝
match l1 with
- [ nil ⇒ nil ?
+ [ nil ⇒ nil ?
| cons a tl ⇒ (map ??(dp ?? a) (g a)) @ dprodl A f tl g
- ].
+ ]. *)
-(**************************** length ******************************)
+(**************************** length ******************************
let rec length (A:Type[0]) (l:list A) on l ≝
match l with
[O ⇒ hd A l d
|S m ⇒ nth m A (tail A l) d].
-(**************************** fold *******************************)
+**************************** fold *******************************)
let rec fold (A,B:Type[0]) (op:B → B → B) (b:B) (p:A→bool) (f:A→B) (l:list A) on l :B ≝
match l with
\fold[op,nil]_{i∈(I@J)} (f i).
#A #B #I #J #nil #op #f (elim I) normalize
[>nill //|#a #tl #Hind <assoc //]
-qed.
-
+qed.
\ No newline at end of file