SPARK (programming language)#Industrial applications

{{Short description|Programming language}}

{{About|the programming language|the cluster computing framework that can run on Scala, Java, and Python|Apache Spark}}

{{Use dmy dates|date=April 2022}}

{{multiple issues|

{{More footnotes needed|date=September 2010}}

{{third-party|date=May 2014}}

}}

{{Infobox programming language

| name = SPARK

| logo = Sparkada.jpg

| logo size = 250px

| paradigm = Multi-paradigm: structured, imperative, object-oriented, aspect-oriented,{{cite web|url=http://www.adacore.com/uploads/technical-papers/Ada2012_Rational_Introducion.pdf|title=Ada2012 Rationale|website=adacore.com|access-date=5 May 2018|url-status=live|archive-url=https://web.archive.org/web/20160418132340/http://www.adacore.com/uploads/technical-papers/Ada2012_Rational_Introducion.pdf|archive-date=18 April 2016}} concurrent, array, distributed, generic, procedural, meta

| developer = Altran, AdaCore

| released = {{Start date and age|2009}}

| latest release version = Community 2021

| latest release date = {{Start date and age|2021|06|01}}

| typing = static, strong, safe, nominative

| operating system = Cross-platform: Linux, Windows, macOS

| license = GPLv3

| website = {{URL|www.adacore.com/about-spark}}

| file ext =

| implementations = SPARK Pro, SPARK GPL Edition, SPARK Community

| dialects =

| influenced_by = Ada, Eiffel

| influenced =

}}

SPARK is a formally defined computer programming language based on the Ada language, intended for developing high integrity software used in systems where predictable and highly reliable operation is essential. It facilitates developing applications that demand safety, security, or business integrity.

Originally, three versions of SPARK existed (SPARK83, SPARK95, SPARK2005), based on Ada 83, Ada 95, and Ada 2005 respectively.

A fourth version, SPARK 2014, based on Ada 2012, was released on April 30, 2014. SPARK 2014 is a complete re-design of the language and supporting verification tools.

The SPARK language consists of a well-defined subset of the Ada language that uses contracts to describe the specification of components in a form that is suitable for both static and dynamic verification.

In SPARK83/95/2005, the contracts are encoded in Ada comments and so are ignored by any standard Ada compiler, but are processed by the SPARK Examiner and its associated tools.

SPARK 2014, in contrast, uses Ada 2012's built-in syntax of aspects to express contracts, bringing them into the core of the language. The main tool for SPARK 2014 (GNATprove) is based on the GNAT/GCC infrastructure, and re-uses almost all of the GNAT Ada 2012 front-end.

Technical overview

SPARK utilises the strengths of Ada while trying to eliminate all its potential ambiguities and insecure constructs. SPARK programs are by design meant to be unambiguous, and their behavior is required to be unaffected by the choice of Ada compiler. These goals are achieved partly by omitting some of Ada's more problematic features (such as unrestricted parallel tasking) and partly by introducing contracts that encode the application designer's intentions and requirements for certain components of a program.

The combination of these approaches allows SPARK to meet its design objectives, which are:

Contract examples

Consider the Ada subprogram specification below:

procedure Increment (X : in out Counter_Type);

In pure Ada, this might increment the variable X by one or one thousand; or it might set some global counter to X and return the original value of the counter in X; or it might do nothing with X.

With SPARK 2014, contracts are added to the code to provide more information regarding what a subprogram actually does. For example, the above specification may be altered to say:

procedure Increment (X : in out Counter_Type)

with Global => null,

Depends => (X => X);

This specifies that the Increment procedure uses no (neither update nor read) global variable and that the only data item used in calculating the new value of X is X alone.

Alternatively, may be specified:

procedure Increment (X : in out Counter_Type)

with Global => (In_Out => Count),

Depends => (Count => (Count, X),

X => null);

This specifies that Increment will use the global variable Count in the same package as Increment, that the exported value of Count depends on the imported values of Count and X, and that the exported value of X does not depend on any variables at all and it will be derived from constant data only.

If GNATprove is then run on the specification and corresponding body of a subprogram, it will analyse the body of the subprogram to build up a model of the information flow. This model is then compared against what has been specified by the annotations and any discrepancies reported to the user.

These specifications can be further extended by asserting various properties that either need to hold when a subprogram is called (preconditions) or that will hold once execution of the subprogram has completed (postconditions). For example, if writing:

procedure Increment (X : in out Counter_Type)

with Global => null,

Depends => (X => X),

Pre => X < Counter_Type'Last,

Post => X = X'Old + 1;

This, now, specifies not only that X is derived from itself alone, but also that before Increment is called X must be strictly less than the last possible value of its type (to ensure that the result will never overflow) and that afterward X will be equal to the initial value of X plus one.

Verification conditions

GNATprove can also generate a set of verification conditions (VCs). These are used to establish whether certain properties hold for a given subprogram. At a minimum, the GNATprove will generate VCs to establish that all run-time errors cannot occur within a subprogram, such as:

  • array index out of range
  • type range violation
  • division by zero
  • numerical overflow

If a postcondition or any other assertion is added to a subprogram, GNATprove will also generate VCs that require the user to show that these properties hold for all possible paths through the subprogram.

Under the hood, GNATprove uses the Why3 intermediate language and VC Generator, and the CVC4, Z3, and Alt-Ergo theorem provers to discharge VCs. Use of other provers (including interactive proof checkers) is also possible through other components of the Why3 toolset.

History

The first version of SPARK (based on Ada 83) was produced at the University of Southampton (with UK Ministry of Defence sponsorship) by Bernard Carré and Trevor Jennings. The name SPARK was derived from SPADE Ada Kernel, in reference to the SPADE subset of the Pascal programming language.{{cite web |url=https://docs.adacore.com/sparkdocs-docs/SPARK_LRM.htm |title=SPARK – The SPADE Ada Kernel (including RavenSPARK) |publisher=AdaCore |access-date=2021-06-30}}

Subsequently the language was progressively extended and refined, first by Program Validation Limited and then by Praxis Critical Systems Limited. In 2004, Praxis Critical Systems Limited changed its name to Praxis High Integrity Systems Limited. In January 2010, the company became Altran Praxis.

In early 2009, Praxis formed a partnership with AdaCore, and released SPARK Pro under the terms of the GPL. This was followed in June 2009 by the SPARK GPL Edition 2009, aimed at the free and open-source software (FOSS) and academic communities.

In June 2010, Altran-Praxis announced that the SPARK programming language would be used in the software of US Lunar project CubeSat, expected to be completed in 2015.

In January 2013, Altran-Praxis changed its name to Altran, which in April 2021 became Capgemini Engineering (following Altran's merger with Capgemini).

The first Pro release of SPARK 2014 was announced on April 30, 2014, and was quickly followed by the SPARK 2014 GPL edition, aimed at the FLOSS and academic communities.

Industrial applications

See also

{{Portal|Free and open-source software}}

References

{{Reflist}}

Further reading

  • {{cite book

|last1=Barnes

|first1= John

|title=SPARK: The Proven Approach to High Integrity Software

|date= 2012

|publisher=Altran Praxis

|ISBN=978-0-9572905-1-8

|url=http://www.cpibookdelivery.com/book/9780957290518/SPARK__The_Proven_Approach_to_High_Integrity_Software

|author-link=John Barnes (computer scientist)

}}

  • {{cite book

|last1=McCormick

|first1=John W.

|last2=Chapin

|first2=Peter C.

|title=Building High Integrity Applications with SPARK

|date= 2015

|publisher=Cambridge University Press

|ISBN= 978-1-107-65684-0

|url=http://www.cambridge.org/9781107656840

}}

  • {{cite journal

|last1=Ross

|first1=Philip E.

|date= September 2005

|title=The Exterminators

|journal=IEEE Spectrum

|volume=42

|issue=9

|pages=36–41

|issn= 0018-9235

|url=https://spectrum.ieee.org/the-exterminators

|doi=10.1109/MSPEC.2005.1502527

|s2cid=26369398

}}