plusMinus

Bx Examples Repository

Title: plusMinus

Version: 0.1

Type: Precise

Overview

Many bx involve abstracting away information, and intuitively, bx which violate “least change” can arise when a small change in a concrete space results in a large change in an abstract space. This example illustrates, and a variant can show the importance of discreteness.

Models

$M$ is the interval $[-1,+1] \subseteq \mathbb R$

$N = \{+, -\}$

Consistency

We say $m\in M$ is consistent with $+$ if $m \ge 0$, and consistent with $-$ if $m \le 0$.

That is, the bx relates a real number with a record of whether it is (weakly) positive or negative.

Consistency Restoration

$\overrightarrow{R}(m,n)$ has no choice if we want correctness and hippocraticness. It returns $+$ if $m > 0$, $-$ if $m < 0$, and $n$ if $m=0$.

$\overleftarrow{R}(m,n)$ has no choice but to return $m$ if $R(m,n)$ already holds and we want hippocraticness. Otherwise, return 0 (which is consistent with any $n$ and will involve the least change, by the usual metric).

Properties

Correct and hippocratic. Metric-least, according to the usual metric on $\mathbb R$.

Variants

  1. We change the consistency condition so that $m\in M$ is consistent with $+$ if $m \ge 0$, and consistent with $-$ if $m < 0$ (strictly). This gives a problem in deciding what the result of $\overleftarrow{R}(m,-)$ should be when $m>0$, because 0 is no longer a correct result, and for any value returned, a “better” one could be found. Observing that this is the result of the model space being non-discrete, we may also consider a second variant:
  2. we replace $M$ by a discrete set, say $\{x/100 : x\in \mathbb Z, -100 \le x \le 100 \}$.

Discussion

In the main setting, the consistency restoration described seems unambiguously best from a least change point of view - at least given the usual understanding of distance in $\mathbb R$. If the user, for example, viewed -3 as a smaller change from 3 than 8 is (e.g., using a product metric on the separate elements, the sign and the magnitude of the number), we would have to make a different choice. This illustrates the way that "the least change consistency restoration" crucially depends on the notion of change, which may vary from user to user, e.g., depending on which tool they use to edit within a given model space.

A very minor change to the consistency condition removes the obvious solution. Restricting to discrete model spaces restores it.

References

This is Example 4.3 from

@inproceedings{cheney15:bx,
author = {James Cheney and Jeremy Gibbons and James McKinna and Perdita Stevens},
title = {Towards a Principle of Least Surprise for Bidirectional Transformations},
booktitle = {Proceedings of {Bx} 2015},
year = 2015,
ee = {http://ceur-ws.org/Vol-1396/p66-cheney.pdf},
publisher = {CEUR-WS.org},
series = {CEUR Workshop Proceedings},
volume = 1396
}

Author(s)

Perdita Stevens

Reviewer(s)

Comments

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.