>;; Part 1: Evaluates to ; For each of these, try to predict what the left-hand-side of the ; equality will evaluate to and then replace the # with the correct ; value -- in the canonical form ACL2 prints when passed that ; expression in the read-eval-print loop. For example: ; ; (check= (/ 3 2) #) ; ; should become ; ; (check= (/ 3 2) 3/2) ; ; which is accepted by ACL2 after moving the line past it. (The ; arguments to CHECK= must be equal for ACL2 to accept the check.) ; What you fill in should be an atom, written differently if the left ; hand side is already an atom. ; car, cdr, cons, list (check= (car (cons 'a 'b)) #) (check= (cdr (cons 'a 'b)) #) (check= (cdr (list 1 2 3)) #) (check= (equal (cons 1 2) (list 1 2)) #) (check= (equal (cons 1 (cons 2 nil)) (list 1 2)) #) (check= (car (cdr (list 'a 'b 'c))) #) ; predicates (check= (natp (cons 16 32)) #) (check= (rationalp (cons 16 32)) #) (check= (endp (cons 16 32)) #) (check= (consp (cons 16 32)) #) (check= (natp 16) #) (check= (rationalp 16) #) (check= (endp 16) #) (check= (consp 16) #) ;; Part 2: Recursive Definitions ; You have to provide definitions for the function stubs below. You ; can use auxiliary definitions, if you need them. You have to use the ; design recipe and the design guidelines presented in class. ; odd-integerp: integer -> Boolean ; signature: (x) ; Usage: Returns true if x is an odd integer, nil otherwise. ; Implementation details: recursively define. (defun odd-integerp (x) #) ; all-oddp: (list integer) -> Boolean ; signature: (l) ; Usage: Returns t if all elements in l are odd, nil otherwise. (defun all-oddp (l) #) ; fifth-element: true-list with length >= 5 -> All ; Usage: Returns fifth element in list (car of list is first element, ; not 0-th) (defun fifth-element (l) #) ; replace-element: All All true-list -> true-list ; signature: (old new l) ; Usage: Returns l with all elements that equal old replaced with new. (defun replace-element (old new l) #) ; ordered-elementp: true-list -> Boolean ; signature: (x) ; Usage: Returns true if x is ordered with the relation <, nil otherwise. (defun ordered-elementp (l) #) ; rotate-right: (true-list nat) -> true-list ; signature: (l n) ; Usage: Rotate the list l to the right n times (defun rotate-right (l n) #)