Question: Question 6: Tree processing Consider the following OCaml definitions of a tree type and a few functions over values of this type. type 'a tree
Question 6: Tree processing Consider the following OCaml definitions of a tree type and a few functions over values of this type. type 'a tree Leaf of 'a let min x y = if x min (mintree t1) (mintree t2) let rec tfold (1: 'a-) 'b) (f: 'b-> ,b-> ,b) (t: ,a tree) : 'b= match t with l Leaf v -1 v l Branch (ti, t2) (tfold 1 f t1) (tfold 1 f t2) let fold-mintree t = tfold (fun x-> x) min t Prove using induction that for any tree t of type int tree mintree t = fold.mintree t 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 justification describing why that step could be taken. uiting nroofs such as these requires a bit of clear thinking and it is Question 6: Tree processing Consider the following OCaml definitions of a tree type and a few functions over values of this type. type 'a tree Leaf of 'a let min x y = if x min (mintree t1) (mintree t2) let rec tfold (1: 'a-) 'b) (f: 'b-> ,b-> ,b) (t: ,a tree) : 'b= match t with l Leaf v -1 v l Branch (ti, t2) (tfold 1 f t1) (tfold 1 f t2) let fold-mintree t = tfold (fun x-> x) min t Prove using induction that for any tree t of type int tree mintree t = fold.mintree t 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 justification describing why that step could be taken. uiting nroofs such as these requires a bit of clear thinking and it is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
