|
47 | 47 | :conclusion CL
|
48 | 48 | )
|
49 | 49 |
|
50 |
| -;TODO |
| 50 | +;;;;;;;;;;;;;;;;;;;;;;; |
| 51 | +; Rule 6: th_resolution |
| 52 | +;;;;;;;;;;;;;;;;;;;;;;; |
| 53 | +; TODO |
51 | 54 | (program check_resolution ((Cs Bool) (CL Bool))
|
52 | 55 | (Bool Bool) Bool
|
53 | 56 | (
|
54 | 57 | ((check_resolution Cs CL) true)
|
55 | 58 | )
|
56 | 59 | )
|
57 | 60 |
|
58 |
| -;TRUST |
59 |
| -(declare-rule th_resolution ((Cs Bool) (CL Bool)) |
| 61 | +(declare-rule th_resolution ((Cs Bool)) |
60 | 62 | :premise-list Cs and
|
61 |
| - :args (CL) |
62 |
| - :requires (((check_resolution Cs CL) true)) |
63 |
| - :conclusion CL |
| 63 | + :requires (((check_resolution Cs eo::conclusion) true)) |
| 64 | + :conclusion-given |
64 | 65 | )
|
65 | 66 |
|
| 67 | +;;;;;;;;;;;;;;;;;;;;;;; |
| 68 | +; Rule 7: resolution |
| 69 | +;;;;;;;;;;;;;;;;;;;;;;; |
| 70 | + |
66 | 71 | ;TRUST
|
67 | 72 | (declare-rule resolution ((Cs Bool))
|
68 | 73 | :premise-list Cs and
|
|
442 | 447 | (program check_and ((premise Bool) (premise_non_cl Bool) (index Int) (conclusion Bool))
|
443 | 448 | (Bool Int Bool) Bool
|
444 | 449 | (((check_and premise index conclusion)
|
445 |
| - (cl_equal (to_cl (index_list and (from_cl premise) index)) |
| 450 | + (cl_equal (to_cl (f_list_index and (from_cl premise) index)) |
446 | 451 | conclusion))
|
447 | 452 | )
|
448 | 453 | )
|
|
491 | 496 | (check_not_or premise_non_cl index conclusion))
|
492 | 497 |
|
493 | 498 | ((check_not_or (not disjuncts) index conclusion)
|
494 |
| - (cl_equal (to_cl (not (index_list or disjuncts index))) |
| 499 | + (cl_equal (to_cl (not (f_list_index or disjuncts index))) |
495 | 500 | conclusion))
|
496 | 501 | )
|
497 | 502 | )
|
|
570 | 575 | (program check_not_and ((conjunction Bool) (conclusion Bool))
|
571 | 576 | (Bool Bool) Bool
|
572 | 577 | (((check_not_and (not conjunction) conclusion)
|
573 |
| - (cl_equal (transform_not_and conjunction) conclusion) |
| 578 | + (cl_equal (de_morgan_not_and conjunction) conclusion) |
574 | 579 | )
|
575 | 580 | )
|
576 | 581 | )
|
|
877 | 882 | (Int Bool) Bool
|
878 | 883 | (
|
879 | 884 | ((check_and_pos pos (@cl (not antecedent) consequent))
|
880 |
| - (cl_equal (index_list and antecedent pos) consequent)) |
| 885 | + (cl_equal (f_list_index and antecedent pos) consequent)) |
881 | 886 |
|
882 | 887 | ;; To simplify the use of the checker
|
883 | 888 | ((check_and_pos pos (@cl consequent (not antecedent)))
|
884 |
| - (cl_equal (index_list and antecedent pos) consequent)) |
| 889 | + (cl_equal (f_list_index and antecedent pos) consequent)) |
885 | 890 | )
|
886 | 891 | )
|
887 | 892 |
|
|
919 | 924 | (Bool) Bool
|
920 | 925 | (
|
921 | 926 | ((check_and_neg (@cl left_disjunct right_disjunct))
|
922 |
| - (cl_equal (transform_not_and left_disjunct) |
| 927 | + (cl_equal (de_morgan_not_and left_disjunct) |
923 | 928 | right_disjunct))
|
924 | 929 | )
|
925 | 930 | )
|
|
970 | 975 | (Int Bool) Bool
|
971 | 976 | (
|
972 | 977 | ((check_or_neg index (@cl left_disjunct (not right_disjunct)))
|
973 |
| - (prop_syntax_eq (index_list or left_disjunct index) right_disjunct)) |
| 978 | + (prop_syntax_eq (f_list_index or left_disjunct index) right_disjunct)) |
974 | 979 |
|
975 | 980 | ((check_or_neg index (@cl (not left_disjunct) right_disjunct))
|
976 |
| - (prop_syntax_eq right_disjunct (index_list or left_disjunct index))) |
| 981 | + (prop_syntax_eq right_disjunct (f_list_index or left_disjunct index))) |
977 | 982 | )
|
978 | 983 | )
|
979 | 984 |
|
|
1632 | 1637 | )
|
1633 | 1638 |
|
1634 | 1639 | ;TODO
|
1635 |
| -(program check_prod_simplify ((l Bool) (r Bool)) |
1636 |
| - (Bool Bool) Bool |
| 1640 | +(program check_prod_simplify ((conclusion Bool)) |
| 1641 | + (Bool) Bool |
1637 | 1642 | (
|
1638 |
| - ((check_prod_simplify l r) true) |
| 1643 | + ((check_prod_simplify conclusion) true) |
1639 | 1644 | )
|
1640 | 1645 | )
|
1641 | 1646 |
|
1642 | 1647 | ;TRUST
|
1643 |
| -(declare-rule prod_simplify ((l Bool) (r Bool)) |
1644 |
| - :args ((@cl (= l r))) |
1645 |
| - :requires (((check_prod_simplify l r) true)) |
1646 |
| - :conclusion (@cl (= l r)) |
| 1648 | +(declare-rule prod_simplify () |
| 1649 | + :requires (((check_prod_simplify eo::conclusion) true)) |
| 1650 | + :conclusion-given |
1647 | 1651 | )
|
1648 | 1652 |
|
1649 | 1653 | ;TODO
|
|
1731 | 1735 | :conclusion-given
|
1732 | 1736 | )
|
1733 | 1737 |
|
1734 |
| -;TODO |
1735 |
| -(program check_distinct_elim ((l Bool) (r Bool)) |
| 1738 | +;;;;;;;;;;;;;;;;;;;;;;;; |
| 1739 | +; Rule 93: distinct_elim |
| 1740 | +;;;;;;;;;;;;;;;;;;;;;;;; |
| 1741 | + |
| 1742 | +; program: build_distinct_list_single_elem |
| 1743 | +; args: |
| 1744 | +; - lhs Bool: |
| 1745 | +; - distinct_list Bool: a distinct-list |
| 1746 | +; return: |
| 1747 | +(program build_distinct_list_single_elem ((lhs Bool) (hd Bool) (tail Bool)) |
1736 | 1748 | (Bool Bool) Bool
|
1737 | 1749 | (
|
1738 |
| - ((check_distinct_elim l r) true) |
| 1750 | + ((build_distinct_list_single_elem lhs (distinct Bool hd tail)) |
| 1751 | + (and (not (= lhs hd)) |
| 1752 | + (build_distinct_list_single_elem lhs (distinct Bool tail)))) |
| 1753 | + |
| 1754 | + ; { hd is single element distinct-list } |
| 1755 | + ((build_distinct_list_single_elem lhs (distinct Bool hd)) |
| 1756 | + (not (= lhs hd))) |
1739 | 1757 | )
|
1740 | 1758 | )
|
1741 | 1759 |
|
1742 |
| -;TRUST |
1743 |
| -(declare-rule distinct_elim ((l Bool) (r Bool)) |
1744 |
| - :args ((@cl (= l r))) |
1745 |
| - :requires (((check_distinct_elim l r) true)) |
1746 |
| - :conclusion (@cl (= l r)) |
| 1760 | +; program: check_distinct_elim |
| 1761 | +; args: |
| 1762 | +; - l Bool: |
| 1763 | +; - r Bool: |
| 1764 | +; return: |
| 1765 | +(program build_distinct_list_full_list ((lhs Bool) (rhs Bool) (tl Bool :list)) |
| 1766 | + (Bool) Bool |
| 1767 | + ( |
| 1768 | + ((build_distinct_list_full_list (and (distinct lhs rhs) tl |
| 1769 | + )) |
| 1770 | + (and (not (= lhs rhs)) |
| 1771 | + (build_distinct_list_full_list tl))) |
| 1772 | + |
| 1773 | + ; Only one proposition |
| 1774 | + ((build_distinct_list_full_list (distinct lhs rhs)) (not (= lhs rhs))) |
| 1775 | + |
| 1776 | + ; Only one proposition |
| 1777 | + ((build_distinct_list_full_list (distinct lhs)) true) |
| 1778 | + |
| 1779 | + ((build_distinct_list_full_list true) true) |
| 1780 | + ) |
1747 | 1781 | )
|
1748 | 1782 |
|
1749 |
| -;;;;;;;;;;;;;;;;;; |
1750 |
| -; Rule 94: and_neg |
1751 |
| -;;;;;;;;;;;;;;;;;; |
| 1783 | +(program check_distinct_elim ((hd Bool) (tl Bool) (conjunctions Bool)) |
| 1784 | + (Bool) Bool |
| 1785 | + ( |
| 1786 | + ((check_distinct_elim (@cl (= (distinct Bool hd tl) conjunctions))) |
| 1787 | + ;; (f_list_equal and |
| 1788 | + (build_distinct_list_full_list (distinct Bool hd tl)) |
| 1789 | + ;; conjunctions) |
| 1790 | + ) |
| 1791 | + |
| 1792 | + ; Only one proposition |
| 1793 | + ((check_distinct_elim (@cl (= (distinct Bool hd) true))) true) |
| 1794 | + ) |
| 1795 | +) |
| 1796 | + |
| 1797 | +; rule: distinct_elim |
| 1798 | +; implements: TODO? |
| 1799 | +; premises: |
| 1800 | +; - distinct_elim nil: |
| 1801 | +; args: |
| 1802 | +; requires: |
| 1803 | +; conclusion: |
| 1804 | +(declare-rule distinct_elim () |
| 1805 | + :requires (((check_distinct_elim eo::conclusion) true)) |
| 1806 | + :conclusion-given |
| 1807 | +) |
| 1808 | + |
| 1809 | +;;;;;;;;;;;;;;;;;;; |
| 1810 | +; Rule 94: la_rw_eq |
| 1811 | +;;;;;;;;;;;;;;;;;;; |
1752 | 1812 |
|
1753 | 1813 | ; program: check_la_rw_eq
|
1754 | 1814 | ; args:
|
1755 |
| -; - t Real: |
1756 |
| -; - u Real: |
1757 |
| -; return: |
| 1815 | +; - conclusion Bool: > |
| 1816 | +; The conclusion provided to the la_rw_eq rule. Must be build with @cl. |
| 1817 | +; return: > |
| 1818 | +; A boolean indicating if "conclusion" is a clause of the form |
| 1819 | +; (= (= t u) (and (<= t u) (<= u t))), for some numbers t and u. |
1758 | 1820 | (program check_la_rw_eq ((t Real) (u Real))
|
1759 | 1821 | (Bool) Bool
|
1760 | 1822 | (
|
|
1765 | 1827 | ; TODO: other number types. Can the equality be flipped?
|
1766 | 1828 | ; rule: la_rw_eq
|
1767 | 1829 | ; implements: TODO?
|
1768 |
| -; requires: |
| 1830 | +; requires: > |
| 1831 | +; Requires for the conclusion to be a clause of the form |
| 1832 | +; (= (= t u) (and (<= t u) (<= u t))), for some numbers t and u. |
1769 | 1833 | ; conclusion-given: >
|
1770 | 1834 | ; Only the "requires" predicate checks if a proper conclusion is given.
|
1771 | 1835 | (declare-rule la_rw_eq ()
|
|
0 commit comments