Results 1 -
2 of
2
Monads through program extraction
, 2008
"... Closing the gap between formalized proof and practical programming has long been an objective of working in type theory. Monads epitomize this balance. They are a formal construct but have revolutionized programming in purely functional environments. We play on this relationship by formalizing the s ..."
Abstract
- Add to MetaCart
Closing the gap between formalized proof and practical programming has long been an objective of working in type theory. Monads epitomize this balance. They are a formal construct but have revolutionized programming in purely functional environments. We play on this relationship by formalizing the structure of a monad as a type. By instantiating the type constructor and its associated operators in a dependent type theory we are able to reason about monads as we would a type. By the fact that we are working in a constructive context this reasoning means that we can begin to close that gap between a formal proof and practical programming when it comes to monads. We are able to extract instances of the operators by the fact that we can prove propositions that correspond to that type. In this paper we will do this in two varieties. The first is that by knowing the algorithm the operators correspond to we can easily state them as an object in our language. We then prove that they have the correct type, the type of the output for which we are trying to generate. The second methodology is to prove a behavior specification and there by obtain an extract based on what the program is supposed to do. Our extract is in the form of a term in a purely functional programming language that is just as powerful as any more common language. We contrast this with the first method which is a statement of verification, or of how to do a certain computation. In our process of verifying and specifying (extracting) monads we show that particular instances of common monads are definable in our type theory. We show that the monad is a well defined type. And we give examples showing that our monads are usable. 1
Constructive Membership and Indexes in Trees
, 2009
"... Trees carrying information stored in their nodes are a fundamental abstract data type. Approaching trees in a formal constructive environment allows us to realize properties of trees, inherent in their structure. Specifically we will look at the evidence provided by the predicates which operate on t ..."
Abstract
- Add to MetaCart
Trees carrying information stored in their nodes are a fundamental abstract data type. Approaching trees in a formal constructive environment allows us to realize properties of trees, inherent in their structure. Specifically we will look at the evidence provided by the predicates which operate on these trees. This evidence, expressed in terms of logical and programming languages, is realizable only in a constructive context. In the constructive setting, membership predicates over recursive types are inhabited by terms indexing the elements that satisfy the criteria for membership. In this paper, we motivate and explore this idea in the concrete setting of lists and trees. We first provide a background in constructive type theory and show relavent properties of trees. We present and define the concept of inhabitants of a generic shape type that corresponds naturally and exactly to the inhabitants of a membership predicate. In this context, (λx.T rue) ∈ S is the set of all indexes into S, but we show that not all subsets of indexes are expressible by strictly local predicates. Accordingly, we extend our membership predicates to predicates that compute and hold the state “from above” as well as allow “looking below”. The modified predicates of this form are complete in the sense that they can express every subset of indexes in S. These ideas are motivated by experience programming in Nuprl’s constructive type theory and the theorems for lists and trees have been formalized and mechanically checked. 1

