Slides 09 1 Counting the Inhabitants of a Type Given a type , how many closed -terms in  - normal form can receive the type  in TA ? There exists an.

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

Some important properties Lectures of Prof. Doron Peled, Bar Ilan University.
Presented by: Ms. Maria Estrellita D. Hechanova, ECE
5.1 Real Vector Spaces.
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Let V be a variety. If fm 2 I(V), then f 2 I(V).
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Longest Common Subsequence
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Copyright © Cengage Learning. All rights reserved.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
1.  Detailed Study of groups is a fundamental concept in the study of abstract algebra. To define the notion of groups,we require the concept of binary.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Slides 07 1 Restricted -terms and logics Definition (1D1) A -term P is called a I-term iff, for each subterm with the form x  M in P, x occurs free in.
Discrete Mathematics Lecture 4 Harper Langston New York University.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
Regular Expression (EXTRA)
CHAPTER 4 Decidability Contents Decidable Languages
Normal forms for Context-Free Grammars
Orthogonality and Least Squares
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.)
Boyce/DiPrima 9th ed, Ch 11.2: Sturm-Liouville Boundary Value Problems Elementary Differential Equations and Boundary Value Problems, 9th edition, by.
Slides 04 1 Deducibility in TA λ Definition (2A9) Let  be a type-context. If there is a TA -deduction of a formula  ' ↦ M:  for some  '   we shall.
Slides 05 1 The Principal-Type Algorithm In general a typable term has an infinite set of types in TA. For example, it is possible to assign to I  x 
1 10. Joint Moments and Joint Characteristic Functions Following section 6, in this section we shall introduce various parameters to compactly represent.
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
5  Systems of Linear Equations: ✦ An Introduction ✦ Unique Solutions ✦ Underdetermined and Overdetermined Systems  Matrices  Multiplication of Matrices.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Mathematics. Session Set, Relation & Function Session - 3.
Reduction Episode 9 0 The operation of reduction and the relation of reducibility Examples of reductions The variety of reduction concepts and their systematization.
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology Independence and Bernoulli.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology The Weak Law and the Strong.
1 2. Independence and Bernoulli Trials Independence: Events A and B are independent if It is easy to show that A, B independent implies are all independent.
Chapter 3 – Set Theory  .
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Three different ways There are three different ways to show that ρ(A) is a simple eigenvalue of an irreducible nonnegative matrix A:
1 The Halting Problem and Decidability How powerful is a TM? Any program in a high level language can be simulated by a TM. Any algorithmic procedure carried.
Independence and Bernoulli Trials. Sharif University of Technology 2 Independence  A, B independent implies: are also independent. Proof for independence.
Mathematical Induction
A Universal Turing Machine
Copyright © Cengage Learning. All rights reserved. 6 Inverse Functions.
12/13/20151 Computer Security Security Policies...
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
CS 203: Introduction to Formal Languages and Automata
Theory of Computation Lecture 5: Primitive Recursive Functions I
Joint Moments and Joint Characteristic Functions.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
C SC 573 Theory of Computation Theory of Computation Lecture 05 Reduction.
12. Lecture WS 2012/13Bioinformatics III1 V12 Menger’s theorem Borrowing terminology from operations research consider certain primal-dual pairs of optimization.
Chapter 10 Mutual Exclusion Presented by Yisong Jiang.
Properties of Groups Proposition 1: Let (G,  ) be a group. i.The inverse element of any element of G is unique. Remark: In view of i., we may use the.
Theory of Computational Complexity Probability and Computing Ryosuke Sasanuma Iwama and Ito lab M1.
Sorting by placement and Shift Sergi Elizalde Peter Winkler By 資工四 B 周于荃.
Theory of Computational Complexity M1 Takao Inoshita Iwama & Ito Lab Graduate School of Informatics, Kyoto University.
 2004 SDU Uniquely Decodable Code 1.Related Notions 2.Determining UDC 3.Kraft Inequality.
Chapter 2 Sets and Functions.
The Acceptance Problem for TMs
Hierarchy of languages
Alternating tree Automata and Parity games
Unification Algorithm ChuChen
V12 Menger’s theorem Borrowing terminology from operations research
CHAPTER 1 Regular Languages
Presentation transcript:

Slides 09 1 Counting the Inhabitants of a Type Given a type , how many closed -terms in  - normal form can receive the type  in TA ? There exists an algorithm (Ben-Yelles 1979, Hirokawa 1993) that will decide in a finite number of steps whether the number of closed  -normal forms that receive the type  is finite or infinite, will compute this number in the finite case, and will list all the relevant terms in both cases.

Slides 09 2 Typed Terms Space-hungry deduction-tree diagrams can be replaced by compact typed terms. We shall define a system of typed terms isomorphic to TA -deductions: for each , a set TT(  ) of typed terms will be defined that will encode deductions of formulae of the form  - ↦ M:  (  -   ).

Slides 09 3 Definition (5A1) Given a type-context , the set TT(  ) of typed terms relative to  is a set of expressions defined as follows: (i)if  contains x:  then the expression x  is in TT(  ) and is called a typed variable; (ii)if  1   2 is consistent and M   TT(  1 ) and N   TT(  2 ), then (M  N  )   TT(  1   2 ); (iii)if  is consistent with {x:  } and M   TT(  ), then ( x   M  )   TT(  - x). If M  is a typed term (relative to some  ),  is called the type of M .

Slides 09 4 Example: ( x a  x a ) a  a  TT(∅) x a  TT(∅) x a  TT({x:a}) (x (a  a)  b ( x a  x a ) a  a ) b  TT({x:(a  a)  b}) (x a  b x a ) b is not a typed term.

Slides 09 5 Definition (5A2) The type-erasure M  ' of M  is the untyped term obtained by erasing all types from M . M  ' is the subject of the conclusion of the TA -deduction that M  encodes.

Slides 09 6 Inhabitants Definition (8A1) An untyped inhabitant of  is a closed term M such that ⊢ M: . A typed inhabitant of  is a closed typed term M . The sets of all typed and untyped inhabitants of  will be called Habs t (  ) and Habs u (  ) respectively. A  -normal inhabitant of a type is an inhabitant in  -nf.

Slides 09 7 The sets of all typed and untyped normal inhabitants of  will be called Nhabs t (  ) and Nhabs u (  ) respectively. A  -normal inhabitant of a type is an inhabitant in  -nf. The sets of all typed and untyped  - normal inhabitants of  will be called Nhabs  (  ). A type with at least one inhabitant is said to be inhabited.

Slides 09 8 Our aim is to count  -normal inhabitants. The following lemma shows that it does not matter whether we count typed or untyped inhabitants. Lemma (8A2) If M   Nhabs t (  ) then M  '  Nhabs u (  ); further, the type-erasing mapping is a one-to-one correspondence between the typed and the untyped  - normal inhabitants of  (modulo   ). The same holds for  -normal inhabitants.

Slides 09 9 Definition (8A3) The number (0, 1, 2,... or  ) of members of a set S, counted modulo   if S is a set of -terms, is called the cardinality of S or #(S). For #(Nhabs(  )) and #(Nhabs  (  )) we usually say just #(  ) and #  (  ).

Slides Definition (8A4) A distinction will be made between counting and enumerating a set S of  - normal inhabitants of a type  : (i)to count S means to compute #(S), the cardinality of S, with a finite number of steps (even when #(S) =  ); (ii)to enumerate or list S means to enumerate S in the usual recursion-theoretic sense, i.e. to output a sequence consisting of all the members of S, continuing forever if S is infinite.

Slides Examples: 1.The type   ((a  b)  a)  a has no inhabitants. 2.The type   (a  b  c)  (a  b)  a  c has exactly one normal inhabitant: xyz  xz(yz) 3.The type   a  a  a has two normal inhabitants: xy  x and xy  y

Slides The aim of Ben-Yelles' algorithm is to count inhabitants as well as enumerate them. Mere enumeration would be easy: we could simply list all closed typed  -nf's in some standard order and for each one we decide whether it is an inhabitant of the given  by looking at its type. But counting is not so easy: we must find a way of enumerating Nhabs t (  ) which will tell us after only a finite number of steps whether the enumeration will continue forever or not. The strategy of counting will be using the concepts of long  -nf and depth of a term.

Slides Lemma (8A5: Structure of a typed  -nf) Let  be a type- context. Every  -nf M   TT(  ) can be expressed uniquely in the form

Slides Definition (8A6) The depth of a typed or untyped  -nf is defined as follows: Examples: Depth( uv.uxvx) = 1 + Max(Depth(x),Depth(v),Depth(x)) = = 1. Depth(z( w  y)) = 1 + Depth( w  y) = = 1. Depth( x  x(z( w  y))( uv.uxvx)) = 2. Lemma (8A6.2) Depth(M  ) = Depth(M  ') < |M  '|.

Slides Definition (8A7: Long  -nf) A typed  -nf M  is called long or maximal iff every variable-occurrence z in M  is followed by the longest sequence of arguments allowed by its type, i.e. iff each component with the form (zP 1...P n ) (n  0) that is not in a function position has atomic type. An untyped  -nf M is called long relative to a type  iff it is the type-erasure of a typed long  -nf M . The sets of all long normal inhabitants of  (typed or untyped) will both be called Long(  ).

Slides Example: Let   ((a  b)  c)  (a  b)  c. Then the following normal inhabitant of  is not long: M   x (a  b)  c y a  b  x (a  b)  c y a  b because y a  b has a type which needs an argument but none is provided. On the other hand, the following one is long: N   x (a  b)  c y a  b  x (a  b)  c ( z a  y a  b z a ).

Slides Definition (8A7.2) The sets of all long normal inhabitants of  (typed or untyped) with depth  d will both be called Long( ,d). The following lemma indicates that if we can enumerate long normal inhabitants, the others will be obtainable from these long ones by  -reduction. Lemma (8A8) Every normal inhabitant of  can be  - expanded to a long normal inhabitant of . And this long inhabitant is unique (modulo   ); i.e. {M , N   Long(  ) and M  =  N  }  M    N . Proof:

Slides Let P   Nhabs(  ). First we must  -expand P  to a term P  +  Long(  ). Then we must show that P  + is unique, i.e. that (1)M   Long(  ) and M  ⊳  P   M    P  +. Suppose P  contains a short component, i.e. a component with the form (yQ 1...Q n ) , where n  0, that is not in function position and whose type  is composite, say    1 ...  k  a(k  1). We choose distinct new variables z 1,..., z k not occurring in P  ' and replace this component by This replacement is an  -expansion and its result is still a  - nf. We make similar replacements until there are no short components left in P . Call the result P  +. This term satisfies (1), by induction on |P  |.

Slides Definition (8A9) The set of all terms obtained by  - reducing M  is called the  -family of M , or {M  } . Lemma (8A10) (i)The  -families of the long typed normal inhabitants of  partition Nhabs(  ) into non-overlapping finite subsets, each  -family containing just one long member and just one  -nf. (ii)#(  ) is finite or infinite or zero according as #  (  ) is finite or infinite or zero. (iii)#  (  ) = #(Long(  )).

Slides Definition (8A11: Principal Inhabitants) An untyped inhabitant M of  is called principal iff  is a principal type of M. A typed inhabitant M  of  is called principal iff the deduction of ↦ M  ':  that it encodes is principal. The sets of all principal inhabitants of  (typed or untyped) will both be called Princ(  ). The sets of all principal  -normal inhabitants of  (typed or untyped) will both be called Nprinc(  ).

Slides Lemma (8A11.1) M  is a typed principal  - normal inhabitant of  iff M  ' is an untyped principal  -normal inhabitant of . Lemma (8A11.2) Let M  + be the unique member of Long(  ) to which M   -expands. Then M   Nprinc(  )  M  +  Nprinc(  ). Proof: The  -expansion in the proof of (8A8) preserves principality because of the way the types given to z 1,..., z k are determined by the type  of the component that is replaced.

Slides Example (8A12) Three sets of  -nf's have been defined, namely: Nhabs(  ), Long(  ), and Nprinc(  ). The sets of all  - nf's in these sets are called respectively: Nhabs  (  ), Long  (  ), and Nprinc  (  ). The relations between these six sets can be demonstrated with the type   (a  a  a)  a  a  a. For this type, the six sets are all distinct. (i) x a  a  a  x a  a  a  Nhabs  – (Long  Nprinc). This term is a  -nf, but it is not long. It fails to encode a principal deduction for x  x because the PT( x  x) is not the given  but a  a. (ii) x a  a  a y a  (xy) a  a  Nhabs – Nhabs  – (Long  Nprinc). This term is obtained by  -expanding the term in (i). (iii) x a  a  a y a z a  (xyz) a  Long – Nhabs  – Nprinc. This term is obtained by  -expanding the term in (i) until it becomes long.

Slides (iv) x a  a  a y a  (x(xyy)) a  a  Nprinc  – Long . This term is principal but it is not long because its second x from the right has only one argument. (v) x a  a  a y a z a  (x(xyy)z) a  Nprinc  Long – Nhabs . This term is obtained from (iv) by  -expansion; both occurrences of x now have two arguments. (vi) x a  a  a y a z a  (xz(xyy)) a  Nprinc   Long . This term is like (v) but z and xyy have been reversed to make it an  -nf. (vii) x a  a  a y a z a  (xzy) a  Long  – Nprinc . This term is long. However, its PT is not the given  but (a  b  c)  b  a  c.

Slides Lemma (8B1) Every type  can be expressed uniquely in the following form, where m  0 and e is an atom:    1 ...  m  e. The occurrences of  1,...,  m and e above are called the premises and conclusion (or tail) of  respectively, and m is called the arity of . Two type-occurrences are called isomorphic iff they are occurrences of the same type. Iff the tail- components of  and  are isomorphic, we say Tail(  ) ≅ Tail(  ).

Slides The core of the inhabitant counting algorithm is a search algorithm which will seek long normal inhabitants of a type  with increasing depths d = 0, 1, 2,.... The strategy of this search algorithm depends on the following facts about the structure of long typed terms.

Slides Remark (8B2) Let  be any type; say  has the form    1 ...  m  e(m  0, e an atom) and let M  be any  -nf with type . By (8A5), M  has the form If M  is long, then (i)k = m,(ii)  *  e, (iii)the types of x 1,..., x m coincide with the premises of , (iv)the tail of the type of is isomorphic to that of , (v)if M  is closed then m  1 and is an x i (1  i  m) and  i   1 ...  n  e.

Slides Example (8B3: a type  with #(  ) = 1) The following type:   (a  b  c)  (a  b)  a  c has exactly one normal inhabitant (which is also both long and principal): S   x a  b  c y a  b z a  xz(yz). Proof: We start by showing that Long(  ) = {S  }. Step 1. By Remark (8B2), for the structure of  we have m = 3, e  c,  1  a  b  c,  2  a  b, and  3  a. Hence any M   Long(  ) must have just three initial abstracted variables, say

Slides By (8B2(iv)), must be one of x 1, x 2, x 3 whose type's tail is isomorphic to that of . The tail of  is c, and the only  i whose tail is an occurrence of c is  1, so must be x 1. Since  1 has two premises, x 1 must be followed by exactly two arguments. Hence M must have the form Step 2. We search for suitable U a and V b. The type of U a is an atom so U a cannot be an abstraction. Thus U a  (wP 1...P r ) a (r  0) where w is an x i whose type's tail is isomorphic to the tail of the type of U. This tail is an occurrence of a, so the only possibility is w  x 3. Since the type of x 3 has no premises we have r = 0 and hence U a  (x 3 ) a.

Slides Next we search for V b. Since b is an atom, V b cannot be an abstraction and its head must be an x i whose type's tail is an occurrence of b. The only possibility is x 2, and the type of x 2 allows only one argument, so Step 3. We search for W a. Just as for U a, the only possibility is W a  (x 3 ) a. Conclusion. Modulo   there is at most one term in Long(  ), namely Note that S  is actually in Long(  ) and is  -irreducible. Hence, by (8A10), Nhabs(  ) = {S  }.

Slides Also, by the PT algorithm,  is a principal type of S  ; hence, Nprinc(  ) = {S  }. Example (8B4: a type  with #(  ) = m) For each m  2 the following type  has exactly m normal inhabitants and all are long and non-principal:   a ...  a  a (m+1 a's). The normal inhabitants are the following m terms (called projectors or selectors): Proof:

Slides By Remark (8B2), any M   Long(  ) must have the form But the types of x 1,..., x m have no premises, so n = 0. Hence Every such selector is in Long(  ) and  -irreducible. So by (8A10), Nhabs(  ) = Long(  ). Since m  2, by the PT algorithm, no selector is in Nprinc(  ); hence Nprinc(  ) = { }.

Slides Example (8B5: types  with #(  ) = 0) (i)No atomic type has inhabitants. (ii)No skeletal type has inhabitants. Proof: (i)Every type with an inhabitant has a normal one, by WN (see next slide). But every type with a normal inhabitant has arity m  1, by (8B2(iii)). (ii)Let  be skeletal and let    1 ...  m  e (m  1). If  had inhabitants it would have at least one long normal one, by (8A8); and, by (8B2), this inhabitant would have the form x 1...x m  x i M 1...M n with x i having type  i and the tail of  i being an occurrence of e. But  is skeletal, so e cannot occur in any  i. Hence  has no inhabitants.

Slides Weak Normalization (WN) Theorem (5C1) Every typed term P  has both a  -nf and a  -nf. Strong Normalization (SN) Theorem (5C2) Let P   TT(  ) for some  ; then, for  -reductions and for  -reductions, (i)all reductions of P  are finite, (ii)there is an algorithm which accepts P  as input and computes a number k(P  ) such that all reductions of P  have length  k(P  ).

Slides Corollary (8B5.1) Intuitionistic implicational logic is consistent in the sense that not all formulas are provable. Proof: If an atomic formula e were provable it would be the type of a closed term, by (6B7), contradicting (8B5).

Slides Example (8B6: Peirce's law) The type   ((a  b)  a)  a has no inhabitants. Proof: Suppose M   Long(  ). Then by (8B2), M  must have the form M   x (a  b)  a  U 1...U n (n  0). And  x, since M  is closed. Hence n = 1, since the type of x has only one premise. Thus M   x (a  b)  a  x (a  b)  a U a  b for some U a  b. Since a  b has just one premise, U a  b must have the form U a  b  y a  (wV 1...V r ) b (r  0).

Slides Since M  is closed, w must be x or y. But w must have a type whose tail is an occurrence of b and neither x nor y has such a type, so no suitable U a  b exists. Thus Long(  ) = { } and hence Nhabs(  ) = { }, by (8A8), and hence Habs(  ) = { }.