Run the following from the root dir:
docker-compose up
That should spin up each subservice. (NOTE: the backend
service will continually restart until the mysql
service has fully initialized.) Otherwise you can launch each service individually by:
-
Commenting out everything in
docker-compose.yml
except for:services: mysql: image: 'bitnami/mysql:latest' ports: - '3306:3306' environment: - ALLOW_EMPTY_PASSWORD=yes - MYSQL_USER=example - MYSQL_PASSWORD=example - MYSQL_DATABASE=example - MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password
Then launching the MySQL subservice via
docker-compose-up
. -
From within
/angular
runnpm i && npm i angular/cli -g
, thenng serve -o
to spin up the Angular frontend. -
From within
/backend
run:cd ml python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt python3 ml-conjunction.py python3 ml-disjunction.py python3 ml-implication.py python3 ml-negation.py python3 ml-nand.py
To generate the Machine Learning models.
-
Lastly, to start the backend service - from within
/backend
run:cd backend python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt python3 main.py
Generally speaking, the necessary config, settings, and commands are available within docker-compose.yml, backend dockerfile, frontend dockerfile, angular.json, and main.py, respectively. So, please make recourse to those if you encounter problems.
Will be exposed on:
- Docker:
http://localhost:4201
- Standalone:
http://localhost:4200
API endpoints are exposed through Docker or by running each subservice individually.
A test endpoint to verify that requests are getting through and the app is exposed correctly through Docker:
- Docker
http://localhost:5001/api/hello
- Standalone
http://localhost:5000/api/hello
Generates Boolean, bivalent, classical, logic results from Deep Learning Linear Regression models (it doesn't use in-built programmatic, native, Boolean clauses or Automated Theorem Proving techniques).
Also, inferences are included that exceed the standard Boolean operations (Material Conditional/Implication, Conjunction, Disjunction, Negation - for example: NAND).
This mirrors research into how one might try to teach a computer logic rather than just stipulate how logic works like we do within programming languages. Read more here.
-
Negation
- Supply sequences of
0,0
(False
) or1,1
(True
) - Will reject any invalid pair (e.g. -
1,0
,0,1
) - Each result will contain two parts with each entry in the first mapped to the result in the second by same index:
1,1
at indexi
will map tofalse
at indexi
.
- Docker:
POST http://localhost:5001/api/logic/negation?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
- Standalone:
POST http://localhost:5000/api/logic/negation?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
Response:
[ [ [ 1, 1 ], [ 0, 0 ], [ 1, 1 ], [ 0, 0 ] ], [ [ false, true, false, true ] ] ]
- Supply sequences of
-
Conjunction
- Supply sequences of
0,1
(left conjunctFalse
, right conjunctTrue
),1,1
(left conjunctTrue
, right conjunctTrue
),1,0
(left conjunctTrue
, right conjunctFalse
),0,0
(left conjunctFalse
, right conjunctFalse
). - Each result will contain two parts with each entry in the first mapped to the result in the second by same index:
1,1
at indexi
will map totrue
at indexi
.
- Docker
POST http://localhost:5001/api/logic/conjunction?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
- Standalone
POST http://localhost:5000/api/logic/conjunction?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
Response:
[ [ [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ], [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ] ], [ [ true, false, false, false, true, false, false, false ] ] ]
- Supply sequences of
-
Implication
- Supply sequences of
0,1
(antecedantFalse
, consequentTrue
),1,1
(antecedantTrue
, consequentTrue
),1,0
(antecedantTrue
, consequentFalse
),0,0
(antecedantFalse
, consequentFalse
). - Each result will contain two parts with each entry in the first mapped to the result in the second by same index:
1,0
at indexi
will map tofalse
at indexi
.
- Docker
POST http://localhost:5001/api/logic/implication?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
- Standalone
POST http://localhost:5000/api/logic/implication?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
Response:
[ [ [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ], [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ] ], [ [ true, true, false, true, true, true, false, true ] ] ]
- Supply sequences of
-
Disjunction
- Supply sequences of
0,1
(left conjunctFalse
, right conjunctTrue
),1,1
(left conjunctTrue
, right conjunctTrue
),1,0
(left conjunctTrue
, right conjunctFalse
),0,0
(left conjunctFalse
, right conjunctFalse
). - Each result will contain two parts with each entry in the first mapped to the result in the second by same index:
1,0
at indexi
will map totrue
at indexi
.
- Docker
POST http://localhost:5001/api/logic/disjunction?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
- Standalone
POST http://localhost:5000/api/logic/disjunction?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
Response:
[ [ [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ], [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ] ], [ [ true, false, true, true, true, false, true, true ] ] ]
- Supply sequences of
-
NAND
- Supply sequences of
0,1
(left conjunctFalse
, right conjunctTrue
),1,1
(left conjunctTrue
, right conjunctTrue
),1,0
(left conjunctTrue
, right conjunctFalse
),0,0
(left conjunctFalse
, right conjunctFalse
). - Each result will contain two parts with each entry in the first mapped to the result in the second by same index:
1,0
at indexi
will map totrue
at indexi
.
- Docker
POST http://localhost:5001/api/logic/nand?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
- Standalone
POST http://localhost:5000/api/logic/nand?test=1,1|0,0|1,0|0,1|1,1|0,0|1,0|0,1
Response:
[ [ [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ], [ 1, 1 ], [ 0, 0 ], [ 1, 0 ], [ 0, 1 ] ], [ [ false, true, true, true, false, true, true, true ] ] ]
- Supply sequences of
Supports RESTful CRUD (CREATE, READ, UPDATE, DELETE) operations against a backing MySQL DB.
Check out the Example SQL Domain entry.
-
Scan
- Retrieve all prepopulated entries from the MySQL DB.
- Docker
GET http://localhost:5001/api/db/examples
- Standalone
GET http://localhost:5000/api/db/examples
Response:
["{ id: 1, name: 'example_a' }","{ id: 2, name: 'example_b' }","{ id: 3, name: 'example_c' }","{ id: 4, name: 'example_d' }"]
-
Get One
- Retrieve one Example by ID.
- Docker
GET http://localhost:5001/api/db/example/1
- Standalone
GET http://localhost:5000/api/db/example/1
Response:
["{ id: 1, name: 'example_a' }"]
-
Create Example
- Create an Example with
form-data
. - Docker
POST http://localhost:5001/api/db/example
- Standalone
POST http://localhost:5000/api/db/example
Request Body
form-data
:name created
Response:
[ "{ id: 5, name: 'created' }" ]
- Create an Example with
-
Update Example
- Update an Example by ID
- Docker
PUT http://localhost:5001/api/db/example/1
- Standalone
PUT http://localhost:5000/api/db/example/1
- Docker
Request Body
form-data
:name updated
Response:
[ "{ id: 1, name: 'updated' }" ]
- Update an Example by ID
-
Delete Example
- Delete an Example by ID
- Docker
DELETE http://localhost:5001/api/db/example/1
- Standalone
DELETE http://localhost:5000/api/db/example/1
- Docker
Request Body
form-data
:name updated
Response:
[ "{ id: 1, name: 'updated' }" ]
- Delete an Example by ID