Question: OCaml : List reverse and append Consider the following denition of append: let rec append l1 l2 = match l1 with | [] -> l2
OCaml :
List reverse and append
Consider the following denition of append:
let rec append l1 l2 = match l1 with
| [] -> l2
| (h::t) -> h :: (append t l2)
Using the denition of reverse from the previous question and the denition of append above,
show, using induction, that
reverse (append l1 l2) = append (reverse l2) (reverse l1)
Your proof must explicitly and clearly indicate the base case you prove, the inductive case you prove and what the inductive hypothesis provides in the proof.
Each step in your proof must be accompanied by a justication describing why that step could be taken.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
