File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,6 +264,14 @@ lemma onth_nth (z : 'a) xs n:
264264 0 <= n < size xs => onth xs n = Some (nth z xs n).
265265proof. by elim: xs n => // = /#. qed.
266266
267+ lemma nth0 ['a] (x : ' a) :
268+ nth witness [x] 0 = x.
269+ proof. by done. qed.
270+
271+ lemma nth1 [' a] (x0 : ' a) (x : ' a) (i : int ) :
272+ nth x0 [x] i = if i = 0 then x else x0.
273+ proof. by done. qed.
274+
267275lemma nth0_head (z : ' a) xs: nth z xs 0 = head z xs.
268276proof. by case: xs. qed.
269277
@@ -1000,6 +1008,10 @@ move=> n_ge0 i_ge0; case: (n < size s) => [lt_n_s|le_s_n].
10001008- by rewrite !(nth_out, drop_oversize) //#.
10011009qed.
10021010
1011+ lemma head_drop [' a] (x0 : ' a) (n : int) (l : ' a list) :
1012+ 0 <= n => nth x0 l n = head x0 (drop n l).
1013+ proof. by move=> ge0_n; rewrite -nth0_head nth_drop. qed.
1014+
10031015lemma nth_take (x0 : ' a) n s i:
10041016 0 <= n => i < n => nth x0 (take n s) i = nth x0 s i.
10051017proof.
@@ -1804,6 +1816,10 @@ op map (f : 'a -> 'b) xs =
18041816 with xs = [] => []
18051817 with xs = y :: ys => (f y) :: (map f ys).
18061818
1819+ lemma map1 [' a ' b] (f: ' a -> ' b) (x : ' a) :
1820+ map f [x] = [f x].
1821+ proof. by done. qed.
1822+
18071823lemma eq_map (f1 f2 : ' a -> ' b):
18081824 (forall x, f1 x = f2 x)
18091825 => forall s, map f1 s = map f2 s.
You can’t perform that action at this time.
0 commit comments