Category theory and Cyber physical systems - … · Category theory and Cyber physical systems...

44
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

Transcript of Category theory and Cyber physical systems - … · Category theory and Cyber physical systems...

CategorytheoryandCyberphysicalsystems

EswaranSubrahmanian (CMU/NIST)SpencerBreiner (NIST)

July22,2017CPSworkshop

RobertBoschCenterforCyberPhysicalSystemsIISCBangalore,India

Talkoutline• BasicelementsofCPS• CPSascompositionofdifferentsystems• Categorytheory

• Aformalismforrepresentingdifferentformalisms• Aformalismforcomposingsystemfromfromformalisms.

• Ologs• ACTbasedknowledgerepresentationscheme• Examplesofdatabaseintergration• CyberandPhysicalsystemandcomposition.

• StringdiagramforProcesscomposition• Basicelements• Antilockbrakes- Toplevel• Antilockbrakes– ExpandingThemodulator• Redesignfortractioncontrol+stabilitycontrol

• Incorporatingsemantics• Conclusion

Environment

PhysicalWorld

PhysicalNetwork

Things

InterconnectedSystems&Control

SensingandActing

InternetofThings

Person

CyberPhysicalSystems

Cyberphysicalsystem:Adefinition

3

BasicelementsandcompositionofCPS

Basicelements• Perceptualdevices:IdentificationandMeasurements• Actuatingdevices:activationresultsinaction• Physicaldevices:transmission,amplificationofpower,• Logicaldevices:computational/logical• Humansdevices:mentalmodel

MultipleModelingformalisms:logic,statemachines,differentialequations,stochasticmodels,etc.Requirescompositionandcompositionalitytoensuredesiredbehavior

Categorytheory

• CategoryTheory(CT)isapotentialsolution.• CTisthemathematicaltheoryofabstractprocessesandcomposition• CTcouldbethoughtofastheconceptualoperatingsystem.

Categories&Composition

• Acategoryisauniverseofresources(objects)𝐴,𝐵,𝐶,…andprocesses(arrows)𝑓,𝑔,ℎ,…

• Everyprocesshasinputandoutputresources,indicated𝑓:𝐴→𝐵.• Themainpropertyofcategoricalprocessesisthattheycompose:

Categorytheory:relationshiptodomains

CategoryTheoryasauniversalModelingLanguage(Spivak,2015*)

TheCategoryTheory(CT)viewofmodeling– twopostulates:

1. Modelingasubjectisforegroundingcertainobservableaspectsofthesubject,andthenfaithfullyformalizingtheseaspectsandcertainobservablerelationshipsbetweenthem.

2. Creatingmodelsisconnectingnon-trivialmodels:Amodelisknownonlybyitsrelationshipswithothermodels.

Modelsincludingcategorytheorymodelsshouldadheretothefollowingpragmaticmaxim:

- Thevalueofamodelismeasuredbytheextenttowhichtheuser’sinteractionswiththesubjectaresuccessfullymediatedbythemodel.

CategoryTheory:AmathematicalModelofmodelingCTforegroundsandformalizesthethirdpostulateasanobservableaspectofmodelingintermsofmorphisms.

Example:Vectorspacesasamathematicalmodeloflinearity(orflatspaces)- exemplifiestheCTperspectiveinthatthemodelisreflectedin(anddeterminedby)therulesdefiningrelationships(morphisms)betweenflatspaces

• Thisimageshowssomefiguresintheplane,andtheirimagesunderalineartransformation.

• Aconcept(representedbyaclassofplanefigures)is*linear*ifitcanbedefinedintermsoflinesandintersections.(Syntacticdefinition)

• *Equivalently*- aclassofplanefiguresrepresentsalinearconceptifandonlyiftheclassisclosedunderalllineartransformations.

Non-linearconcepts:Circle,rectangle,rightangle,

Linearconcepts:Line(obviously),oval,quadrilateral,angle

Categorytheory:ontologylogs,KnowledgerepresentationandInformationsystemsAnontologylog(olog)isaformalspecificationofacategory* expressedinadiagrammaticlanguagethatservesasaknowledgerepresentation.

Mostimportantly,thecategoriesspecifiedbyologs canbeencapsulatedandconnectedbyfunctors+ tobuildhigherlevelcategorieswecallinformationsystems

So,lowerlevelologs canbeusedinrepresentingordesigninghigherlevelormorecomplexcategorieslike:• databases,• experiments,• models,• theories,• researchprograms,• disciplinesandbeyond

*Anologisapresentationofacategorybyobjects,arrowsandpathcongruences.Wecallsuchpresentations,specifications.+ Functorscanberesolvedandpresentedasamorphismbetweenspecifications.

AnExampleOLOG:pathequivalence&AnalyticFacts

• Objects(labeledboxes)representtypesofthings,

• Labeledarrowsrepresentfunctionalrelationships(alsoknownasaspects,attributes,orobservables)

• Commutativediagramsrepresentanalyticfactsreferringtothesamethinginvirtueofwhattheymean.

• Asimpleolog aboutanaminoacidcalledarginine):

ThisslidesisadaptedfromSpivak,D.andKent,R.https:PLoSOne,January2012,//math.mit.edu/~dspivak/informatics/olog.pdf

The paths AER and AXRareequivalent,socommute.

Theyexpressanalyticfactsconstrainingthemeaningoftypesandaspects.

Itisimportanttokeepinmindthatologsthatmodelthesamereal-worldsituationoftendisagreeaboutthefacts.

CompositionofformalismsStatemachinesanddynamicsystems

Statemachinesasdirectedgraphs

Physicalstatespace

Differentialequationsasvectorfields

ModelingCyber-physicalsystems

Logical/PhysicalInteraction

Triggeringtransitions

Engineeringcyberphysicalsystems

Requirementspecificationforageneralbrakesystem

PedalXPosition

Force

ForceAmpXForce-input

Forceoutput

ForceAmp

P2

ForceoutputXbrakesystem XRPM

P1

RPMBrakesystem

FunctionalForce

(P.300) 10Lbs/sq.in

(Fa,10lb)80lb/sq.in

(80lb,BS,3000)

BS

p1

p2

ForceAmp

Mult8X

30002000

Yt =a1yt-1+a2yt-2+….+anyt-n +b

p1

p2

Modelingtheprocessofbrakesystemsandtheirevolution

Basicresourcesensitiveelementsinprocessstringdiagrams

Measure Compute Act Evolve

ABSBrakesystemoperationasastringdiagram

ABSSystemhasthefollowingprocesssteps:

AmplifyPedalForce

Modulatepressure

Engagebrake

BrakecontrolUnitRPM

EngageBrake

ABS– Brakesystem- Detail

ABSBrake-Modulatordetailsexpanded

ABS- BrakesystemandModulatorexpanded

ABSwithTrackingsystemadded

• Modulatorabstractedandmovedtoeachbrakesystem.

• Brakecontrolsystemhasmultipleoutputs– oneforeachwheel.

RepresentingAbstractionandversionevolutionofABSsystem

ABS

ABS-includingmodulatordetails

ABS+BrakeSystemexpanded

ABS+ braking+modulatordetails

ABS+tracking

ABS+tracking+braking+

Modulatordetails

Highlevel

Lowlevel

ABS+tracking+Stabilitycontrol

ABS+tracking+braking+Stability

Incorporatingsemantics:Amplifyingforce(MC)

MasterCylinderunit• Fmc/Amc =Pmc

Slavecylinder• Fsc/Asc =Psc• Poweramplification=Asc/Amc

• TherearefourslavecylinderssoAsc=4X(Asc1+Asc2+Asc3+Asc4)

Brakefluid

Pedel force

Brakefluid

Incorporatingsemantics:pump

Theaboveistheratiofthevelocityoftheservomotorforgivenappliedvoltage.

Thereareadditionalequationsfortheimpellerthatisdrivenbythepump

Brakefluid

Brakefluid

Incorporating:semantics:BrakecontrolunitBreakControlUnitIf the break pedal is pressed

Start modulator:

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

if break pedal not pressed stop

else go to Start modulator

Open.closeValvesignal Start/stop

Pump

Pedeal-statusSensor

Incorporatingsemantics:Measurement

• Measureprocessisdefinedbyaprobabilitydistribution.

Brakediscj BrakediscjRPM

Disc-Rotation+/-200Rpm

Disc-rpm

SomeCTconstructions

• Functors• Createbridgesacrosscategories• Scales• Domains

• Colimits• FederationacrossFunctors• ModularityandStandardization

ImportFunctor

Changingthenamespace

Mappingtodefinedobjects

Whatdowedonow?

Colimits

Composingthemodelsanddata

CT-comp1model

CT-comp2model

Formalism3 Database

Database

CT- Comp34model

Formalism4

Database

CT-comp1model

CT-comp2model

Formalism1 Database

Database

CT- Comp12model

Formalism2

Database

CT- Comp12model

Database

Conclusion• Categorytheory• asameta-languageinmathematicsthatisself-reflective• allowsformodelingmatrices,vectorspaces,dynamicalsystems,groupsandtheiralgebra• allowsforcomposingdatabases,models,theories,requirementsandmethods• Allowsformappingsyntaxtosemanticsthoroughfunctors

• CategorytheoryprovidesaformalandrigorousapproachinformationmodelingforengineeringofCPS.

CTasacomcep

FurtherresearcheffortsinCTatNIST

• Crystallographicdatabases• FormalizationofNISTCPSFramework• CTbasedmathematicalmodelingforproductionschedulingandintegrationwithoptimizationtools.• ProofsinquantumCryptography• DevelopmentofmethodologyforusingCT• AddressingthelackoftoolsforpopularizationofuseofCT.

OthereffortsinCT

• DARPACascade:http://www.darpa.mil/program/complex-adaptive-system-composition-and-design-environment• Matriarch– HierarchicalDesignofProteinsMaterials(Spivak,MIT)• SeveralProjectsinearlystagesinindustry(Airbus,Dassault,…)• PrototypetoolAQLfromCategoricalInformaticsforDatamigrationandIntegration.(Catinf.com)• GeometricspecificationforintegratingdesignandinspectionusingCT(Lu,Wenlong,Phd Thesis,Huddersfield,2011

Referencestosomeofourwork

• Wisnesky,Ryan,etal."UsingCategoryTheorytoFacilitateMultipleManufacturingServiceDatabaseIntegration."JournalofComputingandInformationScienceinEngineering 17.2(2017):021011.

• Padi,S.,Breiner,S.,Subrahmanian,E.,&Sriram,R.D.(2017).ModelingandAnalysisofIndianCarnaticMusicUsingCategoryTheory.IEEETransactionsonSystems,Man,andCybernetics:Systems,April2017.

• Breiner,S.,Subrahmanian,E.,&Sriram,R.D.ModelingtheInternetofThings:AFoundationalApproach.SemanticInteroperabilityforInternetofthingsworkshop,November,Berlin,2016.

• Breiener,S.,Jones,A.,Subrahmanian,E.,Categoricalmodelsforprocessplanning,acceptedwithrevisions,ComputersandIndustry,2017.

• Breiner,S.,Subrhamanian,E.,JonesA,CategoryTheoryforsystemsengineering,ConferenceonsystemengineeringReserach,Rodando Beach,CA,April,2017.

• CategorytheoryandUML,Underpreparation.NIST

Thankyou

Email:EswaranSubrahmanian:[email protected]:[email protected]

AcknowledgmentsDr.RamSriram,Chief,SoftwareandSystemsDivision,NISTDr.AlbertJones,SystemIntegrationDivision,NISTDr.RyanWisnesky,CategoricalInformatics,Boston.MassDr.DavidSpivak,MathematicsDepartment,MIT

Contactusifyouareinterestedinworkingwithus.