Foundations of Computing: Understanding Relations and Graphs

cse 311 foundations of computing n.w
1 / 23
Embed
Share

Explore the concepts of finite state machines, directed graphs, connectivity in graphs, properties of relations, transitive-reflexive closure, n-ary relations, and relational databases in the realm of computing. Delve into topics such as reflexivity, symmetry, transitivity, and relational databases' structures and queries.

  • Computing Foundations
  • Graph Theory
  • Relational Databases
  • Finite State Machines
  • Transitive Closure

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CSE 311: Foundations of Computing Fall 2014 Lecture 21: Finite state machines (aka DFAs)

  2. Directed Graphs V vertices E edges, ordered pairs of vertices G = (V, E) Path of length k: v0, v1, , vk, with (vi, vi+1) in E

  3. Connectivity In Graphs Let R be a relation on a set A. There is a path of length k from a to b if and only if (a,b) Rk Two vertices in a graph are connected iff there is a path between them. Let R be a relation on a set A. The connectivity relation R* consists of the pairs (a,b) such that there is a path from a to b in R. Note: The Rosen text uses the wrong definition of this quantity. What the text defines (ignoring k=0) is usually called R+

  4. Properties of Relations (again) Let R be a relation on A. R is reflexive iff (a,a) R for every a A R is symmetric iff (a,b) R implies (b, a) R R is transitive iff (a,b) R and (b, c) R implies (a, c) R

  5. Transitive-Reflexive Closure Transitive-Reflexive closure: Add the minimum possible number of edges to make the relation transitive and reflexive The transitive-reflexive closure of a relation R is the connectivity relation R*

  6. n-ary relations Let A1, A2, , An be sets. An n-ary relation on these sets is a subset of A1 A2 An.

  7. Relational Databases STUDENT Student_Name ID_Number Office GPA Knuth 328012098 022 4.00 Von Neuman 481080220 555 3.78 Russell 238082388 022 3.85 Einstein 238001920 022 2.11 Newton 1727017 333 3.61 Karp 348882811 022 3.98 Bernoulli 2921938 022 3.21

  8. Relational Databases STUDENT Student_Name ID_Number Office GPA Course Knuth 328012098 022 4.00 CSE311 Knuth 328012098 022 4.00 CSE351 Von Neuman 481080220 555 3.78 CSE311 Russell 238082388 022 3.85 CSE312 Russell 238082388 022 3.85 CSE344 Russell 238082388 022 3.85 CSE351 Newton 1727017 333 3.61 CSE312 Karp 348882811 022 3.98 CSE311 Karp 348882811 022 3.98 CSE312 Karp 348882811 022 3.98 CSE344 Karp 348882811 022 3.98 CSE351 Bernoulli 2921938 022 3.21 CSE351 What s not so nice?

  9. Relational Databases STUDENT TAKES ID_Number Course Student_Name ID_Number Office GPA 328012098 CSE311 Knuth 328012098 022 4.00 328012098 CSE351 Von Neuman 481080220 555 3.78 481080220 CSE311 Russell 238082388 022 3.85 238082388 CSE312 Einstein 238001920 022 2.11 238082388 CSE344 Newton 1727017 333 3.61 238082388 CSE351 Karp 348882811 022 3.98 1727017 CSE312 Bernoulli 2921938 022 3.21 348882811 CSE311 348882811 CSE312 348882811 CSE344 348882811 CSE351 Better 2921938 CSE351

  10. Database Operations: Projection Office Find all offices: OfficeSTUDENT 022 555 333 Office GPA 022 4.00 Find offices and GPAs: Office,GPASTUDENT 555 3.78 022 3.85 022 2.11 333 3.61 022 3.98 022 3.21

  11. Database Operations: Selection Find students with GPA > 3.9 : GPA>3.9(STUDENT) Student_Name ID_Number Office GPA Knuth 328012098 022 4.00 Karp 348882811 022 3.98 Retrieve the name and GPA for students with GPA > 3.9: Student_Name,GPA( GPA>3.9(STUDENT)) Student_Name GPA Knuth 4.00 Karp 3.98

  12. Database Operations: Natural Join Student Takes Student_Name ID_Number Office GPA Course Knuth 328012098 022 4.00 CSE311 Knuth 328012098 022 4.00 CSE351 Von Neuman 481080220 555 3.78 CSE311 Russell 238082388 022 3.85 CSE312 Russell 238082388 022 3.85 CSE344 Russell 238082388 022 3.85 CSE351 Newton 1727017 333 3.61 CSE312 Karp 348882811 022 3.98 CSE311 Karp 348882811 022 3.98 CSE312 Karp 348882811 022 3.98 CSE344 Karp 348882811 022 3.98 CSE351 Bernoulli 2921938 022 3.21 CSE351

  13. Finite State Machines States Transitions on inputs Start state and final states The language recognized by a machine is the set of strings that reach a final state 0 0 State 0 1 1 1 1 s0 s1 s2 s3 s0 s0 s0 s3 s1 s2 s3 s3 s0 s1 s2 s3 0,1 0

  14. Applications of FSMs (a.k.a. finite automata) Implementation of regular expression matching in programs like grep Control structures for sequential logic in digital circuits Algorithms for communication and cache- coherence protocols Each agent runs its own FSM Design specifications for reactive systems Components are communicating FSMs

  15. Applications of FSMs (a.k.a. finite automata) Formal verification of systems Is an unsafe state reachable? Computer games FSMs provide worlds to explore Minimization algorithms for FSMs can be extended to more general models used in Text prediction Speech recognition

  16. What language does this machine recognize? 1 s0 s1 1 0 0 0 0 1 s2 s3 1

  17. Can we recognize these languages with DFAs? * * { x {0,1}* : len(x) > 1}

  18. FSM that accepts binary strings with a 1 three positions from the end

  19. Strings over {0, 1, 2}* M1: Strings with an even number of 2 s s0 s1 M2: Strings where the sum of digits mod 3 is 0 t1 t0 t2

  20. Strings with an even number of 2s and a mod 3 sum of 0 s1t0 s0t1 s0t0 s1t1 s1t2 s0t2

  21. DFA that accepts strings of as, bs, cs with no more than 3 as

  22. Remember the last three bits 3 bit shift register 1 011 001 0 1 1 1 1 1 010 101 111 0 1 000 0 0 1 0 0 0 100 110 0

  23. Remember the last three bits 0 1 0 1 0 1 0 1 11 10 00 01 1 1 1 1 0 0 0 0 1 011 001 0 1 1 1 1 1 010 101 111 0 1 000 0 0 1 0 0 0 100 110 0

Related


More Related Content