Tutorials/LLS: Difference between revisions

From LifeWiki
Jump to navigation Jump to search
m updated a bit(also who use cygwin right now?)
Update for LLS Version 1
Line 7: Line 7:


# Start by installing [http://cygwin.com/ Cygwin]
# Start by installing [http://cygwin.com/ Cygwin]
# When prompted to choose which packages to install, make sure <tt>dos2unix</tt>, <tt>gcc-core</tt>, <tt>git</tt>, <tt>gzip</tt>, <tt>make</tt>, <tt>python2</tt>, and <tt>tar</tt> are all selected.
# When prompted to choose which packages to install, make sure <tt>gcc-core</tt>, <tt>git</tt>, <tt>gzip</tt>, <tt>make</tt>, <tt>python3</tt>, and <tt>tar</tt> are all selected.
# If prompted, confirm that you also want to install any required prerequisities.
# If prompted, confirm that you also want to install any required prerequisites.


If you already have Cygwin installed, you obviously do not need to install it again, but make sure all the packages listed above are installed.
If you already have Cygwin installed, you obviously do not need to install it again, but make sure all the packages listed above are installed.


===Installing LLS===
===Installing LLS===
You can now install LLS itself. The easiest way to do this is using a shell (i.e. command line); you can also download a ZIP file and unpack it using your favorite archiver, but you'll be using the shell to run LLS anyway, so you might as well get used to it.
You can now install LLS itself. The easiest way to do this by going to [https://gitlab.com/OscarCunningham/logic-life-search the LLS homepage], clicking the download button and selecting 'zip' and then unzipping this file to create the <tt>logic-life-search-master</tt> directory, which you can place anywhere convenient on your machine.


LLS is published on [https://en.wikipedia.org/wiki/GitLab GitLab], which uses [https://git-scm.com/ Git] as its version control system. Don't worry, you won't have to learn how to use Git,{{refn|group=note|If you're interested in doing so, refer to Git's documentation. The [https://git-scm.com/docs/gittutorial tutorial] is a good place to start.}}, but you'll be using a few commands to download LLS and keep it updated.
If you prefer, you can use the [https://git-scm.com/ Git] version control system to download LLS and keep it updated. LLS is published on [https://en.wikipedia.org/wiki/GitLab GitLab]. Don't worry, you won't have to learn how to use Git,{{refn|group=note|If you're interested in doing so, refer to Git's documentation. The [https://git-scm.com/docs/gittutorial tutorial] is a good place to start.}}, but you'll be using a few commands.


Start by "cloning" the code so you'll have a full copy (don't worry, this'll only take a few seconds):
Start by "cloning" the code so you'll have a full copy (don't worry, this'll only take a few seconds):
Line 29: Line 29:
</pre>
</pre>


This'll create a subdirectory called "logic-life-search" containing LLS. No further compilation is required.
This'll create a subdirectory called "logic-life-search" containing LLS. No further compilation is required, and again you may place this directory anywhere you wish.


===Staying up-to-date===
===Staying up-to-date===
Line 64: Line 64:
$  
$  
</pre>
</pre>
Note that the development version has some differences with the regular "master" version. These differences are noted in the [[Tutorials/LLS#Development_Version_Differences|Development Version Differences]] section.


===Installing a SAT solver===
===Installing a SAT solver===
LLS works by converting a pattern search problem into a boolean satisfiability (SAT) problem and solving that using a SAT solver tool, so you'll need a SAT solver.
LLS works by converting a pattern search problem into a boolean satisfiability (SAT) problem and solving that using a SAT solver tool, so you'll need a SAT solver.


LLS currently supports many SAT solvers, but we'll focus on Lingeling in this tutorial, as it appears to work best across different platforms, including Windows/Cygwin.
LLS currently supports many SAT solvers, but we'll focus on Lingeling in this tutorial, as it appears to work best across different platforms, including Windows/Cygwin. At the date of writing, the fastest SAT solver freely available is [https://github.com/arminbiere/kissat kissat].


====Installing Lingeling====
====Installing Lingeling====
Line 148: Line 147:
</pre>
</pre>


You also need to tell LLS to use lingeling as its default solver. Go to the file <tt>logic-life-search/src/defaults.py</tt> and change the 'solver' line to read <tt>solver = "lingeling"</tt>.
==First steps==
==First steps==


Line 156: Line 156:


<pre>
<pre>
$ ./lls -S lingeling -m -b 16 6 -p 3 -x 0 -y 1
$ python lls -c -b 16 6 -s p3 x0 y1
 
Getting search pattern...
Getting search pattern...
Done
Done
Line 164: Line 163:
Done
Done


Number of undetermined cells: 270
Number of undetermined cells: 272
Number of variables: 364
Number of variables: 369
Number of clauses: 34177
Number of clauses: 34412


Active width: 16
Active width: 16
Line 175: Line 174:
Done
Done


Time taken: 2.46514105797 seconds
Time taken: 1.7274296283721924 seconds


x = 18, y = 8, rule = B3/S23
x = 18, y = 8, rule = B3/S23
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbobbob$
bbobbbbbbbbbbbbbbb$
bobboboobbbobboobb$
bobbbobbbobbbbbobb$
bboobbbbobbooboobb$
bbooobbbobbobobbob$
bboobooobooobbbbbb$
bbboboobbbbooboobb$
bbbbbbbbbobbbbbbbb$
bbbbbbboooboobobbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb!
bbbbbbbbbbbbbbbbbb!
Line 190: Line 189:
</pre>
</pre>


LLS converted our request to a problem Lingeling could solve, and Lingeling did so in less than 3 seconds. Impressive! Here's our result:
LLS converted our request to a problem Lingeling could solve, and Lingeling did so in less than 2 seconds. Impressive! Here's our result:


{{EmbedViewer
{{EmbedViewer
Line 198: Line 197:
|rle          = x = 18, y = 8, rule = B3/S23
|rle          = x = 18, y = 8, rule = B3/S23
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbobbob$
bbobbbbbbbbbbbbbbb$
bobboboobbbobboobb$
bobbbobbbobbbbbobb$
bboobbbbobbooboobb$
bbooobbbobbobobbob$
bboobooobooobbbbbb$
bbboboobbbbooboobb$
bbbbbbbbbobbbbbbbb$
bbbbbbboooboobobbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb!
bbbbbbbbbbbbbbbbbb!
Line 209: Line 208:
But what ''did'' we request? Let's take a look at the options we passed to LLS:
But what ''did'' we request? Let's take a look at the options we passed to LLS:


* <tt>-S lingeling</tt>: tells LLS to use Lingeling as its SAT solver. The default solver to use is Glucose, but we installed Lingeling and would like to use that.
* <tt>-c</tt>: tells LLS to look for a changing pattern, i.e. for the first two generations to be different.
* <tt>-m</tt>: tells LLS to look for a moving pattern, i.e. for the first two generations to be different.
* <tt>-b 16 6</tt>: tells LLS to create a blank search pattern with a size of 16&times;6. Without this, we'd have to have told LLS explicitly what our pattern should look like.
* <tt>-b 16 6</tt>: tells LLS to create a blank search pattern with a size of 16&times;6. Without this, we'd have to have told LLS explicitly what our pattern should look like.
* <tt>-p 3</tt>: tells LLS to look for a [[period]] 3 pattern.
* <tt>-s</tt>: tells LLS to look for a pattern with a particular symmetry:
* <tt>-x 0</tt>: tells LLS to look for a pattern moving by 0 cells horizontally in each full period.
** <tt>p3</tt> the pattern repeats itself with [[period]] 3,
* <tt>-y 1</tt>: tells LLS to look for a pattern moving by 1 cell vertically in each full period.
** <tt>x0</tt>: moving by 0 cells horizontally in each full period,
** <tt>y1</tt>: and moving by 1 cell vertically in each full period.


There's a lot more options to LLS; run <tt>./lls -h</tt> to see them all.
There's a lot more options to LLS; run <tt>./lls -h</tt> to see them all.
Line 222: Line 221:


<pre>
<pre>
$ ./lls -S lingeling -m -b 17 12 -s "D2|" -p 3 -x 0 -y 1
$ python lls -c -b 17 12 -s p3 x0 y1 -s "D2|"


Getting search pattern...
Getting search pattern...
Line 230: Line 229:
Done
Done


Number of undetermined cells: 314
Number of undetermined cells: 315
Number of variables: 516
Number of variables: 424
Number of clauses: 43417
Number of clauses: 43369


Active width: 17
Active width: 17
Line 241: Line 240:
Done
Done


Time taken: 40.4900970459 seconds
Time taken: 57.500898599624634 seconds


x = 19, y = 14, rule = B3/S23
x = 19, y = 14, rule = B3/S23
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbooboobbbbbbb$
bbobbbbbbbbbbbbbobb$
booobobbbbbbbobooob$
bbobbbbooboobbbbobb$
bbbbbbbbobobbbbbbbb$
bbboobbobbbobboobbb$
bbbobbobobobobbobbb$
bbbooobbobobbooobbb$
bbbooboboboboboobbb$
bbbooboboboboboobbb$
bbbbobobobobobobbbb$
bbbbbbobobobobbbbbb$
bbbbbbobobobobbbbbb$
bbbbbobbobobbobbbbb$
bbobooboobooboobobb$
bobobbbooboobbbobob$
bobobobbbbbbbobobob$
bobbboobbbbboobbbob$
boboboobbbbboobobob$
bbooboobbbbbooboobb$
bbooobbbbbbbbbooobb$
bboobbbbbbbbbbboobb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb!
bbbbbbbbbbbbbbbbbbb!
Line 262: Line 261:
</pre>
</pre>


40 seconds &mdash; not bad! Here's our catch:
57 seconds &mdash; not bad! Here's our catch:


{{EmbedViewer
{{EmbedViewer
Line 270: Line 269:
|rle          = x = 19, y = 14, rule = B3/S23
|rle          = x = 19, y = 14, rule = B3/S23
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbooboobbbbbbb$
bbobbbbbbbbbbbbbobb$
booobobbbbbbbobooob$
bbobbbbooboobbbbobb$
bbbbbbbbobobbbbbbbb$
bbboobbobbbobboobbb$
bbbobbobobobobbobbb$
bbbooobbobobbooobbb$
bbbooboboboboboobbb$
bbbooboboboboboobbb$
bbbbobobobobobobbbb$
bbbbbbobobobobbbbbb$
bbbbbbobobobobbbbbb$
bbbbbobbobobbobbbbb$
bbobooboobooboobobb$
bobobbbooboobbbobob$
bobobobbbbbbbobobob$
bobbboobbbbboobbbob$
boboboobbbbboobobob$
bbooboobbbbbooboobb$
bbooobbbbbbbbbooobb$
bboobbbbbbbbbbboobb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb!
bbbbbbbbbbbbbbbbbbb!
}}
}}


We already know the <tt>-m</tt>, <tt>-b</tt>, <tt>-p</tt>, <tt>-x</tt>, and <tt>-y</tt> options from above. But there's one new one:
We already know the <tt>-c</tt>, <tt>-b</tt> and <tt>-s p3 x0 y1</tt> options from above. But there's one new one:


* <tt>-s "D2|"</tt>: tells LLS to look for patterns with a specific [[symmetry]]. We passed <tt>"D2|"</tt>, meaning we're interested in patterns that are mirror-symmetric about a vertical axis. The quotes around <tt>D2|</tt> are necessary to keep the shell from interpreting the pipe symbol, <tt>|</tt>, as a special character, and instead pass it to LLS unchanged.
* <tt>-s "D2|"</tt>: tells LLS to look for patterns with an additional [[symmetry]]. We passed <tt>"D2|"</tt>, meaning we're interested in patterns that are mirror-symmetric about a vertical axis. The quotes around <tt>D2|</tt> are necessary to keep the shell from interpreting the pipe symbol, <tt>|</tt>, as a special character, and instead pass it to LLS unchanged.


Specifying a symmetry made finding [[Brain]] that much faster.
Specifying a symmetry made finding [[Brain]] that much faster.
Line 295: Line 294:


<pre>
<pre>
$ ./lls -S lingeling -p 3 -x 2 -y 1 -i -b 6 6 -r pB1-c2345678/S012345678 --force_at_most 5
$ .python lls -s p3 x2 y1 -b 6 6 -r pB1-c2345678/S012345678 -p ">0" -p "<=5"


Getting search pattern...
Getting search pattern...
Line 303: Line 302:
Done
Done


Number of undetermined cells: 84
Number of undetermined cells: 86
Number of variables: 242
Number of variables: 306
Number of clauses: 36602
Number of clauses: 38100


Active width: 6
Active width: 6
Line 314: Line 313:
Done
Done


Time taken: 0.455801963806 seconds
Time taken: 0.20017600059509277 seconds


x = 8, y = 8, rule = B2-ei3jq4-aijnwz5-cejn6-c78/S12ck3-ekqr4-ejknr5ejkqy6cn78
x = 8, y = 8, rule = B2-en3ejr4ant/S01c2-en3ey5ae
bbbbbbbb$
bbbbbbbb$
bbbbbbbb$
bbbbobbb$
bbbbobbb$
bbobbbbb$
bbbbobbb$
bbboobbb$
bbbbobbb$
bbbbbbbb$
bobobbbb$
bobbbbbb$
bbbbbbbb$
bbbbbbbb$
bbbbbbbb!
bbbbbbbb!
Line 333: Line 332:
|position    = center
|position    = center
|viewerconfig = #C [[ THEME 6 GRID TRACKLOOP 3 2/3 1/3 AUTOSTART THUMBLAUNCH THUMBSIZE 2 GPS 3 ]]
|viewerconfig = #C [[ THEME 6 GRID TRACKLOOP 3 2/3 1/3 AUTOSTART THUMBLAUNCH THUMBSIZE 2 GPS 3 ]]
|rle          = x = 8, y = 8, rule = B2-ei3jq4-aijnwz5-cejn6-c78/S12ck3-ekqr4-ejknr5ejkqy6cn78
|rle          = x = 8, y = 8, rule = B2-en3ejr4ant/S01c2-en3ey5ae
bbbbbbbb$
bbbbbbbb$
bbbbbbbb$
bbbbobbb$
bbbbobbb$
bbobbbbb$
bbbbobbb$
bbboobbb$
bbbbobbb$
bbbbbbbb$
bobobbbb$
bobbbbbb$
bbbbbbbb$
bbbbbbbb$
bbbbbbbb!
bbbbbbbb!
}}
}}


Most of the options passed to LLS are familiar by now, but three are new:
Most of the options passed to LLS are familiar by now, but two are new:


[[File:Neighborhood 1c.png|right|frame|<tt>B1c</tt>]]
[[File:Neighborhood 1c.png|right|frame|<tt>B1c</tt>]]
* <tt>-i</tt>: tells LLS that the first generation of the pattern found must contain at least one live cell. We're not interested in empty solutions.
* <tt>-r pB1-c2345678/S012345678</tt>: tells LLS what birth/survival conditions we'll allow in our target rules. In <tt>pB1-c2345678/S012345678</tt>, the leading <tt>p</tt> tells LLS that the following is a partial specification, rather than a complete one. The trailing string, <tt>B1-c2345678/S012345678</tt>, describes the [[rulespace]] we'd like to be considered. Here, <tt>B1-c</tt> rules out  the "B1c" subcondition. B1e, B2 to B8, and S0 to S8 are all allowed. Refer to [[Hensel notation]] for an overview over the various subconditions allowed; for an easy-to-use script for converting a given range of rules to the notation required by <tt>-r</tt>, see [[Tutorials/LLS#Finding the right parameter to pass to -r|§ Finding the right parameter to pass to <tt>-r</tt>]].
* <tt>-r pB1-c2345678/S012345678</tt>: tells LLS what birth/survival conditions we'll allow in our target rules. In <tt>pB1-c2345678/S012345678</tt>, the leading <tt>p</tt> tells LLS that the following is a partial specification, rather than a complete one. The trailing string, <tt>B1-c2345678/S012345678</tt>, describes the [[rulespace]] we'd like to be considered. Here, <tt>B1-c</tt> rules out  the "B1c" subcondition. B1e, B2 to B8, and S0 to S8 are all allowed. Refer to [[Hensel notation]] for an overview over the various subconditions allowed; for an easy-to-use script for converting a given range of rules to the notation required by <tt>-r</tt>, see [[Tutorials/LLS#Finding the right parameter to pass to -r|§ Finding the right parameter to pass to <tt>-r</tt>]].
* <tt>--force_at_most 5</Tt>: tells LLS that the first generation of the pattern found must contain at most five live cells.
* <tt>-p ">0"</tt>: tells LLS that the first generation of the pattern found must contain at least one live cell. We're not interested in empty solutions. Likewise <tt>-p "<=5"</Tt> tells LLS that the first generation of the pattern found must contain at most five live cells.
 


The last option is important; without it, Lingeling (and, by extension, LLS) might find a different pattern than the one above. There are many solutions satisfying the constraints we imposed, and only the first solution identified will be reported.
The last option <tt>-p "<=5"</Tt> is important; without it, Lingeling (and, by extension, LLS) might find a different pattern than the one above. There are many solutions satisfying the constraints we imposed, and only the first solution identified will be reported.


==Success -- now what?==
==Success -- now what?==
Line 379: Line 378:


<pre>
<pre>
$ ./lls -S lingeling -r B2en3ij4a5e7e8/S1c2cek3-a4aiqw5aky -b 10 10 -p 55 -x 9 -y 0 -i
$ python lls -r B2en3ij4a5e7e8/S1c2cek3-a4aiqw5aky -b 10 10 -s p55 x9 y0 -p ">0"


Getting search pattern...
Getting search pattern...
Line 387: Line 386:
Done
Done


Number of undetermined cells: 0
Number of undetermined cells: 540
Number of variables: 0
Number of variables: 541
Number of clauses: 1
Number of clauses: 4260


Active width: 0
Active width: 1
Active height: 0
Active height: 10
Active duration: 0
Active duration: 54


Solving...
Solving...
Done
Done


Time taken: 0.0 seconds
Time taken: 0.004628658294677734 seconds


Unsatisfiable
Unsatisfiable
Line 405: Line 404:
</pre>
</pre>


We asked for a deplacement of 9 <tt>-x 9</tt> while also requiring the entire pattern to fit into a 10&times;10 bounding box (<tt>-b 10 10</tt>), and LLS and Lingeling quickly determined that there was no way that a period-55 (<tt>-p 55</tt>) pattern meeting both these criteria could possibly exist.
We asked for a deplacement of <tt>x9</tt> while also requiring the entire pattern to fit into a 10&times;10 bounding box (<tt>-b 10 10</tt>), and LLS and Lingeling quickly determined that there was no way that a period-55 (<tt>-p 55</tt>) pattern meeting both these criteria could possibly exist.


Solution: Passing a larger bounding box should help.
Solution: Passing a larger bounding box should help.
====Incompatible line-end characters====
Possible explanation: you used an input text file created on Windows, which uses different line-end characters than what Unix-based tools expect. Windows uses <tt>\r\n</tt>; Unix uses just <tt>\n</tt>, and LLS is interpreting each line of your input file as representing an entire generation of the pattern.<ref name="post56049" />
Solution: this should be fixed in the "develop" branch of LLS; see [[Tutorials/LLS#Using the development version|§ Using the development version]] for instructions on how to switch to that version. Alternatively, use the <tt>dos2unix</tt> tool to convert your input file to Unix line endings:
<pre>
$ dos2unix.exe input.txt
dos2unix: converting file input.txt to Unix format...
$
</pre>
== Development Version Differences ==
The Development version of LLS has some differences with the regular version in it's commands. It might be a bit tricky to figure out how to use the development version, so here's a quick guide:
*Parameters for the search are now passed into the <tt>-s</tt> option, so for example, while in the regular version search parameters would be written, say, <tt>-p 4 -x 1 -y 2</tt>, in the development version, they would be written <tt>-s p4 x1 y2</tt>
**Symmetries are also now in the <tt>-s</tt> option, so <tt>-p 4 -x 1 -y 0 -s "D2-"</tt> in the regular version would be <tt>-s p4 x1 y0 "D2-"</tt> in the development version.
*The <tt>-i</tt> option is gone. A replacement for it is the <tt>-c</tt>, which forces the first two generations of the pattern to be different. If you wish to tell LLS to make the first generation have at least one live cell, use <tt>-p ">1"</tt>, which says "Make sure the population is greater than ( ">" ) one ( "1" ).
*The <tt>--force_at_most</tt> option is gone as well. Use the <tt>-p</tt> option.


==Notes==
==Notes==
Line 453: Line 434:
|date      = January 29, 2018
|date      = January 29, 2018
|p          = 55864
|p          = 55864
|title      = Re: Logic Life Search
|author    = [[Oscar Cunningham]]
}}</ref>
<ref name="post56049">{{LinkForumThread
|format    = ref
|accessdate = February 3, 2018
|date      = February 2, 2018
|p          = 56049
|title      = Re: Logic Life Search
|title      = Re: Logic Life Search
|author    = [[Oscar Cunningham]]
|author    = [[Oscar Cunningham]]

Revision as of 12:20, 15 May 2022

So you've decided to search for patterns using Oscar Cunningham's Logic Life Search tool. Excellent!

Installation

Prerequisites

Are you a Windows user? If so, you'll need a Unix-like environment.

  1. Start by installing Cygwin
  2. When prompted to choose which packages to install, make sure gcc-core, git, gzip, make, python3, and tar are all selected.
  3. If prompted, confirm that you also want to install any required prerequisites.

If you already have Cygwin installed, you obviously do not need to install it again, but make sure all the packages listed above are installed.

Installing LLS

You can now install LLS itself. The easiest way to do this by going to the LLS homepage, clicking the download button and selecting 'zip' and then unzipping this file to create the logic-life-search-master directory, which you can place anywhere convenient on your machine.

If you prefer, you can use the Git version control system to download LLS and keep it updated. LLS is published on GitLab. Don't worry, you won't have to learn how to use Git,[note 1], but you'll be using a few commands.

Start by "cloning" the code so you'll have a full copy (don't worry, this'll only take a few seconds):

$ git clone https://gitlab.com/OscarCunningham/logic-life-search.git
Cloning into 'logic-life-search'...
remote: Counting objects: 73, done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 73 (delta 29), reused 35 (delta 14), pack-reused 0
Unpacking objects: 100% (73/73), done.
$ 

This'll create a subdirectory called "logic-life-search" containing LLS. No further compilation is required, and again you may place this directory anywhere you wish.

Staying up-to-date

LLS is still evolving; you may want to pull in new changes and improvements made by the author. To do this, use the "git pull" command (be sure to enter the LLS directory if you're not already in it):

$ git pull
remote: Counting objects: 84, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 84 (delta 65), reused 71 (delta 52), pack-reused 0
Unpacking objects: 100% (84/84), done.
From https://gitlab.com/OscarCunningham/logic-life-search
   ac5758a..153f87e  develop    -> origin/develop
Already up to date.
$ 

Using the development version

New features are first made in the "develop" branch of the program. By default, you're using the "master" branch; use the "git checkout" command to switch to a different one:[note 2]

$ git checkout develop
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
$ 

To switch back to the stable "master" branch again, simply use "git checkout" again:

$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ 

Installing a SAT solver

LLS works by converting a pattern search problem into a boolean satisfiability (SAT) problem and solving that using a SAT solver tool, so you'll need a SAT solver.

LLS currently supports many SAT solvers, but we'll focus on Lingeling in this tutorial, as it appears to work best across different platforms, including Windows/Cygwin. At the date of writing, the fastest SAT solver freely available is kissat.

Installing Lingeling

Download Lingeling from [1] Start by "cloning" the code so you'll have a full copy (don't worry, this'll only take a few seconds):

$ git clone https://github.com/arminbiere/lingeling.git
Cloning into 'lingeling'...
remote: Enumerating objects: 90, done.
remote: Counting objects: 100% (11/11), done
remote: Compressing objects: 100% (7/7), done.
remote: Total 90 (delta 3), reused 9 (delta 3), pack-reused 79
Unpacking objects: 100% (90/90), done.
$ 

Now enter Lingeling's directory, and run configure.sh:

$ cd lingeling
$ ./configure.sh
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA
$ 

Now run make to build Lingeling. There may be some warnings; ignore these, they're Mostly Harmless™.

$ make
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglib.c
lglib.c: In function ‘lglstampall’:
lglib.c:19156:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (rootsonly) noimpls++; goto CONTINUE;
  ^~
lglib.c:19156:28: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
  if (rootsonly) noimpls++; goto CONTINUE;
                            ^~~~
rm -f lglcflags.h
echo '#define LGL_CC "gcc (GCC) 6.4.0"' >> lglcflags.h
echo '#define LGL_CFLAGS "-Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA"' >> lglcflags.h
rm -f lglcfg.h
./mkconfig.sh > lglcfg.h
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglbnr.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lgldimacs.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglopts.c
ar rc liblgl.a lglib.o lglbnr.o lgldimacs.o lglopts.o
ranlib liblgl.a
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglmain.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -o lingeling lglmain.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c plingeling.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -pthread -o plingeling plingeling.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c ilingeling.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -pthread -o ilingeling ilingeling.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c treengeling.c
treengeling.c: In function ‘mysrand’:
treengeling.c:1381:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (!z) z = ~z; if (!w) w = ~w;
   ^~
treengeling.c:1381:19: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   if (!z) z = ~z; if (!w) w = ~w;
                   ^~
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -pthread -o treengeling treengeling.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglmbt.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -o lglmbt lglmbt.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lgluntrace.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -o lgluntrace lgluntrace.o -L. -llgl -lm
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -c lglddtrace.c
gcc -Wall -O3 -DNLGLOG -DNDEBUG -DNCHKSOL -DNLGLDRUPLIG -DNLGLYALSAT -DNLGLFILES -DNLGLDEMA -o lglddtrace lglddtrace.o -L. -llgl -lm
$ 

That's it, Lingeling is built. If you're on Windows/Cygwin, the executable will be called lingeling.exe; otherwise (including other WSL) it's just lingeling. You still need to copy this executable into LLS's solver directory, however:

$ cp lingeling.exe ../logic-life-search/solvers/
$ 

You also need to tell LLS to use lingeling as its default solver. Go to the file logic-life-search/src/defaults.py and change the 'solver' line to read solver = "lingeling".

First steps

Finding 25P3H1V0.2

For our first test, let's find 25P3H1V0.2,[1] a small c/3 spaceship originally found by David Bell in 1992.

Enter LLS's directory if necessary, and run the following:

$ python lls -c -b 16 6 -s p3 x0 y1
Getting search pattern...
Done

Preprocessing...
Done

Number of undetermined cells: 272
Number of variables: 369
Number of clauses: 34412

Active width: 16
Active height: 6
Active duration: 4

Solving...
Done

Time taken: 1.7274296283721924 seconds

x = 18, y = 8, rule = B3/S23
bbbbbbbbbbbbbbbbbb$
bbobbbbbbbbbbbbbbb$
bobbbobbbobbbbbobb$
bbooobbbobbobobbob$
bbboboobbbbooboobb$
bbbbbbboooboobobbb$
bbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbb!

$ 

LLS converted our request to a problem Lingeling could solve, and Lingeling did so in less than 2 seconds. Impressive! Here's our result:

x = 18, y = 8, rule = B3/S23 bbbbbbbbbbbbbbbbbb$ bbobbbbbbbbbbbbbbb$ bobbbobbbobbbbbobb$ bbooobbbobbobobbob$ bbboboobbbbooboobb$ bbbbbbboooboobobbb$ bbbbbbbbbbbbbbbbbb$ bbbbbbbbbbbbbbbbbb! #C [[ THUMBSIZE 2 THEME 6 GRID GRIDMAJOR 0 SUPPRESS THUMBLAUNCH ]] #C [[ THEME 6 GRID TRACKLOOP 3 0 1/3 AUTOSTART THUMBLAUNCH THUMBSIZE 2 GPS 3 ]]
25P3H1V0.2
(click above to open LifeViewer)

But what did we request? Let's take a look at the options we passed to LLS:

  • -c: tells LLS to look for a changing pattern, i.e. for the first two generations to be different.
  • -b 16 6: tells LLS to create a blank search pattern with a size of 16×6. Without this, we'd have to have told LLS explicitly what our pattern should look like.
  • -s: tells LLS to look for a pattern with a particular symmetry:
    • p3 the pattern repeats itself with period 3,
    • x0: moving by 0 cells horizontally in each full period,
    • y1: and moving by 1 cell vertically in each full period.

There's a lot more options to LLS; run ./lls -h to see them all.

Finding Brain

Let's try hunting for a different spaceship, Brain.[2] Run the following:

$ python lls -c -b 17 12 -s p3 x0 y1 -s "D2|"

Getting search pattern...
Done

Preprocessing...
Done

Number of undetermined cells: 315
Number of variables: 424
Number of clauses: 43369

Active width: 17
Active height: 12
Active duration: 4

Solving...
Done

Time taken: 57.500898599624634 seconds

x = 19, y = 14, rule = B3/S23
bbbbbbbbbbbbbbbbbbb$
bbobbbbbbbbbbbbbobb$
bbobbbbooboobbbbobb$
bbboobbobbbobboobbb$
bbbooobbobobbooobbb$
bbbooboboboboboobbb$
bbbbobobobobobobbbb$
bbbbbbobobobobbbbbb$
bbobooboobooboobobb$
bobobobbbbbbbobobob$
boboboobbbbboobobob$
bbooobbbbbbbbbooobb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb!

$ 

57 seconds — not bad! Here's our catch:

x = 19, y = 14, rule = B3/S23 bbbbbbbbbbbbbbbbbbb$ bbobbbbbbbbbbbbbobb$ bbobbbbooboobbbbobb$ bbboobbobbbobboobbb$ bbbooobbobobbooobbb$ bbbooboboboboboobbb$ bbbbobobobobobobbbb$ bbbbbbobobobobbbbbb$ bbobooboobooboobobb$ bobobobbbbbbbobobob$ boboboobbbbboobobob$ bbooobbbbbbbbbooobb$ bbbbbbbbbbbbbbbbbbb$ bbbbbbbbbbbbbbbbbbb! #C [[ THUMBSIZE 2 THEME 6 GRID GRIDMAJOR 0 SUPPRESS THUMBLAUNCH ]] #C [[ THEME 6 GRID TRACKLOOP 3 0 1/3 AUTOSTART THUMBLAUNCH THUMBSIZE 2 GPS 3 ]]
Brain
(click above to open LifeViewer)

We already know the -c, -b and -s p3 x0 y1 options from above. But there's one new one:

  • -s "D2|": tells LLS to look for patterns with an additional symmetry. We passed "D2|", meaning we're interested in patterns that are mirror-symmetric about a vertical axis. The quotes around D2| are necessary to keep the shell from interpreting the pipe symbol, |, as a special character, and instead pass it to LLS unchanged.

Specifying a symmetry made finding Brain that much faster.

Finding an alien (2,1)c/3 spaceship

LLS can search different rules. It's not limited to semi-totalistic rules either, and in fact you don't even need to specify the exact rule you're interested in. To demonstrate this, let's find a small alien spaceship moving at a speed of (2,1)c/3:[3]

$ .python lls -s p3 x2 y1 -b 6 6 -r pB1-c2345678/S012345678 -p ">0" -p "<=5"

Getting search pattern...
Done

Preprocessing...
Done

Number of undetermined cells: 86
Number of variables: 306
Number of clauses: 38100

Active width: 6
Active height: 6
Active duration: 4

Solving...
Done

Time taken: 0.20017600059509277 seconds

x = 8, y = 8, rule = B2-en3ejr4ant/S01c2-en3ey5ae
bbbbbbbb$
bbbbbbbb$
bbbbobbb$
bbbbobbb$
bbbbobbb$
bobobbbb$
bbbbbbbb$
bbbbbbbb!

What did we find this time? Let us take a look:

x = 8, y = 8, rule = B2-en3ejr4ant/S01c2-en3ey5ae bbbbbbbb$ bbbbbbbb$ bbbbobbb$ bbbbobbb$ bbbbobbb$ bobobbbb$ bbbbbbbb$ bbbbbbbb! #C [[ THUMBSIZE 2 THEME 6 GRID GRIDMAJOR 0 SUPPRESS THUMBLAUNCH ]] #C [[ THEME 6 GRID TRACKLOOP 3 2/3 1/3 AUTOSTART THUMBLAUNCH THUMBSIZE 2 GPS 3 ]]
An alien (2,1)c/3 ship.
(click above to open LifeViewer)

Most of the options passed to LLS are familiar by now, but two are new:

B1c
  • -r pB1-c2345678/S012345678: tells LLS what birth/survival conditions we'll allow in our target rules. In pB1-c2345678/S012345678, the leading p tells LLS that the following is a partial specification, rather than a complete one. The trailing string, B1-c2345678/S012345678, describes the rulespace we'd like to be considered. Here, B1-c rules out the "B1c" subcondition. B1e, B2 to B8, and S0 to S8 are all allowed. Refer to Hensel notation for an overview over the various subconditions allowed; for an easy-to-use script for converting a given range of rules to the notation required by -r, see § Finding the right parameter to pass to -r.
  • -p ">0": tells LLS that the first generation of the pattern found must contain at least one live cell. We're not interested in empty solutions. Likewise -p "<=5" tells LLS that the first generation of the pattern found must contain at most five live cells.


The last option -p "<=5" is important; without it, Lingeling (and, by extension, LLS) might find a different pattern than the one above. There are many solutions satisfying the constraints we imposed, and only the first solution identified will be reported.

Success -- now what?

Let's assume that you have run your own search, and found something new and exciting. What now? You may want to report your discovery; perhaps it's known, perhaps not. Here are some good places to do so:

There's one thing you should (probably) not do, and that's start a LifeWiki article on your discovery. If it's notable, chances are good someone else will.

How do I...?

This section collects helpful hints and tips on how to accomplish common tasks.

Finding the right parameter to pass to -r

LLS's -r option requires the target rulespace to be passed in what has been dubbed "Macbi partial" notation. Converting a pair of given "minimum" and "maximum" rules to this notation is not entirely straightforward; Rhombic has made available a pair of scripts (to be run inside and outside of Golly, otherwise functionally equivalent) to perform the necessary conversion.[4]

Suppose that you want to search any rules falling into the rulespace demarcated by B3/S2-i34q (tlife) and B35e8/S2-i34ceq6i7e8. Running Rhombic's script and entering both values yields pB3aceijknqry5-acijknqry8/S2acekn-i3aceijknqry4q-aijknrtwyz6-acekn7-c8, so this is the option you should pass to -r when running LLS to perform your desired search.

Troubleshooting

This section collects common and not-so-common problems you may run into, and suggestions on what might have gone wrong.

Unsatisfiable

Problem: LLS says the search is unsatisfiable, i.e. has no solution.

Bounding box too small

Possible explanation: the bounding box you specified was too small to accommodate the full evolution of the final pattern. For example:

$ python lls -r B2en3ij4a5e7e8/S1c2cek3-a4aiqw5aky -b 10 10 -s p55 x9 y0 -p ">0"

Getting search pattern...
Done

Preprocessing...
Done

Number of undetermined cells: 540
Number of variables: 541
Number of clauses: 4260

Active width: 1
Active height: 10
Active duration: 54

Solving...
Done

Time taken: 0.004628658294677734 seconds

Unsatisfiable

$ 

We asked for a deplacement of x9 while also requiring the entire pattern to fit into a 10×10 bounding box (-b 10 10), and LLS and Lingeling quickly determined that there was no way that a period-55 (-p 55) pattern meeting both these criteria could possibly exist.

Solution: Passing a larger bounding box should help.

Notes

  1. ↑ If you're interested in doing so, refer to Git's documentation. The tutorial is a good place to start.
  2. ↑ Despite the name, this is a local command that does not interact with the remote repository on GitLab.

References

  1. ↑ Tom Rokicki (January 28, 2018). Re: Logic Life Search (discussion thread) at the ConwayLife.com forums
  2. ↑ Adam P. Goucher (January 28, 2018). Re: Logic Life Search (discussion thread) at the ConwayLife.com forums
  3. ↑ Oscar Cunningham (January 29, 2018). Re: Logic Life Search (discussion thread) at the ConwayLife.com forums
  4. ↑ Rhombic (February 5, 2018). Re: Logic Life Search (discussion thread) at the ConwayLife.com forums