-(*
-lemma length_make_listi: ∀A,a,n,i.
- |make_listi A a n i| = n.
-#A #a #n elim n // #m #Hind normalize //
-qed.
-definition change_vec ≝ λA,n,v,a,i.
- make_veci A (λj.if (eqb i j) then a else (nth j A v a)) n 0.
-
-let rec mapi (A,B:Type[0]) (f: nat → A → B) (l:list A) (i:nat) on l: list B ≝
- match l with
- [ nil ⇒ nil ?
- | cons x tl ⇒ f i x :: (mapi A B f tl (S i))].
-
-lemma length_mapi: ∀A,B,l.∀f:nat→A→B.∀i.
- |mapi ?? f l i| = |l|.
-#A #B #l #f elim l // #a #tl #Hind normalize //
-qed.
-
-let rec make_listi (A:Type[0]) (a:nat→A) (n,i:nat) on n : list A ≝
-match n with
-[ O ⇒ [ ]
-| S m ⇒ a i::(make_listi A a m (S i))
-].
+lemma change_vec_commute : ∀A,n,v,a,b,i,j. i ≠ j →
+ change_vec A n (change_vec A n v a i) b j
+ = change_vec A n (change_vec A n v b j) a i.
+#A #n #v #a #b #i #j #Hij @(eq_vec … a)
+#k #Hk cases (decidable_eq_nat k i) #Hki
+[ >Hki >nth_change_vec // >(nth_change_vec_neq ??????? (sym_not_eq … Hij))
+ >nth_change_vec //
+| cases (decidable_eq_nat k j) #Hkj
+ [ >Hkj >nth_change_vec // >(nth_change_vec_neq ??????? Hij) >nth_change_vec //
+ | >(nth_change_vec_neq ??????? (sym_not_eq … Hki))
+ >(nth_change_vec_neq ??????? (sym_not_eq … Hkj))
+ >(nth_change_vec_neq ??????? (sym_not_eq … Hki))
+ >(nth_change_vec_neq ??????? (sym_not_eq … Hkj)) //
+ ]
+]
+qed.