1 / 20

Formal Specifications for Complex Systems (236368) Tutorial #1

Formal Specifications for Complex Systems (236368) Tutorial #1. Course site : http://webcourse.cs.technion.ac.il/236368/Spring2009/ T.A. : Emilia Katz emika@cs.technion.ac.il Reception hours: Wednesday 15:30 – 16:30 Taub 641.

sahara
Download Presentation

Formal Specifications for Complex Systems (236368) Tutorial #1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Formal Specifications for Complex Systems (236368)Tutorial #1 Course site : http://webcourse.cs.technion.ac.il/236368/Spring2009/ T.A. : Emilia Katz emika@cs.technion.ac.il Reception hours: Wednesday 15:30 – 16:30 Taub 641

  2. General Information • The course is about: Formally expressing requirements • Statements, not proofs • Homework submission: In pairs • From previous years experience, we recommend both partners to participate in every homework solution, in order to succeed in the exam • Formal and exact writing of the solutions is required • List all your assumptions (everything you had to assume for your solution) • There might be one “wet” homework • No midterm exam. Recommendation: solve midterm exams from previous years before the final exam 236368 Emilia Katz, Shahar Dag

  3. Today: • Logic – reminder • Zed – notation, conventions, examples 236368 Emilia Katz, Shahar Dag

  4. Reminder – FOL • See reminder on Logic and Set Theory on course web-page • Now: a couple of examples 236368 Emilia Katz, Shahar Dag

  5. Example 1 Define the predicate prime(x) using logic and the predicate integer(x): 236368 Emilia Katz, Shahar Dag

  6. Example 2 יש להגדיר בעזרת לוגיקה וסימוני קבוצות, את קבוצת כל המספרים הראשוניים שאינם גדולים מ xprimes_upto(x) איך פותרים את אותה הבעיה בעזרת לוגיקה בלבד? 236368 Emilia Katz, Shahar Dag

  7. דוגמאות – שעשועי לוגיקה הגדר בעזרת לוגיקה את המשפט: "לכל אדם יש אב" בצורה דומה נגדיר בעזרת לוגיקה את המשפט: "לכל אדם יש אם אנושית" איך נגדיר כי לכל אדם אב ואם אנושיים הנשואים זה לזו. 236368 Emilia Katz, Shahar Dag

  8. Zed Notation • נראה בהמשך: • סכמות (Schema notation) • סימונים (Conventions) • נראה היום: • מספרים Numbers)) • פעולות לוגיות (Logic) • פונקציות (Functions) • פעולות על קבוצות (Sets & expressions) • יחסים (Relations) (ראה תקציר של Zed באתר הקורס) 236368 Emilia Katz, Shahar Dag

  9. מספרים מספרים שלמים, טבעיים וטבעיים ללא אפס פעולות חשבון כמו שאנחנו מכירים אותם יחסים בין מספרים פונקצית העוקב 236368 Emilia Katz, Shahar Dag

  10. פעולות מוגדרות מראש suc : ℕ → ℕ suc(n) = n+1 { (1, 2) (2 3), (3, 4) …. } suck(n) = n+k pred : ℕ ↛ ℕ pred(n) = n-1 { (1, 0) (2, 1) (3, 2) …. } predk(n) = n-k למה פנק' חלקית? 236368 Emilia Katz, Shahar Dag

  11. פעולות לוגיות - סימון לכל x מסוג T הפרדיקט p מתקיים קיים x מסוג T המקיים את הפרדיקט p קיים בדיוק x אחד מסוג T המקיים את הפרדיקט p 236368 Emilia Katz, Shahar Dag

  12. פונקציות dom(f)  A dom(f) = A dom(f)  A, One-to-one dom(f) = A, One-to-one dom(f)  A, ran(f)=B dom(f) = A, ran(f)=B 236368 Emilia Katz, Shahar Dag

  13. פונקציות - דוגמאות (1) A = {a, b, c, d, e} B = {1, 2, 3, 4, 5} {(a 1) (b 2) (c 2)} (3) A = {a, b, c, d, e} B = {1, 2, 3, 4, 5} {(a 1) (b 2) (c 3)} (5) A = {a, b, c, d, e} B = {1, 2, 3} {(a 1) (b 2) (c 3)} (2) A = {a, b, c} B = {1, 2, 3, 4, 5} {(a 1) (b 2) (c 2)} (4) A = {a, b, c} B = {1, 2, 3, 4, 5} {(a 1) (b 2) (c 3)} (6) A = {a, b, c} B = {1, 2} {(a 1) (b 2) (c 2)} 236368 Emilia Katz, Shahar Dag

  14. פעולות על קבוצות 236368 Emilia Katz, Shahar Dag

  15. יחסים A={1, 2, 3} B={a, b, c} R={ (1, a) (1, b) (3,c) } Not necessarily a function R;R; … ;R (n times) 236368 Emilia Katz, Shahar Dag

  16. יחסים (המשך) What does this mean? X = {1, 2, 3, 4, 5} Y = {a, b, c, d, e} Z = {א, ב, ג, ד} Q = {(1, a)(2, b)(3, c)(4, d)(5, e)} R = {(a, א)(b, ב)(c, ג)(d, ד)} Q;R = ? 236368 Emilia Katz, Shahar Dag

  17. יחסים (המשך) הסבר לא מדויק בסימון: R = {(1, a)(2, b)(3, c)(4, d)(5, e)} A = {1, 2, 3, 6}  result is: A = {1, 2, 3}  result is: A = {b, c, d}  result is: A = {b, c, d}  result is: 236368 Emilia Katz, Shahar Dag

  18. סדרות סידרה היא למעשה פונקציה שהתחום שלה הוא תת קבוצה רציפה { 1 .. N } של המספרים הטבעיים. seq(A) ≜ { f : N ↛ A | dom f = 1.. #f } (שימו לב שכאן אנו מגדירים אוסף של סדרות בהתאם לכל פונקציות המיפוי האפשריות) למשל <mifrat> הוא בעצם הפונקציה { 1↦m, 2↦i, 3↦f, 4↦r, 5↦a, 6↦t } ( או ברישום חלופי: { (1, m) (2, i) (3, f) (4, r) (5, a) (6, t) }) אם נסמן סידרה זו ב S אזי S(1) יחזיר את האות m, S(2) יחזיר את האות i וכך הלאה. 236368 Emilia Katz, Shahar Dag

  19. סדרות (המשך) חשוב: מאפשר מימוש מערכים מערך חד מימדי s(i) מערך דו מימדי s(i)(j) חשוב: tail ו front מחזירים סדרות ועל כן יש לשמור על תקינות ה domain שלהן (ב tail יש לתקן את ה "אינדקס") 236368 Emilia Katz, Shahar Dag

  20. פעולות על סדרות - דוגמאות נגדיר את הסדרות הבאות: S = <a, b, c, d, e>, T = <f, g, h> אזי: S(3) = head S = tail S = last S = front S = S⌢T = 236368 Emilia Katz, Shahar Dag

More Related