Hybrid dynamical type theories for navigation

08/17/2021 ∙ by Paul Gustafson, et al. ∙ University of Pennsylvania 0

We present a hybrid dynamical type theory equipped with useful primitives for organizing and proving safety of navigational control algorithms. This type theory combines the framework of Fu–Kishida–Selinger for constructing linear dependent type theories from state-parameter fibrations with previous work on categories of hybrid systems under sequential composition. We also define a conjectural embedding of a fragment of linear-time temporal logic within our type theory, with the goal of obtaining interoperability with existing state-of-the-art tools for automatic controller synthesis from formal task specifications. As a case study, we use the type theory to organize and prove safety properties for an obstacle-avoiding navigation algorithm of Arslan–Koditschek as implemented by Vasilopoulos. Finally, we speculate on extensions of the type theory to deal with conjugacies between model and physical spaces, as well as hierarchical template-anchor relationships.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

The problem of composing complex systems from simpler subcomponents is common to all branches of engineering. A general approach is to specify interfaces between components – both logical and physical. For logical interfaces, arguably the most advanced specification language is dependent type theory, a formal system capable of expressing the entirety of constructive mathematics [martin1982constructive]. On the other hand, physical interfaces must deal with finite resources, leading naturally to linear logic, a simultaneous refinement of intuitionistic and classical logic that emphasizes the role of formulas as resources [girard1987linear]. Combining linear logic with dependent types is still an active research area, but much progress has been made in recent years [cervesato2002linear, vakar2014syntax, krishnaswami2015integrating, mcbride2016got, licata2017fibrational]. We are particularly interested in the categorical framework of [fu2020linear], in which the nonlinear dependent types can only depend on the “shape” of a linear term. Roughly speaking, this means that type dependency lives on the parameter level and cannot inspect state-level information of linear terms.

For applications to robotics, we desire a type system capable of encoding sequential and parallel compositions, as well as safety constraints. The former two forms of composition fit naturally within the framework of linear logic, particularly via its incarnation as the internal language of symmetric monoidal categories. Indeed, a weak version of such a category of directed hybrid systems compatible with sequential and independent parallel composition has been defined in [culbertson2020formal]. On the other hand, safety constraints have a natural formulation in the internal language of presheaves over an agent’s sensorium, a setting particularly well-suited to formulating local conditions in the presence of uncertainty.

As we note below, both of these categories—directed hybrid systems and presheaves over the sensorium—can be connected via a state-parameter fibration, the primary input to the linear dependent type theory construction of [fu2020linear]. Although that paper focuses primarily on a symmetric monoidal category of quantum circuits and a corresponding state-parameter fibration from a formal completion of the circuit category to the category of sets, their construction applies equally well to state-parameter fibrations from other symmetric monoidal categories to other locally cartesian closed categories. In our setting, we replace quantum circuits with directed hybrid systems and the base category with , the category of presheaves over a sensorium .

With a state-parameter fibration and its corresponding linear dependent type in hand, we are ready to give types to hybrid controllers used by real engineers. We first provide a conjectural translation from a fragment of linear-time temporal logic (LTL) into the type theory with the goal of interfacing with existing state-of-the-art methods for controller synthesis from formal task specifications [kress2009temporal, saha2014automated]. Then as a case study, we type various components of a navigational controller designed by Arslan–Koditschek [arslan2019sensor] and implemented by Vasilopolous [vasilopoulos2020reactive].

Ii Related work

The closest related work within robotics is the body of literature on controller synthesis from temporal logic specifications. In 1977, Amir Pnueli first proposed linear-time temporal logic as a specification language for formal verification of computer programs [pnueli1977temporal]. In 1996, Antoniotti and Mishra used computation tree logic, a branching-time temporal logic developed by Clarke and Emerson to analyze concurrent programs [emerson1982using], to generate a supervisory controller for a walking robot [antoniotti1995discrete]. In the mid 2000s, Kress-Gazit, Fainekos, and Pappas developed a procedure for automatic controller synthesis from an robot model, class of admissible environments, and LTL task specification [kress2009temporal]. Subsequently as the field of robotics has grown in importance, temporal logic-based specification has remained the dominant paradigm for formal verification of controllers [luckcuck2019formal].

The main difference between our type-theoretic formalization and temporal logic-based approaches is ease of composition. Whereas temporal logics are close to natural human language [kress2008translating], their basic connectives (e.g., “and,” “or,” and classical implication) are a less convenient setting for sequential and parallel composition of dynamical-system-based controllers than the linear logic corresponding to the symmetric monoidal category of directed systems [culbertson2020formal].

On the other hand, the relative simplicity of LTL allows for automatic controller synthesis once one restricts to a computationally tractable class of formulas [bloem2012synthesis]. Thus, the strengths of the type-theoretic and temporal logic approaches are in fact complementary. We provide a conjectural translation between the two logical systems below.

On the type theory side, many have worked on integrating linear logic with non-linear intuitionistic logic in general, and dependent type theory in particular. The idea of using a linear-nonlinear adjunction, i.e. a pair of symmetric monoidal functors between a symmetric monoidal closed category and a cartesian closed category, to relate a linear type theory to the simply typed lambda calculus originates with Benton [benton1994mixed]. Adding dependent types is significantly harder since it is not immediately clear what it means for a type to depend on a linear term. In particular, if is a linear term and is a type family depending on , then both terms of type and the type itself generally reference the term —a violation of linearity, the axiom that linear terms must be used exactly once.

One approach to resolving this contradiction is to have two separate contexts—one for linear data, and one for intuitionistic data—and prescribe how types are allowed to depend on linear terms. This is the approach taken by Cervesato and Pfenning in their Linear Logical Framework combining linear logic with [cervesato2002linear]. In their system, types may not depend on linear terms at all, only intuitionistic terms.

A significant further advance was McBride’s use of indices to decorate the typing annotations to denote the number of times the variable is used. When , his dependent types corresponds to those of Cervesato and Pfenning. The index corresponds to terms that occur in types, and corresponds to terms evaluated at runtime. This allowed much more granular control over variable usage, enabling non-trivial type dependence on linear terms.

Recently, Licata, Shulman, and Riley vastly generalized this work in their fibrational framework for substructural and modal logics [licata2017fibrational], parameterizing a type theory by an underlying mode theory. Categorically, their framework corresponds to a functor between 2-dimensional cartesian multicategories, a powerful but very abstract setting.

In the current paper, we employ the framework of Fu–Kishida–Selinger [fu2020linear] for constructing linear dependent type theories from state-parameter fibrations. Their approach uses McBride’s approach to variable count indexing, but also shares the fibrational approach to categorical semantics of Licata–Shulman–Riley in a less abstract setting (monoidal category theory, rather than higher category theory).

Iii A state-parameter fibration

The primary datum required in the construction of the linear dependent type theory defined in [fu2020linear] is a state-parameter fibration, a categorical fibration from a symmetric monoidal closed category (a setting for linear logic) to a locally cartesian closed category (a setting for dependent type theory) satisfying some additional compatibility axioms.

To construct such a fibration, we start with a symmetric monoidal category of “generalized circuits,” in our case directed hybrid systems as defined in [culbertson2020formal]. In brief (using the notation of [culbertson2020formal], where full details can also be found), a hybrid system consists of a directed graph , whose vertices index a set of continuous modes and whose edges index a set of reset maps between these modes. We can then define a hybrid semiconjugacy of hybrid systems to be a graph morphism on the underlying graphs together with a collection of smooth maps restricting to classical smooth semiconjugacies of the continuous flows and respecting the discrete jumps in the sense that the squares

commute for each reset map . These basic constructions then allow us to define a directed hybrid system to be a cospan of hybrid semiconjugacies

such that (i) both legs are embeddings, (ii) each component map of the right leg is a diffeomorphism, (iii) the image of the graph in is a sink, and (iv) for every and state , there exists an -chain from to the image of in . Roughly speaking, such a system forms the ambient substrate for a “funnel” leading its initial subsystem into its final subsystem .

Sequential composition corresponds to the usual notion of composition of cospans via pushouts: the directed system obtained by composing the systems and is given by


an operation defined only up to isomorphism [benabou1967introduction, grandis1999limits]. Thus, in order to get a strict category, we will consider directed systems up to conjugacy; that is, up to isomorphisms with respect to hybrid semiconjugacy. Using the categorical product with respect to semiconjugacy defined in [culbertson2020formal] as the monoidal product, we then have a symmetric monoidal category of directed systems up to conjugacy under sequential composition.

Following the recipe of [fu2020linear], our first step towards constructing a corresponding linear dependent type theory is to embed into a symmetric monoidal closed category with products by taking the Yoneda embedding. This procedure formally extends the category with exponential objects and categorical products for a more ergonomic type theory.

The second step is to form a category of parametrized circuits. In their case, the spaces of parameters are sets; in ours, presheaves over a topological space , which we call the sensorium. An object of this category consists of a pair where is a presheaf over the sensorium , and is an indexed family of objects of , one for each element of (here, an element of a presheaf is a morphism , i.e. a choice of set-element over every open set of ). An arrow consists of a pair where is a map of presheaves, and is an indexed family of morphisms of .

One can check, following the proof of Fact 2.4 in [fu2020linear], that the functor given by projecting to the first component forms a state-parameter fibration.

Iv Type system

For the purposes of our navigational case study, we focus on three families of simple types: , where is a two-dimensional manifold (the “workspace”), and where is any term. Figure 1 provides their semantics as objects in , fixing the sensorium corresponding to distance measurements from a limited range line-of-sight sensor. For example, the hybrid system associated to consists of object centers and radii with a vector field, while its presheaf consists of a proof that for every sensor measurement in an open set of uncertainty , there exist connected components of distance readings less than a maximum range .

Type Hybrid System Presheaf (evaluated at )
Fig. 1: Semantics of simple types with sensorium ). In the presheaf associated to , the symbols and correspond to the robot’s inferred position and goal locations based on a sensor reading .

With the exception of the simple types, the syntax of the corresponding type theory shown in Figure 2 is identical to [fu2020linear], which we refer to for the corresponding inference rules. The most interesting types are the linear dependent sum and linear dependent function. Just as with regular dependent types, a term of a linear dependent sum is a pair of types and , respectively, and a term of a linear dependent function is a function that returns a term of type for every term . However, linear (i.e. state-level) variables can only be used at most once with one exception—their “shape” can be used arbitrarily many times in parameter types. Roughly speaking, the shape of state-level data corresponds to replacing every simple type in its definition by the parameter type.

In the formal type theory, variable usage is encoded by the index in , and the inference rules enforce state-parameter usage constraints. The “!”, , and operations move types and terms from the state-level to the parameter level and vice versa, while ensuring that parameters can only depend on the shape of linear terms.

  • Simple types

  • Types

  • Parameter types

  • Terms

  • Parameter terms

  • Values

  • Indices

  • Contexts

  • Parameter contexts , where only if is a parameter type.

Fig. 2: Syntax of navigational type theory

We also have a conjectural embedding of a fragment of linear temporal logic (LTL) [pnueli1977temporal] into the type theory shown in Figure 3. We translate the atomic propositions directly into hybrid dynamical types whose presheaves enforce the invariant; for example, inhabitation in a partition element corresponds to a presheaf only supported on that element. We translate “or” as the disjoint union of hybrid systems, and “and” as the parallel composition. The “Eventually” diamond corresponds to a directed system with codomain corresponding to the argument of the diamond operator. We simply translate the “Always” box operator as a directed system whose corresponding presheaf always validates the argument proposition.

LTL Proposition Hybrid dynamical type
Fig. 3: Conjectural embedding of a fragment of LTL

V Navigation example

Fig. 4: Voronoi-based navigation using a limited range line-of-sight sensor (Image source: [arslan2019sensor])

As a case study, we formulate the navigation algorithm of [arslan2019sensor] as a composition of typed hybrid systems and proofs of correctness. Under an assumption on the curvature of the obstacle boundaries (satisfied by circles, for example), the main theorem of the paper is essentially

where is the initial position of the robot, is a safety radius. Rearranging things slightly, we want

Under the translation shown in Figure 3, our task is to construct a controller of type

That is, if the initial position of the robot is safe, then we have a safe controller that reaches the goal unless the obstacle-separation assumption is violated.

Fig. 5: Types for navigation functions
controller g p = (f, safetyProof f ) where
  f = stopSensing . c . startSensing
  c s = case mpg g p s of
    Left (localGoal, s)) ->
      if localGoal == g
      then (sp, d)
      else mpg g f s
    Right (NewObs s’)  -> inl (mpg g f s’)
    Right (LoseObs s’) -> inl (mpg g f s’)
    Right (SeparationViolation o1 o2) -> inr (SeparationViolation o1 o2)
  mpg g p s = go(projGoal(voronoi(lift(s)), g), f, s))
  safetyProof f = <Euclidean geometry formalization of Arslan-Koditschek proof>
Fig. 6: Navigation controller pseudocode

The types shown in Figure 5 provide some Haskell-style typing declarations for the functions involved in such a controller. For example, the “go” function’s typing declaration in Figure 5 has the following meaning—for every natural number and goal location , given the data of a navigational state and visible objects, this controller will either end up at the goal while still seeing objects or it will be interrupted. The type says that the only interrupts correspond to seeing a new object, forgetting an object, or noting that the object separation axiom is violated.

The “controller” function (Figure 6) is defined by looping over the MPG (move-to-projected-goal) function as follows. The result of one application of the MPG function is either arriving at the projected goal or an interrupt. If you have arrived at the projected goal, check to see if it is the final goal point, in which case you are done. Otherwise, check to see if you have detected an obstacle separation violation. If so, pass the violation along and stop. In all other cases, perform MPG again with your current location and sensor readings. In addition, one would like a proof of safety — i.e. a term of the type taking the controller definition as an argument. This corresponds to formalizing Proposition 3 of [arslan2019sensor], which states that the robot’s free space is positively invariant.

Vi Future work

This paper has outlined a type theory useful for organizing and proving safety properties for navigational tasks – a baby step towards our broader goal of a functional programming language for physical work. On the practical side, the next step is to integrate some form of type checking with physical robot platforms. There are two parts to this task – (i) integrating the Robot Operating System (ROS) [quigley2009ros] with better support for functional programming in general and linear dependent types in particular, and (ii) completing the formalization of the algorithm in Figure 6. For the first task, one approach would be to use ideas from RosHask [cowley2011stream] to call ROS from Haskell [jones2003haskell], and either embed a linear dependent language in Haskell or follow Agda’s approach to foreign function interface to Haskell [norell2008dependently]. For the second task, the main obstacle is the reliance of the proof of safety on basic Euclidean geometry which requires some effort to formalize. Fortunately, it may be possible to leverage GeoCoq [boutry:hal-01483457], a dependently typed formalization Tarski’s axiomatic system [tarski1999tarski] in the Coq proof assistant [coquand1986calculus, barras1997coq], previously used to formalize the first book of Euclid’s Elements [beeson:hal-01612807, heath1956thirteen].

More theoretically, the type theory still leaves much to be desired. Perhaps most urgent is the inclusion of template-anchor relationships, a form of controller hierarchy integral to much of robotic programming [full1999templates]. A first step towards this goal would be to extend the type theory to deal with hybrid semiconjugacies, the vertical morphisms in the double category of hybrid systems defined in [culbertson2020formal], potentially leveraging work of New and Licata on double categorical semantics of gradual typing [licata2020call].

Another important direction is the exploration of more expressive categories of “funnel-like” systems closed under sequential composition. For example, since our category of directed systems is not monoidal closed, we need to use the Yoneda embedding to formally adjoin exponential objects. These formal exponentials are not hybrid systems, but rather spaces of recipes for producing hybrid systems. However, just as it is often useful to use the fact that the collection of functions between two finite sets is itself a set, or the collection of linear maps between two vector spaces is a vector space, we believe that putting dynamical structures on the space of “funnels” between two systems will prove useful. However, fundamental obstructions exist when considering even classical dynamical systems, and finding a convenient category in this setting requires considering alternative generalizations of manifolds such as Chen spaces, diffeological spaces, or Frölicher spaces [baez2011convenient, frolicher1980categories]. Thus, a more natural setting for exploring exponentials in categories of hybrid systems might be to consider more topological perspectives such as locally preordered spaces [krishnan2009convenient]. Additionally, we might imagine a refinement procedure that takes a crude plan (“funnel”) to get from an initial system to a final system, and iteratively improves the plan, incorporating a hierarchical notion of dynamics.

Vii Acknowledgment

This work was supported in part by ONR N000141612817, a Vannevar Bush Faculty Fellowship held by Koditschek and by UATL 10601110D8Z, a LUCI Fel-lowship held by Culbertson, both granted by the Basic Research Office of the US Undersecretary of Defense for Research and Engineering.