53
TOWARDS A PHILOSOPHY OF COMPUTER SCIENCE

TOWARDS A PHILOSOPHY OF COMPUTER SCIENCE. OUTLINE 1. The Discipline of Computer Science 2. Semantics 3. Logic and Computation 4. Computability 5. The

Embed Size (px)

Citation preview

  • Slide 1
  • TOWARDS A PHILOSOPHY OF COMPUTER SCIENCE
  • Slide 2
  • OUTLINE 1. The Discipline of Computer Science 2. Semantics 3. Logic and Computation 4. Computability 5. The Ontology of Computer Science 6. Computational Knowledge 7. Computational Thinking 8. Legal and Ethical Questions 9. Further Issues
  • Slide 3
  • I THE DISCIPLINE of COMPUTER SCIENCE
  • Slide 4
  • What is Computer Science? More than programming The methodology of programming and system design The design and exploration of programming and specification Languages The invention and exploration of new computational paradigms The semantics of programming languages The design of interpreters and compilers The relationship between deduction and Computation The design of embedded and distributed systems The design and exploration of architectural description languages Software engineering AI, robotics, Computational science: computational biology, computational physics, Computational finance
  • Slide 5
  • Computer Science, Mathematics, Science and Engineering Mathematics used to build mathematical models of computational artefacts e.g., analysis of algorithms, semantics of programming languages. Mathematics used in the activity of programming: correctness. Experimentation: empirical testing to see if a system meets its specification (which acts as a theory) Engineering : design methodologies CS involves all these aspects: but is this different to engineering in general?
  • Slide 6
  • Lessons and Overlaps Philosophy of mathematics: the nature of mathematical objects and mathematical knowledge Philosophy of language: theories of meaning and semantics Philosophy of science and the nature of experimentation e.g. computational experiments in evolutionary programming. Specification and testing in software development. Metaphysics: the ontological status of computational artefacts Ethics: computer ethics Philosophy of engineering: the nature of practical knowledge
  • Slide 7
  • Some Questions What kinds of things are programs? Are they abstract or concrete? Do programs have a dual existence do they exist in both physical and symbolic forms? What are their equality criteria: when are two programs taken to be the same (legal aspect)? What is the relationship between programs and algorithms? Are the former linguistic and the latter mathematical objects? How do the they differ? Many computer scientists will claim its syntax all the way down. What kind of things are types/data types? Are they best seen/modelled as sets or categories (in both senses) or something else? What distinguishes hardware from software? What kinds of things are digital objects? What is their identity criteria? Do we need a new ontological category to house them? What are the objectives of the various semantic theories of programming languages? What is the difference between operational and denotational semantics? What does it mean for a program to be correct? What do correctness proofs establish? What is abstraction in computer science? How is it related to abstraction in mathematics? What are formal methods? What is the difference between a formal method and informal one? How is mathematics used in computer science? Are mathematical models used in a descriptive or normative way? Does the Church-Turing thesis apply to physical machines? Is there such a thing as computational thinking?
  • Slide 8
  • II SEMANTICS
  • Slide 9
  • Syntax and Semantics A programming language is not completely determined by its grammar; it only pins down what the legal strings of the language are. We also need to supply a semantic account that provides the meaning of the constructs of the language. In the first instance a semantics is normative. But it is also needed for users of the language. It must facilitate and support 1. The design and verification of correct programs 2. The construction of compilers 3. Proofs of properties of programs and systems 4. Etc..
  • Slide 10
  • Approaches to Semantics 1. Physical Machine 2. Natural language interpretation 3. A translation into a (known) Programming Language 4. A mathematical account
  • Slide 11
  • Machine Semantics One popular view is that the semantic account is supplied by an implementation on physical machine i.e., the intended meaning is to be given by the actual effect on the state of a physical machine. Consider a device found in nature with red and yellow buttons. In order to discover what the yellow button does we push it. We observe that the yellow button moves the head. But designed machines are not like that. They are designed with a purpose that is independently specified. The meaning for the instruction push the yellow button must be given independently of the physical machine. Without this there can be no notion of the machine malfunctioning (not meeting the designers intentions): it just does what it does. But how is such an independent specification to be given?
  • Slide 12
  • Natural Language Consider the NL specification push the yellow button means move the head forward Here the semantics of the instruction given in a natural language. For example, we might specify that If B then C else D means Test B. If true then run C. If B is false then run D But what do test and run mean? These words are vague and so cannot really pin down the meaning of an artificial language.
  • Slide 13
  • Metacircular Interpreters Defined via an interpretation into another programming language (or a subset of the source one) L L Here the second language is intended to provide the meaning of the first. There are two objections: 1. Infinite regress: Kripkes Wittgenstein (later) L L L L........... 2. Logical Requirement
  • Slide 14
  • Logical Requirements Such accounts do not easily support argumentation and exploration of the properties of the language and programs written in it. We need to be able to reason about programs and articulate and establish their properties. There is no mathematics here.
  • Slide 15
  • Mathematical Accounts
  • Slide 16
  • Operational Semantics Abstract machine semantics: given by rules of state change e.g., the reduction rules of the lambda calculus or the SECD machine. Some argue that operational accounts are not mathematical We can apparently get quite a long way expounding the properties of a language with purely syntactic rules and transformations........One such language is the Lambda Calculus and, as we shall see, it can be presented solely as a formal system with syntactic conversion rules..........But we must remember that when working like this all we are doing is manipulating symbols-we have no idea at all of what we are talking about. To solve any real problem, we must give some semantic interpretation. We must say, for example, "these symbols represent the integers". Stoy. Peter Landin ISWIM/Dana Scott OWHY.
  • Slide 17
  • Denotational Semantics Meaning via denotation into mathematical structures. Set-theoretic semantics. Often generalised to category theory. Programs and types associated with abstract mathematical objects. But why are such accounts philosophically different to ones given by abstract machines/reduction rules? These issues reflect the realism/antirealism debates in the philosophy of mathematics.
  • Slide 18
  • Infinite Regress Challenge The infinite regress generated by replacing one language by another? Are mathematical accounts different to translational ones? Even set theory is written in a language and rules or axioms need to be grasped or interpreted. All end in axiomatic theories Kripke, Wittgenstein and Rule following
  • Slide 19
  • Axiomatic Axiomatic theory of language constructs e.g. Direct axiomatisation of state change: Hoare logic provide a relation between states induced by programming constructs. Axiomatic accounts can be viewed as the postulation of a new ontology: an ontology of computational objects.
  • Slide 20
  • Criteria For An Adequate Semantic Theory 1. It must deliver the correct truth conditions e.g. while b do S b S; while b do S (x t )s t[s/x] 2. It must provide a plausible explanation of what it is that a users understanding of the language consists in 3. And it must be comprehensible how someone might acquire that understanding of the language 4. Which of the accounts best satisfies these requirements? 5. Different roles for different approaches
  • Slide 21
  • III LOGIC and COMPUTATION
  • Slide 22
  • Logical Questions Many issues here. Many new logics: Hoare Logic, Dynamic logic, sub-structural logics, partial and three- valued logics, temporal and modal logics,.... What is the appropriate logic with which to reason about program correctness and termination? Programs may not terminate. So should we use a logic with truth value gaps? Or should we employ partial logic? Does it need to be typed? Should the underlying logic be constructive or classical? How do we decide? Are the criteria practical or conceptual?
  • Slide 23
  • The Development of Programs and Systems The core of the subject and the home of many conceptual questions Specification Implementation Program construction Proofs of correctness Testing
  • Slide 24
  • Functional Specifications A so-called functional specification lays down the relationship that should hold between the input and the output. Two parts 1. Declaration of variables and their types; some indicated as inputs and some as outputs 2. A statement of the relationship between the input and output 3. It can be represented as: [x:T,y:S | R(x,y)]
  • Slide 25
  • Correctness A program p with input type T and output type S is taken to be correct relative to a specification [x:T,y:S | R(x,y)] if, for every input x:T, p yields an output y that together with x satisfies R i.e., For all x:T, R(x,p(x))
  • Slide 26
  • Proofs of Correctness Usually carried out in some version of (typed) predicate logic etc. There have to be rules that govern the relationship between programs and specifications e.g. program sequencing x:T R ( x, p ( x )) y : S G ( y, q ( y )) x:T RG ( x, p;q ( x )) The proofs are carried out inside such a system
  • Slide 27
  • Two Philosophical Concerns 1. The Epistemological challenge 2. The Empirical challenge
  • Slide 28
  • The Epistemological Challenge Correctness proofs are usually long, shallow and tedious to carry out. Often they are constructed with the aid of theorem provers. What is the epistemological status of correctness proofs? Generally, are they too long to be graspable? What is it to be graspable? Do we have apriori knowledge of the results? The role of new mathematical concepts and abstraction in creating graspable proofs. Should these be seen as making a proof graspable? Or are we constructing a new proof or even putting in place a proof that was not there before?
  • Slide 29
  • The Empirical Challenge Mathematical correctness is established up to the abstract specification But there is always an empirical residue that pertains to the target physical machine: this can still go wrong Hence, proofs of correctness cannot establish that the program will work on a physical machine Whatever we prove formally, the machine may malfunction
  • Slide 30
  • Physical Correctness We cannot prove correctness of a machine code relative to an actual physical machine. Indeed, how is the machine code fixed? Not by the machine itself (recall semantic discussion). To meaningfully talk about the correctness of the code we require an independent semantic specification (presumably of the designers intentions) Whether the physical machine behaves according to this specification of its machine code is an empirical matter. The question is not whether code is correct but whether the physical machine correctly (in terms of the specification of the machine code ) implements the code. It is the machine that is right or wrong not the software.
  • Slide 31
  • IV COMPUTABILITY
  • Slide 32
  • Turing Machines Turing machines were intended to capture the computational ability of human calculators One interpretation of the Church-Turing thesis is that Turing machines do this and only this (Copeland) But do Turing machines also provide the limit to what can be physically computed?
  • Slide 33
  • Gandy Machines Gandy stated four principles that define a class of discrete deterministic mechanical devices (Gandy machines). Gandy machines are intended to reflect what can be computed in the physical world. Gandy proved that Gandy machines are equivalent to Turing machines. But are there examples of (ideal) discrete deterministic mechanical devices that contravene Gandys principles but are consistent with the physics of the real world?
  • Slide 34
  • A Infinite Speed-up machine Imagine a machine that speeds-up at every step i.e., it performs the same number of computation steps in half the time of the previous step. This will perform 4 steps in 1+1/2+1/4+1/8 seconds In the limit it will perform an infinite number of steps in 2 seconds But is this physically possible? Is this consistent with the physics of the real world?
  • Slide 35
  • V ONTOLOGY
  • Slide 36
  • The Objects of Computer Science Programs Algorithms Specifications Data types Software systems Processes Digital objects Programming languages Specification languages.....
  • Slide 37
  • Some Questions What kinds of things are programs? Are they abstract or concrete? Are programs (literally ) strings of symbols that are well-formed according to some grammar i.e., linguistic objects. Are they different to algorithms? Are the former linguistic and the latter mathematical objects? What is the difference? What is the relationship between programs and algorithms? What are the equality criteria for programs? Are two programs taken to be the same when they encode the same algorithm? But what is the equality criteria for algorithms? When are two types taken to be the same? Is it when they are extensionally the same. Can these issues can only be sensibly addressed in the context of a programming language?
  • Slide 38
  • Semantics and Ontological Questions A tradition that has its modern origins in Frege and Dummett has it that ontology is determined by semantics. Each semantic theory for a programming language generates an ontology and a notion of program equality. The criteria for a correct semantics is clearer to articulate (than metaphysical ones)
  • Slide 39
  • Ontological Frameworks Are types abstract mathematical objects? If so which ones: sets or categories? Most textbooks implicitly treat them as sets. However, the average user does not know or employ these frameworks. In practice, types (e.g. numbers, lists, trees, operations and abstract and polymorphic types) play a sortal role and this is articulated as type-inference rules e.g. x:T t: S s: T S a:T ------------------ x:T t :T S sa:S Here type membership is decidable.
  • Slide 40
  • Computational Ontology Do these remarks argue for a direct axiomatisation of programming languages? This would argue for a new ontological framework in which programs and types are taken as ontologically primitive notions And this framework does not supervene on sets or categories of anything else.
  • Slide 41
  • VI COMPUTATIONAL KNOWLEDGE
  • Slide 42
  • Kinds of Knowledge Theoretical Knowledge is traditionally characterised as knowing that something is the case e.g. 2+2=4 Practical Knowledge is traditionally characterised as knowing how to do something: I know how to ride a bicycle Are these distinct and exhaustive?
  • Slide 43
  • Knowledge of a Third Kind? Can you do the tango? Silly answer: I dont know; I have never tried it. Better: No. I do not even know exactly what is involved. In learning the tango, you are not only learning how to do it but also what it is to do it. Of course, you may not be able to articulate that knowledge; the best you may be able to do is to demonstrate it. Your knowledge lies midway between theoretical and practical knowledge. Dummett argues that knowledge of natural language is of this kind
  • Slide 44
  • Knowing How to Program Is knowledge of programming and programming languages also of this kind? Can you articulate your knowledge of your ability to program in Miranda, C or Java? Is it possible to express the knowledge involved in being able program other than by demonstration?
  • Slide 45
  • VII COMPUTATIONAL THINKING
  • Slide 46
  • Thinking like a Computer Scientist Approach to problem solving. Think procedurally. Use abstraction. Use type checking. Go for implementable solutions... Provides a general set of skills that transcend the ability to write software Gaining credibility. E.g. UK RAE and benchmarks But is it distinctive? Is it different to mathematical thinking? How?
  • Slide 47
  • Two Styles of Problem Solving Computational Mathematical Think procedurally to solve problems Specification with implementation as the solution Tractability and efficiency as desiderata for solution Abstraction, both data and procedural Use problem decomposition etc. Type-checking, as a generalization of dimensional analysis. Solve Problems any way you can The solution can take non- constructive forms Solution does not even have to be computable Abstraction is at the heart of mathematics Use problem decomposition etc. Type-checking not necessarily a part of mathematical problem solving
  • Slide 48
  • Abstraction in Maths and CS Is there one kind of abstraction? Is this captured by Freges principle? The direction of A=The direction of B iff A is parallel to B How does CS abstraction differ from abstraction in mathematics? Is abstraction in CS distinctive because the implementation into lower levels must be (eventually) present? In mathematics the examples of the abstraction may involve proof to check that they are instances. However, they are not necessarily algorithmically checkable.
  • Slide 49
  • Types in Maths and CS How are abstract types and polymorphism used in CS? Type-checking as a semantic extension to syntax. How are types used in mathematics? Originally to avoid paradox. But functions are typed.
  • Slide 50
  • VIII LEGAL AND ETHICAL QUESTIONS
  • Slide 51
  • Legal Questions Identity of programs: semantics and identity revisited. The law, algorithms and the ideas behind/underneath programs Copyright and patents
  • Slide 52
  • Ethical Questions Obligations and correctness: Safety critical software. Any different to the civil engineer? The size and complexity of software and correctness proofs: does it mitigate against the obligation to carry out correctness proofs not feasible in practice
  • Slide 53
  • IX FURTHER ISSUES Issues in the philosophy of mind and computationalism Hypercomputation The design of programming languages Computational paradigms..............