diff options
Diffstat (limited to '')
39 files changed, 689 insertions, 0 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..601075b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3/.devcontainer/base.Dockerfile + +# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster +ARG VARIANT="3.10-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +RUN pip3 --disable-pip-version-check --no-cache-dir install -U pip pre-commit + +# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. +COPY .devcontainer/requirements.txt /tmp/pip-tmp/ +RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ + && rm -rf /tmp/pip-tmp + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends <your-package-list-here> + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 + +COPY .devcontainer/act4e-check /usr/local/bin +RUN chmod +x /usr/local/bin/act4e-check + + +# COPY src src +# COPY setup.py . + +# RUN python3 -m pip install -e . + diff --git a/.devcontainer/act4e-check b/.devcontainer/act4e-check new file mode 100644 index 0000000..d4fd9e7 --- /dev/null +++ b/.devcontainer/act4e-check @@ -0,0 +1,16 @@ +#!/bin/bash +set -eux +if [ $# -eq 0 ] + then + act4e-test --collections act4e_checks --module act4e_solutions +else +if [ $# -eq 1 ] + then + act4e-test --collections act4e_checks --module act4e_solutions --group $1 +else + echo "Need to pass either 0 or 1 argument" + exit 3 +fi +fi + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c3fc20e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3 +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local on arm64/Apple Silicon. + "VARIANT": "3.10-bullseye", + // Options + "NODE_VERSION": "none" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "tht13.html-preview-vscode", + // "ms-python.vscode-pylance" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "git": "os-provided", + "git-lfs": "latest" + } +} diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt new file mode 100644 index 0000000..28fee9e --- /dev/null +++ b/.devcontainer/requirements.txt @@ -0,0 +1,2 @@ +ACT4E-exercises +pre-commit
\ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a5bb0b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__ +*.pyc +*.egg-info +.DS_Store +.python-version +.vscode/*log +.out-results/*html
\ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f4adb4c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +--- +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks +# - id: trailing-whitespace +# - id: end-of-file-fixer +# - id: check-yaml +# - id: check-json +# - id: check-docstring-first +# - id: flake8 +# args: [--max-line-length=100] +- repo: https://github.com/psf/black + rev: 22.1.0 + hooks: + - id: black + args: [-l, '110'] +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.1.0 # or specific tag + hooks: + - id: yamlfmt + args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150', --preserve-quotes] +files: (^src/.*py)|(.*yaml) diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..d13ca13 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,7 @@ +[MASTER] +disable= + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring + C0103, # pylint complains about the TypeVar names https://github.com/PyCQA/pylint/issues/3324 + R0903, # too few public methods
\ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a77d3ce --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.exclude": { + "**/__pycache__": true, + "**/*.egg-info": true + } +}
\ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e131248 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# ARG DOCKER_REGISTRY=docker.io +# FROM ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel + +FROM python:3.10 +RUN python3 -m pip install -U pip -v +WORKDIR /ACT4E + +RUN uname -a +COPY .devcontainer/requirements.txt . +RUN python3 -m pip install -r requirements.txt + +COPY src src +COPY setup.py . + +RUN python3 -m pip install -e . + diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..4e280e6 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,19 @@ +#@ These are autogenerated. Add local stuff in the next section. + +include setup.json +exclude project.pp1.yaml +exclude Makefile* +exclude Dockerfile* +exclude *.mk +exclude requirements*txt +exclude MANIFEST.in +exclude README* +exclude LICENSE* +prune .* +exclude .* +exclude src/conf.py +prune src/**/__pycache__ +prune src/*_tests* +prune out + +#@ add local below diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9c80517 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +all: + +tag=act4e-image + +build: + docker build -f .devcontainer/Dockerfile --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . + +docker-check: build + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ + act4e-test --collections act4e_checks --module act4e_solutions + + +docker-check-%: build + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ + act4e-test --collections act4e_checks --module act4e_solutions --group $* + +# check: +# act4e-test --collections act4e_checks --module act4e_solutions + +# check-%: +# act4e-test --collections act4e_checks --module act4e_solutions --group $*
\ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c24aaf4 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +## Setup + +### Install Docker + +<ul> + <li> (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/) </li> + <li>(Windows): + <ul> + <li>Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. On step 6, you can download Ubuntu 18.04 LTS. You do not necessarily need to install Windows Terminal. </li> + <li>Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide.</li> + </ul> + </li> + </ul> + +### Install VS Code. + +Select File -> Open and select *the entire folder*. + +VS Code will propose to install "Dev Container". Click "install". + +VS Code will give you a message similar to: + +> Folder contains a Dev Container configuration file. Reopen folder to develop in a container. + +Select "Reopen in container". + +Now you should have the folder open while VS Code is in "container development mode". + +Create a new terminal using Terminal -> New Terminal. + +Run the following: + + act4e-check TestSimpleIntro + +This will have created a file `out-results/result-TestSimpleIntro.html`. + +From the file tree to the left, right-click the file and select "open preview". You will see the results of the testing. + +Now browse the Python files in `src/`. Verify that autocompletion works.. + + + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e20c8f1 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +from setuptools import find_packages, setup + +setup( +name='ACT4E-MySolutions', +version="0.1", +package_dir={'': 'src'}, +packages=find_packages('src'), +entry_points={}, +extras_require={}, +install_requires=['ACT4E-exercises'], +) diff --git a/src/act4e_solutions/__init__.py b/src/act4e_solutions/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/act4e_solutions/__init__.py diff --git a/src/act4e_solutions/intro.py b/src/act4e_solutions/intro.py new file mode 100644 index 0000000..2a4856d --- /dev/null +++ b/src/act4e_solutions/intro.py @@ -0,0 +1,6 @@ +import act4e_interfaces as I + + +class SolSimpleIntro(I.SimpleIntro): + def sum(self, a: int, b: int) -> int: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py new file mode 100644 index 0000000..aff881f --- /dev/null +++ b/src/act4e_solutions/maps.py @@ -0,0 +1,16 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +C = TypeVar("C") + + +class SolFiniteMapOperations(I.FiniteMapOperations): + + def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: + raise NotImplementedError() + + def compose(self, f: I.FiniteMap[A, B], g: I.FiniteMap[B, C]) -> I.FiniteMap[A, C]: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py new file mode 100644 index 0000000..f532658 --- /dev/null +++ b/src/act4e_solutions/maps_representation.py @@ -0,0 +1,14 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") + + +class SolFiniteMapRepresentation(I.FiniteMapRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMap[Any, Any]) -> I.FiniteMap_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets.py b/src/act4e_solutions/posets.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/act4e_solutions/posets.py diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py new file mode 100644 index 0000000..e1f9d26 --- /dev/null +++ b/src/act4e_solutions/posets_bounds.py @@ -0,0 +1,64 @@ +from typing import Any, List, Optional, overload, TypeVar + +import act4e_interfaces as I + +E = TypeVar("E") +X = TypeVar("X") + +class SolFinitePosetMeasurement(I.FinitePosetMeasurement): + def height(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + def width(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + +class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): + def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: + raise NotImplementedError() # implement here + + +class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): + def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_antichain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class SolFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): + def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_upper_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class SolFinitePosetClosures(I.FinitePosetClosures): + def upper_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + def lower_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + +class SolFinitePosetInfSup(I.FinitePosetInfSup): + def lower_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def upper_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def infimum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + def supremum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + +class SolFinitePosetMinMax(I.FinitePosetMinMax): + def minimal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() + + def maximal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py new file mode 100644 index 0000000..ae24f75 --- /dev/null +++ b/src/act4e_solutions/posets_construction.py @@ -0,0 +1,10 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFinitePosetConstructionPower(I.FinitePosetConstructionPower): + def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py new file mode 100644 index 0000000..6047217 --- /dev/null +++ b/src/act4e_solutions/posets_interval.py @@ -0,0 +1,17 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") +E = TypeVar("E") +X = TypeVar("X") + + +class SolFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): + def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + raise NotImplementedError() + + +class SolFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): + def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/posets_map.py b/src/act4e_solutions/posets_map.py new file mode 100644 index 0000000..a91d4d8 --- /dev/null +++ b/src/act4e_solutions/posets_map.py @@ -0,0 +1,15 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class SolFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): + def is_monotone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() + + def is_antitone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_monoidal.py b/src/act4e_solutions/posets_monoidal.py new file mode 100644 index 0000000..96afedc --- /dev/null +++ b/src/act4e_solutions/posets_monoidal.py @@ -0,0 +1,12 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class SolMonoidalPosetOperations(I.MonoidalPosetOperations): + def is_monoidal_poset(self, fp: I.FinitePoset[X], fm: I.FiniteMonoid[X]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py new file mode 100644 index 0000000..bf67efd --- /dev/null +++ b/src/act4e_solutions/posets_product.py @@ -0,0 +1,10 @@ +from typing import Any, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): + def product(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetProduct[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py new file mode 100644 index 0000000..c43da82 --- /dev/null +++ b/src/act4e_solutions/posets_representation.py @@ -0,0 +1,11 @@ +from typing import Any + +import act4e_interfaces as I + + +class SolFinitePosetRepresentation(I.FinitePosetRepresentation): + def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, p: I.FinitePoset[Any]) -> I.FinitePoset_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py new file mode 100644 index 0000000..a797a14 --- /dev/null +++ b/src/act4e_solutions/posets_sum.py @@ -0,0 +1,11 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFinitePosetConstructionSum(I.FinitePosetConstructionSum): + def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: + raise NotImplementedError() # implement here + diff --git a/src/act4e_solutions/py.typed b/src/act4e_solutions/py.typed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/act4e_solutions/py.typed diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py new file mode 100644 index 0000000..26f90a7 --- /dev/null +++ b/src/act4e_solutions/relations.py @@ -0,0 +1,64 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I +from act4e_interfaces import FiniteRelation + +E1 = TypeVar("E1") +E2 = TypeVar("E2") +E3 = TypeVar("E3") +E = TypeVar("E") + +A = TypeVar("A") +B = TypeVar("B") + + +class SolFiniteRelationProperties(I.FiniteRelationProperties): + def is_surjective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_defined_everywhere(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_injective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_single_valued(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class SolFiniteRelationOperations(I.FiniteRelationOperations): + def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: + raise NotImplementedError() + + def as_relation(self, f: I.FiniteMap[A, B]) -> I.FiniteRelation[A, B]: + raise NotImplementedError() + + +class SolFiniteEndorelationProperties(I.FiniteEndorelationProperties): + def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_irreflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_transitive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_symmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_antisymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_asymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class SolFiniteEndorelationOperations(I.FiniteEndorelationOperations): + def transitive_closure(self, fr: I.FiniteRelation[E, E]) -> I.FiniteRelation[E, E]: + raise NotImplementedError() + + +class SolFiniteRelationCompose(I.FiniteRelationCompose): + def compose(self, fr1: FiniteRelation[E1, E2], fr2: FiniteRelation[E2, E3]) -> I.FiniteRelation[E1, E3]: + raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py new file mode 100644 index 0000000..69ccdf0 --- /dev/null +++ b/src/act4e_solutions/relations_representation.py @@ -0,0 +1,14 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") + + +class SolFiniteRelationRepresentation(I.FiniteRelationRepresentation): + def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteRelation[A, B]) -> I.FiniteRelation_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups.py b/src/act4e_solutions/semigroups.py new file mode 100644 index 0000000..1b02766 --- /dev/null +++ b/src/act4e_solutions/semigroups.py @@ -0,0 +1,10 @@ +from typing import List, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") + + +class SolFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): + def free(self, fs: I.FiniteSet[C]) -> I.FreeSemigroup[C, List[C]]: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_morphisms_representation.py b/src/act4e_solutions/semigroups_morphisms_representation.py new file mode 100644 index 0000000..43df89f --- /dev/null +++ b/src/act4e_solutions/semigroups_morphisms_representation.py @@ -0,0 +1,27 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + + +class SolFiniteSemigroupMorphismRepresentation(I.FiniteSemigroupMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteSemigroupMorphism_desc) -> I.FiniteSemigroupMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteSemigroupMorphism[Any, Any]) -> I.FiniteSemigroupMorphism_desc: + raise NotImplementedError() + + +class SolFiniteMonoidMorphismRepresentation(I.FiniteMonoidMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMonoidMorphism_desc) -> I.FiniteMonoidMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMonoidMorphism[Any, Any]) -> I.FiniteMonoidMorphism_desc: + raise NotImplementedError() + + +class SolFiniteGroupMorphismRepresentation(I.FiniteGroupMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteGroupMorphism_desc) -> I.FiniteGroupMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteGroupMorphism[Any, Any]) -> I.FiniteGroupMorphism_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py new file mode 100644 index 0000000..4d75708 --- /dev/null +++ b/src/act4e_solutions/semigroups_representation.py @@ -0,0 +1,29 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteSemigroup[Any]) -> I.FiniteSemigroup_desc: + raise NotImplementedError() + + +class SolFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMonoid_desc) -> I.FiniteMonoid[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMonoid[Any]) -> I.FiniteMonoid_desc: + raise NotImplementedError() + + +class SolFiniteGroupRepresentation(I.FiniteGroupRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteGroup_desc) -> I.FiniteGroup[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteGroup[Any]) -> I.FiniteGroup_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets.py b/src/act4e_solutions/sets.py new file mode 100644 index 0000000..1dc635f --- /dev/null +++ b/src/act4e_solutions/sets.py @@ -0,0 +1,14 @@ +from typing import Callable, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolEnumerableSetsOperations(I.EnumerableSetsOperations): + def make_set_sequence(self, f: Callable[[int], X]) -> I.EnumerableSet[X]: + raise NotImplementedError() + + def union_esets(self, a: I.EnumerableSet[X], b: I.EnumerableSet[X]) -> I.EnumerableSet[X]: + """Creates the union of two EnumerableSet.""" + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py new file mode 100644 index 0000000..49b4b7b --- /dev/null +++ b/src/act4e_solutions/sets_power.py @@ -0,0 +1,11 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteMakePowerSet(I.FiniteMakePowerSet): + def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: + raise NotImplementedError() # implement here + diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py new file mode 100644 index 0000000..bdba104 --- /dev/null +++ b/src/act4e_solutions/sets_product.py @@ -0,0 +1,11 @@ +from typing import Any, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteMakeSetProduct(I.FiniteMakeSetProduct): + + def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py new file mode 100644 index 0000000..5390d23 --- /dev/null +++ b/src/act4e_solutions/sets_properties.py @@ -0,0 +1,20 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteSetProperties(I.FiniteSetProperties): + def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: + raise NotImplementedError() + + +class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion): + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + raise NotImplementedError() # implement here + + +class SolFiniteMakeSetIntersection(I.FiniteMakeSetIntersection): + def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py new file mode 100644 index 0000000..7f3e818 --- /dev/null +++ b/src/act4e_solutions/sets_representation.py @@ -0,0 +1,11 @@ +from typing import Any + +import act4e_interfaces as I + + +class SolFiniteSetRepresentation(I.FiniteSetRepresentation): + def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteSet[Any]) -> I.FiniteSet_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py new file mode 100644 index 0000000..eab93d3 --- /dev/null +++ b/src/act4e_solutions/sets_sum.py @@ -0,0 +1,10 @@ +from typing import Any, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteMakeSetDisjointUnion(I.FiniteMakeSetDisjointUnion): + def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py new file mode 100644 index 0000000..e70b2a9 --- /dev/null +++ b/src/act4e_solutions/sets_union_inter.py @@ -0,0 +1,21 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion): + + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + raise NotImplementedError() # implement here + + +class SolSetoidOperations(I.SetoidOperations): + @classmethod + def union_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() + + @classmethod + def intersection_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() |