Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thery/minirubik
Solving the mini Rubik (2x2) in Coq
https://github.com/thery/minirubik
2x2x2 coq formalization rubik-cube theorem-proving
Last synced: 3 months ago
JSON representation
Solving the mini Rubik (2x2) in Coq
- Host: GitHub
- URL: https://github.com/thery/minirubik
- Owner: thery
- Created: 2019-03-15T11:37:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-16T13:03:22.000Z (over 1 year ago)
- Last Synced: 2024-04-23T16:38:01.070Z (8 months ago)
- Topics: 2x2x2, coq, formalization, rubik-cube, theorem-proving
- Language: Coq
- Size: 164 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# minirubik
[![Docker CI][docker-action-shield]][docker-action-link]
[docker-action-shield]: https://github.com/thery/minirubik/workflows/Docker%20CI/badge.svg?branch=master
[docker-action-link]: https://github.com/thery/minirubik/actions?query=workflow:"Docker%20CI"This is a certified solver for the Rubik 2x2
The formalisation is explained in the file [paper.pdf](https://github.com/thery/minirubik/blob/master/paper.pdf),
A position of the cube is encoded by the constructor
``State`` that takes 7 cubes (`C1`, `C2`, `C3`, `C4`, `C5`, `C6`, `C7`)
and their respective orientation (`O1`, `O2`, `O3`).For example, the initial configuration is
``State C1 C2 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1``
Swapping two adjacent corners gives:
``State C2 C1 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1``
Swapping two opposite corners gives
``State C7 C2 C3 C4 C5 C6 C1 O1 O1 O1 O1 O1 O1 O1``
There are 3 positive moves that corresponds to the right face, the back face and the down face.
Each move can be applied once (`Right`, `Back`, `Down`),
twice (`Right2`, `Back2`, `Down2`) or three times
(`Rightm1`, `Backm1`, `Downm1`) and is still considered
as a single move.For example, applying the move `Right` to the initial
configuration gives``State C2 C5 C3 C1 C4 C6 C7 O2 O3 O1 O3 O2 O1 O1``
The ``solve`` function takes a position and returns
a list of minimal length of the moves to return to
the initial position.For example, solving
``State C2 C1 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1``
returns a list of length 11
``Right :: Backm1 :: Down2 :: Rightm1 :: Back
:: Rightm1 :: Backm1 :: Right :: Down2 :: Right :: Back :: nil``Other examples are given in the file [Example.v](https://github.com/thery/minirubik/blob/master/Example.v)
## Meta
- Author(s):
- Laurent Théry
- License: [MIT License](LICENSE)
- Compatible Coq versions: 8.17 or later
- Additional dependencies:
- [BigNums](https://github.com/coq/bignums)
- Coq namespace: `minirubik`
- Related publication(s): none## Building and installation instructions
To build and install manually, do:
``` shell
git clone https://github.com/thery/minirubik.git
cd minirubik
make # or make -j
make install
```