Menu

(Solved) : Consider Following Functions Defined Lists Arbitrary Type Takew Bool Takew P Takew P X Xs Q31337875 . . .

Now consider the following functions defined on lists over an arbitrary type a takew :: (a -> Bool) -> [a] -> [a] takew p ]-] takew p (x:xs) -if (px) then x: (takewp xs) else [] dropw :: (a -> Bool) -> [a] -> [a] dropwp [] = [] dropw p (x:xs) - if p x then (dropw p xs) else (x:xs) together with the append function and the standard equations for if Ll (x:xs) +t ys- x : (xs + ys) -- A2 Show, using structural induction on lists, that the property A1 if True then p else _- p 1f False then _ else q q ++ ys - I2 holds for all lists xs and all functions p :: a -> Bool. In all proofs indicate the justification (eg, the line of a definition used) for each step. a) State and prove the base case of the proof of FP. b) State the inductive hypotheses of the proof of P c) State and prove the step case goal of the proof of P.

Now consider the following functions defined on lists over an arbitrary type a takew :: (a -> Bool) -> [a] -> [a] takew p ]-] takew p (x:xs) -if (px) then x: (takewp xs) else [] dropw :: (a -> Bool) -> [a] -> [a] dropwp [] = [] dropw p (x:xs) – if p x then (dropw p xs) else (x:xs) together with the append function and the standard equations for if Ll (x:xs) +t ys- x : (xs + ys) — A2 Show, using structural induction on lists, that the property A1 if True then p else _- p 1f False then _ else q q ++ ys – I2 holds for all lists xs and all functions p :: a -> Bool. In all proofs indicate the justification (eg, the line of a definition used) for each step. a) State and prove the base case of the proof of FP. b) State the inductive hypotheses of the proof of P c) State and prove the step case goal of the proof of P. Show transcribed image text

Expert Answer


Answer to Consider Following Functions Defined Lists Arbitrary Type Takew Bool Takew P Takew P X Xs Q31337875 . . .

OR