Skip to content
Snippets Groups Projects
Commit acaabec6 authored by dgelessus's avatar dgelessus
Browse files

Update www3 URLs to stups.hhu-hosting.de

parent c9a3ea98
No related branches found
No related tags found
No related merge requests found
Pipeline #106803 passed
......@@ -8,7 +8,7 @@
* Rewrote the kernel installation code in Python. This is mostly an internal change and shouldn't affect most users. As a side effect, uninstalling the kernel is now simpler and requires no extra steps after `jupyter kernelspec remove`.
* Disabled LaTeX formatting inside `:check` tables as well, because of the layout issues mentioned below.
## [1.3.0](https://www3.hhu.de/stups/downloads/prob2-jupyter/prob2-jupyter-kernel-1.3.0-all.jar)
## [1.3.0](https://stups.hhu-hosting.de/downloads/prob2-jupyter/prob2-jupyter-kernel-1.3.0-all.jar)
* Added support for Java 17.
* Updated ProB 2 to version 3.15.0.
......@@ -25,7 +25,7 @@
* Fixed the `:trace` command sometimes displaying transitions as `null`.
* Disabled LaTeX formatting inside `:table` output, because it leads to various layout issues inside Jupyter Notebook. The table contents are now rendered as plain Unicode text instead.
## [1.2.0](https://www3.hhu.de/stups/downloads/prob2-jupyter/prob2-jupyter-kernel-1.2.0-all.jar)
## [1.2.0](https://stups.hhu-hosting.de/downloads/prob2-jupyter/prob2-jupyter-kernel-1.2.0-all.jar)
* Added support for Java 14.
* Added B parser version information to `:version` output.
......@@ -34,7 +34,7 @@
* Fixed a parse error when a line comment is used on the last line of an expression while any `:let` variables are defined.
* Fixed detection of B machines in cells without `::load`. Previously only single-line machines were recognized.
## [1.1.0](https://www3.hhu.de/stups/downloads/prob2-jupyter/prob2-jupyter-kernel-1.1.0-all.jar)
## [1.1.0](https://stups.hhu-hosting.de/downloads/prob2-jupyter/prob2-jupyter-kernel-1.1.0-all.jar)
* Added a `--user` flag to the installer to allow installing the kernel into the user home directory. This allows installing the kernel without `sudo` when not using a virtual environment.
* Added `:let` and `:unlet` commands to (un)define local variables.
......@@ -52,6 +52,6 @@
* Fixed `:trace` not showing the parameters and return values of executed transitions.
* Changed error handling so exception stack traces are no longer shown in the notebook. (They are still logged to the console.)
## [1.0.0](https://www3.hhu.de/stups/downloads/prob2-jupyter/prob2-jupyter-kernel-1.0.0-all.jar)
## [1.0.0](https://stups.hhu-hosting.de/downloads/prob2-jupyter/prob2-jupyter-kernel-1.0.0-all.jar)
* Initial release.
......@@ -8,7 +8,7 @@ This is a [Jupyter](https://jupyter.org/) kernel for the [ProB animator and mode
## Downloads
* **[Download the latest version of the ProB2 Jupyter kernel here](https://www3.hhu.de/stups/downloads/prob2-jupyter/prob2-jupyter-kernel-1.3.0-all.jar).**
* **[Download the latest version of the ProB2 Jupyter kernel here](https://stups.hhu-hosting.de/downloads/prob2-jupyter/prob2-jupyter-kernel-1.3.0-all.jar).**
* Download links for previous versions can be found in the [changelog].
* A [snapshot build](https://gitlab.cs.uni-duesseldorf.de/api/v4/projects/848/jobs/artifacts/master/raw/build/libs/prob2-jupyter-kernel-1.3.1-SNAPSHOT-all.jar?job=test) of the latest development version is also available. **Warning:** this is an unstable version that can contain bugs or breaking changes.
......
%% Cell type:markdown id:85001897 tags:
# Reals and Floats in ProB
### Michael Leuschel
%% Cell type:markdown id:42473a5e tags:
## Classical B
In Atelier-B the following two types were added to the B language:
* REAL
* FLOAT
ProB treats these keywords as synonyms for a new base type.
The current representation in ProB are floating point numbers; but this
will probably change in the future, at least for the REAL type.
One can now also use literals in decimal point notation for REAL and FLOAT.
%% Cell type:code id:cf76baf3 tags:
``` prob
1.0
```
%% Output
$1.0$
1.0
%% Cell type:code id:941433ba tags:
``` prob
1.0 : REAL & 1.0 : FLOAT
```
%% Output
$\mathit{TRUE}$
TRUE
%% Cell type:markdown id:6caf3504 tags:
### Conversion Operators
The following conversion operators are available in classical B:
* floor
* ceiling
* real
%% Cell type:code id:8925f6fe tags:
``` prob
real(2)
```
%% Output
$2.0$
2.0
%% Cell type:code id:bbd73954 tags:
``` prob
floor(2.2)
```
%% Output
$2$
2
%% Cell type:code id:838ea786 tags:
``` prob
ceiling(2.2)
```
%% Output
$3$
3
%% Cell type:code id:ee31f934 tags:
``` prob
ceiling(-2.2)
```
%% Output
$-2$
−2
%% Cell type:markdown id:f7398e0e tags:
### Arithmetic Operators
The documentation of Atelier-B is not entirely consistent according to which
operators to use.
In ProB you can use the standard arithmetic operators also for
floats:
%% Cell type:code id:65a66ec9 tags:
``` prob
1.0 + 1.0
```
%% Output
$2.0$
2.0
%% Cell type:code id:35ce95d5 tags:
``` prob
2.0 * 2.0 < 2.1
```
%% Output
$\mathit{FALSE}$
FALSE
%% Cell type:code id:531aa72d tags:
``` prob
2.0 * 2.0 < 2.0 + 2.0
```
%% Output
$\mathit{FALSE}$
FALSE
%% Cell type:markdown id:9066aa50 tags:
You can control whether to allow arithmetic operators for reals
in ProB via the preference ```ALLOW_REALS```.
By default reals are allowed for classical B and disallowed for Event-B.
The only disadvantage of allowing reals is that the arithmetic operators
are overloaded, which may require stronger typing.
E.g., without ```x:INT``` you get an error that the type of x and y cannot be inferred, when reals are allowed:
%% Cell type:code id:528e647d tags:
``` prob
x:INT & x < y
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{x} = -1$
* $\mathit{y} = 0$
TRUE
Solution:
x = −1
y = 0
%% Cell type:markdown id:02b86510 tags:
### Constraint solving
Constraint solving and enumeration is very limited in ProB.
This will change in future.
Currently ProB will enumerate a few random values for unspecified reals,
and then stop with an enumeration warning.
%% Cell type:code id:9356ea2c tags:
``` prob
x:REAL
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{x} = 0.0$
TRUE
Solution:
x = 0.0
%% Cell type:code id:b6d8671d tags:
``` prob
x + 1.0 = 2.0
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{x} = 1.0$
TRUE
Solution:
x = 1.0
%% Cell type:markdown id:13388af0 tags:
### Other Operators
The standard library ```LibraryReals.def``` provides many functions
over reals as external functions.
These functions typically start with a capital R.
The functions are available in the REPL (aka console) but
one needs to import ```LibraryReals.def``` to use them in a B machine.
%% Cell type:code id:df6d2cd0 tags:
``` prob
RSQRT(2.0)
```
%% Output
$1.4142135623730951$
1.4142135623730951
%% Cell type:code id:d2daab50 tags:
``` prob
RSIN(RPI)
```
%% Output
$1.2246467991473532E-16$
1.2246467991473532E-16
%% Cell type:code id:481e4f68 tags:
``` prob
r=RPOW(RSIN(x),2.0)+RPOW(RCOS(x),2.0) & x=0.5
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{r} = 1.0$
* $\mathit{x} = 0.5$
TRUE
Solution:
r = 1.0
x = 0.5
%% Cell type:code id:bfd74a24 tags:
``` prob
r=RPOW(RSIN(x),2.0)+RPOW(RCOS(x),2.0) & x=10.5
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{r} = 1.0$
* $\mathit{x} = 10.5$
TRUE
Solution:
r = 1.0
x = 10.5
%% Cell type:code id:34ca2773 tags:
``` prob
REULER
```
%% Output
$2.718281828459045$
2.718281828459045
%% Cell type:code id:4b24407f tags:
``` prob
RSIGN(-2.2)
```
%% Output
$-1.0$
−1.0
%% Cell type:code id:ec855071 tags:
``` prob
RABS(-2.2)
```
%% Output
$2.2$
2.2
%% Cell type:code id:c0bf9060 tags:
``` prob
RLOG(2.0,1024.0)
```
%% Output
$10.0$
10.0
%% Cell type:code id:152d2052 tags:
``` prob
RLOGe(REULER)
```
%% Output
$1.0$
1.0
%% Cell type:code id:0a81f12f tags:
``` prob
RMAX(1.4,RSQRT(2.0))
```
%% Output
$1.4142135623730951$
1.4142135623730951
%% Cell type:code id:4669fcd2 tags:
``` prob
RONE+RZERO
```
%% Output
$1.0$
1.0
%% Cell type:markdown id:8df6222b tags:
There are also external functions which are equivalent to the arithmetic operators: RLEQ, RGEQ, RLT, RGT, ROUND, RINTEGER, RADD, RSUB, RMUL, RDIV.
This can be useful in some cases (e.g., when ALLOW_REALS is false or when mapping Event-B operators to classical B, see below).
%% Cell type:markdown id:cc7e1768 tags:
## Event-B Theories
Event-B does not have support for reals or floats as basic type but one can use the theory plugin.
[https://prob.hhu.de/w/index.php?title=Event-B_Theories]
To be able to view reals in ProB within Rodin you need to install a recent nightly build: [https://www3.hhu.de/stups/rodin/prob1/nightly]
To be able to view reals in ProB within Rodin you need to install a recent nightly build: [https://stups.hhu-hosting.de/rodin/prob1/nightly]
You need to use one of the standard theories.
To write your own theory you should add an axiomatic type called REAL, FLOAT or the unicode R for reals.
Then you have to define axiomatic operators and link them to ProB's real operators.
You can do this either
* using a theory mapping file (.ptm extension) which needs to be put into the Rodin project, see [https://prob.hhu.de/w/index.php?title=Event-B_Theories]
* or use the same name as the external functions above (e.g., RSQRT); in this way ProB will do the mapping automatically.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment