Category Theory and Cyber Physical Systems
Total Page:16
File Type:pdf, Size:1020Kb
Category theory and Cyber physical systems Eswaran Subrahmanian (CMU/NIST) Spencer Breiner (NIST) July 22, 2017 CPS workshop Robert Bosch Center for Cyber Physical Systems IISC Bangalore, India Talk outline • Basic elements of CPS • CPS as composition of different systems • Category theory • A formalism for representing different formalisms • A formalism for composing system from from formalisms. • Ologs • A CT based knowledge representation scheme • Examples of database intergration • Cyber and Physical system and composition. • String diagram for Process composition • Basic elements • Antilock brakes - Top level • Antilock brakes – Expanding The modulator • Redesign for traction control + stability control • Incorporating semantics • Conclusion Cyber physical system: A definition Cyber Physical Systems Interconnected Systems & Control Internet of Things Sensing and Acting Physical Environment Things Person Network Physical World 3 Basic elements and composition of CPS Basic elements • Perceptual devices: Identification and Measurements • Actuating devices: activation results in action • Physical devices: transmission, amplification of power, • Logical devices: computational/logical • Humans devices: mental model Multiple Modeling formalisms: logic, state machines, differential equations, stochastic models, etc. Requires composition and compositionality to ensure desired behavior Category theory • Category Theory (CT) is a potential solution. • CT is the mathematical theory of abstract processes and composition • CT could be thought of as the conceptual operating system. Categories & Composition • A category is a universe of resources (objects) �, �, �, … and processes (arrows) �, �, ℎ, … • Every process has input and output resources, indicated �:�→�. • The main property of categorical processes is that they compose: Category theory: relationship to domains Category Theory as a universal Modeling Language (Spivak, 2015*) The Category Theory (CT) view of modeling – two postulates: 1. Modeling a subject is foregrounding certain observable aspects of the subject, and then faithfully formalizing these aspects and certain observable relationships between them. 2. Creating models is connecting non-trivial models: A model is known only by its relationships with other models. Models including category theory models should adhere to the following pragmatic maxim: - The value of a model is measured by the extent to which the user’s interactions with the subject are successfully mediated by the model. Category Theory: A mathematical Model of modeling CT foregrounds and formalizes the third postulate as an observable aspect of modeling in terms of morphisms. Example: Vector spaces as a mathematical model of linearity (or flat spaces) - exemplifies the CT perspective in that the model is reflected in (and determined by) the rules defining relationships (morphisms) between flat spaces • This image shows some figures in the plane, and their images under a linear transformation. • A concept (represented by a class of plane figures) is *linear* if it can be defined in terms of lines and intersections. (Syntactic definition) • *Equivalently* - a class of plane figures represents a linear concept if and only if the class is closed under all linear transformations. Non-linear concepts: Circle, rectangle, right angle, Linear concepts: Line (obviously), oval, quadrilateral, angle Category theory: ontology logs, Knowledge representation and Information systems An ontology log (olog) is a formal specification of a category* expressed in a diagrammatic language that serves as a knowledge representation. Most importantly, the categories specified by ologs can be encapsulated and connected by functors+ to build higher level categories we call information systems So, lower level ologs can be used in representing or designing higher level or more complex categories like: • databases, • experiments, • models, • theories, • research programs, • disciplines and beyond * An olog is a presentation of a category by objects, arrows and path congruences. We call such presentations, specifications. + Functors can be resolved and presented as a morphism between specifications. An Example OLOG: path equivalence & Analytic Facts • Objects (labeled boxes) represent types of things, • Labeled arrows represent functional relationships (also known as aspects, attributes, or observables) • Commutative diagrams represent analytic facts referring to the same thing in virtue of what they mean. • A simple olog about an amino acid called arginine): The paths AER and AXR are equivalent, so commute. They express analytic facts constraining the meaning of types and aspects. It is important to keep in mind that ologs that model the same real-world situation often disagree about the facts. This slides is adapted from Spivak, D. and Kent, R. https: PLoS One, January 2012,//math.mit.edu/~dspivak/informatics/olog.pdf Composition of formalisms State machines and dynamic systems State machines as directed graphs Physical state space Differential equations as vector fields Modeling Cyber-physical systems Logical/Physical Interaction Triggering transitions Engineering cyber physical systems Requirement specification for a general brake system Pedal X Position (P. 300) 10 Lbs/sq.in p2 80 lb/sq.in (Fa,10lb) p1 Force Force output p1 Force Amp (80lb,BS,3000) P2 P1 Mult p2 Force output X brakesystem X RPM 8X Force Amp X Force-input BS 3000 2000 Brakesystem RPM Force Functional Yt = a1yt-1 + a2yt-2+….+anyt-n + b Amp Force Modeling the process of brake systems and their evolution Basic resource sensitive elements in process string diagrams Measure Compute Act Evolve ABS Brake system operation as a string diagram ABS System has the following process steps: Amplify Pedal Force Modulate pressure Engage brake RPM Brake control Unit Engage Brake ABS – Brake system - Detail ABS Brake - Modulator details expanded ABS- Brake system and Modulator expanded ABS with Tracking system added • Modulator abstracted and moved to each brake system. • Brake control system has multiple outputs – one for each wheel. Representing Abstraction and version evolution of ABS system High level ABS + Brake ABS + tracking + ABS ABS + tracking System expanded Stability control ABS + tracking + ABS-including ABS + braking + ABS + tracking braking + modulator details modulator details +braking +Stability Modulator details Low level Incorporating semantics: Amplifying force (MC) Pedel force Brake fluid Master Cylinder unit • Fmc/Amc = Pmc Slave cylinder • Fsc/Asc = Psc Brake fluid • Power amplification= Asc/Amc • There are four slave cylinders so Asc= 4X (Asc1+Asc2+Asc3+Asc4) Incorporating semantics: pump Brake fluid The above is the ratio f the velocity of the servo motor for given applied voltage. Brake fluid There are additional equations for the impeller that is driven by the pump Incorporating: semantics: Brake control unit Break Control Unit If the break pedal is pressed Pedeal-status Start modulator: Sensor For each wheel; Get disc rotation measurement then activate the hydraulic modulator system -sending signals to inlet valve to open and - send signals to the start the pump to transmit power to the brake calipers - hold calipers for a given time (cycles per minute) - open outlet valve initiate pump to restore pressure in the outlet lines Open.close if break pedal not pressed stop Valve signal Start/stop else go to Start modulator Pump Incorporating semantics: Measurement • Measure process is defined by a probability distribution. Disc-Rotation+/-200 Rpm Brake discj Brake discj RPM Disc- rpm Some CT constructions • Functors • Create bridges across categories • Scales • Domains • Colimits • Federation across Functors • Modularity and Standardization Import Functor Changing the namespace Mapping to defined objects What do we do now? Colimits Composing the models and data CT- Comp12 model CT- Comp34 CT- Comp12 Data model model base CT-comp1 CT-comp2 CT-comp1 CT-comp2 model model model model Data Data base base Formalism 3 Data Data Data Formalism 4 Formalism 1 Data Formalism 2 base base base base Conclusion • Category theory • as a meta-language in mathematics that is self-reflective CT as a comcep • allows for modeling matrices, vector spaces, dynamical systems, groups and their algebra • allows for composing databases, models, theories, requirements and methods • Allows for mapping syntax to semantics thorough functors • Category theory provides a formal and rigorous approach information modeling for engineering of CPS. Further research efforts in CT at NIST • Crystallographic databases • Formalization of NIST CPS Framework • CT based mathematical modeling for production scheduling and integration with optimization tools. • Proofs in quantum Cryptography • Development of methodology for using CT • Addressing the lack of tools for popularization of use of CT. Other efforts in CT • DARPA Cascade : http://www.darpa.mil/program/complex-adaptive- system-composition-and-design-environment • Matriarch – Hierarchical Design of Proteins Materials (Spivak, MIT) • Several Projects in early stages in industry (Airbus, Dassault,…) • Prototype tool AQL from Categorical Informatics for Data migration and Integration. (Catinf.com) • Geometric specification for integrating design and inspection using CT (Lu, Wenlong, Phd Thesis, Huddersfield,2011 References to some of our work • Wisnesky, Ryan, et al. "Using Category Theory to Facilitate Multiple Manufacturing Service Database Integration." Journal of Computing and Information