2 , … , and = 1 , 2 , … , is 1 , 2 , … , , 1 , 2 , … , . How can we define this constructively? Also: Any questions about definitions so far, recursive data, etc. 13
1 , 2 , … , and = 1 , 2 , … , is 1 , 2 , … , , 1 , 2 , … , . How can we define this constructively? 14 Suggestion: Define p+q ::= Prepend(p,q) Why does not work: then first(p+q) would be p not 1 Another reason this is not a good idea to define concatenation: We might define Lists of “restricted objects” (e.g. integers) in which case Prepend(e,q) only accepts “e” to be in restricted form (not including lists)
two lists, and , is recursively defined as: Base case: if = (empty list) then + = Constructor case: if = prepend(, ) for some list , obj then + = prepend(, + ) 15
(Natural Numbers) for all data type objects for all reachable states To prove ∙ for all natural numbers prove a base case 0 0 base object prove an inductive step ⇒ ( + 1) ⇒ for all constructable from ⇒ for all reachable from 19
due tomorrow (make sure to read the updated problem 7) Problem set 7 posted tomorrow night (or Sat morning) – read chapter 7 + notes/slides of this weak