Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. copy(A, B, Proof) :- %If all true, copy rule is true.
  2. A < B, %Row copied to is higher than row copied from.
  3.  
  4. get_rule(B, Proof, Rule), %Get rule of row copied to.
  5. Rule = copy(A), %Check that the rule is equal to copy of row A.
  6.  
  7. get_prop(A, Proof, PropA), %Get proposition of row being copied from.
  8. get_prop(B, Proof, PropB), %Get proposition of row being copied to.
  9.  
  10. PropA = PropB. %Are the proposition of the rows equal to each other.
  11. %__ADD FUNCTIONALLITY OF BOXES__
  12.  
  13. andint(A, B, C, Proof) :- %If all true, copy rule is true.
  14. A < C, %Left conjunction cannot be on a row after the row with the andint rule.
  15. B < C, %Right conjunction cannot be on a row after the row with the andint rule.
  16.  
  17. get_rule(C, Proof, Rule), %Get rule of row being introducted an and.
  18. Rule = andint(A, B), %Check that the rule is equal to andint of row A and B.
  19.  
  20. get_prop(A, Proof, PropA), %Get proposition of row being andint:ed from on the left conjunction.
  21. get_prop(B, Proof, PropB), %Get proposition of row being andint:ed from on the right conjunction.
  22. get_prop(C, Proof, PropC), %Get proposition of row being andint:ed to.
  23.  
  24. and(PropA, PropB) = PropC. %Check that the and of PropA and PropB is the same as PropC.
  25.  
  26. andel1(A, B, Proof) :- %If all true, andel1 rule is true.
  27. A < B, %Row copied to is higher than row copied from.
  28.  
  29. get_rule(B, Proof, Rule), %Get rule of row copied to.
  30. Rule = andel1(A), %Check that the rule is equal to andel1 of row A.
  31.  
  32. get_prop(A, Proof, PropA), %Get proposition of row being copied from.
  33. get_prop(B, Proof, PropB), %Get proposition of row being copied to.
  34.  
  35. get_pred_of_prop(PropA, PredA), %Get predicate of row being andel1:ed from.
  36. get_pred_l(PredA, PredLeftA), %Get the left conjunction of the predicate (left predicate).
  37.  
  38. PredLeftA = PropB. %Check that the left predicate of the conjunction is the same as the prop of PropB
  39.  
  40. andel2(A, B, Proof) :- %If all true, andel2 rule is true.
  41. A < B, %Row copied to is higher than row copied from.
  42.  
  43. get_rule(B, Proof, Rule), %Get rule of row copied to.
  44. Rule = andel2(A), %Check that the rule is equal to andel2 of row A.
  45.  
  46. get_prop(A, Proof, PropA), %Get proposition of row being copied from.
  47. get_prop(B, Proof, PropB), %Get proposition of row being copied to.
  48.  
  49. get_pred_of_prop(PropA, PredA), %Get predicate of row being andel1:ed from.
  50. get_pred_r(PredA, PredRightA), %Get the right conjunction of the predicate (right predicate).
  51.  
  52. PredRightA = PropB. %Check that the right predicate of the conjunction is the same as the prop of PropB
  53.  
  54. orint1(A, B, C, Proof) :- %If all true, andel2 rule is true.
  55. A < C, %Row copied to is higher than row copied from.
  56. B < C,
  57.  
  58. get_rule(C, Proof, Rule), %Get rule of row copied to.
  59. Rule = orint1(A, B), %Check that the rule is equal to or of row A.
  60.  
  61. get_prop(A, Proof, PropA), %Get proposition of row being copied from.
  62. get_prop(C, Proof, PropC), %Get proposition of row being copied to.
  63.  
  64. get_pred_of_prop(PropC, PredC), %Get predicate of row being orint1:ed from.
  65. get_pred_l(PredC, PredLeftC), %Get the left conjunction of the predicate (right predicate).
  66.  
  67. PredLeftC = PropA. %Check that the right predicate of the conjunction is the same as the prop of PropB
  68.  
  69. orint2(A, B, C, Proof) :- %If all true, andel2 rule is true.
  70. A < C,
  71. B < C,
  72. %Row copied to is higher than row copied from.
  73.  
  74. get_rule(C, Proof, Rule), %Get rule of row copied to.
  75. Rule = orint2(A, B), %Check that the rule is equal to or of row A.
  76.  
  77. get_prop(B, Proof, PropB), %Get proposition of row being copied from.
  78. get_prop(C, Proof, PropC), %Get proposition of row being copied to.
  79.  
  80. get_pred_of_prop(PropC, PredC), %Get predicate of row being orint1:ed from.
  81. get_pred_r(PredC, PredRightC), %Get the left conjunction of the predicate (right predicate).
  82.  
  83. PredRightC = PropB. %Check that the right predicate of the conjunction is the same as the prop of PropB
  84.  
  85. orel(X, A, B, C, D, E, Proof) :-
  86. A < B,
  87. C < D,
  88. B < E,
  89. D < E,
  90. X < E,
  91.  
  92. get_rule(E, Proof, Rule),
  93. Rule = orel(X, A, B, C, D),
  94.  
  95. get_prop(B, Proof, PropB),
  96. get_prop(D, Proof, PropD),
  97.  
  98. PropB = PropD.
  99. %__ADD FUNCTIONALLITY OF BOXES__
  100.  
  101. impint(A, B, C, Proof) :-
  102. A < B,
  103. A < C,
  104. B < C,
  105.  
  106. get_rule(C, Proof, Rule),
  107. Rule = impint(A, B),
  108.  
  109. get_prop(A, Proof, PropA),
  110. get_prop(B, Proof, PropB),
  111. get_prop(C, Proof, PropC),
  112.  
  113. get_pred_of_prop(PropC, PredC),
  114. get_pred_l(PredC, PredLeftC),
  115. get_pred_r(PredC, PredRightC),
  116.  
  117. PropA = PredLeftC,
  118. PropB = PredRightC.
  119.  
  120.  
  121. impel(A, B, C, Proof) :-
  122. A < C,
  123. B < C,
  124.  
  125. get_rule(C, Proof, Rule),
  126. Rule = impel(A, B),
  127.  
  128. get_prop(A, Proof, PropA),
  129. get_prop(B, Proof, PropB),
  130. get_prop(C, Proof, PropC),
  131.  
  132. get_pred_of_prop(PropB, PredB),
  133. get_pred_l(PredB, PredLeftB),
  134. get_pred_r(PredB, PredRightB),
  135.  
  136. PropA = PredLeftB,
  137. PropC = PredRightB.
  138.  
  139. negint(A, B, C, Proof) :-
  140. A < B,
  141. A < C,
  142. B < C,
  143.  
  144. get_rule(C, Proof, Rule),
  145. Rule = negint(A, B),
  146.  
  147. get_prop(A, Proof, PropA),
  148. get_prop(B, Proof, PropB),
  149. get_prop(C, Proof, PropC),
  150.  
  151. get_pred_of_prop(PropC, PredC),
  152. get_pred_l(PredC, PredLeftC),
  153.  
  154. PropA = PredLeftC,
  155. PropB = cont.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement