Skip to content

Commit

Permalink
update readme to show the option to count objects
Browse files Browse the repository at this point in the history
  • Loading branch information
enadeau committed Aug 27, 2019
1 parent 9abcc1b commit e56b32e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.rst
Expand Up @@ -177,6 +177,20 @@ the ``from_dict`` function is written in such a way that for any class
... data['alphabet'],
... bool(int(data['just_prefix'])))
We also add some methods that we will need to get the enumerations of the
objects.

.. code:: python
... def is_epsilon(self):
... return self.prefix == "" and self.just_prefix
...
... def is_atom(self):
... return len(self.prefix) == 1 and self.just_prefix
...
... def is_positive(self):
... return len(self.prefix) > 0
Our ``CombinatorialClass`` is now ready. What is left to do is create
the strategies that the ``CombinatorialSpecificationSearcher`` will use
for performing combinatorial exploration. This is given in the form of a
Expand Down Expand Up @@ -394,5 +408,10 @@ we see that the minimum polynomial satisfied by the generating function
and moreover
``F = -(x**7 + x**5 + x**4 + x**3 + x**2 + 1)/(x**6 + x**3 - x**2 + 2*x - 1)``.

.. code:: python
>>> tree.count_objects_of_length(10)
331
You can now try this yourself using the file ``example.py``, which can
count any set of words avoiding consecutive patterns.

0 comments on commit e56b32e

Please sign in to comment.