1 / 34

Computability

Computability. CPS 001 Mason F. Matthews October 19 th and 21 st , 2005. Write Your Names (or just exercise your curiosity). What is Computer Science?. What can a computer do?. What can a computer not do?. Types of Problems. Tractable

Télécharger la présentation

Computability

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. Computability CPS 001 Mason F. Matthews October 19th and 21st, 2005

  2. Write Your Names(or just exercise your curiosity)

  3. What is Computer Science?

  4. What can a computer do? What can a computer not do?

  5. Types of Problems • Tractable • Problems that can be solved by a computer in a “reasonable” amount of time.

  6. Types of Problems • Tractable • Problems that can be solved by a computer in a “reasonable” amount of time. • Intractable • Problems that can’t be solved by a computer in a “reasonable” amount of time, • But can be solved eventually.

  7. Types of Problems • Tractable • Problems that can be solved by a computer in a “reasonable” amount of time. • Intractable • Problems that can’t be solved by a computer in a “reasonable” amount of time, • But can be solved eventually. • Non-computable • Problems that can never be solved by a computer.

  8. Questions?

  9. Questions? • What is a “problem?”

  10. Questions? • What is a “problem?” • What if I do something dumb, and it takes forever?

  11. Questions? • What is a “problem?” • What if I do something dumb, and it takes forever? • What does “reasonable” mean?

  12. Is there a path from Ann to Bob? Ann Joe Kim Jim Bob Jen John

  13. Is there a path from Ann to Bob? Josh Brett Ann Joe Kyle Kim Lucy Jim Ben Suzy Bob Jen John Jen Julie Frank

  14. How much oil can flow?

  15. How much oil can flow?

  16. Can you color this map with 4 colors?

  17. Can you color this map with 3 colors?

  18. Can you color this map with 3 colors?

  19. Can you color this map with 3 colors?

  20. Can you solve this puzzle?

  21. Can you solve this puzzle?

  22. Can you solve this puzzle? • Does “Intractable” mean impossible?

  23. What is the hardest problemthat you can think of?

  24. How can we deal with these problems?

  25. How can we deal with these problems? • Random Numbers • Can “expect” to solve some in reasonable time

  26. How can we deal with these problems? • Random Numbers • Can “expect” to solve some in reasonable time • Approximation • Can guarantee that we’re “close” to the right answer

  27. How can we deal with these problems? • Random Numbers • Can “expect” to solve some in reasonable time • Approximation • Can guarantee that we’re “close” to the right answer • Parallel Computers?

  28. Non-Computable Problems • Problems that cannot be solved by a computer ever

  29. If you start this program, will it ever stop running? while(1==1) { System.out.println(“Still Running.”); } return;

  30. If you start this program, will itever stop running? int i = 1; while(i>0) { System.out.println(“Still Running.”); i++; } return;

  31. If you start this program, will itever stop running? public class Client {    public static void main(String[] args) {       if(args.length != 2) {          System.out.println("Usage: vbj Client <carrier-name> <aircraft-name>\n");          return;       }       String carrierName = args[0];       String aircraftName = args[1];       org.omg.CORBA.Object carrier = null;       org.omg.CORBA.Object aircraft = null;       org.omg.CORBA.ORB orb = null;       try {           orb = org.omg.CORBA.ORB.init(args, null);       }       catch (org.omg.CORBA.SystemException se) {           System.err.println("ORB init failure " + se);           System.exit(1);        }       { // scope          try {             carrier = orb.bind("IDL:Ship/AircraftCarrier:1.0", carrierName, null, null);          }          catch (org.omg.CORBA.SystemException se) {              System.err.println("ORB init failure " + se);              System.exit(1);           }          org.omg.CORBA.Request request = carrier._request("launch");          request.add_in_arg().insert_string(aircraftName);          request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));          request.invoke();          aircraft = request.result().value().extract_Object();       }       { // scope          org.omg.CORBA.Request request = aircraft._request("codeNumber");          request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));          request.invoke();          String designation = request.result().value().extract_string();          System.out.println ("Aircraft " + designation + " is coming your way");       }        { // scope          org.omg.CORBA.Request request = aircraft._request("attitude");          int altitude = 10000;          org.omg.CORBA.Any ioAltitude = request.add_inout_arg();          ioAltitude.insert_long(altitude); }          try {             carrier = orb.bind("IDL:Ship/AircraftCarrier:1.0", carrierName, null, null);          }          catch (org.omg.CORBA.SystemException se) {              System.err.println("ORB init failure " + se);              System.exit(1);           }          org.omg.CORBA.Request request = carrier._request("launch");          request.add_in_arg().insert_string(aircraftName);          request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));          request.invoke();          aircraft = request.result().value().extract_Object();       }       { // scope          org.omg.CORBA.Request request = aircraft._request("codeNumber");          request.set_return_type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));          request.invoke();          String designation = request.result().value().extract_string();          System.out.println ("Aircraft " + designation + " is coming your way");       }        { // scope          org.omg.CORBA.Request request = aircraft._request("attitude");          int altitude = 10000;          org.omg.CORBA.Any ioAltitude = request.add_inout_arg();          ioAltitude.insert_long(altitude);          String direction = "headup";          request.add_in_arg().insert_string(direction);          request.invoke();          altitude = ioAltitude.extract_long();          System.out.println ("Aircraft is heading up to " + altitude + " Feet.");       }    } }

  32. Proof of impossibility!

  33. What else can’t we knowabout our programs? • Do two programs do the same thing? • Do programs have any bugs? • Do programs do what they’re supposed to do?

  34. What else can’t we knowabout our programs? • Do two programs do the same thing? • Do programs have any bugs? • Do programs do what they’re supposed to do?

More Related