combinatory-synthesizer 0.0.1.dev2__tar.gz → 0.0.1.dev24__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/benchmarks.yml +12 -18
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/build-nightly.yml +7 -2
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/check-docs.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/checks.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/deploy-docs.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/pr-rules-develop.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/pr-rules-main.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/pre-release.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/workflows/release.yml +1 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/PKG-INFO +14 -6
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/README.md +10 -2
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/benchmarks/test_benchmark_maximal_elements.py +2 -1
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/benchmarks/test_benchmark_maze.py +8 -9
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/benchmarks/test_benchmark_maze_contains.py +8 -9
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/benchmarks/test_benchmark_maze_loopfree.py +9 -10
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/features/constraints.md +4 -4
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/quick-start.md +3 -3
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/examples/example_constraints.py +12 -9
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/examples/example_constraints_inline.py +12 -9
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/examples/example_fibonacci.py +10 -8
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/examples/example_fibonacci_linear.py +10 -7
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/pyproject.toml +9 -3
- combinatory_synthesizer-0.0.1.dev24/src/cosy/_version.py +24 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/core/__init__.py +17 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/inspector.py +2 -2
- combinatory_synthesizer-0.0.1.dev24/src/cosy/core/solution_space.py +696 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/specification_builder.py +3 -3
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/subtypes.py +38 -7
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/synthesizer.py +16 -14
- combinatory_synthesizer-0.0.1.dev24/src/cosy/extensions/__init__.py +6 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/extensions/solutions.py +52 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/extensions/visualization/collapsible_tree.html +45 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/extensions/visualization/script.js +480 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/extensions/visualize.py +211 -0
- combinatory_synthesizer-0.0.1.dev24/src/cosy/maestro/__init__.py +5 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/maestro}/maestro.py +12 -8
- combinatory_synthesizer-0.0.1.dev24/src/cosy/py.typed +0 -0
- combinatory_synthesizer-0.0.1.dev24/tests/__init__.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_combinatorics.py +14 -13
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_contains_tree.py +5 -4
- combinatory_synthesizer-0.0.1.dev24/tests/test_enumerate_artificial_solution_space.py +56 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_group_underspecification.py +6 -4
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_infinite_enumeration.py +6 -5
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_intersect_arguments.py +12 -4
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_literal_candidates.py +32 -3
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_literal_inference.py +5 -4
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/tests/test_no_prune.py +3 -2
- combinatory_synthesizer-0.0.1.dev24/tests/test_overlapping_substitution_inference.py +93 -0
- combinatory_synthesizer-0.0.1.dev2/src/cosy/__init__.py +0 -19
- combinatory_synthesizer-0.0.1.dev2/src/cosy/_version.py +0 -34
- combinatory_synthesizer-0.0.1.dev2/src/cosy/solution_space.py +0 -365
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.github/dependabot.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/.gitignore +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/CITATION.cff +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/LICENSE.txt +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/benchmarks/__init__.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/.overrides/partials/copyright.html +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/about/authors.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/assets/badges/mypy.json +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/assets/images/logo.svg +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/bibliographies/applications.bib +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/bibliographies/theory.bib +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/examples/introduction.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/features/advanced.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/guidelines/best-practice.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/guidelines/troubleshoot.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/index.md +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/stylesheets/extra.css +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/hatch.toml +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/mkdocs.yml +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/scripts/gen_example_pages.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/scripts/gen_reference_pages.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2/tests → combinatory_synthesizer-0.0.1.dev24/src/cosy}/__init__.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/combinatorics.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/py.typed +0 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/tree.py +0 -0
- {combinatory_synthesizer-0.0.1.dev2/src/cosy → combinatory_synthesizer-0.0.1.dev24/src/cosy/core}/types.py +0 -0
|
@@ -5,7 +5,7 @@ on:
|
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
7
|
- develop
|
|
8
|
-
|
|
8
|
+
pull_request_target:
|
|
9
9
|
branches:
|
|
10
10
|
- main
|
|
11
11
|
- develop
|
|
@@ -34,19 +34,17 @@ jobs:
|
|
|
34
34
|
private-key: ${{ secrets.TUDO_SEAL_WORKFLOW_PRIVATE_KEY }}
|
|
35
35
|
repositories: |
|
|
36
36
|
cosy
|
|
37
|
-
cosy-benchmarks
|
|
37
|
+
cosy-benchmarks
|
|
38
38
|
|
|
39
|
-
- uses: actions/checkout@
|
|
39
|
+
- uses: actions/checkout@v6
|
|
40
40
|
with:
|
|
41
41
|
repository: tudo-seal/cosy-benchmarks
|
|
42
|
-
token: ${{ steps.tudo-seal-workflow-token.outputs.token }}
|
|
43
42
|
ref: 'gh-pages'
|
|
44
43
|
|
|
45
|
-
- uses: actions/checkout@
|
|
44
|
+
- uses: actions/checkout@v6
|
|
46
45
|
with:
|
|
47
46
|
# Full history for timestamps
|
|
48
47
|
fetch-depth: 0
|
|
49
|
-
token: ${{ steps.tudo-seal-workflow-token.outputs.token }}
|
|
50
48
|
path: 'cosy-nested'
|
|
51
49
|
|
|
52
50
|
- name: Set up Python
|
|
@@ -57,21 +55,17 @@ jobs:
|
|
|
57
55
|
- name: Install Hatch
|
|
58
56
|
uses: pypa/hatch@install
|
|
59
57
|
|
|
58
|
+
- name: Fetch PR branch from fork
|
|
59
|
+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
|
|
60
|
+
run: gh pr checkout ${{ github.event.number }}
|
|
61
|
+
env:
|
|
62
|
+
GH_TOKEN: ${{ steps.tudo-seal-workflow-token.outputs.token }}
|
|
63
|
+
working-directory: 'cosy-nested'
|
|
64
|
+
|
|
60
65
|
- name: Run Benchmark Suite
|
|
61
66
|
run: hatch test benchmarks --benchmark-json benchmarks.json
|
|
62
67
|
working-directory: 'cosy-nested'
|
|
63
68
|
|
|
64
|
-
- name: Config Git
|
|
65
|
-
run: |
|
|
66
|
-
git config user.name "tudo-seal-workflows[bot]"
|
|
67
|
-
git config user.email "244727884+tudo-seal-workflows[bot]@users.noreply.github.com"
|
|
68
|
-
|
|
69
|
-
- name: Determine Push Or Not
|
|
70
|
-
if: github.event_name != 'pull_request'
|
|
71
|
-
run: |
|
|
72
|
-
echo "PUSH_TO_BENCHMARKS=true" >> $GITHUB_ENV
|
|
73
|
-
echo "COMMENT_ALWAYS=false" >> $GITHUB_ENV
|
|
74
|
-
|
|
75
69
|
- name: Store Benchmark Result
|
|
76
70
|
uses: benchmark-action/github-action-benchmark@v1
|
|
77
71
|
with:
|
|
@@ -86,4 +80,4 @@ jobs:
|
|
|
86
80
|
comment-always: ${{ env.COMMENT_ALWAYS }}
|
|
87
81
|
summary-always: true
|
|
88
82
|
gh-repository: 'github.com/tudo-seal/cosy-benchmarks'
|
|
89
|
-
benchmark-data-dir-path: '${{ env.BRANCH_NAME }}/benchmarks'
|
|
83
|
+
benchmark-data-dir-path: '${{ env.BRANCH_NAME }}/benchmarks'
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
app-id: ${{ secrets.TUDO_SEAL_WORKFLOW_CLIENT_ID }}
|
|
19
19
|
private-key: ${{ secrets.TUDO_SEAL_WORKFLOW_PRIVATE_KEY }}
|
|
20
20
|
|
|
21
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
22
|
with:
|
|
23
23
|
# Full history for timestamps
|
|
24
24
|
fetch-depth: 0
|
|
@@ -43,6 +43,10 @@ jobs:
|
|
|
43
43
|
- name: Build Package
|
|
44
44
|
run: hatch build
|
|
45
45
|
|
|
46
|
+
- name: Stable Url
|
|
47
|
+
run: |
|
|
48
|
+
cp dist/combinatory_synthesizer-${{ env.NIGHTLY_VERSION }}.tar.gz dist/combinatory_synthesizer-nightly.tar.gz
|
|
49
|
+
|
|
46
50
|
- name: Convert nightly to draft
|
|
47
51
|
run: gh release edit --draft "${{ env.nightly_tag }}" || true
|
|
48
52
|
env:
|
|
@@ -75,4 +79,5 @@ jobs:
|
|
|
75
79
|
GH_TOKEN: ${{ steps.tudo-seal-workflow-token.outputs.token }}
|
|
76
80
|
ARTIFACTS: >
|
|
77
81
|
dist/combinatory_synthesizer-${{ env.NIGHTLY_VERSION }}.tar.gz
|
|
78
|
-
dist/combinatory_synthesizer
|
|
82
|
+
dist/combinatory_synthesizer-nightly.tar.gz
|
|
83
|
+
dist/combinatory_synthesizer-${{ env.NIGHTLY_VERSION }}-py3-none-any.whl
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: combinatory-synthesizer
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev24
|
|
4
4
|
Summary: Type based synthesis framework using inhabitation in FCLP
|
|
5
|
-
Project-URL: Documentation, https://github.
|
|
6
|
-
Project-URL: Issues, https://github.com/
|
|
7
|
-
Project-URL: Source, https://github.com/
|
|
5
|
+
Project-URL: Documentation, https://tudo-seal.github.io/cosy/
|
|
6
|
+
Project-URL: Issues, https://github.com/tudo-seal/cosy/issues
|
|
7
|
+
Project-URL: Source, https://github.com/tudo-seal/cosy
|
|
8
8
|
Author-email: Constantin Chaumet <constantin.chaumet@tu-dortmund.de>, Andrej Dudenhefner <andrej.dudenhefner@cs.tu-dortmund.de>, Felix Laarmann <felix.laarmann@tu-dortmund.de>, Christoph Stahl <christoph.stahl@tu-dortmund.de>
|
|
9
9
|
License-Expression: Apache-2.0
|
|
10
10
|
License-File: LICENSE.txt
|
|
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml) |
|
|
32
32
|
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml) |
|
|
33
33
|
| Coverage | [](https://codecov.io/github/tudo-seal/cosy) |
|
|
34
|
-
| Traits | [](https://hatch.pypa.io/latest/) [](https://hatch.pypa.io/latest/) [](http://mypy-lang.org/) [](https://github.com/astral-sh/ruff) |
|
|
35
35
|
|
|
36
36
|
</div>
|
|
37
37
|
|
|
@@ -69,7 +69,15 @@ Examples currently all employ the `Maestro`.
|
|
|
69
69
|
Installation is as simple as running:
|
|
70
70
|
|
|
71
71
|
```console
|
|
72
|
-
pip install combinatory-synthesizer
|
|
72
|
+
pip install --pre combinatory-synthesizer
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Since `CoSy` is still in pre-release state, `PyPi` distributions are likely to be outdated most of the time.
|
|
76
|
+
|
|
77
|
+
If you want to stay up to date with a nightly build:
|
|
78
|
+
|
|
79
|
+
```console
|
|
80
|
+
pip install https://github.com/tudo-seal/cosy/releases/download/nightly/combinatory_synthesizer-nightly.tar.gz
|
|
73
81
|
```
|
|
74
82
|
|
|
75
83
|
`CoSy` itself has no dependencies at all, so it will play nice with any pre-existing projects.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
| Package | [](https://github.com/tudo-seal/cosy/actions/workflows/checks.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/release.yml) |
|
|
12
12
|
| Docs | [](https://github.com/tudo-seal/cosy/actions/workflows/check-docs.yml) [](https://github.com/tudo-seal/cosy/actions/workflows/deploy-docs.yml) |
|
|
13
13
|
| Coverage | [](https://codecov.io/github/tudo-seal/cosy) |
|
|
14
|
-
| Traits | [](https://hatch.pypa.io/latest/) [](https://hatch.pypa.io/latest/) [](http://mypy-lang.org/) [](https://github.com/astral-sh/ruff) |
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
@@ -49,7 +49,15 @@ Examples currently all employ the `Maestro`.
|
|
|
49
49
|
Installation is as simple as running:
|
|
50
50
|
|
|
51
51
|
```console
|
|
52
|
-
pip install combinatory-synthesizer
|
|
52
|
+
pip install --pre combinatory-synthesizer
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Since `CoSy` is still in pre-release state, `PyPi` distributions are likely to be outdated most of the time.
|
|
56
|
+
|
|
57
|
+
If you want to stay up to date with a nightly build:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
pip install https://github.com/tudo-seal/cosy/releases/download/nightly/combinatory_synthesizer-nightly.tar.gz
|
|
53
61
|
```
|
|
54
62
|
|
|
55
63
|
`CoSy` itself has no dependencies at all, so it will play nice with any pre-existing projects.
|
|
@@ -2,9 +2,10 @@ from collections.abc import Callable, Mapping
|
|
|
2
2
|
from itertools import product
|
|
3
3
|
|
|
4
4
|
import pytest
|
|
5
|
-
|
|
6
|
-
from cosy.
|
|
7
|
-
from cosy.
|
|
5
|
+
|
|
6
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
7
|
+
from cosy.core.synthesizer import Specification, Synthesizer
|
|
8
|
+
from cosy.core.types import Constructor, DataGroup, Literal, Type, Var
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
@@ -16,12 +17,10 @@ def is_free(pos: tuple[int, int]) -> bool:
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
@pytest.fixture
|
|
19
|
-
def component_specifications() ->
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
]
|
|
24
|
-
):
|
|
20
|
+
def component_specifications() -> Mapping[
|
|
21
|
+
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
22
|
+
Specification,
|
|
23
|
+
]:
|
|
25
24
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
26
25
|
return f"{p} => UP({b})"
|
|
27
26
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from collections.abc import Callable, Mapping
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
|
-
|
|
5
|
-
from cosy.
|
|
6
|
-
from cosy.
|
|
4
|
+
|
|
5
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
6
|
+
from cosy.core.synthesizer import Specification, Synthesizer
|
|
7
|
+
from cosy.core.types import Constructor, Group, Literal, Type, Var
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
@@ -18,12 +19,10 @@ SIZE = 50
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
@pytest.fixture
|
|
21
|
-
def component_specifications() ->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]
|
|
26
|
-
):
|
|
22
|
+
def component_specifications() -> Mapping[
|
|
23
|
+
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
24
|
+
Specification,
|
|
25
|
+
]:
|
|
27
26
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
28
27
|
return f"{p} => UP({b})"
|
|
29
28
|
|
|
@@ -2,10 +2,11 @@ from collections.abc import Callable, Iterable, Mapping
|
|
|
2
2
|
from itertools import product
|
|
3
3
|
|
|
4
4
|
import pytest
|
|
5
|
-
|
|
6
|
-
from cosy.
|
|
7
|
-
from cosy.
|
|
8
|
-
from cosy.
|
|
5
|
+
|
|
6
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
7
|
+
from cosy.core.synthesizer import Specification, Synthesizer
|
|
8
|
+
from cosy.core.tree import Tree
|
|
9
|
+
from cosy.core.types import Constructor, DataGroup, Literal, Type, Var
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def is_free(pos: tuple[int, int]) -> bool:
|
|
@@ -17,12 +18,10 @@ def is_free(pos: tuple[int, int]) -> bool:
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
@pytest.fixture
|
|
20
|
-
def component_specifications() ->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
25
|
-
):
|
|
21
|
+
def component_specifications() -> Mapping[
|
|
22
|
+
Callable[[tuple[int, int], tuple[int, int], str], str] | str,
|
|
23
|
+
Specification,
|
|
24
|
+
]:
|
|
26
25
|
def up(b: tuple[int, int], _a: tuple[int, int], p: str) -> str:
|
|
27
26
|
return f"{p} => UP({b})"
|
|
28
27
|
|
|
@@ -20,20 +20,20 @@ def one(s: str) -> str:
|
|
|
20
20
|
```
|
|
21
21
|
These binary sequences are assigned names and specifications, forming a triple:
|
|
22
22
|
```
|
|
23
|
-
(
|
|
23
|
+
(
|
|
24
24
|
"empty",
|
|
25
25
|
empty,
|
|
26
26
|
SpecificationBuilder()
|
|
27
27
|
.suffix(Constructor("str")),
|
|
28
28
|
),
|
|
29
|
-
(
|
|
29
|
+
(
|
|
30
30
|
"zero",
|
|
31
31
|
zero,
|
|
32
32
|
SpecificationBuilder()
|
|
33
33
|
.argument("s", Constructor("str"))
|
|
34
34
|
.suffix(Constructor("str")),
|
|
35
35
|
),
|
|
36
|
-
(
|
|
36
|
+
(
|
|
37
37
|
"one",
|
|
38
38
|
one,
|
|
39
39
|
SpecificationBuilder()
|
|
@@ -56,7 +56,7 @@ def fin(_b: bool, s: str) -> str:
|
|
|
56
56
|
```
|
|
57
57
|
with triple:
|
|
58
58
|
```
|
|
59
|
-
(
|
|
59
|
+
(
|
|
60
60
|
"fin",
|
|
61
61
|
fin,
|
|
62
62
|
SpecificationBuilder()
|
{combinatory_synthesizer-0.0.1.dev2 → combinatory_synthesizer-0.0.1.dev24}/docs/quick-start.md
RENAMED
|
@@ -32,19 +32,19 @@ def fib_next(_z: int, _y: int, _x: int, f1 : int, f2: int) -> int:
|
|
|
32
32
|
return f1 + f2
|
|
33
33
|
|
|
34
34
|
named_components_with_specifications = [
|
|
35
|
-
(
|
|
35
|
+
(
|
|
36
36
|
"fib_zero",
|
|
37
37
|
fib_zero,
|
|
38
38
|
SpecificationBuilder()
|
|
39
39
|
.suffix(Constructor("fib") & Constructor("at", Literal(0))),
|
|
40
40
|
),
|
|
41
|
-
(
|
|
41
|
+
(
|
|
42
42
|
"fib_one",
|
|
43
43
|
fib_one,
|
|
44
44
|
SpecificationBuilder()
|
|
45
45
|
.suffix(Constructor("fib") & Constructor("at", Literal(1))),
|
|
46
46
|
),
|
|
47
|
-
(
|
|
47
|
+
(
|
|
48
48
|
"fib_next",
|
|
49
49
|
fib_next,
|
|
50
50
|
SpecificationBuilder()
|
|
@@ -5,9 +5,9 @@ Demonstrates constraints in CoSy.
|
|
|
5
5
|
|
|
6
6
|
import re
|
|
7
7
|
|
|
8
|
-
from cosy import
|
|
9
|
-
from cosy.
|
|
10
|
-
from cosy.
|
|
8
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
9
|
+
from cosy.core.types import Constructor, Group, Literal, Type, Var
|
|
10
|
+
from cosy.maestro import Maestro
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def empty() -> str:
|
|
@@ -64,22 +64,22 @@ def main():
|
|
|
64
64
|
pass
|
|
65
65
|
|
|
66
66
|
named_components_with_specifications = [
|
|
67
|
-
(
|
|
67
|
+
(
|
|
68
68
|
"empty",
|
|
69
69
|
empty,
|
|
70
70
|
SpecificationBuilder().suffix(Constructor("str")),
|
|
71
71
|
),
|
|
72
|
-
(
|
|
72
|
+
(
|
|
73
73
|
"zero",
|
|
74
74
|
zero,
|
|
75
75
|
SpecificationBuilder().argument("s", Constructor("str")).suffix(Constructor("str")),
|
|
76
76
|
),
|
|
77
|
-
(
|
|
77
|
+
(
|
|
78
78
|
"one",
|
|
79
79
|
one,
|
|
80
80
|
SpecificationBuilder().argument("s", Constructor("str")).suffix(Constructor("str")),
|
|
81
81
|
),
|
|
82
|
-
(
|
|
82
|
+
(
|
|
83
83
|
"fin",
|
|
84
84
|
fin,
|
|
85
85
|
SpecificationBuilder()
|
|
@@ -96,8 +96,11 @@ def main():
|
|
|
96
96
|
# Query for heavy strings
|
|
97
97
|
target: Type = Constructor("matches", Literal("01+0"))
|
|
98
98
|
|
|
99
|
-
# Query the Maestro with the target and print results
|
|
100
|
-
|
|
99
|
+
# Query the Maestro with the target, then visualize and print results
|
|
100
|
+
results = maestro.query(target)
|
|
101
|
+
results.visualize(amount=3)
|
|
102
|
+
print("Now printing all infinite results in order:")
|
|
103
|
+
for result in results:
|
|
101
104
|
print(result)
|
|
102
105
|
|
|
103
106
|
|
|
@@ -5,9 +5,9 @@ Demonstrates constraints in CoSy, highlighting how the Component class can be us
|
|
|
5
5
|
|
|
6
6
|
import re
|
|
7
7
|
|
|
8
|
-
from cosy import
|
|
9
|
-
from cosy.
|
|
10
|
-
from cosy.
|
|
8
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
9
|
+
from cosy.core.types import Constructor, Group, Literal, Type, Var
|
|
10
|
+
from cosy.maestro import Maestro
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def main():
|
|
@@ -22,22 +22,22 @@ def main():
|
|
|
22
22
|
pass
|
|
23
23
|
|
|
24
24
|
named_components_with_specifications = [
|
|
25
|
-
(
|
|
25
|
+
(
|
|
26
26
|
"empty",
|
|
27
27
|
lambda: "",
|
|
28
28
|
SpecificationBuilder().suffix(Constructor("str")),
|
|
29
29
|
),
|
|
30
|
-
(
|
|
30
|
+
(
|
|
31
31
|
"zero",
|
|
32
32
|
lambda s: s + "0",
|
|
33
33
|
SpecificationBuilder().argument("s", Constructor("str")).suffix(Constructor("str")),
|
|
34
34
|
),
|
|
35
|
-
(
|
|
35
|
+
(
|
|
36
36
|
"one",
|
|
37
37
|
lambda s: s + "1",
|
|
38
38
|
SpecificationBuilder().argument("s", Constructor("str")).suffix(Constructor("str")),
|
|
39
39
|
),
|
|
40
|
-
(
|
|
40
|
+
(
|
|
41
41
|
"fin",
|
|
42
42
|
lambda _, s: s,
|
|
43
43
|
SpecificationBuilder()
|
|
@@ -54,8 +54,11 @@ def main():
|
|
|
54
54
|
# Query for heavy strings
|
|
55
55
|
target: Type = Constructor("matches", Literal("01+0"))
|
|
56
56
|
|
|
57
|
-
# Query the Maestro with the target and print results
|
|
58
|
-
|
|
57
|
+
# Query the Maestro with the target, then visualize and print results
|
|
58
|
+
results = maestro.query(target)
|
|
59
|
+
results.visualize(amount=3)
|
|
60
|
+
print("Now printing all infinite results in order:")
|
|
61
|
+
for result in results:
|
|
59
62
|
print(result)
|
|
60
63
|
|
|
61
64
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Overall description of this example goes here.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from cosy import
|
|
7
|
-
from cosy.
|
|
8
|
-
from cosy.
|
|
6
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
7
|
+
from cosy.core.types import Constructor, DataGroup, Literal, Type, Var
|
|
8
|
+
from cosy.maestro import Maestro
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def fib_zero() -> int:
|
|
@@ -46,17 +46,17 @@ def main():
|
|
|
46
46
|
bound = 20
|
|
47
47
|
|
|
48
48
|
named_components_with_specifications = [
|
|
49
|
-
(
|
|
49
|
+
(
|
|
50
50
|
"fib_zero",
|
|
51
51
|
fib_zero,
|
|
52
52
|
SpecificationBuilder().suffix(Constructor("fib") & Constructor("at", Literal(0))),
|
|
53
53
|
),
|
|
54
|
-
(
|
|
54
|
+
(
|
|
55
55
|
"fib_one",
|
|
56
56
|
fib_one,
|
|
57
57
|
SpecificationBuilder().suffix(Constructor("fib") & Constructor("at", Literal(1))),
|
|
58
58
|
),
|
|
59
|
-
(
|
|
59
|
+
(
|
|
60
60
|
"fib_next",
|
|
61
61
|
fib_next,
|
|
62
62
|
SpecificationBuilder()
|
|
@@ -75,9 +75,11 @@ def main():
|
|
|
75
75
|
# Target describing Fibonacci numbers at relevant indices
|
|
76
76
|
target: Type = Constructor("fib")
|
|
77
77
|
|
|
78
|
-
# Query the Maestro with the target and print
|
|
79
|
-
|
|
78
|
+
# Query the Maestro with the target, then visualize and print results
|
|
79
|
+
results = maestro.query(target)
|
|
80
|
+
for result in results:
|
|
80
81
|
print(result)
|
|
82
|
+
results.visualize()
|
|
81
83
|
|
|
82
84
|
for i in range(20):
|
|
83
85
|
# Target for Fibonacci numbers at index i
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Overall description of this example goes here.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from cosy import
|
|
7
|
-
from cosy.
|
|
8
|
-
from cosy.
|
|
6
|
+
from cosy.core.specification_builder import SpecificationBuilder
|
|
7
|
+
from cosy.core.types import Constructor, Group, Literal, Var
|
|
8
|
+
from cosy.maestro import Maestro
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def fst(_x: int, f: tuple[int, int]) -> int:
|
|
@@ -53,7 +53,7 @@ def main():
|
|
|
53
53
|
yield from frozenset(range(self._bound))
|
|
54
54
|
|
|
55
55
|
component_specifications = [
|
|
56
|
-
(
|
|
56
|
+
(
|
|
57
57
|
"fst",
|
|
58
58
|
fst,
|
|
59
59
|
SpecificationBuilder()
|
|
@@ -61,12 +61,12 @@ def main():
|
|
|
61
61
|
.argument("f", Constructor("fibs") & Constructor("at", Var("x")))
|
|
62
62
|
.suffix(Constructor("fib") & Constructor("at", Var("x"))),
|
|
63
63
|
),
|
|
64
|
-
(
|
|
64
|
+
(
|
|
65
65
|
"fib_zero_one",
|
|
66
66
|
fib_zero_one,
|
|
67
67
|
SpecificationBuilder().suffix(Constructor("fibs") & Constructor("at", Literal(0))),
|
|
68
68
|
),
|
|
69
|
-
(
|
|
69
|
+
(
|
|
70
70
|
"fib_next",
|
|
71
71
|
fib_next,
|
|
72
72
|
SpecificationBuilder()
|
|
@@ -84,7 +84,10 @@ def main():
|
|
|
84
84
|
target = Constructor("fib") & Constructor("at", Literal(5000))
|
|
85
85
|
|
|
86
86
|
# Query the Maestro with the target and print the only composition
|
|
87
|
-
|
|
87
|
+
results = maestro.query(target)
|
|
88
|
+
print("5000th Fibonacci number:", next(iter(results)))
|
|
89
|
+
# Visualize that result
|
|
90
|
+
results.visualize()
|
|
88
91
|
|
|
89
92
|
|
|
90
93
|
if __name__ == "__main__":
|
|
@@ -30,9 +30,9 @@ dependencies = []
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
[project.urls]
|
|
33
|
-
Documentation = "https://github.
|
|
34
|
-
Issues = "https://github.com/
|
|
35
|
-
Source = "https://github.com/
|
|
33
|
+
Documentation = "https://tudo-seal.github.io/cosy/"
|
|
34
|
+
Issues = "https://github.com/tudo-seal/cosy/issues"
|
|
35
|
+
Source = "https://github.com/tudo-seal/cosy"
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
[tool.hatch.version]
|
|
@@ -41,6 +41,7 @@ source = "vcs"
|
|
|
41
41
|
|
|
42
42
|
[tool.hatch.version.raw-options]
|
|
43
43
|
local_scheme = "no-local-version"
|
|
44
|
+
version_scheme = "guess-next-dev"
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
[tool.hatch.build.hooks.vcs]
|
|
@@ -97,3 +98,8 @@ exclude_lines = [
|
|
|
97
98
|
"FBT",
|
|
98
99
|
]
|
|
99
100
|
|
|
101
|
+
[tool.setuptools.packages.find]
|
|
102
|
+
where = ["src"]
|
|
103
|
+
|
|
104
|
+
[tool.setuptools.package-data]
|
|
105
|
+
cosy.extensions.visualization = ["*"]
|