Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Questions for Assignment 3 - Introduction to Formal Specification | CS 645, Assignments of Computer Science

Material Type: Assignment; Class: Intro to Formal Specification; Subject: Computer Science; University: University of New Hampshire-Main Campus; Term: Unknown 1989;

Typology: Assignments

2009/2010

Uploaded on 02/25/2010

koofers-user-g2c
koofers-user-g2c 🇺🇸

8 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS-645
Assignment 3
Jeff Rose
1. Give a formal proof of the following theorems:
(a) ((A ¬B) C) (B C)
1. (A ¬B) C P
2. BP
3. ¬CP for IP
4. A ¬B1, 3, DS
5. ¬B4, Simp.
6. 2, 5, Conj.
7. C3, 6, IP
8. B C2, 7, CP
QED 1, 8, CP
(b) (A B) ((A B) ≡ B)
1. A BP
2. ¬((A B) B)P for IP
3. ¬(¬(A B) B)2, T, E
4. (A B) ¬B3, T, E
5. A B4, Simp.
6. ¬B4, Simp.
7. A5, 6, DS
8. B1, 7, MP
9. 6, 8, Conj.
10. (A B) B2, 9, IP
11. ¬(B (A B)) P for IP
12. ¬(¬B (A B)) 11, T, E
13. B ¬(A B)12, T, E
14. B ¬A ¬B13, T, E
15. 14, T, E
16. B (A B)11, 15, IP
17. ((A B) B) (B (A B)) 10, 16, Conj.
18. A BB17, T, E
QED 1, 18, CP
pf3
pf4
pf5
pf8

Partial preview of the text

Download Questions for Assignment 3 - Introduction to Formal Specification | CS 645 and more Assignments Computer Science in PDF only on Docsity!

CS-

Assignment 3 Jeff Rose

  1. Give a formal proof of the following theorems: (a) (( A ∧ ¬ B ) ∨ C ) → ( BC )
  2. (^) ( A ∧ ¬ B ) ∨ C P
  3. B P
  4. (^) ¬ C P for IP
  5. (^) A ∧ ¬ B 1, 3, DS
  6. ¬ B 4, Simp.
  7. (^) ⊥ 2, 5, Conj.
  8. C 3, 6, IP
  9. BC 2, 7, CP QED 1, 8, CP (b) ( AB ) → (( AB ) ≡ B )
  10. (^) AB P
  11. (^) ¬(( AB ) → B ) P for IP
  12. (^) ¬(¬( AB ) ∨ B ) 2, T, E
  13. (^) ( AB ) ∧ ¬ B 3, T, E
  14. (^) AB 4, Simp.
  15. (^) ¬ B 4, Simp.
  16. A 5, 6, DS
  17. B 1, 7, MP
  18. (^) ⊥ 6, 8, Conj.
  19. (^) ( AB ) → B 2, 9, IP
  20. ¬( B → ( AB )) P for IP
  21. (^) ¬(¬ B ∨ ( AB )) 11, T, E
  22. (^) B ∧ ¬( AB ) 12, T, E
  23. (^) B ∧ ¬ A ∧ ¬ B 13, T, E
  24. ⊥ 14, T, E
  25. (^) B → ( AB ) 11, 15, IP
  26. (^) (( AB ) → B ) ∧ ( B → ( AB )) 10, 16, Conj.
  27. (^) ABB 17, T, E QED 1, 18, CP

(c) (( AB ) ≡ B ) → ( AB )

  1. (^) ( AB ) ≡ B P
  2. (^) (( AB ) → B ) ∧ ( B → ( AB )) 1, T, E
  3. (^) ( AB ) → B 2, Simp.
  4. A P
  5. (^) AB 4, Add
  6. B 3, 5, MP
  7. (^) AB 4, 6, CP QED 1, 7, CP (d) B ∨ ((( AB ) → ( CD )) ∧ ( AC )) → ( AB ) ∨ C
  8. (^) B ∨ ((( AB ) → ( CD )) ∧ ( AC )) P
  9. (^) B ∨ ((¬( AB ) ∨ ( CD )) ∧ ( AC )) 1, T, E
  10. B ∨ (((¬ A ∧ ¬ B ) ∨ ( CD )) ∧ ( AC )) 2, T, E
  11. (^) ¬(( AB ) ∨ C ) P for IP
  12. (^) ¬( AB ) ∧ ¬ C 4, T, E
  13. (^) ¬(¬ AB ) ∧ ¬ C 5, T, E
  14. A ∧ ¬ B ∧ ¬ C 6, T, E
  15. (^) ¬ B 7, Simp.
  16. (^) ((¬ A ∧ ¬ B ) ∨ ( CD )) ∧ ( AC ) 3, 8, DS
  17. (^) (¬ A ∧ ¬ B ) ∨ ( CD ) 9, Simp.
  18. A 7, Simp.
  19. (^) AB 11, Add.
  20. (^) ¬(¬ A ∧ ¬ B ) 12, T, E
  21. (^) CD 10, 13, DS
  22. C 14, Simp.
  23. (^) ¬ C 7, Simp.
  24. (^) ⊥ 15, 16, Conj.
  25. (^) ( AB ) ∨ C 4, 17, IP QED 1, 18, CP

The Fifth Trial The same rules apply, and here are the signs: 1 AT LEAST ONE ROOM CONTAINS A LADY

THE OTHER ROOM

CONTAINS A LADY

What should the prisoner do? (L 1 ≡ S 1 ) ∧ (L 2 ≡ ¬S 2 ) ∧ (S 1 ≡ (L 1 ∨ L 2 )) ∧ (S 2 ≡ L 1 )

  1. L 1 ≡ S 1 P
  2. (^) L 2 ≡ ¬S 2 P
  3. (^) S 1 ≡ (L 1 ∨ L 2 ) P
  4. S 2 ≡ L 1 P
  5. (^) ¬L 1 P for IP
  6. (^) (L 1 → S 1 ) ∧ (S 1 → L 1 ) 1, T, E
  7. (^) S 1 → L 1 6, Simp.
  8. (^) ¬S 1 5, 7, MT
  9. (^) (S 1 → (L 1 ∨ L 2 )) ∧ ((L 1 ∨ L 2 ) → S 1 ) 3, T, E
  10. (^) (L 1 ∨ L 2 ) → S 1 9, Simp.
  11. (^) ¬(L 1 ∨ L 2 ) 8, 10, MT
  12. (^) ¬L 1 ∧ ¬L 2 11, T, E
  13. (^) ¬L 2 12, Simp.
  14. (^) (L 2 → ¬S 2 ) ∧ (¬S 2 → L 2 ) 2, T, E
  15. (^) ¬S 2 → L 2 14, Simp.
  16. (^) S 2 13, 15, MT
  17. (^) (S 2 → L 1 ) ∧ (L 1 → S 2 ) 4, T, E
  18. (^) S 2 → L 1 17, Simp.
  19. (^) L 1 16, 18, MP
  20. (^) ⊥ 5, 19, Conj.
  21. L 1 5, 20, IP The prisoner should pick the first room.

The Sixth Trial The king was particularly fond of this puzzle, and the next one too. Here are the signs: 1 IT MAKES NO DIFFERENCE WHICH ROOM YOU PICK

THERE IS A LADY

IN THE OTHER ROOM

What should the prisoner do? (L 1 ≡ S 1 ) ∧ (L 2 ≡ ¬S 2 ) ∧ (S 1 ≡ (L 1 ≡ L 2 )) ∧ (S 2 ≡ L 1 )

  1. L 1 ≡ S 1 P
  2. (^) L 2 ≡ ¬S 2 P
  3. S 1 ≡ (L 1 ≡ L 2 ) P
  4. S 2 ≡ L 1 P
  5. (^) ¬L 2 P for IP
  6. (^) (L 2 → ¬S 2 ) ∧ (¬S 2 → L 2 ) 2, T, E
  7. (^) ¬S 2 → L 2 6, Simp.
  8. (^) S 2 5, 7, MT
  9. (^) (S 2 → L 1 ) ∧ (L 1 → S 2 ) 4, T, E
  10. (^) S 2 → L 1 9, Simp.
  11. (^) L 1 8, 10, MP
  12. (^) (L 1 → S 1 ) ∧ (S 1 → L 1 ) 1, T, E
  13. (^) L 1 → S 1 12, Simp.
  14. (^) S 1 11, 13, MP
  15. (^) (S 1 → (L 1 ≡ L 2 )) ∧ ((L 1 ≡ L 2 ) → S 1 ) 3, T, E
  16. (^) S 1 → (L 1 ≡ L 2 ) 15, Simp.
  17. (^) L 1 ≡ L 2 14, 16, MP
  18. (^) (L 1 → L 2 ) ∧ (L 2 → L 1 ) 17, T, E
  19. (^) L 1 → L 2 18, Simp.
  20. (^) L 2 11, 19, MP
  21. (^) ⊥ 5, 20, Conj.
  22. L 2 5, 21, IP The prisoner should pick the second room.

The Eighth Trial “There are no signs above the doors!” exclaimed the prisoner. “Quite true,” said the king. “The signs were just made, and I haven't had time to put them up yet.” “Then how do you expect me to choose?” demanded the prisoner. “Well, here are the signs,” replied the king. THIS ROOM CONTAINS A TIGER BOTH ROOMS CONTAIN TIGERS “That's all well and good,” said the prisoner anxiously, “but which sign goes on which door?” The king thought a while. “I needn't tell you,” he said. “You can solve this problem without that information.” “Only remember, of course,” he added, “that a lady in the lefthand room means the sign which should be on that door is true and a tiger in it means the sign should be false, and that the reverse is true for the righthand room.” What is the solution? (L 1 ≡ S 1 ) ∧ (L 2 ≡ ¬S 2 ) ∧ ((S 1 ≡ ¬L 1 ) ∨ (S 1 ≡ (¬L 1 ∧ ¬L 2 ))) ∧ ((S 1 ≡ ¬L 1 ) ≡ (S 2 ≡ (¬L 1 ∧ ¬L 2 ))) ∧ ((S 1 ≡ (¬L 1 ∧ ¬L 2 )) ≡ (S 2 ≡ ¬L 2 ))

  1. L 1 ≡ S 1 P
  2. (^) L 2 ≡ ¬S 2 P
  3. (^) (S 1 ≡ ¬L 1 ) ∨ (S 1 ≡ (¬L 1 ∧ ¬L 2 )) P
  4. (^) (S 1 ≡ ¬L 1 ) ≡ (S 2 ≡ (¬L 1 ∧ ¬L 2 )) P
  5. (^) (S 1 ≡ (¬L 1 ∧ ¬L 2 )) ≡ (S 2 ≡ ¬L 2 ) P
  6. (^) (L 1 → S 1 ) ∧ (S 1 → L 1 ) 1, T, E
  7. (^) L 1 → S 1 6, Simp.
  8. (^) S 1 → L 1 6, Simp.
  9. (^) S 1 ≡ ¬L 1 P for IP
  10. (^) (S 1 → ¬L 1 ) ∧ (¬L 1 → S 1 ) 9, T, E
  11. (^) S 1 → ¬L 1 10, Simp.
  12. (^) ¬L 1 → S 1 10, Simp.
  13. (^) ¬S 1 P for IP
  14. (^) L 1 12, 13, MT
  15. (^) ¬L 1 7, 13, MT
  16. (^) ⊥ 14, 15, Conj.
  17. (^) S 1 13, 16, IP
  18. ¬L 1 11, 17, MP
  19. (^) L 1 8, 17, MP
  1. (^) ⊥ 18, 19, Conj.
  2. (^) ¬(S 1 ≡ ¬L 1 ) 9, 20, IP
  3. (^) S 1 ≡ (¬L 1 ∧ ¬L 2 ) 3, 21, DS
  4. (^) (S 1 → (¬L 1 ∧ ¬L 2 )) ∧ ((¬L 1 ∧ ¬L 2 ) → S 1 ) 22, T, E
  5. S 1 → (¬L 1 ∧ ¬L 2 ) 23, Simp.
  6. (^) (¬L 1 ∧ ¬L 2 ) → S 1 23, Simp.
  7. (^) ((S 1 ≡ (¬L 1 ∧ ¬L 2 )) → (S 2 ≡ ¬L 2 )) ∧ ((S 2 ≡ ¬L 2 ) → (S 1 ≡ (¬L 1 ∧ ¬L 2 ))) 5, T, E
  8. (^) (S 1 ≡ (¬L 1 ∧ ¬L 2 )) → (S 2 ≡ ¬L 2 ) 26, Simp.
  9. S 2 ≡ ¬L 2 22, 27, MP
  10. (^) ¬L 2 P for IP
  11. (^) (S 2 → ¬L 2 ) ∧ (¬L 2 → S 2 ) 28, T, E
  12. (^) ¬L 2 → S 2 30, Simp.
  13. S 2 29, 31, MP
  14. (^) L 1 P for IP
  15. (^) S 1 7, 33, MP
  16. (^) ¬L 1 ∧ ¬L 2 24, 34, MP
  17. ¬L 1 35, Simp.
  18. (^) ⊥ 33, 36, Conj.
  19. (^) ¬L 1 33, 37, IP
  20. (^) ¬L 1 ∧ ¬L 2 29, 38, Conj.
  21. (^) S 1 25, 39, MP
  22. (^) L 1 8, 40, MP
  23. (^) ⊥ 38, 41, Conj.
  24. L 2 29, 42, IP The prisoner should pick the second room.