Last active
November 28, 2018 21:26
-
-
Save blrB/f4add3bef23ce2ac578331b2e83bed8f to your computer and use it in GitHub Desktop.
LOIS lab2 m4SCP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m4include(m4define([m4currentFile],builtin(translit,__file__,\,/))builtin(regexp,m4currentFile,.*[/],\&)_config.m4) | |
M4SCS( | |
#include "../include/sckp_keynodes.scsy" | |
// Location: /lib/transformation_implication | |
) | |
// Равносильное преобразования импликации. (A->B) <=> ((!A)\/B) | |
procedure(logics_transformation_implication,[[ | |
msg_start = /"TRANSFORMATION IMPLICATION PROCEDURE START!\n"/, | |
msg_finish = /"TRANSFORMATION IMPLICATION PROCEDURE FINISH!\n"/, | |
push_first_singlet = "/lib/chain/push_first_singlet/chain_push_first_singlet", | |
push_singlet = "/lib/chain/push_singlet/chain_push_singlet", | |
get_next_singlet = "/lib/chain/get_next_singlet/chain_get_next_singlet", | |
reverse_msg_get_subformula_A = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: get subformula A\n"/, | |
reverse_msg_get_subformula_B = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: get subformula B\n"/, | |
reverse_msg_generation = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: generation new formula\n"/, | |
reverse_msg_have_next = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: have next\n"/, | |
read_param_then = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: read param then\n"/, | |
read_param_else = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: read param else\n"/, | |
read_param_then_in = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: read param in then\n"/, | |
read_param_else_in = /"TRANSFORMATION IMPLICATION PROCEDURE[info]: read param in else\n"/, | |
atom, | |
all, | |
exist, | |
alternative, | |
equivalence, | |
implication, | |
conjunction, | |
disjunction, | |
negotiation, | |
prm1,prm2,prm3,prm4,prm5,prm3_1,prm3_2,prm3_3,prm4_1,prm4_2,prm4_3, | |
reverse_prm1,reverse_prm2,reverse_prm3,reverse_prm4,reverse_prm5,reverse_prm6,reverse_prm7,reverse_prm8,reverse_prm9,reverse_prm10 | |
]], | |
[{ | |
empty, | |
chain_next, | |
el_next, | |
chain_formula, | |
answer, | |
subformula, | |
subformula_A, | |
subformula_B, | |
parameters_next, | |
then, | |
else, | |
then_routine, | |
then_parameters, | |
else_routine, | |
else_parameters, | |
state, | |
true, | |
stack, | |
parameters, | |
logger, | |
descr | |
}], | |
{[ | |
1_: in_: out_: state, | |
2_: in_: out_: true, | |
3_: in_: out_: stack, | |
4_: in_: parameters, | |
5_: in_: logger | |
]}) | |
// START *********************************************************************************************** START | |
M4SCS( | |
print([1_: fixed_: msg_start]) | |
) | |
genEl([1_: assign_: const_: undf_: empty]) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm1=[{1_: stack, 2_: chain_next, 3_: chain_formula}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
M4SCS( | |
print([1_: fixed_: read_param_then]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm3=[{1_: parameters, 2_: parameters_next, 3_: then}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([ | |
1_: then | |
],,transformation_implication_start) | |
M4SCS( | |
print([1_: fixed_: read_param_else]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm4=[{1_: parameters_next, 2_: parameters_next, 3_: else}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
// --------------------------------- --------------------------------- --------------------------------- | |
label(transformation_implication_start) | |
ifVarAssign([ | |
1_: chain_formula | |
], ,chain_error) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: reverse_prm1=[{1_: chain_formula, 2_: chain_next, 3_: el_next}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: el_next],,chain_error) | |
ifCoin([1_: fixed_: el_next, | |
2_: fixed_: implication],,chain_error) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: reverse_prm2=[{1_: chain_next, 2_: chain_next, 3_: subformula_A}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
M4SCS( | |
print([1_: fixed_: reverse_msg_get_subformula_A]) | |
) | |
ifVarAssign([1_: subformula_A],,chain_error) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: reverse_prm3=[{1_: chain_next, 2_: chain_next, 3_: subformula_B}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
M4SCS( | |
print([1_: fixed_: reverse_msg_get_subformula_B]) | |
) | |
ifVarAssign([1_: subformula_B],,chain_error) | |
M4SCS( | |
print([1_: fixed_: reverse_msg_generation]) | |
) | |
// (implication,A,B) <=> (disjunction, (negotiation,A), B) --------------------------------- GENERATION | |
call([1_: fixed_: push_first_singlet, | |
2_: fixed_: reverse_prm4=[{1_: subformula_B, 2_: answer, 3_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
// --- | |
call([1_: fixed_: push_first_singlet, | |
2_: fixed_: reverse_prm5=[{1_: subformula_A, 2_: subformula, 3_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: reverse_prm6=[{1_: subformula, 2_: negotiation, 3_: subformula, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: reverse_prm7=[{1_: answer, 2_: subformula, 3_: answer, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
// --- | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: reverse_prm8=[{1_: answer, 2_: disjunction, 3_: answer, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
label(transformation_implication_exit) | |
// --------------------------------- --------------------------------- --------------------------------- | |
ifVarAssign([ | |
1_: answer | |
],,chain_error) | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: prm2=[{1_: stack, 2_: answer, 3_: stack, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
// THEN *********************************************************************************************** THEN | |
M4SCS( | |
print([1_: fixed_: read_param_then_in]) | |
) | |
ifVarAssign([ | |
1_: then | |
],,finish) | |
M4SCS( | |
print([1_: fixed_: read_param_then_in]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prmg3_1 = [{1_: then, 2_: then, 3_: then_routine}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
ifVarAssign([ | |
1_: then_routine | |
],,set_state_true) | |
M4SCS( | |
print([1_: fixed_: read_param_then_in]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prmg3_2 = [{1_: then, 2_: then, 3_: then_parameters}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
ifVarAssign([ | |
1_: then_parameters | |
], then_parameters_is_not_empty) | |
varAssign([ | |
1_: assign_: then_parameters, | |
2_: fixed_: empty | |
]) | |
label(then_parameters_is_not_empty) | |
ifCoin([ | |
1_: then_routine, | |
2_: then_parameters | |
], set_state_true) | |
call([1_: fixed_: then_routine, | |
2_: fixed_: prmr3_3 = [{1_: state, 2_: true, 3_: stack, 4_: then_parameters, 5_: logging}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
label(set_state_true) | |
varAssign([ | |
1_: assign_: state, | |
2_: fixed_: true | |
],finish,finish) | |
// ELSE *********************************************************************************************** ELSE | |
label(chain_error) | |
M4SCS( | |
print([1_: fixed_: read_param_else_in]) | |
) | |
ifVarAssign([ | |
1_: else | |
],,finish) | |
M4SCS( | |
print([1_: fixed_: read_param_else_in]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prmg4_1 = [{1_: else, 2_: else, 3_: else_routine}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
ifVarAssign([ | |
1_: else_routine | |
],,finish) | |
M4SCS( | |
print([1_: fixed_: read_param_else_in]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prmg4_2 = [{1_: else, 2_: else, 3_: else_parameters}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
ifVarAssign([ | |
1_: else_parameters | |
], else_parameters_is_not_empty) | |
varAssign([ | |
1_: assign_: else_parameters, | |
2_: fixed_: empty | |
]) | |
label(else_parameters_is_not_empty) | |
ifCoin([ | |
1_: else_routine, | |
2_: else_parameters | |
], finish) | |
call([1_: fixed_: else_routine, | |
2_: fixed_: prmr4_3 = [{1_: state, 2_: true, 3_: stack, 4_: else_parameters, 5_: logging}], | |
3_: assign_: descr]) | |
waitReturn([1_: fixed_: descr]) | |
// FINISH *********************************************************************************************** FINISH | |
label(finish) | |
M4SCS( | |
print([1_: fixed_: msg_finish]) | |
) | |
eraseEl([1_: f_: fixed_: empty]) | |
return([]) | |
end() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m4include(m4define([m4currentFile],builtin(translit,__file__,\,/))builtin(regexp,m4currentFile,.*[/],\&)_config.m4) | |
M4SCS( | |
#include "../../include/sckp_keynodes.scsy" | |
// Location: /lib/test/transformation_implication | |
) | |
// Тест равносильного преобразования импликации. (A->B) <=> ((!A)\/B) | |
procedure(test_transformation_implication,[[ | |
msg_start = /"TEST transformation_implication PROCEDURE START!\n"/, | |
msg_call = /"TEST transformation_implication PROCEDURE CALL!\n"/, | |
msg_call_finish = /"TEST transformation_implication PROCEDURE CALL FINISH!\n"/, | |
msg_finish = /"TEST transformation_implication PROCEDURE FINISH!\n"/, | |
msg_finish_ok = /"TEST FINISH OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"/, | |
push_first_singlet = "/lib/chain/push_first_singlet/chain_push_first_singlet", | |
push_singlet = "/lib/chain/push_singlet/chain_push_singlet", | |
get_next_singlet = "/lib/chain/get_next_singlet/chain_get_next_singlet", | |
transformation_implication = "/lib/transformation_implication/logics_transformation_implication", | |
atom, | |
all, | |
exist, | |
alternative, | |
equivalence, | |
implication, | |
conjunction, | |
disjunction, | |
negotiation, | |
prm_try_0, prm_try_1, prm_try_2, prm_try_3, prm_try_4, prm_try_5, prm_try_6, | |
prm1,prm2,prm3,prm4,prm5,prm6; | |
]], | |
[{ | |
new_formula, | |
new_subformula, | |
empty, | |
state, | |
true, | |
stack, | |
parameters, | |
el_next, | |
chain_head, | |
logger, | |
el_1, | |
chain_1, | |
el_2, | |
chain_2, | |
el_head, | |
descr | |
}], | |
{[ | |
]}) | |
M4SCS( | |
print([1_: fixed_: msg_start]) | |
) | |
genEl([1_: assign_: const_: undf_: logger]) | |
genEl([1_: assign_: const_: undf_: el_1]) | |
genEl([1_: assign_: const_: undf_: el_2]) | |
genEl([1_: assign_: const_: undf_: el_head]) | |
genEl([1_: assign_: const_: undf_: empty]) | |
call([1_: fixed_: push_first_singlet, | |
2_: fixed_: prm1=[{1_: el_1, 2_: chain_1, 3_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: prm2=[{1_: chain_1, 2_: el_2, 3_: chain_2, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
call([1_: fixed_: push_singlet, | |
2_: fixed_: prm3=[{1_: chain_2, 2_: implication, 3_: chain_head, 4_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
genEl([1_: assign_: const_: undf_: state]) | |
genEl([1_: assign_: const_: undf_: true]) | |
call([1_: fixed_: push_first_singlet, | |
2_: fixed_: prm4=[{1_: chain_head, 2_: stack, 3_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
genEl([1_: assign_: const_: undf_: parameters]) | |
M4SCS( | |
print([1_: fixed_: msg_call]) | |
) | |
call([1_: fixed_: transformation_implication, | |
2_: fixed_: prm5=[{1_: state, 2_: true, 3_: stack, 4_: parameters: 5_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
M4SCS( | |
print([1_: fixed_: msg_call_finish]) | |
) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_0=[{1_: stack, 2_: stack, 3_: new_formula}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_1=[{1_: new_formula, 2_: new_formula, 3_: el_next}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: el_next],,finish) | |
ifCoin([1_: fixed_: el_next, | |
2_: fixed_: disjunction],,finish) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_2=[{1_: new_formula, 2_: new_formula, 3_: new_subformula}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: new_subformula],,finish) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_3=[{1_: new_subformula, 2_: new_subformula, 3_: el_next}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: el_next],,finish) | |
ifCoin([1_: fixed_: el_next, | |
2_: fixed_: negotiation],,finish) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_4=[{1_: new_subformula, 2_: new_subformula, 3_: el_next}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: el_next],,finish) | |
ifCoin([1_: fixed_: el_next, | |
2_: fixed_: el_2],,finish) | |
call([1_: fixed_: get_next_singlet, | |
2_: fixed_: prm_try_5=[{1_: new_formula, 2_: new_formula, 3_: el_next}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
ifVarAssign([1_: el_next],,finish) | |
ifCoin([1_: fixed_: el_next, | |
2_: fixed_: el_1],,finish) | |
M4SCS( | |
print([1_: fixed_: msg_finish_ok]) | |
) | |
M4SCS( | |
print([1_: fixed_: msg_call]) | |
) | |
call([1_: fixed_: transformation_implication, | |
2_: fixed_: prm6=[{1_: state, 2_: true, 3_: empty, 4_: parameters: 5_: logger}], | |
3_: assign_: descr]) | |
waitReturn(1_: fixed_: descr) | |
M4SCS( | |
print([1_: fixed_: msg_call_finish]) | |
) | |
label(finish) | |
M4SCS( | |
print([1_: fixed_: msg_finish]) | |
) | |
eraseEl([1_: f_: fixed_: logger]) | |
return([]) | |
end() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom = "/proc/keynode/atom"; | |
all = "/proc/keynode/all"; | |
exist = "/proc/keynode/exist"; | |
alternative = "/proc/keynode/alternative"; | |
equivalence = "/proc/keynode/equivalence"; | |
implication = "/proc/keynode/implication"; | |
conjunction = "/proc/keynode/conjunction"; | |
disjunction = "/proc/keynode/disjunction"; | |
negotiation = "/proc/keynode/negotiation"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Location: /logic_sc/keynode/ | |
@node, @const -> atom; | |
@node, @const -> all; | |
@node, @const -> exist; | |
@node, @const -> alternative; | |
@node, @const -> equivalence; | |
@node, @const -> implication; | |
@node, @const -> conjunction; | |
@node, @const -> disjunction; | |
@node, @const -> negotiation; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment