rbool 0.0.4
1D boolean operations
Requires Python: <4.0,>=3.7

[![Documentation Status][docs-img]][docs-url]
[![Build Status][build-img]][build-url]
[![Lint with Black][lintblack-img]][lintblack-url]
[![Code Coverage][coverage-img]][coverage-url]

[![PyPI Version][pypi-img]][pypi-url]
[![Python Versions][pyversions-img]][pyversions-url]
[![License: MIT][license-img]][license-url]

# Unibool

A python package for unidimensional boolean operations

#### Simple example

```python
>>> from rbool import *
>>> interval = Interval(-10, 5)  # Create a closed interval
>>> interval
[-10, 5]
>>> interval | (3, 8)  # Unite with open interval
[-10, 8)
>>> ~interval  # Complementar of the interval
(-inf, 10) U (5, inf)
>>> interval |= {-2, 6, 10}  # Unite with single values
>>> interval
[-10, 5] U {6, 10}
>>> interval - {2, 3}  # Remove single values from interval
[-10, 2) U (2, 3) U (3, 5] U {6, 10}
>>> [-8, 3] in interval  # Checks if [-8, 3] is inside the interval
True
```

The usual operations happens between two subsets:
* `A | B`: union
* `A & B`: intersection
* `~A`: complementar
* `A ^ B`: XOR
* `A - B`: subtract
* `A in B`: is subset ?

#### Useful functions

```python
>>> minimum("[-3, 10]")  # Gets the minimum value from subset
-3
>>> minimum("(-3, 10]")  # Returns None, there's no minimum
>>> infimum("(-3, 10]")  # Gets the infimum value from subset
-3
>>> maximum("(-3, 10]")  # Gets the maximum value
10
>>> supremum("(-3, 10]")
10
>>> lower(5)  # All values on real line less than 5
(-inf, 5]
>>> {-15, 0} in lower(5)  # -15 and 0 are inside (-inf, 5] ?
True
>>> [-3, 6] in bigger(5)  # interval [-3, 6] is inside [5, inf) ?
False
>>> scale("[-3, 10) U {15}", 2)  # Maps each value 'x' to '2*x'
[-6, 20) U {30}
>>> move("[-3, 10) U {15}", -8)  # Maps each value 'x' to 'x - 8'
[-8, 2) U {7}
```


### Installation:

This library is available in [PyPI][pypi-url]. To install it

```
$ pip install rbool
```

For more details, refer to the [documentation][docs-url]

### Documentation

The documentation can be found at [rbool.readthedocs.io][docs-url]


### Contribute

Please use the [Issues][issues-url] or refer to the email ```compmecgit@gmail.com```

<!-- Badges: -->

[lintblack-img]: https://github.com/compmec/rbool/actions/workflows/black.yaml/badge.svg
[lintblack-url]: https://github.com/compmec/rbool/actions/workflows/black.yaml
[docs-img]: https://readthedocs.org/projects/rbool/badge/?version=latest
[docs-url]: https://rbool.readthedocs.io/en/latest/?badge=latest
[pypi-img]: https://img.shields.io/pypi/v/rbool
[pypi-url]: https://pypi.org/project/rbool/
[build-img]: https://github.com/compmec/rbool/actions/workflows/build.yaml/badge.svg
[build-url]: https://github.com/compmec/rbool/actions/workflows/build.yaml
[coverage-img]: https://codecov.io/gh/compmec/rbool/branch/main/graph/badge.svg?token=vfGMPe9W3I
[coverage-url]: https://codecov.io/gh/compmec/rbool
[pyversions-img]: https://img.shields.io/pypi/pyversions/rbool.svg?style=flat-square
[pyversions-url]: https://pypi.org/project/rbool/
[license-img]: https://img.shields.io/pypi/l/ansicolortags.svg
[license-url]: https://github.com/compmec/rbool/blob/main/LICENSE.md
[pypi-url]: https://pypi.org/project/rbool/
[issues-url]: https://github.com/compmec/rbool/issues