From philosophy to computation: how Russell’s type theory impacts programming languages

Type theory introduced by Russell and Whitehead to overcome a paradox found in Frege’s work. The design of lambda-calculus in functional programming languages. The isomorphism between concepts of logic and concepts in type theory and programming.

Рубрика Программирование, компьютеры и кибернетика
Вид статья
Язык английский
Дата добавления 22.02.2021
Размер файла 135,3 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

Размещено на http://www.allbest.ru

Taras Shevchenko National University of Kyiv, Faculty of Philosophy, (Kyiv, Ukraine)

From philosophy to computation: how Russell's type theory impacts programming languages

Mohamad Awwad Ph.D. Candidate

Summary

Type theory is a mathematical development introduced by Russell and Whitehead to overcome a paradox found in Frege's work defending the logicism programme. This theory has strongly influenced the history of computer science. It particularly led to the design of lambda-calculus which is central in functional programming languages and in automated theorem proving. In the meantime, a major result, the Curry-Howard correspondence, has formally proved the isomorphism between concepts of logic and concepts in type theory and programming. The aim of this paper is to show the immense role of Russell's type theory in programming languages design, and to emphasize the importance of the Curry-Howard correspondence in automated deduction.

Consequently, but implicitly, this paper proves how a purely philosophical question concerning the position of logicism in the philosophy of Mathematics led to a major “practical” development in Computer Science.

Keywords: Russell's Paradox, Type Theory, Philosophy of Mathematics, Logicism, Principia Mathematica, Logic, Functional Programming Language, Lambda-Calculus, Curry-Howard Correspondence, Theorem Provers.

Introduction

In 1879 Frege published his Begriffsscrift [1] in which he has developed what is called today modern logic. Frege's main objective was to realize the programme of logicism meaning that Mathematics (or a part of it) could be reduced to logic. In the Begriffsscrift, Frege has tried to reduce arithmetic to logic.

In the early 20th century, Russell sent a letter to Frege pointing out a paradox found in the Begriffsscrift. In 1903, Russell and Whitehead published the monumental work “Principia

Mathematica” (or Principles of Mathematics) [2], in which they provided a new formal model claiming to overcome this paradox, but more importantly tried to reduce, again with a strong belief on the logicism programme, the whole of mathematics to logic. In this immense work, the authors have developed a new theory, the type theory, believing it helps in proving the logicism position as a valid foundation of Mathematics.

In 1930, Godel proved in his Incompleteness theorems [3, p.48] that there are truths in arithmetic that cannot be proved inside Russell's system. This is, in addition, true when applied to any other formal system similar to the approach used in Principles of Mathematics.

Despite the fail of logicism programme, type theory turned out to be of big importance in Computer Science developed few decades later. The importance of type theory in programming languages is described by Gillies as follows: Although the role of a hierarchy of types has remained important in the foundations of set theory, strong typing has not. It has turned out that one can function quite well with variables that range over sets of whatever type. So, Russell's ultimate contribution was to programming languages!” [4, p. 595].

Type theory is now situated at the heart of the understanding of the computing process in terms of logic, of enhancing computational mathematics, and of doing programming as logical objects. Thus, it allows the developing of logical tools that can reason about programs. Particularly, it helps in the design of compilers that guarantee a certain level of correctness and efficiency of programs. It helps detecting errors in programs before their execution which increase the quality and the reliability of the software. In addition, type theory is a main tool in assisted theorem provers.

In this paper I give a simple description of type theory, and then point out the multiple impacts and roles that this theory have been playing in the development of Computer Science in general, and in programming languages in particular.

1. Type Theory: Description and Usefulness in Computer Science

Russell defined the objects in his system in a way that each object belongs to a specific type in a hierarchical manner. The numbers, for instance, belong to type 0, the set of numbers to type 1, the sets of sets of numbers to type 2, and so on. This means that a set of type i can contain elements of type less than i, and thus, the set type should be different to its elements' type, and all these elements are of the same type. This idea is known as the comprehension rule which only allows the creation of sets over elements already created. Consequently, Russell's set containing “all sets that are not elements of themselves” is not accepted by the comprehension rule, and so Russell's paradox seems to be avoided.

This idea of distinguishing between objects of different types is explicitly used in programming languages. In fact, by opposition of humans who are naturally able to assign the right type to the objects used in an expression, computers, with the absence of intuition, can easily assign the wrong type to an object used in a program if the concept of a typed syntax is not applied.

For example, assigning an integer instead of a real number to a variable leads to a loss of precision, or in a critical situation when a function returns the address of an object instead of its content. Thus, when defining a function in a program, it is important to assure that the types of its return value and its parameters are well defined in order to avoid any wrong calculation due to a bad type matching.

An important objective of a type system is to enforce the computer program to respect type constraints in order to avoid a wrong assignment of types among the considered object, such as variables, functions, etc. These constraints are usually taken into consideration upon the design of the programming language to ensure that the data type of an object and its physical representation in the computer are compatible, and consequently ensuring the integrity and the correct execution of the computer instructions. In other words, type theory in programming deals with the organization and the treatment of the data and expressions into specific types as well as the relationship between them when it is a question of interpreting their types. This can be seen as type checking algorithms built in the design of typed languages' compilers. In this sense, the authors of [5, p.220] defined a type system as follows:

“A type system is a form of context-sensitive grammar that imposes restrictions on the formation of programs to ensure that a large class of errors, those that arise from misinterpretation of values, cannot occur. Examples of such errors are: applying a function on the integers to a boolean argument; treating an integer as a pointer to a data structure or a region of executable code” [5, p.220].

It is summed up again in the same reference as follows: “Type theory emerged as a unifying conceptual framework for the design, analysis, and implementation of programming languages” [5, p.7]. More precisely, the authors pointed out that “Type theory helps to clarify subtle concepts such as data abstraction, polymorphism, and inheritance. It provides a foundation for developing logics ofprogram behaviour that are essential for reasoning about programs. It suggests new techniques for implementing compilers that can improve the efficiency and integrity of code”. [5, p. 7]

More generally, type theory is defined as the discipline of studying type systems in programming languages in a formal way. It is seen as a tool in the design and definition of programming languages [6, p. 516]. It intervenes in the definition of abstraction, polymorphism [7, p.2], and other fundamental principles in programming.

2. Influence of Type Theory on Functional Programming Languages

Type theory and functional programming language are intimately related. In fact, type theory constitutes the core of most functional languages such as LISP, ML and others, and consequently the “programming by functions” paradigm became, as wanted by Church, a foundational part of the design of functional languages. They are, in addition, used to analyze other programming languages which often integrate some features of type systems' principles.

In 1932-1933 Church defined the lambda-calculus notation [8, p.60] focusing on functions as primitive objects instead of sets developed earlier by Russell and Whitehead. It became, then, an integral part of type theory.

Consequently, the typed lambda calculus became a semantic model for many functional languages and theorem provers.

More precisely, a term in lambda-calculus is a variable, function, or application. The only valid terms are who respect a type constraint fortified by types' rules. For example, if a function f is defined as f\ t1 ^ t2 , this typing rule means that the only valid input type is t1, and the only output valid type is t2.

Concerning the languages design, Church's lambda-calculus has been at the origin of the development of functional programming languages in general, and Lisp language in particular. It basically led to two main programming approaches: untyped (or implicitly typed) languages, and typed languages, such as Algol, in which the types of variables, functions or other programming objects are explicitly defined in the program.

The principle of type theory allows, on one hand, to define the data types, and on the other hand, to precise the functions intervals or their data range.

Functional programming languages deal with computation simply as evaluation of functions. The extension of Russell's type theory based on sets to a simple type theory based on functions is a basis of the development of functional languages in which a set becomes a type among many others. In this sense, it is computationally more practical to consider objects as types rather than sets. This allows the definition of many data structures such as lists, graphs, trees, etc. as different types on which many functions can be applied.

LISP is one the first and most popular functional programming language designed by McCarthy in 1958. In this language, the core data type are the atoms (or terms), lists, and functions. Lisp is known for its many innovative principles such as dynamic typing principle. It is particularly popular in Artificial Intelligence applications, in Automated Theorem Provers, and in the design of other programming languages. For example, Common Lisp was used as input and design language to create ACL2 (A Computational Logic for Applicative Common Lisp), which is basically used in the automated reasoning systems such as formal verification.

Another important functional programming language is ML, for Meta Language, which is derived from Lisp with strong type system. It is known for its type safety based on a polymorphic type system [9, p. 353]. It is widely used in the design of formal languages and theorem provers.

3. Curry-Howard Correspondence and Theorem Provers

One of the most striking results that connect Logic and Type theory is the Curry-Howard correspondence. It shows a deep relationship between Logic (usually constructive) and type systems. The basic correspondence (or isomorphism) states that programs and proofs are equivalent. The fact of using a constructive or intuitionistic proof of the existence of a certain object allows the use of this proof as a program that creates instances of that object. In other words, given a logical proposition P, a proof of P corresponds exactly to an example of type P.

This concept is widely used in the design of theorem provers. Thus, considering the type systems terminologies, a proof is a well-typed program; a type is isomorphic to a proposition, and an inhabited type is a truth or a theorem. Other correspondences are listed below in Table 1.

Many theorem provers, such as Coq, use an extension of lambda-calculus called Calculus of Inductive Constructions as the logical basis of these provers. In fact, this calculus uses the approach that considers a proposition as type discussed above.

Fig. 1 Table 1 CORRESPONDENCE BETWEEN TYPE THEORY AND LOGIC

Source: Propositions as Types, Curry-Howard Isomorphism; Klaus Ostermann Aarhus University; Educational slides.

As I already mentioned, Russell's type theory leading to Church's simple Type Theory, and then extended to the Calculus of Inductive Construction, occupies a fundamental part in several interactive “provers” or computer-assisted reasoning.

Perhaps, as suggested in [10, p.9], one of the most important contributions of “Principles of Mathematics” is its capacity to promote the proposition-as-type principle, and more generally to connect Logic to formal type systems. Consequently, Type systems provided a strong computational interpretation to Logic.

Type Theory has been used as the basic model (or meta-language) of many interactive automated reasoning systems. These provers include, among others, Coq, HOL, Twelf, and Agda.

They usually provide constructive proofs of mathematical statements or correctness and verification of other systems. This idea about the use of type theory in computer science was interestingly described in [10, p. 1] as follows:

“These intellectual contributions are matched by an elegant computing and information technology that integrates programming languages, interactive provers, model checkers, and databases of formal knowledge“/)10, p.1].

The next section is dedicated to highlight the role of type theory in object-oriented languages, a major programming languages family.

4. Influence of Type Theory on Object-Oriented Paradigm

There are different central principles in object- oriented programming languages that constitute a direct result of the type theory developments. These principles are, among many others, polymorphism, data abstraction, and inheritance.

It is useful to mention that polymorphic functions are those who receive parameters having more than one type. Polymorphic types are used when operations on values having more than one type are applied. Usually a value can have many types in belonging to a parametric polymorphism in which the functions have explicit (or implicit) type parameters or to an inclusion polymorphism where the instance depends on different classes which are inclusive among each other's [6, p. 474].

Object-oriented languages regroup in one package the principles of types, data abstraction, and polymorphism. Note that the data abstraction is a way of creating and organizing complex data structures by providing only the essential information to the outside environment and hiding all the details. Inheritance, on the other hand, is a kind of polymorphism where subclasses inherit the attributes and properties of the superclasses.

In sum, object-oriented languages are directly related to type theory by having typed objects and types that can inherit entities from higher types (supertypes). As I mentioned, these objects can be organized as “added” data structures within the language, and the inheritance allows the definition of new type based on predefined types. It is important, however, to emphasize the importance of the bounded quantification notion in the inheritance process. Formally, bounded quantification can be defined as follows: [6, p.480]

...

Подобные документы

  • Написaние прoграммы, выполняющей трансляцию с языка программирования Пaскaль нa язык прoгрaммирoвaния Си и транслирующей конструкции, такие кaк integer, repeat … until Le, procedure, type, record для type. Обработка арифметических и логических выражений.

    курсовая работа [314,3 K], добавлен 03.07.2011

  • Формализованное описание закона Pearson Type V. Характеристика методов получения выборки с распределением Pearson Type V. Исследование временных рядов с шумом заданным Rayleigh. Экспериментальное исследование средней трудоемкости Pirson Type V и Rayleigh.

    курсовая работа [4,5 M], добавлен 20.06.2010

  • Использование в программах, написанных на языке C, Windows application programming interfaces. Роль центрального процессора. Архитектура Фон Неймана. Оперативная память. Графическая плата. Создание интерфейса программы. Разработка машинного кода.

    реферат [101,5 K], добавлен 15.05.2014

  • Составление транслятора на языке С для перевода кода программы из языка Pascal в код программы на языке Cи. Распознавание и перевод конструкций: for, type, function, integer. Вешняя спецификация, описание, структура, текст программы; распечатка текстов.

    курсовая работа [287,8 K], добавлен 24.06.2011

  • Creation of the graphic program with Visual Basic and its common interface. The text of program code in programming of Visual Basic language creating in graphics editor. Creation of pictures in Visual Basic, some graphic actions with graphic editor.

    лабораторная работа [1,8 M], добавлен 06.07.2009

  • Lines of communication and the properties of the fiber optic link. Selection of the type of optical cable. The choice of construction method, the route for laying fiber-optic. Calculation of the required number of channels. Digital transmission systems.

    дипломная работа [1,8 M], добавлен 09.08.2016

  • Social network theory and network effect. Six degrees of separation. Three degrees of influence. Habit-forming mobile products. Geo-targeting trend technology. Concept of the financial bubble. Quantitative research method, qualitative research.

    дипломная работа [3,0 M], добавлен 30.12.2015

  • The solving of the equation bose-chaudhuri-hocquenghem code, multiple errors correcting code, not excessive block length. Code symbol and error location in the same field, shifts out and fed into feedback shift register for the residue computation.

    презентация [111,0 K], добавлен 04.02.2011

  • Проектирование базы данных "Учет товаров на складе". Сущность типа связи "один – к – одному", "один – ко – многим". Реализация базы данных на компьютере. Define Secondary Indexes. Взаимосвязанные таблицы информационной части в формате "Paradox 7.0".

    контрольная работа [713,0 K], добавлен 18.05.2014

  • Розробка принципової електричної схеми системи управління конвеєрною лінією, яка складається з трьох послідовних конвеєрів. Реалізація алгоритму роботи на мові сходинкових діаграм LD. Розробка керуючої програми для мікроконтролерів Zelio Logic та ОВЕН.

    курсовая работа [230,2 K], добавлен 15.06.2015

  • Окно для работ с Design Assistant. Пример комбинационной логики, используемой в качестве тактового сигнала. Условия эффективного снижения энергопотребления с помощью сигнала синхронизации, полученного при помощи логической ячейки. Вкладка Fitter Settings.

    курсовая работа [562,7 K], добавлен 05.11.2014

  • История образования ТОО "ABC Design". Разработка программного и информационного обеспечения компьютерных сетей, автоматизированных систем вычислительных комплексов и сервисов. Работа с CRM системой Task Manager и с панелью управления сайтов JOOMLA.

    отчет по практике [727,4 K], добавлен 13.07.2017

  • Рассмотрение особенностей структурного разбиения предметной области. Характеристика функциональной и информационной модели бизнес-процессов предметной области. Построение IDEF0- и IDEF1Х-модели заданной предметной области с помощью пакета Design/IDEF.

    контрольная работа [486,5 K], добавлен 08.06.2019

  • Структура економічної інформації підприємства, її основні елементи та їх взаємозв’язок. Структуризація економічної інформації. Класифікація та різновиди інформаційних систем. Особливості СУБД Approach, Paradox, Access, перспективи їх подальшого розвитку.

    контрольная работа [28,9 K], добавлен 27.07.2009

  • Расчет трудоемкости алгоритма. Определение быстродействия процессора. Характеристика контроллеров серии Direct Logic DL. Устройства, которые вошли в структуру системы. Выбор программного обеспечения. Расчет работоспособности и надежности системы.

    курсовая работа [2,0 M], добавлен 14.01.2013

  • Информация, хранящаяся в наших компьютерах, главное содержание, принципы построения и требования к ней. Основные методы учета рисков при анализе проектов. Теория Нечеткой Логики (Fuzzy Logic), направления и специфика применения с помощью пакета Matlab.

    контрольная работа [2,9 M], добавлен 06.10.2014

  • Обоснование выбора средств разработки приложения. Добавление, удаление, редактирование информации. Отражение информации из базы данных. Поиск информации по выбранной таблице. Проекты Data, Entity, Logic, Firm. Схема взаимодействия проектов программы.

    курсовая работа [1,8 M], добавлен 18.01.2015

  • Проектирование экспертной системы выбора нейронной сети. Сущность семантических сетей и фреймов. MatLab и системы Фаззи-регулирования. Реализация программы с использованием пакета fuzzy logic toolbox системы MatLab 7. Составление продукционных правил.

    курсовая работа [904,4 K], добавлен 17.03.2016

  • Структурированные кабельные сети. Универсальная среда передачи информации, объединяющая локальные вычислительные и телефонные сети, системы безопасности, видеонаблюдения. Деятельность компании Step Logic. Применение программ Raster Desk и PlanTracer.

    доклад [597,2 K], добавлен 24.02.2013

  • Основные направления деятельности компании Step Logic в области сетевой интеграции. Использование растрового изображения в качестве подложки. Особенности применение программы Raster Desk и PlanTracer. Отключение видимости при распознавании объекта.

    доклад [599,1 K], добавлен 04.04.2013

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.