Code Monkey home page Code Monkey logo

gkat's Introduction

GKAT Interpreter

This an student made interpreter of the model language GKAT. Currently, several tasks are supported:

Translating

Take in a GKAT expression, parse it and construct an automaton structure

Equivalence Checking

Normalize the automata obtained from above and check equivalence of two GKAT expressions using a Union-Find algorithm

Usage

Translating

First, a repl can directly show the resulting automaton:

make repl

In the repl, type in a GKAT expression, the repl returns the states and the test configuration of the automaton. Each state is named after the action is produces.

Moreover, the procedure below is an example of translation, and we show the correctness of the translation by feeding in atoms and checking the output actions. This is because the language denoted by GKAT satisfies the Determinacy Property

The procedure is done in Utop.

cd GKAT/
make
(* get the automata from a GKAT string *)
let (automata, test_config) = interp_expr "p1*p2*(p3 +b1 p4)*p5(b2)";;
(* design the sequence of atoms *)
let atom_list = [[("b1", true); ("b2", true)]; [("b1", true); ("b2", true)]; [("b1", false); ("b2", true)]; [("b1", true); ("b2", true)]; [("b1", true); ("b2", true)]; [("b1", true); ("b2", false)];];;
(* call function to output the actions *)
output_action_sequence automata atom_list;;

The function output_action_sequence that we use above has the type

output_action_sequence : Automata.automata -> Automata.atom list -> Ast.id list

it takes in a list of atoms, and outputs the determinated actions from the automaton. The output should be ["p1"; "p2"; "p4"; "p5"; "p5"].

Checking equivalence

The function check_equiv will take two GKAT strings, convert them to automata, normalize the automata, and then the use Union-Find algorithm to check their equivalence

make
check_equiv "p1*p2" "p1*p3";;

It will output "not equal"

gkat's People

Contributors

yc2454 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

l-z-7

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.