Mathematical Language Evolution Design

From Event-B
Revision as of 11:07, 25 March 2009 by imported>Nicolas (→‎Parser Changes)
Jump to navigationJump to search


This document describes the modifications that occur to the Event-B mathematical language from the developer point of view. The old language will still be recognized, in order to provide backward compatibility.

Syntax Tree

Deprecated nodes (becoming atomic expressions):

  • KPRJ1
  • KPRJ2
  • KID

New nodes:

  • KPARTITION that represents the new partition predicate (relational predicate)
  • KPRJ1_GEN that represents the atomic version of the first projection
  • KPRJ2_GEN that represents the atomic version of the second projection
  • KID_GEN that represents the atomic version of the identity

Parser Changes

The new parser has a version attribute. Depending on the version, formulas are parsed differently. Thus, the KPARTITION node is illegal if version is V1. It is accepted only from version V2. Concerning, identity and projections, they are recognized as non-generic with V1 and generic with V2. The following table summarizes how tokens are processed depending on the parser version:

Token Recognition
Parser V1 Parser V2
"partition" illegal KPARTITION
"prj1" KPRJ1 KPRJ1_GEN
"prj2" KPRJ2 KPRJ2_GEN


FormulaFactory has new parse() methods with a parser version argument. Existing methods default to the latest version. To cope with version problems, parsing is done in several steps:

  • try to parse with the given version (or latest by default)
  • if parse succeeds, the result is returned as usual
  • else, try to parse with older versions incrementally
    • if no version succeeds, return the failed result of the parse call with the latest version
    • else propose upgrading from the highest succeeding version to the latest

Multiple Predicates / Partition

A new predicate class is introduced: {class|MultiplePredicate} that is abstract and superclasses {class|Partition}. A {class|MultiplePredicate} is a predicate that applies to a list of two or more expressions. In a {class|Partition}, all expressions must have the same type, that is the type of the partitioned set (first child).


IVisitor has three more methods:

  • enter KPARTITION
  • continue KPARTITION

ISimpleVisitor has one more method:

  • visitMultiplePredicate

Sequent Prover


Affected client code