Giter VIP home page Giter VIP logo

property_test_regular's Introduction

Property testing of regular languages

Efficient C++ header-contained implementation of a property tester for regular languages (i.e. sets of words defined by regular expressions), by Gabriel Bathie.
This is part of the work I did during my research internship under the supervision of Tatiana Starikovskaya at ENS Ulm during the summer 2020.
Our publication with details on the analysis of the algorithm can be found online here (not yet available, todo).


Usage

Simply include property_tester.h in your project, and add nfa.h and property_tester.h to your include path.
Examples of creation of an NFA and usage of the property testing algorithm can be found in example.cpp.
To compile the example, use make example.


Tests

Here may be found the results of the tests.cpp program when compiled and ran on my computer.

Results for the NFA for 0^*1^*: 01star

Results for a random NFA with 10 states: random_nfa

As expected, the property testing algorithm is much faster than the exact algorithm when the input is large, and tends to a constant time complexity. The runtime is not exactly constant because letters that appear in multiple samples are only queried once. The larger the input is, the less overlapping queries there are (on average), and therefore the number of queries (and the runtime) increases slightly.

To compile the test program, run make tests. Run the resulting ./tests file, and then run python generate_graphs.py to generate graphs as seen above.


Warnings

When using functions Nfa::accepts an property_test on literal strings (that is characters in between double quotes, e.g. "Hello world"), one must either convert the literals to std::strings explicitely or explicitely call the functions with the template argument Container = std::string, otherwise the trailing null character \0 is added to the literal, which makes the automaton reject.


property_test_regular's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.