Guest User

Untitled

a guest
Jul 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. 3. (listp l) => (delete x l) = (delete* x l)
  2.  
  3. phi: (listp l) => (delete-t x l nil) = (delete x l)
  4.  
  5. a. (not (listp l)) => phi
  6. C1. (not (listp l))
  7. C2. (listp l)
  8. C3. (listp acc)
  9. C4. nil { C1, C2 }
  10.  
  11. b. (listp l) /\ (endp l) => phi
  12. C1. (listp l)
  13. C2. (endp l)
  14. C3. (listp acc)
  15.  
  16. (delete-t x l nil)
  17. = { C2, def. delete-t }
  18. nil
  19. = { C2, def. delete }
  20. (delete x l)
  21.  
  22. c. (listp l) /\ (equal x (first l)) /\ phi|((l (rest l)) (acc nil)) => phi
  23. C1. (listp l)
  24. C2. (listp acc)
  25. C3. (equal x (first l))
  26. C4. (listp (rest l)) => (delete-t x (rest l) nil) = (delete x (rest l))
  27. C5. (listp (rest l)) { C1, def. listp }
  28. C6. (delete-t x (rest l) nil) = (delete x (rest l)) { C3, C4, MP }
  29.  
  30. (delete-t x l nil)
  31. = { C2, def. delete-t }
  32. (delete-t x (rest l) nil)
  33. = { C5 }
  34. (delete x (rest l))
  35.  
  36. d. (listp l) /\ (not (equal x (first l))) /\ phi|((l (rest l)) (acc nil)) => phi
  37. C1. (listp l)
  38. C2. (listp acc)
  39. C3. (not (equal x (first l)))
  40. C4. (listp (rest l)) => (delete-t x (rest l) nil) = (delete x (rest l))
  41. C5. (listp (rest l)) { C1, def. listp }
  42. C6. (delete-t x (rest l) nil) = (delete x (rest l)) { C4, C5, MP }
  43.  
  44. (delete-t x l nil)
  45. { Lemma2|((acc nil)) }
  46. (app (delete x l) nil)
  47. { def. app }
  48. (delete x l)
  49.  
  50. Lemma2: (listp l) /\ (listp acc) => (delete-t x l acc) = (app (delete x l) acc)
  51.  
  52. 1. (not (listp l)) /\ (not (listp acc)) => Lemma2
  53. C1. (not (listp l))
  54. C2. (not (listp acc))
  55. C3. (listp l)
  56. C4. (listp acc)
  57. C5. nil { C1, C2, C3, C4 }
  58.  
  59. 2. (listp l) /\ (listp acc) /\ (endp l) => Lemma2
  60. C1. (listp l)
  61. C2. (listp acc)
  62. C3. (endp l)
  63.  
  64. (delete-t x l acc)
  65. = { C3, def. delete-t }
  66. acc
  67. = { C3, def. app }
  68. (app (delete x l) acc)
  69.  
  70. 3. (listp l) /\ (listp acc) /\ (equal x (first l)) /\ Lemma2|((l (rest l))) => Lemma2
  71. C1. (listp l)
  72. C2. (listp acc)
  73. C3. (equal x (first l))
  74. C4. (listp (rest l)) /\ (listp acc) => (delete-t x (rest l) acc) = (delete x (rest l))
  75. C5. (listp (rest l)) { C1, def. listp }
  76. C6. (delete-t x (rest l) acc) = (app (delete x (rest l)) acc) { C2, C4, C5, MP }
  77.  
  78. (delete-t x l acc)
  79. = { C3, def. delete-t }
  80. (delete-t x (rest l) acc)
  81. = { C6 }
  82. (app (delete x (rest l)) acc)
  83. = { C3, def. delete }
  84. (app (delete x l) acc)
  85.  
  86. 4. (listp l) /\ (listp acc) /\ (not (equal x (first l))) /\ Lemma2|((l (rest l)) (acc (app acc (list (first l))))) => Lemma2
  87. C1. (listp l)
  88. C2. (listp acc)
  89. C3. (not (equal x (first l)))
  90. C4. (listp (rest l)) /\ (listp (app acc (list (first l)))) => (delete-t x (rest l) (app acc (list (first l)))) = (app (delete x (rest l)) (app acc (list (first l))))
  91. C5. (listp (rest l)) { C1, def. listp }
  92. C6. (listp (app acc (list (first l)))) { C2, def. app, def. listp }
  93. C7. (delete-t x (rest l) (app acc (list (first l)))) = (app (delete x (rest l)) (app acc (list (first l))))
  94.  
  95. (delete-t x l acc)
  96. = { C3, def. delete-t }
  97. (delete-t x (rest l) (app acc (list (first l))))
  98. = { C7 }
  99. (app (delete x (rest l)) (app acc (list (first l))))
  100. = { associativity of app }
  101. (app (app (delete x (rest l)) (list (first l))) acc)
  102. = { def. app }
  103. (app (cons (first l) (delete x (rest l))) acc)
  104. = { C3, def. delete }
  105. (app (delete x l) acc)
Add Comment
Please, Sign In to add comment