Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Formal Specifications for Complex Systems (236368) Tutorial #1 Course site : T.A. :Emilia Katz.

Similar presentations


Presentation on theme: "1 Formal Specifications for Complex Systems (236368) Tutorial #1 Course site : T.A. :Emilia Katz."— Presentation transcript:

1 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 236368 Emilia Katz, Shahar Dag2 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

3 236368 Emilia Katz, Shahar Dag3 Today: Logic – reminder Zed – notation, conventions, examples

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

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

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

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

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

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

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

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

12 236368 Emilia Katz, Shahar Dag12 פונקציות 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

13 236368 Emilia Katz, Shahar Dag13 פונקציות - דוגמאות (1) A = {a, b, c, d, e} B = {1, 2, 3, 4, 5} {(a 1) (b 2) (c 2)} (2) A = {a, b, c} 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)} (4) A = {a, b, c} 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)} (6) A = {a, b, c} B = {1, 2} {(a 1) (b 2) (c 2)}

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

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

16 236368 Emilia Katz, Shahar Dag16 יחסים (המשך) 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, ד)} What does this mean? Q;R = ?

17 236368 Emilia Katz, Shahar Dag17 יחסים (המשך) הסבר לא מדויק בסימון: 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:

18 236368 Emilia Katz, Shahar Dag18 סדרות סידרה היא למעשה פונקציה שהתחום שלה הוא תת קבוצה רציפה { 1.. N } של המספרים הטבעיים. seq(A) ≜ { f : N ↛ A | dom f = 1.. #f } (שימו לב שכאן אנו מגדירים אוסף של סדרות בהתאם לכל פונקציות המיפוי האפשריות) למשל הוא בעצם הפונקציה { 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 וכך הלאה.

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

20 236368 Emilia Katz, Shahar Dag20 פעולות על סדרות - דוגמאות נגדיר את הסדרות הבאות: S =, T = אזי: S(3) = head S = tail S = last S = front S = S ⌢ T =


Download ppt "1 Formal Specifications for Complex Systems (236368) Tutorial #1 Course site : T.A. :Emilia Katz."

Similar presentations


Ads by Google