Program extraction in constructive analysis Helmut Schwichtenberg Mathematisches Institut, LMU, M¨ unchen Tsukuba University, 19. June 2009 Helmut Schwichtenberg Program extraction in constructive analysis
Algebras and function spaces ◮ Parametrized free algebras. Examples: Binary numbers (constructors 1, S 0 , S 1 ), lists. ◮ “Lazy” base types; function spaces via limits of finite approximations (Scott’s information systems). ◮ Computable functionals are recursively enumerable limits. ◮ Variables range over the Scott-Ershov partial continuous functionals. ◮ Constructors are injective and have disjoint ranges. Helmut Schwichtenberg Program extraction in constructive analysis
Computable functionals can be conveniently defined by “computation rules” (a form of pattern matching). Examples: � R (0 , r , s ) = τ r , R ( S n , r , s ) = τ s ( n , R ( n , r , s )) or the fixed point operator Y τ w τ → τ = τ w ( Y τ w ) . Helmut Schwichtenberg Program extraction in constructive analysis
Denotational and operational semantics ◮ Define terms from (simply) typed variables and constants by (lambda) abstraction and application. ◮ The approach via information systems allows a direct definition of denotational semantics. ◮ Operational semantics ( β -conversion plus computation rules) is “adequate”: closed terms denoting “total” objects evaluate to numerals. Helmut Schwichtenberg Program extraction in constructive analysis
Minimal logic ◮ The only (basic) logical connectives are → , ∀ . ◮ Proofs have two aspects: (i) They guarantee correctness. (ii) They may have computational content. ◮ Computational content only enters a proof via inductively (or coinductively) defined predicates. Helmut Schwichtenberg Program extraction in constructive analysis
Natural deduction : assumption variables u A . Rules for → : derivation proof term [ u : A ] | M ( λ u A M B ) A → B B → + u A → B | M | N ( M A → B N A ) B A → B A → − B Helmut Schwichtenberg Program extraction in constructive analysis
Natural deduction: rules for ∀ derivation proof term | M ( λ x M A ) ∀ x A (var. cond.) A ∀ + x (var. cond.) ∀ x A | M ( M ∀ x A ( x ) r ) A ( r ) ∀ x A ( x ) r ∀ − A ( r ) Helmut Schwichtenberg Program extraction in constructive analysis
Inductive definitions ◮ Example: Totality, defined by the clauses T 0 , ∀ n ( Tn → T ( S n )) . ◮ Elimination (or least fixed point) scheme ∀ n ( Tn → A (0) → ∀ n ( Tn → A ( n ) → A ( S n )) → A ( n )) , i.e., the induction scheme for (total) natural numbers. Helmut Schwichtenberg Program extraction in constructive analysis
Example: Leibniz equality ◮ is defined by the clause ∀ x Eq ρ ( x ρ , x ρ ). Elimination scheme: ∀ x , y ( Eq ( x , y ) → ∀ x C ( x , x ) → C ( x , y )) . ◮ With C ( x , y ) := A ( x ) → A ( y ) this implies ∀ x , y ( Eq ( x , y ) → A ( x ) → A ( y )) (compatibility of Eq ). Hence symmetry and transitivity of Eq . Helmut Schwichtenberg Program extraction in constructive analysis
Equalities Notice that we have at least three different equalities: ◮ Leibniz equality Eq . ◮ Decidable equality = N : N → N → B . The boolean term n = N m is turned into a formula by writing Eq B ( n = N m , tt) . ◮ Equality of reals: a defined equivalence relation. Helmut Schwichtenberg Program extraction in constructive analysis
Example: ∃ ◮ ∃ x A is a nullary inductively defined predicate, with parameter { x | A } . ◮ Clause: ∀ x ( A → ∃ x A ) . ◮ Elimination scheme: ∃ x A → ∀ x ( A → B ) → B ( x not free in B ). ◮ Similarly for ∧ , ∨ . Helmut Schwichtenberg Program extraction in constructive analysis
Ex-Falso-Quodlibet need not be assumed, but can be proved. F → A , with F := Eq (ff , tt) (“falsity”) . The proof is in 2 steps. (i) F → Eq ( x ρ , y ρ ), since from Eq (ff , tt) by compatibility Eq [ if tt then x else y ] [ if ff then x else y ] . � �� � � �� � x y (ii) Induction on (the sim. definition of) predicates and formulas. ◮ Case Is . Let K 0 be the nullary clause A 1 → · · · → A n → It . By IH: F → A i . Hence It . From F we obtain Eq ( s , t ), by (i). Hence Is by compatibility. ◮ The cases A → B , ∀ x A are easy. Helmut Schwichtenberg Program extraction in constructive analysis
Embedding classical arithmetic ◮ Let ¬ A := ( A → F ), and ˜ A ˜ ∃ x A := ¬∀ x ¬ A , ∨ B := ( ¬ A → ¬ B → F ) . ◮ Consider a total boolean term r B as representing a decidable predicate: Eq ( r , tt). ◮ Prove ∀ p ∈ T ( ¬¬ Eq ( p , tt) → Eq ( p , tt)) by boolean induction. ◮ Lift this via → , ∀ using ⊢ ( ¬¬ B → B ) → ¬¬ ( A → B ) → A → B , ⊢ ( ¬¬ A → A ) → ¬¬∀ x A → ∀ x A . ◮ For formulas A built from Eq ( · , tt) by → , ∀ x ∈ T prove stability ∀ � x ∈ T ( ¬¬ A → A ) ( FV ( A ) among � x ) . Helmut Schwichtenberg Program extraction in constructive analysis
Reals A real number x is a pair (( a n ) n ∈ N , α ) with a n ∈ Q and α : N → N such that ( a n ) n is a Cauchy sequence with modulus α , that is ∀ k , n , m ( α ( k ) ≤ n , m → | a n − a m | ≤ 2 − k ) , and α is weakly increasing. Two reals x := (( a n ) n , α ), y := (( b n ) n , β ) are equivalent (written x = y ), if ∀ k ( | a α ( k +1) − b β ( k +1) | ≤ 2 − k ) . Helmut Schwichtenberg Program extraction in constructive analysis
Nonnegative and positive reals A real x := (( a n ) n , α ) is nonnegative (written x ∈ R 0+ ) if ∀ k ( − 2 − k ≤ a α ( k ) ) . It is k -positive (written x ∈ k R + ) if 2 − k ≤ a α ( k +1) . x ∈ R 0+ and x ∈ k R + are compatible with equivalence. Can define x �→ k x such that a n ≤ 2 k x for all n . However, x �→ k x is not compatible with equivalence. Helmut Schwichtenberg Program extraction in constructive analysis
Arithmetical functions Given x := (( a n ) n , α ) and y := (( b n ) n , β ), define z c n γ ( k ) x + y a n + b n max( α ( k + 1) , β ( k + 1)) − x − a n α ( k ) | x | | a n | α ( k ) x · y a n · b n max( α ( k + 1 + k | y | ) , β ( k + 1 + k | x | )) � 1 if a n � = 0 1 x for | x | ∈ l R + a n α (2( l + 1) + k ) 0 if a n = 0 Helmut Schwichtenberg Program extraction in constructive analysis
Comparison of reals Write x ≤ y for y − x ∈ R 0+ and x < y for y − x ∈ R + . x ≤ y ↔ ∀ k ∃ p ∀ n ≥ p ( a n ≤ b n + 2 − k ) , x < y ↔ ∃ k , q ∀ n ≥ q ( a n + 2 − k ≤ b n ) . Write x < k , q y (or simply x < k y if q is not needed) when we want to call these witnesses. Notice: x ≤ y ↔ y � < x . Helmut Schwichtenberg Program extraction in constructive analysis
Continuous functions A continuous function f : I → R on a compact interval I with rational end points is given by ◮ an approximating map h f : ( I ∩ Q ) × N → Q , ◮ a (uniform) modulus map α f : N → N such that ( h f ( c , n )) n is a real with modulus α f , and ◮ a (uniform) modulus of continuity ω f : N → N satisfying | a − b | ≤ 2 − ω f ( k )+1 → | h f ( a , n ) − h f ( b , n ) | ≤ 2 − k for n ≥ α f ( k ). α f , ω f required to be weakly increasing. Notice: h f , α f , ω f are of type level 1 only. Helmut Schwichtenberg Program extraction in constructive analysis
Application of a continuous function to a real Given a continuous function f (by h f , α f , ω f ) and a real x := (( a n ) n , α ), application f ( x ) is defined to be ( h f ( a n , n )) n with modulus k �→ max( α f ( k + 2) , α ( ω f ( k + 1) − 1)). One proves easily x = y → f ( x ) = f ( y ) , | x − y | ≤ 2 − ω f ( k ) → | f ( x ) − f ( y ) | ≤ 2 − k . Helmut Schwichtenberg Program extraction in constructive analysis
Intermediate value theorem Let a < b be rationals. If f : [ a , b ] → R is continuous with f ( a ) ≤ 0 ≤ f ( b ), and with a uniform lower bound on its slope, then we can find x ∈ [ a , b ] such that f ( x ) = 0. Proof sketch. 1. Approximate Splitting Principle. Let x , y , z be given with x < y . Then z ≤ y or x ≤ z . 2. IVTAux. Assume a ≤ c < d ≤ b , say 2 − n < d − c , and f ( c ) ≤ 0 ≤ f ( d ). Construct c 1 , d 1 with d 1 − c 1 = 2 3 ( d − c ), such that a ≤ c ≤ c 1 < d 1 ≤ d ≤ b and f ( c 1 ) ≤ 0 ≤ f ( d 1 ). 3. IVTcds. Iterate the step c , d �→ c 1 , d 1 in IVTAux. Let x = ( c n ) n and y = ( d n ) n with the obvious modulus. As f is continuous, f ( x ) = 0 = f ( y ) for the real number x = y . Helmut Schwichtenberg Program extraction in constructive analysis
Inverse functions Theorem Let f : [ a , b ] → R be continuous with a uniform lower bound on its slope. Let f ( a ) ≤ a ′ < b ′ ≤ f ( b ) . We can find a continuous g : [ a ′ , b ′ ] → R such that f ( g ( y )) = y for every y ∈ [ a ′ , b ′ ] and g ( f ( x )) = x for every x ∈ [ a , b ] such that a ′ ≤ f ( x ) ≤ b ′ . Proof sketch. Let f ( a ) ≤ a ′ < b ′ ≤ f ( b ). Construct a continuous g : [ a ′ , b ′ ] → R by the Intermediate Value Theorem. Helmut Schwichtenberg Program extraction in constructive analysis
Recommend
More recommend