Computational content of proofs involving coinduction Helmut Schwichtenberg (j.w.w. Kenji Miyamoto and Fredrik Nordvall Forsberg) Mathematisches Institut, LMU, M¨ unchen Kyoto University, 19. March 2014 1 / 29
Proof: 2 aspects ◮ provides insight (uniformity) ◮ may have computational content Mathematics = logic + data + inductive definitions ◮ Logic: minimal, intro and elim for → , ∀ ◮ Proof ∼ lambda-term (Curry-Howard correspondence) ◮ Can embed classical and intuitionistic logic 2 / 29
Computable functionals Arguments of any finite type, not only numbers and functions. ◮ Principle of finite support. If H (Φ) is defined with value n , then there is a finite approximation Φ 0 of Φ such that H (Φ 0 ) is defined with value n . ◮ Monotonicity principle. If H (Φ) is defined with value n and Φ ′ extends Φ, then also H (Φ ′ ) is defined with value n . ◮ Effectivity principle. An object is computable iff its set of finite approximations is (primitive) recursively enumerable (or equivalently, Σ 0 1 -definable). 3 / 29
Tokens, consistency and entailment at base types Types ◮ Base types ι : free algebras, given by constructors (e.g. 0, S ). ◮ Function types: ρ → σ . Example: ι := D (derivations, or binary trees), by constructors ◦ (leaf, or nil) and C : D → D → D (branch, or cons). ◮ Token a D : ◦ , C ∗◦ , C ◦∗ , C ( C ∗◦ ) ◦ . ◮ U D := { a 1 , . . . , a n } consistent if ◮ all a i start with the same constructor, ◮ (proper) tokens at j -th argument positions are consistent (example: { C ∗◦ , C ◦∗} ). ◮ U D ⊢ a (entails) if ◮ all a i ∈ U and a start with the same constructor, ◮ (proper) tokens at j -th argument positions of a i entail j -th argument of a (example: { C ∗◦ , C ◦∗} ⊢ C ◦◦ ). An ideal x ρ is a (possibly infinite) set of tokens which is ◮ consistent and ◮ closed under entailment. 4 / 29
Tokens and entailment for N ... S ( S ( S 0)) • ❅ � ❅ � ❅ � S ( S 0) • • S ( S ( S ∗ )) ❅ � ❅ � ❅ � • • S ( S ∗ ) S 0 ❅ � ❅ � ❅ � • • 0 S ∗ { a } ⊢ b iff there is a path from a (up) to b (down). 5 / 29
Total and cototal ideals of base type An ideal x ι is cototal if every constructor tree P ( ∗ ) ∈ x has a “ ≻ 1 -predecessor” P ( C � ∗ ) ∈ x ; it is total if it is cototal and the relation ≻ 1 on x is well-founded. Examples. N : ◮ Every total ideal is the deductive closure of a token S ( S . . . ( S 0) . . . ). The set of all tokens S ( S . . . ( S ∗ ) . . . ) is a cototal ideal. D (derivations): ◮ Total ideal ∼ finite derivation. ◮ Cototal ideal ∼ finite or infinite “locally correct” derivation [Mints 78]. ◮ Arbitrary ideal ∼ incomplete derivation, with “holes”. 6 / 29
Tokens, consistency and entailment at function types Ideals: partial continuous functionals f ρ → σ (Scott, Ershov). ◮ Tokens of type ρ → σ are pairs ( U , a ) with U ∈ Con ρ . ◮ { ( U i , a i ) | i ∈ I } ∈ Con ρ → σ means ∀ J ⊆ I ( � j ∈ J U j ∈ Con ρ → { a j | j ∈ J } ∈ Con σ ) . “Formal neighborhood”. ◮ W ⊢ ρ → σ ( U , a ) means WU ⊢ σ a , where application WU of W = { ( U i , a i ) | i ∈ I } to U is { a i | U ⊢ ρ U i } . Application of f ρ → σ to x ρ is f ( x ) := { a σ | ∃ U ⊆ x ( U , a ) ∈ f } . Principles of finite support and monotonicity hold. 7 / 29
Computable functionals A partial continuous functional f ρ is computable if it is a (primitive) recursively enumerable set of tokens. How to define computable functionals? By computation rules D � P i ( � y i ) = M i ( i = 1 , . . . , n ) with free variables of � y i , where � P i ( � y i ) and M i among � P i ( � y i ) are “constructor patterns”. Terms (a common extension of G¨ odel’s T and Plotkin’s PCF ) M , N ::= x ρ | C ρ | D ρ | ( λ x ρ M σ ) ρ → σ | ( M ρ → σ N ρ ) σ . 8 / 29
Examples +: N → N → N defined by n + 0 = n , n + S m = S ( n + m ) . Y : ( τ → τ ) → τ defined by Yf = f ( Yf ) . R τ N : N → τ → ( N → τ → τ ) → τ defined by R τ N 0 xf = x , R τ N ( S n ) xf = fx ( R τ N nxf ) . Reduction (including β , η ) is non-terminating, but confluent. 9 / 29
Denotational semantics How to use computation rules to define a computable functional? Inductively define ( � U , a ) ∈ [ [ λ � x M ] ] ( FV ( M ) ⊆ { � x } ). Case λ � z M with � x free in M , but not y . x , y ,� ( � U , � W , a ) ∈ [ [ λ � z M ] ] x ,� ( K ) . ( � U , V , � W , a ) ∈ [ [ λ � z M ] ] x , y ,� x M with � x the free variables in M . Case λ � ( � ( � U ⊢ a U , V , a ) ∈ [ [ λ � x M ] ] U , V ) ⊆ [ [ λ � x N ] ] ]( V ) , ( A ) . ( U , a ) ∈ [ [ λ x x ] ( � U , a ) ∈ [ [ λ � x ( MN )] ] For every constructor C and defined constant D : � ( � � U ⊢ � P ( � U ⊢ � a ∗ V , a ) ∈ [ [ λ � x M ] ] V ) ( C ) , ( D ) , ( � ( � U , C � a ∗ ) ∈ [ [ C ] ] U , a ) ∈ [ [ D ] ] with one rule ( D ) for every defining equation D � P ( � x ) = M . 10 / 29
Properties of the denotational semantics ◮ The value is preserved under standard β, η -conversion and the computation rules. ◮ An adequacy theorem holds: whenever a closed term M ι has a token a ∈ P ( � V ) in its denotation [ [ M ] ], then M head reduces to a constructor term entailing a . 11 / 29
A theory of computable functionals ( TCF ) A variant of HA ω . Formulas A and predicates P are defined simultaneously A , B ::= P � r | A → B | ∀ x A P ::= X | { � x | A } | I ( I inductively defined) . ∀ X A not allowed, since this would be impredicative: in the predicate existence axiom P := { � x | A } the formula A could contain quantifiers with the newly created P in its range. ∀ x ρ A is unproblematic: no such existence axioms. 12 / 29
Brouwer - Heyting - Kolmogorov Have → ± , ∀ ± , I ± . BHK-interpretation: ◮ p proves A → B iff p is a construction transforming any proof q of A into a proof p ( q ) of B . ◮ p proves ∀ x ρ A ( x ) iff p is a construction such that for all a ρ , p ( a ) proves A ( a ). Leaves open: ◮ What is a “construction”? ◮ What is a proof of a prime formula? Proposal: ◮ Construction: computable functional. ◮ Proof of a prime formula I � r : generation tree. Example: generation tree for Even (6) should consist of a single branch with nodes Even (0), Even (2), Even (4) and Even (6). 13 / 29
The type τ ( A ) of a formula A Distinguish non-computational (n.c.) (or Harrop) and computationally relevant (c.r.) formulas. Example: ◮ r = s is n.c. ◮ Even ( n ) is c.r. Extend the use of ρ → σ to the “nulltype symbol” ◦ : ( ρ → ◦ ) := ◦ , ( ◦ → σ ) := σ, ( ◦ → ◦ ) := ◦ . Define the type τ ( A ) of a formula A by � if I is c.r. , ι I τ ( I � r ) = ◦ if I is n.c. , τ ( A → B ) := τ ( A ) → τ ( B ) , τ ( ∀ x ρ A ) := ρ → τ ( A ) with ι I associated naturally with I . 14 / 29
Realizability Introduce a special nullterm symbol ε to be used as a “realizer” for n.c. formulas. Extend term application to ε by ε t := ε, t ε := t , εε := ε. Definition ( t r A , t realizes A ) Let A be a formula and t either a term of type τ ( A ) if the latter is a type, or the nullterm symbol ε for n.c. A . � if I is c.r. ( I r inductively defined) , I r t � s t r I � s := I � s if I is n.c. , t r ( A → B ) := ∀ x ( x r A → tx r B ) , t r ∀ x A := ∀ x ( tx r A ) . 15 / 29
Extracted terms, soundness theorem For a derivation M of a formula A define its extracted term et ( M ), of type τ ( A ). For M A with A n.c. let et ( M A ) := ε . Else := x τ ( A ) ( x τ ( A ) et ( u A ) uniquely associated to u A ) , u u et (( λ u A M B ) A → B ) := λ x τ ( A ) et ( M ) , u et (( M A → B N A ) B ) := et ( M ) et ( N ) , et (( λ x ρ M A ) ∀ x A ) := λ x ρ et ( M ) , et (( M ∀ x A ( x ) r ) A ( r ) ) := et ( M ) r . Extracted terms for the axioms: let I be c.r. et ( I + et ( I − ) := R , i ) := C i , where both the constructor C i and the recursion operator R refer to the algebra ι I associated with I . Soundness. Let M be a derivation of A from assumptions u i : C i . Then we can derive et ( M ) r A from assumptions x u i r C i . 16 / 29
Relation of TCF to type theory ◮ Main difference: partial functionals are first class citizens. ◮ “Logic enriched”: Formulas and types kept separate. ◮ Minimal logic: → , ∀ only. x = y (Leibniz equality), ∃ , ∨ , ∧ inductively defined (Martin-L¨ of). ◮ ⊥ := ( False = True ). Ex-falso-quodlibet: ⊥ → A provable. ◮ “Decorations” → nc , ∀ nc (i) allow abstract theory (ii) remove unused data. 17 / 29
Case study: uniformly continuous functions (U. Berger) ◮ Formalization of an abstract theory of (uniformly) continuous real functions f : I → I ( I := [ − 1 , 1]). ◮ Let C f express that f is a continuous real function. Assume the abstract theory proves with I b , n := [ b − 1 2 n , b + 1 C f → ∀ n ∃ m ∀ a ∃ b ( f [ I a , m ] ⊆ I b , n ) 2 n ] � �� � B m , n f Then n �→ m modulus of (uniform) continuity ( ω ) n , a �→ b approximating rational function ( h ) 18 / 29
Recommend
More recommend