lib/ProofGeneral/pgip.rnc
changeset 23434 b2e7d4c29614
parent 17735 e6948d8f5f73
child 33686 8e33ca8832b1
equal deleted inserted replaced
23433:c2c10abd2a1e 23434:b2e7d4c29614
     1 # 
     1 # 
     2 # RELAX NG Schema for PGIP, the Proof General Interface Protocol                   
     2 # RELAX NG Schema for PGIP, the Proof General Interface Protocol                   
     3 # 
     3 # 
     4 # Authors:  David Aspinall, LFCS, University of Edinburgh       
     4 # Authors:  David Aspinall, LFCS, University of Edinburgh       
     5 #           Christoph Lueth, University of Bremen       
     5 #           Christoph Lüth, University of Bremen       
     6 #
     6 #
     7 # Version: $Id$    
     7 # Version: $Id$    
     8 # 
     8 # 
     9 # Status:   Prototype.
     9 # Status:   Prototype.
    10 #
    10 #
    23 #  4. Prover Configuration
    23 #  4. Prover Configuration
    24 #  5. Interface Configuration
    24 #  5. Interface Configuration
    25 #  6. Prover Control
    25 #  6. Prover Control
    26 #  7. Proof script markup and proof control
    26 #  7. Proof script markup and proof control
    27 #
    27 #
       
    28 #
       
    29 # ===============================================================================
       
    30 #
       
    31 # Note on datatypes.  (see e.g. http://books.xmlschemata.org/relaxng):
       
    32 #
       
    33 #  token  : any string possibly with spaces, but spaces are normalised/collapsed
       
    34 #	    (i.e. tokenised).  Same as XML Schema xs:token
       
    35 #  string : any string, whitespaces preserved.  Same as XML Schema xs:string
       
    36 #	    (NB: attributes are normalised by XML 1.0 parsers so
       
    37 #	     spaces/newlines must be quoted)
       
    38 #  text	  : text nodes/mixed content (whitespace may be lost in mixed content)
       
    39 #
       
    40 # So: attributes should usually be tokens or more restrictive; (sometimes: strings for printing)
       
    41 #     element contents may be string (preserving whitespace), token (tokenising), 
       
    42 #       or text (which may contain further nodes).
    28 
    43 
    29 # ==============================================================================
    44 # ==============================================================================
    30 # 0. Prelude
    45 # 0. Prelude
    31 # ==============================================================================
    46 # ==============================================================================
    32 
    47 
    33 include "pgml.rnc"                           # include PGML grammar
    48 include "pgml.rnc"                           # include PGML grammar
    34 
    49 
    35 name_attr = attribute name { text }          # names are user-level textual identifiers
    50 name_attr = attribute name { token }         # names are user-level textual identifiers (space-collapsed)
    36 thyname_attr = attribute thyname { text }    # names for theories (special case of name)
    51 thyname_attr = attribute thyname { token }   # names for theories (special case of name)
    37 thmname_attr = attribute thmname { text }    # names for theorems (special case of name)
    52 thmname_attr = attribute thmname { token }   # names for theorems (special case of name)
    38 
    53 
    39 datetime_attr = 
    54 datetime_attr = 
    40    attribute datetime { xsd:dateTime }       # CCYY-MM-DDHH:MM:SS plus timezone info
    55    attribute datetime { xsd:dateTime }       # CCYY-MM-DDHH:MM:SS plus timezone info
    41 url_attr  = attribute url { xsd:anyURI }     # URLs  (often as "file:///localfilename.extn")
    56 url_attr  = attribute url { xsd:anyURI }     # URLs  (often as "file:///localfilename.extn")
    42 dir_attr  = attribute dir { text }           # Unix-style directory name (no final slash)
    57 dir_attr  = attribute dir { string }         # Unix-style directory name (no final slash)
    43 
    58 
    44 systemdata_attr  = 
    59 systemdata_attr  = 
    45             attribute systemdata { text }?   # system-specific data (useful for "stateless" RPC)
    60             attribute systemdata { token }?   # system-specific data (useful for "stateless" RPC)
    46 
    61 
    47 
    62 objname = token	     # an identifier name (convention: any characters except semi-colon)
    48 objname = string
    63 objnames = token     # sequence of names in an attribute: semi-colon separated
    49 termobjname = string                         # (User-level) object names, semi-colon terminated
    64 
    50 objnames = string                            # A sequence of objnames
    65 #objnames = string                            # A sequence of objnames
    51 
    66 #termobjname  = string { pattern = "[^;]+;" }  # unfortunately these declarations don't 
    52 #termobjname  = xsd:string { pattern = "[^;]+;" }  # unfortunately these declarations don't 
    67 #objnames = objname | (termobjname, objname)
    53 #objnames = objname+                               #  work with the RNC->DTD tool trang
    68 #objnames = objname+                               #  work with the RNC->DTD tool trang
    54 
    69 
    55 
    70 
    56 # ==============================================================================
    71 # ==============================================================================
    57 # 1. Top-level Messages/documents
    72 # 1. Top-level Messages/documents
    59 
    74 
    60 start = pgip                                 # Single message
    75 start = pgip                                 # Single message
    61       | pgips                                # A log of messages between components
    76       | pgips                                # A log of messages between components
    62       | displayconfig                        # displayconfig as a standalone element
    77       | displayconfig                        # displayconfig as a standalone element
    63       | pgipconfig                           # pgipconfig as a standalone element
    78       | pgipconfig                           # pgipconfig as a standalone element
       
    79       | pgipdoc                              # A proof script document 
    64 
    80 
    65 pgip = element pgip {                        #  A PGIP packet contains:
    81 pgip = element pgip {                        #  A PGIP packet contains:
    66    pgip_attrs,                               #   - attributes with header information;
    82    pgip_attrs,                               #   - attributes with header information;
    67    (toprovermsg | todisplaymsg |             #   - a message with one of four channel types
    83    (toprovermsg | todisplaymsg |             #   - a message with one of four channel types
    68     fromprovermsg | fromdisplaymsg 
    84     fromprovermsg | fromdisplaymsg 
    70   }
    86   }
    71 
    87 
    72 pgips = element pgips { pgip+ }
    88 pgips = element pgips { pgip+ }
    73 
    89 
    74 pgip_attrs =
    90 pgip_attrs =
    75  attribute tag { text }?,                   # message tag, e.g. name of origin component (diagnostic)
    91  attribute tag { token }?,                  # message tag, e.g. name of origin component (diagnostic)
    76  attribute id { text },                     # (unique) session id of this component 
    92  attribute id { token },                    # (unique) session id of this component 
    77  attribute destid { text }?,                # session id of destination component
    93  attribute destid { token }?,               # session id of destination component
    78  attribute class { pgip_class },            # general categorization of message
    94  attribute class { pgip_class },            # general categorization of message
    79  attribute refid { text }?,                 # component id this message responds to (usually destid)
    95  attribute refid { token }?,                # component id this message responds to (usually destid)
    80  attribute refseq { xsd:positiveInteger }?, # message sequence this message responds to
    96  attribute refseq { xsd:positiveInteger }?, # message sequence this message responds to
    81  attribute seq { xsd:positiveInteger }      # sequence number of this message
    97  attribute seq { xsd:positiveInteger }      # sequence number of this message
    82 
    98 
    83 pgip_class = "pg"      # message sent TO proof general broker
    99 pgip_class = "pg"      # message sent TO proof general broker (e.g. FROM proof assistant).
    84            | "pa"      # message sent TO the proof assistant/other component
   100            | "pa"      # message sent TO the proof assistant/other component
    85            | "pd"      # message sent TO display/front-end components
   101            | "pd"      # message sent TO display/front-end components
    86 
   102 
    87 toprovermsg =          # Messages sent to the prover (class "pa"):
   103 toprovermsg =          # Messages sent to the prover (class "pa"):
    88    proverconfig        #   query Prover configuration, triggering interface configuration
   104    proverconfig        #   query Prover configuration, triggering interface configuration
   126 componentspec = 
   142 componentspec = 
   127    element componentspec {
   143    element componentspec {
   128       componentid_attr,         # Unique identifier for component class
   144       componentid_attr,         # Unique identifier for component class
   129       componentname_attr,       # Textual name of component class
   145       componentname_attr,       # Textual name of component class
   130       componenttype,            # Type of component: prover, display, auxiliary
   146       componenttype,            # Type of component: prover, display, auxiliary
   131       systemattrs,              # System attributes for connecting to component
   147       startupattrs,		# Describing startup behaviour
       
   148       systemattrs,              # System attributes for component
   132       componentconnect          # How to connect to component
   149       componentconnect          # How to connect to component
   133    }
   150    }
   134 
   151 
   135 componentid_attr   = attribute componentid   { token }
   152 componentid_attr   = attribute componentid   { token }
   136 componentname_attr = attribute componentname { text }
   153 componentname_attr = attribute componentname { token }
   137 
   154 
   138 componenttype = element componenttype {
   155 componenttype = element componenttype {
   139      provercomponent 
   156      provercomponent 
   140    | displaycomponent 
   157    | displaycomponent 
   141  # | filehandlercomponent 
   158  # | filehandlercomponent 
   149 
   166 
   150 componentconnect =
   167 componentconnect =
   151    componentsubprocess | componentsocket | connectbyproxy
   168    componentsubprocess | componentsocket | connectbyproxy
   152 
   169 
   153 componentsubprocess = 
   170 componentsubprocess = 
   154    element syscommand { text }
   171    element syscommand { string }
   155 componentsocket = 
   172 componentsocket = 
   156    (element host { text }, element port { text })
   173    (element host { token }, element port { xsd:positiveInteger })
   157 connectbyproxy = 
   174 connectbyproxy = 
   158    (element proxy { attribute host { text }    # Host to connect to
   175    (element proxy { attribute host { token }    # Host to connect to
   159 		  , attribute connect { 
   176 		  , attribute connect { 
   160                            "rsh" | "ssh" # Launch proxy via RSH or SSH, needs
   177                            "rsh" | "ssh" # Launch proxy via RSH or SSH, needs
   161 			                 # authentication 
   178 			                 # authentication 
   162                          | "server"  # connect to running proxy on given port
   179                          | "server"  # connect to running proxy on given port
   163                          }?
   180                          }?
   164                   , attribute user { text } ? # user to connect as with RSH/SSH
   181                   , attribute user { token } ? # user to connect as with RSH/SSH
   165 		  , attribute port { text } ? # port to connect to running proxy
   182                   , attribute path { token } ? # path of pgipkit on remote
       
   183 		  , attribute port { xsd:positiveInteger } ? # port to connect to running proxy
   166 		  , componentconnect
   184 		  , componentconnect
   167 		  })
   185 		  })
   168 
   186 
   169 systemattrs = (
   187 # Attributes describing when to start the component.
   170    attribute timeout { xsd:integer }?,  # timeout for communications
   188 startupattrs =
   171    attribute sync { xsd:boolean }?,     # whether to wait for ready
   189   attribute startup {		# what to do on broker startup:
   172    attribute startup {		# what to do on broker startup:
       
   173              "boot"   |		# always start this component (default with displays)
   190              "boot"   |		# always start this component (default with displays)
   174              "manual" |		# start manually (default with provers)
   191              "manual" |		# start manually (default with provers)
   175              "ignore"		# never start this
   192              "ignore"		# never start this component
   176              }?
   193              }?
   177    )
   194 
       
   195 # System attributes describing behaviour of component. 
       
   196 systemattrs = (
       
   197     attribute timeout { xsd:integer }?  # timeout for communications
       
   198   , attribute sync { xsd:boolean }?     # whether to wait for ready
       
   199   , attribute nestedgoals { xsd:boolean}? # Does prover allow nested goals?
       
   200   )
   178 
   201 
   179 # Control commands from display to broker
   202 # Control commands from display to broker
   180 brokercontrol = 
   203 brokercontrol = 
   181     launchprover		# Launch a new prover
   204     launchprover		# Launch a new prover
   182   | exitprover			# Request to terminate a running prover
   205   | exitprover			# Request to terminate a running prover
   208 
   231 
   209 brokerstatus  = element brokerstatus 
   232 brokerstatus  = element brokerstatus 
   210                        { knownprovers, runningprovers, brokerinformation }
   233                        { knownprovers, runningprovers, brokerinformation }
   211 
   234 
   212 knownprover   = element knownprover   { componentid_attr, provername }
   235 knownprover   = element knownprover   { componentid_attr, provername }
   213 runningprover = element runningprover { proverid_attr, provername }
   236 runningprover = element runningprover { componentid_attr, proverid_attr, provername }
   214 
   237 
   215 knownprovers   = element knownprovers { knownprover* }
   238 knownprovers   = element knownprovers { knownprover* }
   216 runningprovers = element runningprovers { runningprover* }
   239 runningprovers = element runningprovers { runningprover* }
   217 brokerinformation = element brokerinformation { text }
   240 brokerinformation = element brokerinformation { string }
   218 
   241 
   219 proveravailmsg  = element proveravailable { provername_attr,
   242 proveravailmsg  = element proveravailable { provername_attr,
   220                                             componentid_attr }
   243                                             componentid_attr }
   221 newprovermsg    = element proverstarted { provername_attr, 
   244 newprovermsg    = element proverstarted { proverid_attr
   222 		                          proverid_attr }
   245 					, componentid_attr
   223                   # QUESTION: do we want  componentid_attr 
   246 		                        , provername_attr
   224                   # here as well, and do we want to be able to run multiple
   247 		                        }
   225                   # copies of the same prover? 
       
   226 proverstatemsg = element proverstate { 
   248 proverstatemsg = element proverstate { 
   227                        proverid_attr, provername_attr,
   249                        proverid_attr, provername_attr,
   228                        attribute proverstate {proverstate} } 
   250                        attribute proverstate {proverstate} } 
   229 
   251 
   230 proverstate    = ("ready" | "busy" | "exitus")
   252 proverstate    = ("ready" | "busy" | "exitus")
   251   | savefile			# save opened file
   273   | savefile			# save opened file
   252   | discardfile			# discard changes to opened file
   274   | discardfile			# discard changes to opened file
   253 
   275 
   254 dispfilemsg =
   276 dispfilemsg =
   255     newfile			# announce creation of new file (in response to load/open)
   277     newfile			# announce creation of new file (in response to load/open)
   256   | filestatus			#announce change in status of file in broker
   278   | filestatus			# announce change in status of file in broker
   257 
   279 
   258 # unique identifier of loaded files
   280 # unique identifier of loaded files
   259 srcid_attr = attribute srcid { text }
   281 srcid_attr = attribute srcid { token }
   260 
   282 
   261 loadparsefile = element loadparsefile { url_attr, proverid_attr }
   283 loadparsefile = element loadparsefile { url_attr, proverid_attr }
   262 newfilewith   = element newfilewith   { url_attr, proverid_attr, text }
   284 newfilewith   = element newfilewith   { url_attr, proverid_attr, string }
   263 dispopenfile  = element dispopenfile { url_attr,
   285 dispopenfile  = element dispopenfile { url_attr,
   264                                        proverid_attr,
   286                                        proverid_attr,
   265                                        attribute overwrite { xsd:boolean }?}
   287                                        attribute overwrite { xsd:boolean }?}
   266 savefile      = element savefile { srcid_attr,     
   288 savefile      = element savefile { srcid_attr,     
   267                                    url_attr? }
   289                                    url_attr? }
   268 discardfile   = element discardfile { srcid_attr }
   290 discardfile   = element discardfile { srcid_attr }
   269 
   291 
   270 newfile       = element newfile  { proverid_attr, srcid_attr, url_attr }
   292 newfile       = element newfile  { proverid_attr, srcid_attr, url_attr }
   271 filestatus    = element filestatus  { proverid_attr, srcid_attr, newstatus_attr, 
   293 filestatus    = element filestatus  { proverid_attr, srcid_attr, newstatus_attr, url_attr?,
   272 				      datetime_attr} 
   294 				      datetime_attr} 
   273 
   295 
   274 newstatus_attr = attribute newstatus { "saved" | "changed" | "discarded" }
   296 newstatus_attr = attribute newstatus { "saved" | "changed" | "discarded" }
   275 
   297 
   276 dispobjcmd =
   298 dispobjcmd =
   277     setobjstate			# request of change of state 
   299     setobjstate			# request of change of state 
   278   | editobj			# request edit operation of opbjects
   300   | editobj			# request edit operation of objects
   279   | createobj			# request creation of new objects
   301   | createobj			# request creation of new objects
       
   302 # Suggested May 06: probably add re-load flags instead 
       
   303 #  | reloadobjs                  # request relisting of all objects
   280   | inputcmd		        # process the command (generated by an input event)
   304   | inputcmd		        # process the command (generated by an input event)
   281   | interruptprover		# send interrupt or kill signal to prover
   305   | interruptprover		# send interrupt or kill signal to prover
   282 
   306 
   283 dispobjmsg = element dispobjmsg { 
   307 dispobjmsg = element dispobjmsg { 
   284       newobj+			# new objects have been created
   308       newobj+			# new objects have been created
   293 	    objid_attr, 
   317 	    objid_attr, 
   294             attribute objposition { objid } ?,
   318             attribute objposition { objid } ?,
   295             objtype_attr ?,
   319             objtype_attr ?,
   296             attribute objparent { objid }?,
   320             attribute objparent { objid }?,
   297             attribute objstate { objstate },
   321             attribute objstate { objstate },
       
   322 	    # FIXME: would like to include metainfo here
       
   323             # as (properscriptcmd, metainfo*) | unparseable
   298             (properscriptcmd | unparseable) }
   324             (properscriptcmd | unparseable) }
   299 
   325 
   300 replaceobjs = element replaceobjs {
   326 replaceobjs = element replaceobjs {
   301 	                srcid_attr,
   327 	                srcid_attr,
   302 	                attribute replacedfrom { objid }? ,
   328 	                attribute replacedfrom { objid }? ,
   303 			attribute replacedto { objid }?,
   329 			attribute replacedto { objid }?,
   304                         delobj*,
   330                         delobj*,    # actually, either of delobj or 
   305                         newobj+ }
   331                         newobj* }   # newobj can be empty but not both.
   306 
   332 
   307 delobj = element delobj   { proverid_attr, srcid_attr, objid_attr }
   333 delobj = element delobj   { proverid_attr, srcid_attr, objid_attr }
   308 
   334 
   309 objectstate = element objstate
   335 objectstate = element objstate
   310                        { proverid_attr, srcid_attr, objid_attr,
   336                        { proverid_attr, srcid_attr, objid_attr,
   314                   {  objid_attr, attribute newstate {objstate} }
   340                   {  objid_attr, attribute newstate {objstate} }
   315 
   341 
   316 editobj = element editobj { srcid_attr ?,
   342 editobj = element editobj { srcid_attr ?,
   317 	                    attribute editfrom { objid }?,
   343 	                    attribute editfrom { objid }?,
   318                             attribute editto   { objid }?,
   344                             attribute editto   { objid }?,
   319                             text }
   345                             string }
   320 createobj = element createobj { srcid_attr ?, 
   346 createobj = element createobj { srcid_attr ?, 
   321                                 attribute objposition { objid }?, 
   347                                 attribute objposition { objid }?, 
   322                                 text}
   348                                 string }
   323 
   349 
   324 inputcmd       = element inputcmd { improper_attr, text }
   350 # Suggested May 06: probably add re-load flags instead 
       
   351 # reloadobjs = element reloadobjs { srcid_attr }
       
   352 
       
   353 inputcmd       = element inputcmd { improper_attr, string }
   325 improper_attr  = attribute improper { xsd:boolean }
   354 improper_attr  = attribute improper { xsd:boolean }
   326 
   355 
   327 interruptprover = element interruptprover 
   356 interruptprover = element interruptprover 
   328                           { interruptlevel_attr, proverid_attr }
   357                           { interruptlevel_attr, proverid_attr }
   329 
   358 
   330 interruptlevel_attr  = attribute interruptlevel { "interrupt" | "stop" | "kill" }
   359 interruptlevel_attr  = attribute interruptlevel { "interrupt" | "stop" | "kill" }
   331 
   360 
   332 objid_attr = attribute objid { objid } 
   361 objid_attr = attribute objid { objid } 
   333 objid      = text 
   362 objid      = token 
   334 
   363 
   335 objstate = 
   364 objstate = 
   336   ( "unparseable" | "parsed" | "being_processed" | "processed" | "outdated" )
   365   ( "unparseable" | "parsed" | "being_processed" | "processed" | "outdated" )
   337 
   366 
   338 
   367 
   348  | setpref			# please set this preference value 
   377  | setpref			# please set this preference value 
   349  | getpref			# please tell me this preference value
   378  | getpref			# please tell me this preference value
   350 
   379 
   351 
   380 
   352 
   381 
   353 prefcat_attr = attribute prefcategory { text}   # e.g. "expert", "internal", etc.
   382 prefcat_attr = attribute prefcategory { token }   # e.g. "expert", "internal", etc.
   354                                                 # could be used for tabs in dialog
   383                                                       # could be used for tabs in dialog
   355 
   384 
   356 askpgip   = element askpgip   { empty }
   385 askpgip   = element askpgip   { empty }
   357 askpgml   = element askpgml   { empty }
   386 askpgml   = element askpgml   { empty }
   358 askconfig = element askconfig { empty }
   387 askconfig = element askconfig { empty }
   359 askprefs  = element askprefs  { prefcat_attr? }
   388 askprefs  = element askprefs  { prefcat_attr? }
   380   | idvalue			# display the value of some identifier
   409   | idvalue			# display the value of some identifier
   381   | menuadd			# add a menu entry
   410   | menuadd			# add a menu entry
   382   | menudel			# remove a menu entry
   411   | menudel			# remove a menu entry
   383 
   412 
   384 # version reporting
   413 # version reporting
   385 version_attr  = attribute version { text }
   414 version_attr  = attribute version { token }
   386 usespgml = element usespgml  { version_attr }
   415 usespgml = element usespgml  { version_attr }
   387 usespgip = element usespgip  { version_attr 
   416 usespgip = element usespgip  { version_attr 
   388 	                     , activecompspec
   417 	                     , activecompspec
   389 			     }
   418 			     }
   390 
   419 
   393 # There are some restrictions: if we start a tool, the componentid and the type must be the
   422 # There are some restrictions: if we start a tool, the componentid and the type must be the
   394 # same as initially specified.
   423 # same as initially specified.
   395 activecompspec =  ( componentid_attr?   # unique identifier of component class
   424 activecompspec =  ( componentid_attr?   # unique identifier of component class
   396 	          , componentname_attr? # Textual name of this component (overrides initial spec)
   425 	          , componentname_attr? # Textual name of this component (overrides initial spec)
   397 		  , componenttype?      # Type of component
   426 		  , componenttype?      # Type of component
       
   427 		  , systemattrs         # system attributes
   398 		  , acceptedpgipelems?  # list of accepted elements
   428 		  , acceptedpgipelems?  # list of accepted elements
   399 		  )
   429 		  )
   400 
   430 
   401 
   431 
   402 acceptedpgipelems = element acceptedpgipelems { singlepgipelem* }
   432 acceptedpgipelems = element acceptedpgipelems { singlepgipelem* }
   403 
   433 
   404 singlepgipelem    = element pgipelem { 
   434 singlepgipelem    = element pgipelem { 
   405    attribute async { xsd:boolean }?,  # true if this command supported asynchronously (deflt false)
   435    attribute async { xsd:boolean }?,  # true if this command supported asynchronously (deflt false)
   406    text }                             # (otherwise part of ready/sync stream)
   436 				      # (otherwise part of usual ready/sync stream)
       
   437    attribute attributes { text }?,    # comma-separated list of supported optional attribute names
       
   438 				      # useful for: times attribute
       
   439    text }                             # the unadorned name of the PGIP element (*not* an element)
   407 
   440 
   408 # PGML configuration
   441 # PGML configuration
   409 pgmlconfig = element pgmlconfig { pgmlconfigure+ }
   442 pgmlconfig = element pgmlconfig { pgmlconfigure+ }
   410 
   443 
   411 # Types for config settings: corresponding data values should conform to canonical
   444 # Types for config settings: corresponding data values should conform to canonical
   412 # representation for corresponding XML Schema 1.0 Datatypes.  (This representation is verbose
   445 # representation for corresponding XML Schema 1.0 Datatypes.  
   413 # but helps for error checking later)
       
   414 #
   446 #
   415 # In detail:
   447 # In detail:
       
   448 #  pgipnull   = empty
   416 #  pgipbool   = xsd:boolean = true | false
   449 #  pgipbool   = xsd:boolean = true | false
   417 #  pgipint    = xsd:integer = (-)?(0-9)+     (canonical: no leading zeroes)
   450 #  pgipint    = xsd:integer = (-)?(0-9)+     (canonical: no leading zeroes)
   418 #  pgipstring = xsd:string  =  <any character sequence>
   451 #  pgipstring = string  =  <any non-empty character sequence>
   419 #  pgipchoice = cf xs:choice  = type1 | type2 | ... | typen
   452 #  pgipchoice = cf xs:choice  = type1 | type2 | ... | typen
   420 
   453 
   421 pgiptype   = pgipbool | pgipint | pgipstring | pgipchoice | pgipconst
   454 pgiptype   = pgipnull | pgipbool | pgipint | pgipstring | pgipchoice | pgipconst
   422 pgipbool   = element pgipbool { empty }
   455 
   423 
   456 pgipnull   = element pgipnull { descr_attr?, empty }
   424 pgipint    = element pgipint  { min_attr?, max_attr?, empty }
   457 pgipbool   = element pgipbool { descr_attr?, empty }
       
   458 pgipint    = element pgipint  { min_attr?, max_attr?, descr_attr?, empty }
   425 min_attr   = attribute min { xsd:integer }
   459 min_attr   = attribute min { xsd:integer }
   426 max_attr   = attribute max { xsd:integer }
   460 max_attr   = attribute max { xsd:integer }
   427 pgipstring = element pgipstring { empty }
   461 pgipstring = element pgipstring { descr_attr?, empty }
       
   462 pgipconst  = element pgipconst { name_attr, descr_attr? } 
       
   463       # FIXME: Temporary fix because Isabelle does it wrong -- should be empty }
   428 pgipchoice = element pgipchoice { pgiptype+ }
   464 pgipchoice = element pgipchoice { pgiptype+ }
   429 pgipconst  = element pgipconst { name_attr?, text }
   465 
   430 
   466 # Notes on pgipchoice:
   431 pgipvalue  = text
   467 # 1. Choices must not be nested (i.e. must not contain other choices)
       
   468 # 2. The description attributes for pgipbool, pgipint, pgipstring and pgipconst
       
   469 #    are for use with pgipchoice: they can be used as a user-visible label
       
   470 #    when representing the choice to the user (e.g. in a pull-down menu).
       
   471 # 3. A pgipchoice should have an unambiguous representation as a string. That means
       
   472 #    all constants in the choice must have different names, and a choice must not
       
   473 #    contain more than one each of pgipint, pgipstring and pgipbool.
       
   474 
       
   475 pgipvalue  = string
   432 
   476 
   433 icon  = element icon { xsd:base64Binary }  # image data for an icon
   477 icon  = element icon { xsd:base64Binary }  # image data for an icon
   434 
   478 
   435 default_attr = attribute default { text }
   479 # The default value of a preference as a string (using the unambiguous
   436 descr_attr   = attribute descr { text }
   480 # conversion to string mentioned above). A string value will always be quoted
       
   481 # to distinguish it from constants or integers.
       
   482 default_attr = attribute default { token }
       
   483 
       
   484 # Description of a choice.  If multi-line, first line is short tip.
       
   485 descr_attr   = attribute descr { string }
   437 
   486 
   438 # icons for preference recommended size: 32x32 
   487 # icons for preference recommended size: 32x32 
   439 # top level preferences: may be used in dialog for preference setting
   488 # top level preferences: may be used in dialog for preference setting
   440 # object preferences: may be used as an "emblem" to decorate 
   489 # object preferences: may be used as an "emblem" to decorate 
   441 # object icon (boolean preferences with default false, only)
   490 # object icon (boolean preferences with default false, only)
   443    name_attr, descr_attr?, 
   492    name_attr, descr_attr?, 
   444    default_attr?, icon?,
   493    default_attr?, icon?,
   445    pgiptype
   494    pgiptype
   446 }
   495 }
   447 
   496 
       
   497 
       
   498 
   448 hasprefs = element hasprefs { prefcat_attr?, haspref* }
   499 hasprefs = element hasprefs { prefcat_attr?, haspref* }
   449 
   500 
   450 prefval = element prefval { name_attr, pgipvalue } 
   501 prefval = element prefval { name_attr, pgipvalue } 
   451 
   502 
   452 # menu items (incomplete, FIXME)
   503 # menu items (incomplete, FIXME)
   453 path_attr = attribute path { text }
   504 path_attr = attribute path { token }
   454 
   505 
   455 menuadd  = element menuadd  { path_attr?, name_attr?, opn_attr? }
   506 menuadd  = element menuadd  { path_attr?, name_attr?, opn_attr? }
   456 menudel  = element menudel  { path_attr?, name_attr? }
   507 menudel  = element menudel  { path_attr?, name_attr? }
   457 opn_attr = attribute operation { token }
   508 opn_attr = attribute operation { token }
   458 
   509 
   461 # basic prover information, lexical structure of files, 
   512 # basic prover information, lexical structure of files, 
   462 # an icon for the prover, help documents, and the 
   513 # an icon for the prover, help documents, and the 
   463 # objects, types, and operations for building proof commands.
   514 # objects, types, and operations for building proof commands.
   464 
   515 
   465 # NB: the following object types have a fixed interpretation 
   516 # NB: the following object types have a fixed interpretation 
   466 # in PGIP:  "comment", "theorem", "theory", "file" 
   517 # in PGIP:
       
   518 #        "identifier":   an identifier in the identifier syntax
       
   519 #           "comment":   an arbitrary sequence of characters
       
   520 #	    "theorem":   a theorem name or text
       
   521 #	    "theory" :   a theory name or text
       
   522 #	    "file" :     a file name
   467 
   523 
   468 displayconfig =
   524 displayconfig =
   469   element displayconfig { 
   525   element displayconfig { 
   470      welcomemsg?, icon?, helpdoc*, lexicalstructure*,
   526      welcomemsg?, icon?, helpdoc*, lexicalstructure*,
   471      objtype*, opn* }
   527      objtype*, opn* }
   472 
   528 
   473 objtype = element objtype { name_attr, descr_attr?, icon?, hasprefs?, contains* }
   529 objtype = element objtype { name_attr, descr_attr?, icon?,  contains*, hasprefs?  }
   474 
   530 
   475 objtype_attr = attribute objtype { token }           # the name of an objtype
   531 objtype_attr = attribute objtype { token }           # the name of an objtype
   476 contains = element contains { objtype_attr, empty }  #  a container for other objtypes
   532 contains = element contains { objtype_attr, empty }  #  a container for other objtypes
   477 
   533 
   478 opn   = element opn { name_attr, inputform?, opsrc, optrg, opcmd, improper_attr? }
   534 opn = element opn { 
   479 
   535    name_attr, 
   480 opsrc = element opsrc { list { token* } }  # source types: a space separated list
   536    descr_attr?,
   481 optrg = element optrg { token }?           # single target type, empty for proof command
   537    inputform?,	  # FIXME: can maybe remove this?
   482 opcmd = element opcmd { text }             # prover command, with printf-style "%1"-args
   538    opsrc*,	  # FIXME: incompat change wanted: have list of source elts, not spaces
       
   539    optrg, 
       
   540    opcmd, 
       
   541    improper_attr? }
       
   542 
       
   543 opsrc = 
       
   544    element opsrc {	  
       
   545       name_attr?,         # %name as an alternative to %number
       
   546       selnumber_attr?,    # explicit number for %number, the nth item selected
       
   547       prompt_attr?,	  # prompt in form or tooltip in template
       
   548       listwithsep_attr?,  # list of args of this type with given separator
       
   549       list { token* } }   # source types: a space separated list
       
   550 			  # FIXME incompat change wanted: just have one source here
       
   551 			  # FIXME: need to add optional pgiptype
       
   552 
       
   553 listwithsep_attr =  attribute listwithsep { token }
       
   554 selnumber_attr =    attribute selnumber { xsd:positiveInteger }
       
   555 prompt_attr =       attribute prompt { string }
       
   556 
       
   557 optrg = 
       
   558    element optrg { token }?           # single target type, empty for proof command
       
   559 opcmd = 
       
   560    element opcmd { string }           # prover command, with printf-style "%1"-args
       
   561 					   #  (whitespace preserved here: literal text)
   483 
   562 
   484 # interactive operations - require some input
   563 # interactive operations - require some input
   485 inputform = element inputform { field+ }  
   564 inputform = element inputform { field+ }  
   486 
   565 
   487 # a field has a PGIP config type (int, string, bool, choice(c1...cn)) and a name; under that
   566 # a field has a PGIP config type (int, string, bool, choice(c1...cn)) and a name; under that
   488 # name, it will be substituted into the command Ex. field name=number opcmd="rtac %1 %number"
   567 # name, it will be substituted into the command Ex. field name=number opcmd="rtac %1 %number"
   489 
   568 
   490 field = element field { 
   569 field = element field { 
   491    name_attr, pgiptype,
   570    name_attr, pgiptype,
   492    element prompt { text }
   571    element prompt { string }
   493 }
   572 }
   494 
   573 
   495 # identifier tables: these list known items of particular objtype.
   574 # identifier tables: these list known items of particular objtype.
   496 # Might be used for completion or menu selection, and inspection.
   575 # Might be used for completion or menu selection, and inspection.
   497 # May have a nested structure (but objtypes do not).
   576 # May have a nested structure (but objtypes do not).
   498 
   577 
   499 setids  = element setids { idtable* }   # (with an empty idtable, clear table)
   578 setids  = element setids { idtable* }   # (with an empty idtable, clear table)
   500 addids  = element addids { idtable* }
   579 addids  = element addids { idtable* }
   501 delids  = element delids { idtable* }
   580 delids  = element delids { idtable* }
   502 
   581 
   503 # give value of some identifier (response to showid)
   582 # give value of some identifier (response to showid; same values returned)
   504 idvalue = element idvalue               
   583 idvalue = element idvalue               
   505    {  name_attr, objtype_attr, pgmltext }
   584    {  thyname_attr?, name_attr, objtype_attr, pgmltext }
   506 
   585 
   507 idtable    = element idtable { context_attr?, objtype_attr, identifier* }
   586 idtable    = element idtable { context_attr?, objtype_attr, identifier* }
   508 identifier = element identifier { token }
   587 identifier = element identifier { token }
   509 
   588 
   510 context_attr = attribute context { token } # parent identifier (context) 
   589 context_attr = attribute context { token } # parent identifier (context) 
   511 
       
   512 instance_attr = attribute instance { text }
       
   513 
   590 
   514 # prover information: 
   591 # prover information: 
   515 # name, instance (e.g. in case of major parameter of invocation);
   592 # name, instance (e.g. in case of major parameter of invocation);
   516 # description, version, homepage,  welcome message, docs available
   593 # description, version, homepage,  welcome message, docs available
   517 proverinfo = element proverinfo 
   594 proverinfo = element proverinfo 
   519      descr_attr?, url_attr?, filenameextns_attr?, 
   596      descr_attr?, url_attr?, filenameextns_attr?, 
   520 ## TEMP: these elements are duplicated in displayconfig, as they're
   597 ## TEMP: these elements are duplicated in displayconfig, as they're
   521 ## moving there.  
   598 ## moving there.  
   522       welcomemsg?, icon?, helpdoc*, lexicalstructure* }
   599       welcomemsg?, icon?, helpdoc*, lexicalstructure* }
   523 
   600 
   524 welcomemsg = element welcomemsg { text }
   601 instance_attr = attribute instance { token }
       
   602 
       
   603 welcomemsg = element welcomemsg { string }
   525 
   604 
   526 # helpdoc: advertise availability of some documentation, given a canonical
   605 # helpdoc: advertise availability of some documentation, given a canonical
   527 # name, textual description, and URL or viewdoc argument.
   606 # name, textual description, and URL or viewdoc argument.
   528 # 
   607 # 
   529 helpdoc = element helpdoc { name_attr, descr_attr, url_attr?, text } # text is arg to "viewdoc"
   608 helpdoc = element helpdoc { name_attr, descr_attr, url_attr?, token } # token string is arg to "viewdoc"
   530 
   609 
   531 filenameextns_attr = attribute filenameextns { objnames }
   610 filenameextns_attr = attribute filenameextns { xsd:NMTOKENS } # space-separated extensions sans "."
   532 
   611 
   533 # lexical structure of proof texts
   612 # lexical structure of proof texts
   534 lexicalstructure = 
   613 lexicalstructure = 
   535    element lexicalstructure {
   614    element lexicalstructure {
   536       keyword*,
   615       keyword*,
   539       commentdelimiter*,
   618       commentdelimiter*,
   540       identifiersyntax?
   619       identifiersyntax?
   541    }
   620    }
   542 
   621 
   543 keyword = element keyword {
   622 keyword = element keyword {
   544    attribute word { text },
   623    attribute word { token },
   545    shorthelp?,
   624    shorthelp?,
   546    longhelp? }
   625    longhelp? }
   547 
   626 
   548 shorthelp = element shorthelp { text }   # one-line (tooltip style) help 
   627 shorthelp = element shorthelp { string }   # one-line (tooltip style) help 
   549 longhelp  = element longhelp { text }    # multi-line help
   628 longhelp  = element longhelp { string }    # multi-line help
   550 
   629 
   551 stringdelimiter = element stringdelimiter { text }  # should be a single char
   630 stringdelimiter = element stringdelimiter { token }  # should be a single char
   552 
   631 
   553 # The escape character is used to escape strings and other special characters - in most languages it is \
   632 # The escape character is used to escape strings and other special characters - in most languages it is \
   554 escapecharacter = element escapecharacter { text }  # should be a single char
   633 escapecharacter = element escapecharacter { token }  # should be a single char
   555 
   634 
   556 commentdelimiter = element commentdelimiter { 
   635 commentdelimiter = element commentdelimiter { 
   557    attribute start { text },
   636    attribute start { token },
   558    attribute end { text }?,
   637    attribute end { token }?,
   559    empty
   638    empty
   560   }
   639   }
   561 
   640 
   562 
   641 
   563 # syntax for ids: id = initial allowed*  or id = allowed+ if initial empty
   642 # syntax for ids: id = initial allowed*  or id = allowed+ if initial empty
   564 identifiersyntax = element identifiersyntax { 
   643 identifiersyntax = element identifiersyntax { 
   565    attribute initialchars { text }?,
   644    attribute initialchars { token }?,
   566    attribute allowedchars { text }
   645    attribute allowedchars { token }
   567 }
   646 }
   568 
   647 
   569 # ==============================================================================
   648 # ==============================================================================
   570 # 6. Prover Control
   649 # 6. Prover Control
   571 # ==============================================================================
   650 # ==============================================================================
   575  | proverexit			# exit prover
   654  | proverexit			# exit prover
   576  | startquiet			# stop prover sending proof state displays, non-urgent messages
   655  | startquiet			# stop prover sending proof state displays, non-urgent messages
   577  | stopquiet			# turn on normal proof state & message displays
   656  | stopquiet			# turn on normal proof state & message displays
   578  | pgmlsymbolson		# activate use of symbols in PGML output (input always understood)
   657  | pgmlsymbolson		# activate use of symbols in PGML output (input always understood)
   579  | pgmlsymbolsoff		# deactivate use of symbols in PGML output
   658  | pgmlsymbolsoff		# deactivate use of symbols in PGML output
       
   659  | setproverflag		# set/clear a standard control flag (supersedes above)
   580 
   660 
   581 proverinit     = element proverinit { empty }  
   661 proverinit     = element proverinit { empty }  
   582 proverexit     = element proverexit { empty }
   662 proverexit     = element proverexit { empty }
   583 startquiet     = element startquiet { empty }  
   663 startquiet     = element startquiet { empty }      # DEPRECATED 
   584 stopquiet      = element stopquiet  { empty }  
   664 stopquiet      = element stopquiet  { empty }      # DEPRECATED 
   585 pgmlsymbolson  = element pgmlsymbolson { empty }
   665 pgmlsymbolson  = element pgmlsymbolson { empty }   # DEPRECATED
   586 pgmlsymbolsoff = element pgmlsymbolsoff { empty }
   666 pgmlsymbolsoff = element pgmlsymbolsoff { empty }  # DEPRECATED
   587 
   667 
       
   668 setproverflag  = element setproverflag { flagname_attr, 
       
   669 					 attribute value { xsd:boolean } }
       
   670 flagname_attr  = 
       
   671    attribute flagname { "quiet" 
       
   672 		      | "pgmlsymbols" 
       
   673 		      | "metainfo:thmdeps" 
       
   674 		      }
   588 
   675 
   589 # General prover output/responses
   676 # General prover output/responses
   590 
   677 
   591 # Nearly all prover output has an optional proverid attribute, except for the one which is 
   678 # Prover output has an otional proverid_attribute. This is set by the broker when relaying 
   592 # never seen by any display. This is set by the Broker to indicate the originating or referring
   679 # prover output to displays. When producing output, provers can and should not set this
   593 # prover. 
   680 # attribute. 
   594 # Displays rendering these messages can rely on this attribute being set.
       
   595 
   681 
   596 proveroutput =
   682 proveroutput =
   597    ready			# prover is ready for input
   683    ready			# prover is ready for input
   598  | cleardisplay			# prover requests a display area to be cleared
   684  | cleardisplay			# prover requests a display area to be cleared
   599  | proofstate			# prover outputs the proof state
   685  | proofstate			# prover outputs the proof state
   604  | parseresult			# results of a <parsescript> request (see later)
   690  | parseresult			# results of a <parsescript> request (see later)
   605 
   691 
   606 ready = element ready { empty }
   692 ready = element ready { empty }
   607 
   693 
   608 displayarea = "status"		# a status line
   694 displayarea = "status"		# a status line
   609 	    | "message"		# the message area (e.g. response buffer)
   695 	    | "message"		# the message area (e.g. response buffer, perhaps swapped into view)
   610             | "display"		# the main display area (e.g. goals buffer)
   696             | "display"		# the main display area (e.g. goals buffer, usually persistent)
   611 	    | token		# prover-specified window name
   697 	    | token		# prover-specified window name
   612 
   698 
   613 cleardisplay = 
   699 cleardisplay = 
   614    element cleardisplay {
   700    element cleardisplay {
   615       proverid_attr?,
   701       proverid_attr?,
   625  | "information"		#  - user-level debug/info message (interface may hide)
   711  | "information"		#  - user-level debug/info message (interface may hide)
   626  | "tracing"			#  - user-level "tracing" message (possibly voluminous)
   712  | "tracing"			#  - user-level "tracing" message (possibly voluminous)
   627 
   713 
   628 normalresponse =                           
   714 normalresponse =                           
   629   element normalresponse { 
   715   element normalresponse { 
   630     proverid_attr?,
   716     proverid_attr?,				    # if no proverid, assume message is from broker
   631     attribute area { displayarea },
   717     attribute area { displayarea },
   632     attribute messagecategory { messagecategory }?, # optional extra category (e.g. tracing/debug)
   718     attribute messagecategory { messagecategory }?, # optional extra category (e.g. tracing/debug)
   633     attribute urgent { "y" }?,                      # indication that message must be displayed
   719     attribute urgent { xsd:boolean }?,              # message should be brought to users attention
   634     pgmltext 
   720     pgmltext 
   635 }
   721 }
   636 
   722 
   637 ## Error messages:  these are different from ordinary messages in that
   723 ## Error messages:  these are different from ordinary messages in that
   638 ##		    they indicate an error condition in the prover, with a notion
   724 ## they indicate an error condition in the prover, with a notion
   639 ##		    of fatality and (optionally) a location.  The interface may collect these
   725 ## of fatality and (optionally) a location.  The interface may collect these
   640 ##		    messages in a log, display in a modal dialog, or in the specified
   726 ## messages in a log, display in a modal dialog, or in the specified
   641 ##		    display area if one is specified.
   727 ## display area if one is given
       
   728 ## 
       
   729 ## Error responses are also taken to indicate failure of a command to be processed, but only in
       
   730 ## the special case of a response with fatality "fatal".  If any errorresponse with
       
   731 ## fatality=fatal is sent before <ready/>, the PGIP command which triggered the message is
       
   732 ## considered to have failed.  If the command is a scripting command, it will not be added to
       
   733 ## the successfully processed part of the document.  A "nonfatal" error also indicates some
       
   734 ## serious problem with the sent command, but it is not considered to have failed.  This is the
       
   735 ## ordinary response for
   642 
   736 
   643 errorresponse = 
   737 errorresponse = 
   644    element errorresponse { 
   738    element errorresponse { 
   645      proverid_attr?,
   739      proverid_attr?,				   #  ... as above ...
   646      attribute area { displayarea }?,
   740      attribute area { displayarea }?,
   647      attribute fatality { fatality },
   741      attribute fatality { fatality },
   648      location_attrs,
   742      location_attrs,
   649      pgmltext
   743      pgmltext
   650   }
   744   }
   651 
   745 
   652 fatality =	  # degree of error conditions:
   746 fatality =	  # degree of error conditions:
   653    "nonfatal"     #  - warning message (interface should show message)
   747    "info"	  #  - info message
   654  | "fatal"        #  - error message (interface must show message)
   748  | "warning"      #  - warning message
       
   749  | "nonfatal"     #  - error message, recovered and state updated
       
   750  | "fatal"        #  - error message, command has failed
   655  | "panic"        #  - shutdown condition, component exits (interface may show message)
   751  | "panic"        #  - shutdown condition, component exits (interface may show message)
   656  | "log"          #  - log message (interface must not show message, write to broker log file)
   752  | "log"          #  - system-level log message (interface does not show message; written to log file)
   657  | "debug"        #  - debug message (interface may show message, write to broker log file)
   753  | "debug"        #  - system-level debug message (interface may show message; written to log file)
   658 		   ## FIXME da: wondering if this is more appropriate than normal/internal above
       
   659 
       
   660 
   754 
   661 # attributes describing a file location (for error messages, etc)
   755 # attributes describing a file location (for error messages, etc)
   662 location_attrs = 
   756 location_attrs = 
   663      attribute location_descr    { text }?,
   757      attribute location_descr    { string }?,
   664      attribute location_url      { xsd:anyURI }?,
   758      attribute location_url      { xsd:anyURI }?,
   665      attribute locationline      { xsd:positiveInteger }?,
   759      attribute locationline      { xsd:positiveInteger }?,
   666      attribute locationcolumn    { xsd:positiveInteger }?,
   760      attribute locationcolumn    { xsd:positiveInteger }?,
   667      attribute locationcharacter { xsd:positiveInteger }?
   761      attribute locationcharacter { xsd:positiveInteger }?,
   668 
   762      attribute locationlength    { xsd:positiveInteger }?
   669 scriptinsert = element scriptinsert { proverid_attr?, metavarid_attr?, text }
   763 
       
   764 # instruction to insert some literal text into the document
       
   765 scriptinsert = element scriptinsert { proverid_attr?, metavarid_attr?, string }
   670 
   766 
   671 
   767 
   672 # metainformation is an extensible place to put system-specific information
   768 # metainformation is an extensible place to put system-specific information
   673 
   769 
   674 value = element value { name_attr?, text }   # generic value holder
   770 value = element value { name_attr?, text }        # generic value holder [ deprecated: use metainfo ]
       
   771 metainfo = element metainfo { name_attr?, text }  # generic info holder
   675 
   772 
   676 metainforesponse = 
   773 metainforesponse = 
   677    element metainforesponse { 
   774    element metainforesponse { 
   678       proverid_attr?,
   775       proverid_attr?,
   679       attribute infotype { text },      # categorization of data
   776       attribute infotype { token },      # categorization of data
   680       value* }                          # data values
   777       (value | metainfo)* }              # data values/text
   681 
   778 
   682 
   779 
   683 # ==============================================================================
   780 # ==============================================================================
   684 # 7. Proof script markup and proof control 
   781 # 7. Proof script markup and proof control 
   685 # ==============================================================================
   782 # ==============================================================================
   686 
   783 
   687 # properproofcmds are purely markup on native proof script text
   784 # properproofcmds are purely markup on native proof script (plain) text
   688 properproofcmd =
   785 properproofcmd =
   689     opengoal        # open a goal in ambient context
   786     opengoal        # open a goal in ambient context
   690   | proofstep       # a specific proof command (perhaps configured via opcmd) 
   787   | proofstep       # a specific proof command (perhaps configured via opcmd) 
   691   | closegoal       # complete & close current open proof (succeeds iff proven, may close nested pf)
   788   | closegoal       # complete & close current open proof (succeeds iff proven, may close nested pf)
   692   | giveupgoal      # close current open proof, retaining attempt in script (Isar oops)
   789   | giveupgoal      # close current open proof, retaining attempt in script (Isar oops)
   693   | postponegoal    # close current open proof, record as proof obl'n  (Isar sorry)  
   790   | postponegoal    # close current open proof, record as proof obl'n  (Isar sorry)  
   694   | comment         # a proof script comment; text probably ignored by prover 
   791   | comment         # a proof script comment; text probably ignored by prover 
       
   792   | doccomment      # a proof script document comment; text maybe processed by prover 
   695   | whitespace      # a whitespace comment; text ignored by prover
   793   | whitespace      # a whitespace comment; text ignored by prover
   696   | spuriouscmd     # command ignored for undo, e.g. "print x", could be pruned from script
   794   | spuriouscmd     # command ignored for undo, e.g. "print x", could be pruned from script
   697   | badcmd          # a command which should not be stored in the script (e.g. an improperproofcmd)
   795   | badcmd          # a command which should not be stored in the script (e.g. an improperproofcmd)
   698   | litcomment      # a literate comment (never passed to prover)
   796   | litcomment      # a PGIP literate comment (never passed to prover)
   699   | pragma	    # a document generating instruction (never passed to prover)
   797   | pragma	    # a document generating instruction (never passed to prover)
   700 
   798 
   701 # improperproofcmds are commands which are never stored in the script
   799 # improperproofcmds are commands which are never stored in the script
   702 improperproofcmd =
   800 improperproofcmd =
   703     dostep        # issue a properproofcmd (without passing in markup)
   801     dostep        # issue a properproofcmd (without passing in markup)
   705   | redostep      # redo the last undone step issued in currently open goal (optionally supported)
   803   | redostep      # redo the last undone step issued in currently open goal (optionally supported)
   706   | abortgoal     # give up on current open proof, close proof state, discard history
   804   | abortgoal     # give up on current open proof, close proof state, discard history
   707   | forget        # forget a theorem (or named target), outdating dependent theorems
   805   | forget        # forget a theorem (or named target), outdating dependent theorems
   708   | restoregoal   # re-open previously postponed proof, outdating dependent theorems
   806   | restoregoal   # re-open previously postponed proof, outdating dependent theorems
   709 
   807 
   710 opengoal     = element opengoal     { display_attr?, thmname_attr?, text } # FIXME: add objprefval
   808 # In future we may allow input to contain markup; for now it is treated uniformly as plain text.
   711 proofstep    = element proofstep    { display_attr?, name_attr?, objtype_attr?, text }
   809 
   712 closegoal    = element closegoal    { display_attr?, text }
   810 opengoal     = element opengoal     { display_attr?, thmname_attr?, string } # FIXME: add objprefval
   713 giveupgoal   = element giveupgoal   { display_attr?, text }
   811 proofstep    = element proofstep    { display_attr?, name_attr?, objtype_attr?, string }
   714 postponegoal = element postponegoal { display_attr?, text }
   812 closegoal    = element closegoal    { display_attr?, string }
   715 comment      = element comment      { display_attr?, text }
   813 giveupgoal   = element giveupgoal   { display_attr?, string }
   716 whitespace   = element whitespace   { display_attr?, text }
   814 postponegoal = element postponegoal { display_attr?, string }
       
   815 comment      = element comment      { display_attr?, string }
       
   816 doccomment   = element doccomment   { display_attr?, string }
       
   817 whitespace   = element whitespace   { display_attr?, string }
   717 
   818 
   718 display_attr = attribute nodisplay { xsd:boolean }  # whether to display in documentation
   819 display_attr = attribute nodisplay { xsd:boolean }  # whether to display in documentation
   719 
   820 
   720 spuriouscmd  = element spuriouscmd { text }
   821 spuriouscmd  = element spuriouscmd { string }  # no semantic effect (e.g. print)
   721 badcmd       = element badcmd { text }
   822 badcmd       = element badcmd { string }       # illegal in script (e.g. undo)
       
   823 nonscripting = element nonscripting { string } # non-scripting text (different doc type)
   722 
   824 
   723 litcomment  = element litcomment { format_attr?, (text | directive)* }
   825 litcomment  = element litcomment { format_attr?, (text | directive)* }
   724 directive   = element directive { (proofctxt,pgml) }
   826 directive   = element directive { (proofctxt,pgml) }
   725 format_attr = attribute format { token }
   827 format_attr = attribute format { token }
   726 
   828 
   727 pragma       = showhidecode | setformat
   829 pragma       = showhidecode | setformat
   728 showhidecode = element showcode { attribute show { xsd:boolean } }
   830 showhidecode = element showcode { attribute show { xsd:boolean } }
   729 setformat    = element setformat { format_attr }
   831 setformat    = element setformat { format_attr }
   730 
   832 
   731 dostep       = element dostep { text }
   833 dostep       = element dostep { string }
   732 undostep     = element undostep { empty }
   834 undostep     = element undostep { times_attr? }
   733 redostep     = element redostep { empty }
   835 redostep     = element redostep { times_attr? }
   734 abortgoal    = element abortgoal { empty }
   836 abortgoal    = element abortgoal { empty }
   735 forget       = element forget { thyname_attr?, name_attr?, objtype_attr? }
   837 forget       = element forget { thyname_attr?, name_attr?, objtype_attr? }
   736 restoregoal  = element restoregoal { thmname_attr }
   838 restoregoal  = element restoregoal { thmname_attr }
   737 
   839 
       
   840 times_attr   = attribute times { xsd:positiveInteger }
       
   841 
   738 # empty objprefval element is used for object prefs in script markup 
   842 # empty objprefval element is used for object prefs in script markup 
   739 objprefval = element objprefval { name_attr, val_attr, empty }
   843 objprefval = element objprefval { name_attr, val_attr, empty }
   740 val_attr   = attribute value { text }
   844 val_attr   = attribute value { token }
   741 
   845 
   742 
   846 
   743 
   847 
   744 
   848 
   745 # =======================================================
   849 # =======================================================
   746 # Inspecting the proof context, etc.
   850 # Inspecting the proof context, etc.
   747 
   851 
       
   852 # NB: ids/refs/parent: work in progress, liable to change.
       
   853 
   748 proofctxt =
   854 proofctxt =
   749     askids         # please tell me about identifiers (given objtype in a theory)
   855     askids         # tell me about identifiers (given objtype in a theory)
   750   | showid         # print value of an object
   856   | askrefs        # tell me about dependencies (references) of an identifier
   751   | askguise       # please tell me about the current state of the prover
   857 #  | askparent      # tell me the container for some identifier
       
   858   | showid         # print the value of some object
       
   859   | askguise       # tell me about the current state of the prover
   752   | parsescript    # parse a raw proof script into proofcmds
   860   | parsescript    # parse a raw proof script into proofcmds
   753   | showproofstate # (re)display proof state (empty if outside a proof)
   861   | showproofstate # (re)display proof state (empty if outside a proof)
   754   | showctxt       # show proof context
   862   | showctxt       # show proof context
   755   | searchtheorems # search for theorems (prover-specific arguments)  
   863   | searchtheorems # search for theorems (prover-specific arguments)  
   756   | setlinewidth   # set line width for printing
   864   | setlinewidth   # set line width for printing
   759 askids = element askids  { thyname_attr?, objtype_attr? }
   867 askids = element askids  { thyname_attr?, objtype_attr? }
   760 	# Note that thyname_attr is *required* for certain objtypes (e.g. theorem).
   868 	# Note that thyname_attr is *required* for certain objtypes (e.g. theorem).
   761 	# This is because otherwise the list is enormous.
   869 	# This is because otherwise the list is enormous.
   762 	# Perhaps we should make thyname_attr obligatory? 
   870 	# Perhaps we should make thyname_attr obligatory? 
   763 	# With a blank entry (i.e. thyname="") allowed for listing theories, or for when 
   871 	# With a blank entry (i.e. thyname="") allowed for listing theories, or for when 
   764 	# you really do want to see everything.
   872 	# you really do want to see everything (could be a shell-style glob)
       
   873 
       
   874 
       
   875 # askids:    container -> identifiers contained within
       
   876 # askparent: identifier + type + context -> container
       
   877 # askrers:   identifier + type + context -> identifiers which are referenced 
       
   878 #
       
   879 askrefs = element askrefs { url_attr?, thyname_attr?, objtype_attr?, name_attr? }
       
   880 # TODO: maybe include guises here as indication of reference point.  
       
   881 # setrefs in reply to askrefs only really needs identifiers, but it's nice to
       
   882 # support voluntary information too.
       
   883 setrefs = element setrefs { url_attr?, thyname_attr?, objtype_attr?, name_attr?, idtable*, fileurl* }
       
   884 fileurl = element fileurl { url_attr }
       
   885 # telldeps = element telldeps { thyname_attr?, objtype_attr, name_attr?, identifier* }
       
   886 # Idea: for a theory dependency we return a single file (URL), the containing file.
       
   887 #       for a file dependency we return urls of parent files,
       
   888 #       for theorem dependency we return theory
       
   889 #       for term dependency we return definition (point in file)
       
   890 
   765 
   891 
   766 showid = element showid  { thyname_attr?, objtype_attr, name_attr }
   892 showid = element showid  { thyname_attr?, objtype_attr, name_attr }
   767 
   893 
   768 askguise = element askguise { empty }
   894 askguise = element askguise { empty }
   769 
   895 
       
   896 showproofstate = element showproofstate { empty }
       
   897 showctxt       = element showctxt { empty }
       
   898 searchtheorems = element searchtheorems { string }
       
   899 setlinewidth   = element setlinewidth { xsd:positiveInteger }
       
   900 viewdoc        = element viewdoc { token }
       
   901 
   770 
   902 
   771 # =======================================================
   903 # =======================================================
   772 # Parsing proof scripts
   904 # Proof script documents and parsing proof scripts
       
   905 
       
   906 # A PGIP document is a sequence of script commands, each of which
       
   907 # may have meta information attached.
       
   908 properscriptcmdmetainfo = properscriptcmd, metainfo*
       
   909 pgipdoc = element pgipdoc { properscriptcmdmetainfo* }
       
   910 
   773 
   911 
   774 # NB: parsing needs only be supported for "proper" proof commands,
   912 # NB: parsing needs only be supported for "proper" proof commands,
   775 # which may appear in proof texts.  The groupdelimiters are purely
   913 # which may appear in proof texts.  The groupdelimiters are purely
   776 # markup hints to the interface for display structure on concrete syntax.
   914 # markup hints to the interface for display structure on concrete syntax.
   777 # The location attributes can be used by the prover in <parsescript> to
   915 # The location attributes can be used by the prover in <parsescript> to
   780 # particularly in the case of (re-)parsing only part of a file.
   918 # particularly in the case of (re-)parsing only part of a file.
   781 # The parsing component MUST return the same location attributes
   919 # The parsing component MUST return the same location attributes
   782 # (and system data attribute) that was passed in.
   920 # (and system data attribute) that was passed in.
   783 
   921 
   784 parsescript = element parsescript
   922 parsescript = element parsescript
   785                  { location_attrs, systemdata_attr, text }
   923                  { location_attrs, systemdata_attr, string }
   786        
   924        
   787 parseresult = element parseresult { location_attrs, systemdata_attr,
   925 parseresult = element parseresult { location_attrs, systemdata_attr,
   788 				    singleparseresult* }
   926 				    singleparseresult* }
   789 
   927 
   790 singleparseresult  = properscriptcmd | unparseable | errorresponse
   928 # Really we'd like parsing to return properscriptcmdmetainfo as a single
   791 
   929 # result (and similarly for newobj).  
   792 unparseable = element unparseable { text }
   930 # Unfortunately, although this is an XML-transparent extension, it
       
   931 # messes up the Haskell schema-fixed code rather extensively, so for
       
   932 # now we just treat metainfo at the same level as the other results,
       
   933 # although it should only appear following a properscriptcmd.
       
   934 
       
   935 singleparseresult  = properscriptcmd | metainfo | unparseable | errorresponse
       
   936 
       
   937 unparseable = element unparseable { string }
   793 properscriptcmd = properproofcmd | properfilecmd | groupdelimiter
   938 properscriptcmd = properproofcmd | properfilecmd | groupdelimiter
   794 
   939 
   795 
   940 
       
   941 
       
   942 
   796 groupdelimiter = openblock | closeblock
   943 groupdelimiter = openblock | closeblock
   797 openblock  = element openblock { metavarid_attr? }
   944 openblock  = element openblock { 
       
   945    name_attr?, objtype_attr?, 
       
   946    metavarid_attr?, positionid_attr?,
       
   947    fold_attr?, indent_attr? }
   798 closeblock = element closeblock { empty }
   948 closeblock = element closeblock { empty }
   799 
   949 
   800 # 
   950 # 
   801 metavarid_attr = attribute metavarid { token }
   951 metavarid_attr  = attribute metavarid { token }
   802 
   952 positionid_attr = attribute positionid { token }
   803 showproofstate = element showproofstate { empty }
   953 fold_attr       = attribute fold { xsd:boolean }
   804 showctxt       = element showctxt { empty }
   954 indent_attr     = attribute indent { xsd:integer }
   805 searchtheorems = element searchtheorems { text }
       
   806 setlinewidth   = element setlinewidth { xsd:positiveInteger }
       
   807 viewdoc        = element viewdoc { text }
       
   808 
   955 
   809 
   956 
   810 # =======================================================
   957 # =======================================================
   811 # Theory/file handling
   958 # Theory/file handling
   812 
   959 
   819     doitem	    # issue a proper file command (without passing in markup)
   966     doitem	    # issue a proper file command (without passing in markup)
   820   | undoitem	    # undo last step (or named item) in theory construction
   967   | undoitem	    # undo last step (or named item) in theory construction
   821   | redoitem	    # redo last step (or named item) in theory construction (optionally supported)
   968   | redoitem	    # redo last step (or named item) in theory construction (optionally supported)
   822   | aborttheory     # abort currently open theory
   969   | aborttheory     # abort currently open theory
   823   | retracttheory   # retract a named theory
   970   | retracttheory   # retract a named theory
   824   | openfile        # lock a file for constructing a proof text 
   971   | openfile        # signal a file is being opened for constructing a proof text interactively
   825   | closefile       # unlock a file, suggesting it has been processed
   972   | closefile       # close the currently open file, suggesting it has been processed
   826   | abortfile       # unlock a file, suggesting it hasn't been processed
   973   | abortfile       # unlock a file, suggesting it hasn't been processed
   827   | loadfile        # load a file possibly containing theory definition(s)
   974   | loadfile        # load (i.e. process directly) a file possibly containing theory definition(s)
       
   975   | retractfile     # retract a given file (including all contained theories) 
   828   | changecwd       # change prover's working directory (or load path) for files
   976   | changecwd       # change prover's working directory (or load path) for files
   829   | systemcmd       # system (other) command, parsed internally
   977   | systemcmd       # system (other) command, parsed internally
   830 
   978 
   831 fileinfomsg = 
   979 fileinfomsg = 
   832    informfileloaded       # prover informs interface a particular file is loaded
   980    informfileloaded       # prover informs interface a particular file is loaded
   833  | informfileretracted    # prover informs interface a particular file is outdated
   981  | informfileretracted    # prover informs interface a particular file is outdated
   834  | informguise		  # prover informs interface about current state
   982  | informguise		  # prover informs interface about current state
   835 
   983 
   836 opentheory    = element opentheory    { thyname_attr, parentnames_attr?, text }
   984 opentheory    = element opentheory    { thyname_attr, parentnames_attr?, string }
   837 closetheory   = element closetheory   { text }
   985 closetheory   = element closetheory   { string }
   838 theoryitem    = element theoryitem    { name_attr?, objtype_attr?, text } # FIXME: add objprefval
   986 theoryitem    = element theoryitem    { name_attr?, objtype_attr?, string } # FIXME: add objprefval
   839 
   987 
   840 doitem        = element doitem        { text } 
   988 doitem        = element doitem        { string } 
   841 undoitem      = element undoitem      { name_attr?, objtype_attr? } 
   989 undoitem      = element undoitem      { name_attr?, objtype_attr?, times_attr? } 
   842 redoitem      = element redoitem      { name_attr?, objtype_attr? } 
   990 redoitem      = element redoitem      { name_attr?, objtype_attr?, times_attr? } 
   843 aborttheory   = element aborttheory   { empty }
   991 aborttheory   = element aborttheory   { empty }
   844 retracttheory = element retracttheory { thyname_attr }
   992 retracttheory = element retracttheory { thyname_attr }
   845 
   993 
   846 parentnames_attr = attribute parentnames { objnames }
   994 parentnames_attr = attribute parentnames { objnames }
   847 
   995 
   852 
  1000 
   853 openfile      = element openfile  { url_attr }	    # notify begin reading from given file
  1001 openfile      = element openfile  { url_attr }	    # notify begin reading from given file
   854 closefile     = element closefile { empty }	    # notify currently open file is complete
  1002 closefile     = element closefile { empty }	    # notify currently open file is complete
   855 abortfile     = element abortfile { empty }	    # notify currently open file is discarded
  1003 abortfile     = element abortfile { empty }	    # notify currently open file is discarded
   856 loadfile      = element loadfile  { url_attr }	    # ask prover to read file directly
  1004 loadfile      = element loadfile  { url_attr }	    # ask prover to read file directly
   857 changecwd     = element changecwd { dir_attr }	    # ask prover to change current working dir
  1005 retractfile   = element retractfile { url_attr }    # ask prover to retract file
       
  1006 changecwd     = element changecwd { url_attr }	    # ask prover to change current working dir
   858 
  1007 
   859 # this one not yet implemented, but would be handy.  Perhaps could be 
  1008 # this one not yet implemented, but would be handy.  Perhaps could be 
   860 # locatethy/locatefile instead.
  1009 # locatethy/locatefile instead.
   861 #locateobj     = element locateobj { name_attr, objtype_attr } # ask prover for file defining obj
  1010 #locateobj     = element locateobj { name_attr, objtype_attr } # ask prover for file defining obj
   862 
  1011 
   863 informfileloaded    = element informfileloaded    { url_attr }  # prover indicates a processed file
  1012 informfileloaded    = element informfileloaded    { completed_attr?, 
   864 informfileretracted = element informfileretracted { url_attr }  # prover indicates an undone file
  1013 						    url_attr }  # prover indicates a processed file
       
  1014 informfileretracted = element informfileretracted { completed_attr?, 
       
  1015 						    url_attr }  # prover indicates an undone file
       
  1016 informfileoutdated = element informfileoutdated { completed_attr?, 
       
  1017 						    url_attr }  # prover indicates an outdated file
       
  1018 
   865 informfilelocation  = element informfilelocation  { url_attr }  # response to locateobj
  1019 informfilelocation  = element informfilelocation  { url_attr }  # response to locateobj
       
  1020 
       
  1021 completed_attr = attribute completed { xsd:boolean }  # false if not completed (absent=>true)
       
  1022 						      # (the prover is requesting a lock)
       
  1023 
       
  1024 
   866 
  1025 
   867 informguise = 
  1026 informguise = 
   868    element informguise {
  1027    element informguise {
   869       element guisefile { url_attr }?,
  1028       element guisefile { url_attr }?,
   870       element guisetheory { thyname_attr }?,
  1029       element guisetheory { thyname_attr }?,
   871       element guiseproof { thmname_attr?, proofpos_attr? }?
  1030       element guiseproof { thmname_attr?, proofpos_attr? }?
   872    }
  1031    }
   873 
  1032 
   874 proofpos_attr = attribute proofpos { xsd:nonNegativeInteger }
  1033 proofpos_attr = attribute proofpos { xsd:nonNegativeInteger }
   875 
  1034 
   876 systemcmd     = element systemcmd     { text }		# "shell escape", arbitrary prover command!
  1035 systemcmd     = element systemcmd     { string }	# "shell escape", arbitrary prover command!
   877 
  1036 
   878 # ==============================================================================
  1037 # ==============================================================================
   879 # 8. Internal messages-- only used between communicating brokers.
  1038 # 8. Internal messages: only used between communicating brokers.
   880 # ==============================================================================
  1039 # ==============================================================================
   881 internalmsg  = launchcomp | stopcomp | registercomp | compstatus
  1040 internalmsg  = launchcomp | stopcomp | registercomp | compstatus
   882 
  1041 
   883 launchcomp   = element launchcomponent { componentspec }
  1042 launchcomp   = element launchcomponent { componentspec }
   884 	               # request to start an instance of this component remotely
  1043 	               # request to start an instance of this component remotely
   885 stopcomp     = element stopcomponent { attribute sessionid { string } }
  1044 stopcomp     = element stopcomponent { attribute sessionid { token } }
   886                        # request to stop component with this session id remotely
  1045                        # request to stop component with this session id remotely
   887 
  1046 
   888 registercomp = element registercomponent { activecompspec } 
  1047 registercomp = element registercomponent { activecompspec } 
   889                        # component has been started successfully
  1048                        # component has been started successfully
   890 compstatus   = element componentstatus { componentstatus_attr    # status
  1049 compstatus   = element componentstatus { componentstatus_attr    # status
   891 	                               , componentid_attr?       # component id (for failure)
  1050 	                               , componentid_attr?       # component id (for failure)
   892 	                               , element text { text }?  # user-visible error message
  1051 	                               , element text { string }?  # user-visible error message
   893 				       , element info { text }?  # Additional info for log files.
  1052 				       , element info { string }?  # Additional info for log files.
   894 				       }	
  1053 				       }	
   895                        # component status: failed to start, or exited
  1054                        # component status: failed to start, or exited
   896 
  1055 
   897 componentstatus_attr = attribute status { ("fail"   # component failed to start
  1056 componentstatus_attr = attribute status { ("fail"   # component failed to start
   898  		                          |"exit"  # component exited
  1057  		                          |"exit"  # component exited