Skip to content
Snippets Groups Projects
Select Git revision
  • 6ba211de0472b83328db70c5a907e86477c4568b
  • main default protected
2 results

README.md

Blame
  • user avatar
    Antonio MATTAR authored
    6ba211de
    History

    Alligators-python

    About the project

    The main goal of the program is to generate the result of the beta_reduction of a lambda term given as an input and to show the images of the alligator's families that represents the lambda term and the different steps of it's beta_reduction. It also allows us to see how logical, boolean and arithmetic expressions are written in lambda calculus.

    Table of contents

    - The structures
    - What to install
    - How to install
    - Usage
    - Parsing syntax
    - Documentation
    - Project status and Contribution

    Structures

    Lambda terms are respresented by lists, the first element of the list is an indication to the type of the lambda term that it represents.
    Variable: [VAR, name]
    Abstraction: [ABS, input, output] input and output are also lambda terms
    Application: [APP, first_Term, second_Term] first_term and second_term are also lambda terms

    The JPEG images are already created, to build the image of a lambda term, we just have to concatenate the existing images and to colorate the alligators and eggs by random colors.

    What to install

    1. PIL library (used to generate images)
    2. PYFIGLET library(used to implement a new font)
    3. keyboard module (used to get an enter char)
    4. shutil module (manipulate directories)

    How to install

    • To install the needed tools, you have to use the following command:
      pip: -r requirements.txt

    Usage

    The program is very simple to use, these are some advices once we run the code:

    1. When you have to make a choice, click a button which is indicated, the code won't stop asking you to re-enter a choice until you press a right button.
    2. The lambda term that is given as an input has to respect some syntactic rules, you can find the rules in the section parsing syntax.
    3. When you choose an option in the menu, the images that could have been generated are stocked in a temporary directory which you are free to save or delete at the end.

    Parsing Syntax

    In order to parse a lambda term, we have to respect some rules:

    1. The lambda term has to be written in a single line.
    2. Represent the lambda by a hashtag '#'
    3. For the variable, the name of the variables cannnot contain spaces or it wont be considered a variable (it would be considered an application)
    4. For the abstraction, the input has to be written between the hashtag '#' and the point '.' which seperates the input from the output, then WITHOUT SPACE directly after the dot the output of the term should be written
    5. For the application, the first term has to be written between parantheses only if it is not a variable and then a SPACE seperates the first term from the second, which should be written between parantheses only if it is an application
      EXAMPLES:
      λx.x ---> #x.x
      λx.x λy.y ---> (#x.x) #y.y ( NOT #x.(x #y.y) )
      λf.(λx.(f(x x)))λx.(f(x x)) ---> #f.(#x.(#f.(x x)))c#f.(#x.(#f.(x x)))

    Documentation

    WikiPedia: Lambda Calculus Brilliant: Lambda Calculus MPSIB-CAMILLE-GUERIN: Lambda Calculus


    Authors and acknowledgment

    Authors:
    Antonio MATTAR Tamazouzt AIT ELJOUDI

    Under the supervision of:
    Dr. Benjamin MONMEGE Julie PARREAUX

    License

    GNU General Public License v3.0

    Project status

    The project development finished. However, If you want to contribute in this project, we did a small unfinished todo list:
    TO DO LIST:
    . Add a menu to choose the language of the program (English or French)
    . Add a menu to choose the quality of images generated by the program. (HIGH, MEDIUM, LOW)
    .Add an option to save the reduction as an animation with alligators eating and sound effects.
    .Add the possibility to deal with relative integers in the arithmetic operations. (NEED A GOOD KNOWLEDGE OF LAMBDA CALCULUS)