Extracting the Fan Functional Ulrich Berger Swansea University Theory Seminar, RIMS, Kyoto University January 17, 2019 Supported by the EU project ’Computation with Infinite Data’ 1 / 39
Overview 1. The fan functional 2. Computational content of proofs 3. Bar induction 4. Proving uniform continuity 5. Extracting the fan functional 6. Further work in program extraction 2 / 39
The fan functional Given: A continuous functional F : ( N → B ) → N ( B = { 0 , 1 } ) Since N → B is compact, F is uniformly continuous (fan theorem). Wanted: The modulus of uniform continuity of F . That is, the least n such that for all α, β : N → B , if α ( k ) = β ( k ) for all k < n , then F ( α ) = F ( β ). The function F �→ n is called fan functional . We are looking for a functional program computing the fan functional, that is, a term in PCF (arithmetic + typed lambda calculus + recursion + lazy evaluation). Moreover, we wish to extract the fan functional as the content of a constructive proof that F is uniformly continuous. 3 / 39
Computational content of proofs via realizability - Overview Instead of defining when a formula is true or false one can define what it means to realize it, i.e. what it means to solve the computational problem it expresses: p r A (program p realizes the formula A ) Depending on the variant of realizability, p can be ◮ a code of a Turing machine (Kleene 1945) ◮ a higher-type functional program (e.g. a term in G¨ odel’s system T ) ◮ an element of a combinatory algebra (e.g. Scott’s D ∞ ) Soundness Theorem. From a constructive proof of a formula one can extract a program realizing it. 4 / 39
Intuitionistic Fixed Point logic ( IFP ) ◮ Intuitionistic first-order logic with equality. ◮ Extra constants, function symbols and atomic predicates (not necessarily decidable), depending on applications. ◮ Free predicate variables X , Y , . . . . ◮ Inductive and coinductive definitions as least and largest fixed points of monotone predicate transformers. ◮ Axioms consisting of non-computational (nc) , that is, disjunction-free, formulas (depending on applications). ◮ For the classically minded user it suffices for these nc axioms to be classically true in the intended model. IFP is developed jointly with Hideki Tsuiki and Olga Petrovska . The rational for IFP is to stay as close as possible to the axiomatic style common in mathematics while still being able to extract useful computational content from proofs. Without nc axioms the proof-theoretic strength of IFP is that of Π 1 2 -comprehension (M¨ ollerfeld 2003, Tupailo 2004). 5 / 39
Induction and coinduction Let Φ = λ X λ� x A ( X , � x ) a monotone predicate transformer. Monotonicity is usually guaranteed by requiting X to occur only at strictly positive positions in A . The following rules express that µ (Φ) is the least predicate X such that Φ( X ) ⊆ X (hence Φ( µ (Φ)) = µ Φ)), and ν (Φ) is the largest predicate X such that X ⊆ Φ( X ) (hence Φ( ν (Φ)) = ν Φ)). Φ( P ) ⊆ P Φ( µ (Φ)) ⊆ µ (Φ) cl µ (Φ) ⊆ P ind P ⊆ Φ( P ) ν (Φ) ⊆ Φ( ν (Φ)) cocl P ⊆ ν (Φ) coind 6 / 39
Example: Real and natural numbers ◮ Variables x , y , . . . are intended to range over abstract real numbers ◮ Constants and function symbols: 0 , 1 , + , − , ∗ , /, | · | , . . . . ◮ Atomic predicates: <, ≤ , . . . . ◮ Nc axioms: ∀ x . x + 0 = x , . . . . ◮ Inductive predicate defining the natural numbers as a subset of the reals numbers: N Def = µ Φ, where Φ = λ X λ x . x = 0 ∨ X ( x − 1). µ We write this more intuitively as N ( x ) = x = 0 ∨ N ( x − 1). ◮ Coinductive predicate defining those real numbers that can be approximated by dyadic rationals: C Def = ν Ψ, where Ψ = λ X λ x . ∃ n ∈ N | x − n | ≤ 1 ∧ X (2 x ). Intuitive notation C ( x ) ν = ∃ n ∈ N | x − n | ≤ 1 ∧ C (2 x ). One can prove C ( x ) ↔ ∀ k ∈ N ∃ q ∈ Q | x − q | ≤ 2 − k where Q is the set of the rational numbers, defined as usual. 7 / 39
Realizability To every predicate variable X we assign a new predicate variable ˜ X with an extra argument place for realizers. a r P ( � P ( � t ) = t ) ∧ a = Nil P atomic predicate ˜ a r X ( � X ( � t ) = t , a ) X a predicate variable c r ( A ∧ B ) = proj 1 ( c ) r A ∧ proj 2 ( c ) r B c r ( A ∨ B ) = ∃ a ( c = Left ( a ) ∧ a r A ) ∨ ∃ b ( c = Right ( b ) ∧ b r B ) f r ( A → B ) = ∀ a ( a r A → ( f a ) r B ) a r ∀ x A = ∀ x ( a r A ) a r ∃ x A = ∃ x ( a r A ) ( µ ( λ ˜ x . A ))( � x λ b . b r A ))( � a r ( µ ( λ X λ� t ) = X λ� t , a ) ( ν ( λ ˜ x . A ))( � x λ b . b r A ))( � a r ( ν ( λ X λ� X λ� t ) = t , a ) Special treatment of nc formulas, e.g. b r ( A → B ) = A → b r B if A is nc 8 / 39
Soundness Soundness Theorem From an IFP proof of a formula A from nc axioms Γ one can extract a program realizing A , provably from Γ in RIFP , the extension of IFP to the language of realizers. Γ ⊢ IFP d : A = ⇒ Γ ⊢ RIFP ep ( d ) r A The nc property (no disjunctions) can be weakened to requiring that axioms be Harrop formulas , that is, don’t contain disjunctions at strictly positive positions and that these axioms imply their realizability translations. 9 / 39
Paths and accessibility Let ≺ be an arbitrary binary relation. ν Path ≺ ( x ) = ∃ y ≺ x Path ≺ ( y ) ( ν means ’greatest’) µ Acc ≺ ( x ) = ∀ y ≺ x Acc ≺ ( y ) Classically, Path ≺ and Acc ≺ are complements of each other. Path ≺ ( x ) means (with dependent choice) that there is an infinite ≺ -descending sequence starting with x . Acc ≺ ( x ) means that ≺ -induction is valid at x : ∀ x ( ∀ y ≺ x P ( y ) → P ( x )) accind ∀ x ( Acc ≺ ( x ) → P ( x )) (progressive predicates hold at all accessible points). 10 / 39
Brouwer’s thesis (abstract form) The implication Acc ≺ ( x ) → ¬ Path ≺ ( x ) is intuitionistically valid (easy ≺ -induction). The converse is can be viewed as a version of Brouwer’s thesis: BT 0 ∀ x ( ¬ Path ≺ ( x ) → Acc ≺ ( x )) Both, the premise and conclusion of BT 0 , are Harrop formulas (do not contain ∨ at a strictly positive position). Therefore, BT 0 has no computational content and hence does not spoil program extraction. Recommended reading on Brouwer’s Thesis: Wim Veldman: Brouwers Real Thesis on Bars, Philosophia Scientiae, CS 6, 2006. 11 / 39
Wellfounded induction Combining BT 0 and induction for Acc ≺ one obtains wellfounded induction ∀ x ( ∀ y ≺ x P ( y ) → P ( x )) ∀ x ( ¬ Path ≺ ( x ) → P ( x )) wfind (progressive predicates hold at all wellfounded points). The extracted program is wellfounded recursion . 12 / 39
Abstract bar induction ( ABI ) y ≺ ∗ x y = x ∨ ∃ z ( y ≺ ∗ z ∧ z ≺ x ) µ = (refl. trans. closure) Def y ≺ P x = y ≺ x ∧ ¬ P ( x ) Let x 0 be arbitrary (playing the role of the empty sequence). Theorem (ABI). If (1) ¬ Path ≺ P ( x 0 ) (2) ∀ x ≺ ∗ x 0 ( ¬ P ( x ) ∨ Q ( x )), (3) ∀ x ≺ ∗ x 0 ( ∀ y ≺ x Q ( y ) → Q ( x )), then Q ( x 0 ). Proof. A constructive proof will be given later. An intuitive classical argument is: Suppose ¬ Q ( x 0 ). Then ¬ Q ( x 1 ) for some x 1 ≺ x 0 , by (2). Iteratively, there is an infinite ≺ -descending sequence ( x i ) such that ¬ Q ( x i ) for all i . By (1), ¬ P ( x i ) for all i . Hence ( x i ) is even ≺ P -descending, contradicting (1). 13 / 39
Constructive proof of ABI Assume (1) ¬ Path ≺ P ( x 0 ) (2) ∀ x ≺ ∗ x 0 ( ¬ P ( x ) ∨ Q ( x )), (3) ∀ x ≺ ∗ x 0 ( ∀ y ≺ x Q ( y ) → Q ( x )), To show Q ( x 0 ) it suffices, by (1), to show ¬ Path ≺ P ⊆ Q , which we do by wellfounded induction. By i.h., ∀ y ≺ ∗ P x Q ( y ). We have to show Q ( x ). We do a case analysis according to (2). If Q ( x ), we are done. If ¬ P ( x ) then the i.h. is equivalent to the premise of (3), hence, again Q ( x ). The extracted program takes as inputs realizers f and g of (2) and (3) respectively and returns h �� where �� is a suggestive name for Left ( Nil ) (realizing x 0 ≺ ∗ x 0 ) and h is a realizer of the formula ∀ x ≺ ∗ x 0 Q ( x ) recursively defined by h s = case f s of { Left ( Nil ) → g s ( λ a ( h ( s ∗ a ))); Right ( b ) → b } with s ∗ a a suggestive notation for Pair ( s , a ). 14 / 39
Bang! If A is a formula, then ! A is a Harrop formula with a r ! A Def = a = Nil ∧ ∀ a ( a r A ). For example, Nil r !( ⊥ → A ) since, a r ( ⊥ → A ) ≡ ⊥ → a r A . Intuitively, ! A expresses that A is true (realizable) for trivial reasons. Valid (realizable) rules we will use in the following: A ! H ( A Harrop) ! A A → ! B ! A ∧ ! B ! → ! ∧ !( A → B ) !( B ∧ A ) ∀ x ! A ( x ) ! ∀ ∃ x ! A ( x ) ! ∃ ! ∀ x A ( x ) ! ∃ x A ( x ) 15 / 39
! LEM ¬ A → B A → ! B ! LEM B Lemma The rules for bang are realizable. Proof. We only look at ! LEM . Assume a r ( ¬ A → B ) and Nil r ( A → ! B ), that is, ¬∃ c c r A → a r B and ∃ c c r A → ∀ b b r B . Using the law of excluded middle, we conclude a r B . 16 / 39
Recommend
More recommend