Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I usually can understand structural Induction but i'm getting lost in the base case here. COSC 2300 Exam #2 Part 3: Lists and Trees as

image text in transcribed

I usually can understand structural Induction but i'm getting lost in the base case here.

COSC 2300 Exam #2 Part 3: Lists and Trees as Inductively Defined Types. The following questions test your understanding of inductively defined types in general use cons, first, and rest to create and process lists. and lists and trees in particular. You may 15 pts.|6. Consider the functions operating on lists defined as follows: (defun square (xs) (if (consp xs) (cons (* (first xs) (first xs)) (square (rest xs))) NIL)) s (defun mul (xs) f (consp xs) (first xs) (mul (rest xs))) Prove using structural induction on lists that (mul (square xs)) (* (mul xs) (mul xs)) = You may use any basic arithmetic facts you like, without giving justification. For example, you can just simply use the following fact without giving it a second thought: Solution: Base case,zs=NIL. Then (mul (square xs)) (mul (mul (square NIL) ) NIL)) = = (* (* (mul (mul NIL) (mul NIL)) xs) (mul xs)) = = Induction case, rs cons(a, rsl). Then (mul (square xs)) (mul = (mul (cons (* a a) (square xsl))) - (* a a) (mul (square xs1))) = (* (* a a) (* (mul xs1) (mul xsl)) By Ind. Hyp = (* (* a (mul xsl)) (* a (mul xsl)) = (* (mul (cons a xs 1)) (mul (cons a xsl))) = (* (mul xs) (mul xs)) (square (cons a xsl))) = COSC 2300 Exam #2 Part 3: Lists and Trees as Inductively Defined Types. The following questions test your understanding of inductively defined types in general use cons, first, and rest to create and process lists. and lists and trees in particular. You may 15 pts.|6. Consider the functions operating on lists defined as follows: (defun square (xs) (if (consp xs) (cons (* (first xs) (first xs)) (square (rest xs))) NIL)) s (defun mul (xs) f (consp xs) (first xs) (mul (rest xs))) Prove using structural induction on lists that (mul (square xs)) (* (mul xs) (mul xs)) = You may use any basic arithmetic facts you like, without giving justification. For example, you can just simply use the following fact without giving it a second thought: Solution: Base case,zs=NIL. Then (mul (square xs)) (mul (mul (square NIL) ) NIL)) = = (* (* (mul (mul NIL) (mul NIL)) xs) (mul xs)) = = Induction case, rs cons(a, rsl). Then (mul (square xs)) (mul = (mul (cons (* a a) (square xsl))) - (* a a) (mul (square xs1))) = (* (* a a) (* (mul xs1) (mul xsl)) By Ind. Hyp = (* (* a (mul xsl)) (* a (mul xsl)) = (* (mul (cons a xs 1)) (mul (cons a xsl))) = (* (mul xs) (mul xs)) (square (cons a xsl))) =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

9. System creates a large, diverse talent pool.

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago