Require Import Arith List Bool. (* 1/ Define a function that takes a list of natural numbers as argument and adds all its elements. *) (* 2/ Define a function that takes a list of natural numbers as argument and returns the list of successors of its elements. *) (* 3/ Define a function that takes a list as arguments and returns a list of lists of natural numbers, where each list contains exactly one element that is the corresponding element in the input. For instance, with 1::2::3::nil as input, the output should be (1::nil)::(2::nil)::(3::nil)::nil *) (* 4/ Define a function that takes two natural numbers as input m p, and returns a list that starts with p occurrences of 0, a 1, and (m - p + 1) occurrences of 0, so that the length of the output is always m. If m is 0, then there is no element (and thus no 1) *) (* 5/ Define a function that takes two lists as argument and returs as a result, the list containing the products of the two first elements, then the product of two second elements and so on, if one of the lists is shorter, the corresponding missing elements are considered to be 0. For instance, with inputs (1::2::3::nil) and (4::5::6::7::nil), the output should be (4::10::18::0::nil) *) (* 6/ Define a function that takes a number k and a list of lists as arguments and returns the list of kth elements of all the lists (starting counting at 0). If one of the lists is to short, the value returned should be 0. For instance with inputs 0 and ((1::2::3::nil)::(4::5::6::nil)::(7::nil)::(8::9::nil)::nil::nil) the output should be 1::4::7::8::0::nil with inputs 1 and ((1::2::3::nil)::(4::5::6::nil)::(7::nil)::(8::9::nil)::nil::nil) the output should be 2::5::0::9::0::nil *) (* 7/ Define a function that takes as input a list of lists and returns the maximum length of these lists *) (* 8/ LONG PROJECT: assuming matrices are represented by lists of list of numbers, define a function that performs matrix computation. Parts of this software can be inspired by exercises 1, 5, 6 *)