Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.85 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.
  156.  
  157.  
  158. negel(A, B, C, Proof) :-
  159. A < C,
  160. B < C,
  161.  
  162. get_rule(C, Proof, Rule),
  163. Rule = negel(A, B),
  164.  
  165. get_prop(A, Proof, PropA),
  166. get_prop(B, Proof, PropB),
  167. get_prop(C, Proof, PropC),
  168.  
  169. get_pred_of_prop(PropB, PredB),
  170. get_pred_l(PredB, PredLeftB),
  171.  
  172. PropA = PredLeftB,
  173. PropC = cont.
  174.  
  175. contel(A, B, Proof) :-
  176. A < B,
  177.  
  178. get_rule(B, Proof, Rule),
  179. Rule = contel(A),
  180.  
  181. get_prop(A, Proof, PropA),
  182.  
  183. PropA = cont.
  184.  
  185. negnegint(A, B, Proof) :-
  186. A < B,
  187.  
  188. get_rule(B, Proof, Rule),
  189. Rule = negnegint(A),
  190.  
  191. get_prop(A, Proof, PropA),
  192. get_prop(B, Proof, PropB),
  193.  
  194. get_pred_of_prop(PropB, PredB),
  195. get_pred_l(PredB, PredLeftB),
  196. get_pred_of_prop(PredLeftB, PredBB),
  197. get_pred_l(PredBB, PredLeftBB),
  198.  
  199. PropA = PredLeftBB.
  200.  
  201. negnegel(A, B, Proof) :-
  202. A < B,
  203.  
  204. get_rule(B, Proof, Rule),
  205. Rule = negnegel(A),
  206.  
  207. get_prop(A, Proof, PropA),
  208. get_prop(B, Proof, PropB),
  209.  
  210. get_pred_of_prop(PropA, PredA),
  211. get_pred_l(PredA, PredLeftA),
  212. get_pred_of_prop(PredLeftA, PredAA),
  213. get_pred_l(PredAA, PredLeftAA),
  214.  
  215. PropB = PredLeftAA.
  216.  
  217. mt(A, B, C, Proof) :-
  218. A < C,
  219. B < C,
  220.  
  221. get_rule(C, Proof, Rule),
  222. Rule = mt(A, B),
  223.  
  224. get_prop(A, Proof, PropA),
  225. get_prop(B, Proof, PropB),
  226. get_prop(C, Proof, PropC),
  227.  
  228. get_pred_of_prop(PropA, PredA),
  229. get_pred_l(PredA, PredLeftA),
  230. get_pred_r(PredA, PredRightA),
  231.  
  232. neg(PredLeftA) = PropC,
  233. neg(PredRightA) = PropB.
  234.  
  235. pbc(A, B, C, Proof) :-
  236. A < B,
  237. B < C,
  238.  
  239. get_rule(C, Proof, Rule),
  240. Rule = pcb(A, B),
  241.  
  242. get_prop(A, Proof, PropA),
  243. get_prop(B, Proof, PropB),
  244. get_prop(C, Proof, PropC),
  245.  
  246. get_pred_of_prop(PropA, PredA),
  247. get_pred_l(PredA, PredLeftA),
  248.  
  249.  
  250. neg(PredLeftA) = PropC,
  251. cont = PropB.
  252.  
  253. lem(A, Proof) :-
  254. get_rule(A, Proof, Rule),
  255. Rule = lem,
  256.  
  257. get_prop(A, Proof, PropA),
  258.  
  259. get_pred_of_prop(PropA, PredA),
  260. get_pred_l(PredA, PredLeftA),
  261. get_pred_r(PredA, PredRightA),
  262.  
  263. neg(PredLeftA) = PredRightA,
  264. PropA = and(PredLeftA, PredRightA).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement