branch | isac-update-Isa09-2 |
changeset 38031 | 460c24a6a6ba |
parent 37991 | 028442673981 |
child 38034 | 928cebc9c4aa |
38030:95d956108461 | 38031:460c24a6a6ba |
---|---|
66 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
66 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
67 print("\n\n********************* rational.sml - TESTS *************************\n\n"); |
67 print("\n\n********************* rational.sml - TESTS *************************\n\n"); |
68 print("\n\n***** divide tests *****\n"); |
68 print("\n\n***** divide tests *****\n"); |
69 val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_))); |
69 val mv_pquot1 = (#1(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_))); |
70 (* result: [(1,[0,0,1]),(1,[0,0,0])] *) |
70 (* result: [(1,[0,0,1]),(1,[0,0,0])] *) |
71 if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed"); |
71 if mv_pquot1=[(1,[0,0,1]),(1,[0,0,0])] then () else error ("rational.sml: example failed"); |
72 |
72 |
73 val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_))); |
73 val mv_prest1 = (#2(mv_division([(1,[1,1,1]),(1,[1,1,0]),(1,[1,0,1]),(1,[0,0,0])],[(1,[1,1,0]),(1,[0,0,0])],LEX_))); |
74 (* result: [(1,[1,0,1]),(~1,[0,0,1])] *) |
74 (* result: [(1,[1,0,1]),(~1,[0,0,1])] *) |
75 if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else raise error ("rational.sml: example failed"); |
75 if mv_prest1=[(1,[1,0,1]),(~1,[0,0,1])] then () else error ("rational.sml: example failed"); |
76 |
76 |
77 val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_))); |
77 val mv_pquot2 = (#1(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_))); |
78 (* result: [(4,[1]),(4,[0])] *) |
78 (* result: [(4,[1]),(4,[0])] *) |
79 if mv_pquot2=[(4,[1]),(4,[0])] then () else raise error ("rational.sml: example failed"); |
79 if mv_pquot2=[(4,[1]),(4,[0])] then () else error ("rational.sml: example failed"); |
80 |
80 |
81 val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_))); |
81 val mv_prest2 = (#2(mv_division([(4,[2]),(8,[1]),(16,[0])],[(1,[1]),(1,[0])],LEX_))); |
82 (* result: [(12,[0]] *) |
82 (* result: [(12,[0]] *) |
83 if mv_prest2=[(12,[0])] then () else raise error ("rational.sml: example failed"); |
83 if mv_prest2=[(12,[0])] then () else error ("rational.sml: example failed"); |
84 |
84 |
85 val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_))); |
85 val mv_pquot3 = (#1(mv_division([(4,[2]),(~4,[0])],[(2,[1]),(2,[0])],LEX_))); |
86 (* [(2,[1]),(~2,[0])] *) |
86 (* [(2,[1]),(~2,[0])] *) |
87 if mv_pquot3=[(2,[1]),(~2,[0])] then () else raise error ("rational.sml: example failed"); |
87 if mv_pquot3=[(2,[1]),(~2,[0])] then () else error ("rational.sml: example failed"); |
88 |
88 |
89 val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_))); |
89 val mv_prest3 = (#2(mv_division([(1,[2]),(~1,[0])],[(2,[1]),(2,[0])],LEX_))); |
90 (* [(1,[2]),(~1,[0])] *) |
90 (* [(1,[2]),(~1,[0])] *) |
91 if mv_prest3=[(1,[2]),(~1,[0])] then () else raise error ("rational.sml: example failed"); |
91 if mv_prest3=[(1,[2]),(~1,[0])] then () else error ("rational.sml: example failed"); |
92 |
92 |
93 val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_))); |
93 val mv_pquot4 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],LEX_))); |
94 (* [(1,[0,1,1])] *) |
94 (* [(1,[0,1,1])] *) |
95 if mv_pquot4=[(1,[0,1,1])] then () else raise error ("rational.sml: example failed"); |
95 if mv_pquot4=[(1,[0,1,1])] then () else error ("rational.sml: example failed"); |
96 |
96 |
97 val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_))); |
97 val mv_prest4 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1])],[(2,[1,0,0]),(4,[0,0,1])],GGO_))); |
98 (* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *) |
98 (* [(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] *) |
99 if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed"); |
99 if mv_prest4 =[(1,[1,1,1]),(~4,[0,1,2]),(4,[1,0,1]),(3,[0,0,1])] then () else error ("rational.sml: example failed"); |
100 |
100 |
101 val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_))); |
101 val mv_pquot5 = (#1(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_))); |
102 (* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*) |
102 (* [(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])]*) |
103 if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else raise error ("rational.sml: example failed"); |
103 if mv_pquot5=[(1,[2,2,0]),(6,[2,1,2]),(3,[1,1,0]),(4,[1,0,0]),(4,[0,4,0]),(3,[0,0,0])] then () else error ("rational.sml: example failed"); |
104 |
104 |
105 val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_))); |
105 val mv_prest5 = (#2(mv_division([(3,[1,1,1]),(4,[1,0,1]),(3,[0,0,1]),(6,[2,1,3]),(4,[0,4,1]),(1,[2,2,1])],[(1,[0,0,1])],LEX_))); |
106 (* [] *) |
106 (* [] *) |
107 if mv_prest5=[] then () else raise error ("rational.sml: example failed"); |
107 if mv_prest5=[] then () else error ("rational.sml: example failed"); |
108 |
108 |
109 (* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *) |
109 (* (x^2 + 2(a+1)x + (a^2+2a+1)) / (x+a+1) = x+a+1 *) |
110 val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_))); |
110 val mv_pquot6 = (#1(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_))); |
111 if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else raise error ("rational.sml: example failed"); |
111 if mv_pquot6=[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])] then () else error ("rational.sml: example failed"); |
112 |
112 |
113 val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_))); |
113 val mv_prest6 = (#2(mv_division([(1,[2,0,0]),(2,[1,1,0]),(2,[1,0,0]),(1,[0,2,0]),(2,[0,1,0]),(1,[0,0,0])],[(1,[1,0,0]),(1,[0,1,0]),(1,[0,0,0])],LEX_))); |
114 if mv_prest6=[] then () else raise error ("rational.sml: example failed"); |
114 if mv_prest6=[] then () else error ("rational.sml: example failed"); |
115 |
115 |
116 |
116 |
117 print("\n\n***** MV_CONTENT-TESTS *****\n"); |
117 print("\n\n***** MV_CONTENT-TESTS *****\n"); |
118 val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]); |
118 val mv_cont1=mv_content([(1,[2,1]),(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]); |
119 (* [(1,[0,1]),(1,[0,0])] *) |
119 (* [(1,[0,1]),(1,[0,0])] *) |
120 if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else raise error ("rational.sml: example failed"); |
120 if mv_cont1=[(1,[0,1]),(1,[0,0])] then () else error ("rational.sml: example failed"); |
121 |
121 |
122 val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]); |
122 val mv_pp1=mv_pp([(1,[1,1]),(1,[1,0]),(1,[0,1]),(1,[0,0])]); |
123 (*[(1,[1,0]),(1,[0,0])]*) |
123 (*[(1,[1,0]),(1,[0,0])]*) |
124 if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else raise error ("rational.sml: example failed"); |
124 if mv_pp1=[(1,[1,0]),(1,[0,0])] then () else error ("rational.sml: example failed"); |
125 |
125 |
126 val mv_cont2=mv_content([(2,[1]),(4,[0])]); |
126 val mv_cont2=mv_content([(2,[1]),(4,[0])]); |
127 (* [(2,[0])] *) |
127 (* [(2,[0])] *) |
128 if mv_cont2=[(2,[0])] then () else raise error ("rational.sml: example failed"); |
128 if mv_cont2=[(2,[0])] then () else error ("rational.sml: example failed"); |
129 |
129 |
130 val mv_pp2=mv_pp([(2,[1]),(4,[0])]); |
130 val mv_pp2=mv_pp([(2,[1]),(4,[0])]); |
131 (* [(1,[1]),(2,[0])] *) |
131 (* [(1,[1]),(2,[0])] *) |
132 if mv_pp2=[(1,[1]),(2,[0])] then () else raise error ("rational.sml: example failed"); |
132 if mv_pp2=[(1,[1]),(2,[0])] then () else error ("rational.sml: example failed"); |
133 |
133 |
134 val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])]; |
134 val mv_cont3=mv_content[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])]; |
135 (* [(2,[0,0,0])] *) |
135 (* [(2,[0,0,0])] *) |
136 if mv_cont3=[(2,[0,0,0])] then () else raise error ("rational.sml: example failed"); |
136 if mv_cont3=[(2,[0,0,0])] then () else error ("rational.sml: example failed"); |
137 |
137 |
138 val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])]; |
138 val mv_pp3=mv_pp[(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(16,[1,1,1])]; |
139 (* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *) |
139 (* [(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] *) |
140 if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else raise error ("rational.sml: example failed"); |
140 if mv_pp3=[(5,[2,2,0]),(4,[2,1,1]),(8,[1,1,1]),(6,[1,0,2])] then () else error ("rational.sml: example failed"); |
141 |
141 |
142 val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
142 val mv_cont4=mv_content[(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
143 (* [(1,[0,0,0])] *) |
143 (* [(1,[0,0,0])] *) |
144 if mv_cont4=[(1,[0,0,0])] then () else raise error ("rational.sml: example failed"); |
144 if mv_cont4=[(1,[0,0,0])] then () else error ("rational.sml: example failed"); |
145 |
145 |
146 val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
146 val mv_pp4=mv_pp [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
147 (* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *) |
147 (* [(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] *) |
148 if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed"); |
148 if mv_pp4=[(2,[2,1,0]),(2,[1,1,0]),(3,[1,0,1]),(3,[0,0,1])] then () else error ("rational.sml: example failed"); |
149 |
149 |
150 val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]); |
150 val con1=mv_content([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]); |
151 (* [(3,[0,0])] *) |
151 (* [(3,[0,0])] *) |
152 if con1=[(3,[0,0])] then () else raise error ("rational.sml: example failed"); |
152 if con1=[(3,[0,0])] then () else error ("rational.sml: example failed"); |
153 |
153 |
154 val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]); |
154 val pp1=mv_pp([(9,[2,0]),(15,[1,1]),(12,[1,0]),(6,[0,2]),(12,[0,1])]); |
155 (* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *) |
155 (* [(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] *) |
156 if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else raise error ("rational.sml: example failed"); |
156 if pp1=[(3,[2,0]),(5,[1,1]),(4,[1,0]),(2,[0,2]),(4,[0,1])] then () else error ("rational.sml: example failed"); |
157 |
157 |
158 val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]); |
158 val con2=mv_content([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]); |
159 (* [(1,[0,0])] *) |
159 (* [(1,[0,0])] *) |
160 if con2=[(1,[0,0])] then () else raise error ("rational.sml: example failed"); |
160 if con2=[(1,[0,0])] then () else error ("rational.sml: example failed"); |
161 |
161 |
162 val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]); |
162 val pp2 =mv_pp([(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])]); |
163 (* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *) |
163 (* [(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] *) |
164 if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else raise error ("rational.sml: example failed"); |
164 if pp2=[(1,[2,0]),(1,[1,1]),(1,[1,0]),(1,[0,2]),(1,[0,1])] then () else error ("rational.sml: example failed"); |
165 |
165 |
166 val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])]; |
166 val cont1 = mv_content [(1,[2,1,0]),(2,[2,1,0])]; |
167 (* [(3,[0,1,0])] *) |
167 (* [(3,[0,1,0])] *) |
168 if cont1=[(3,[0,1,0])] then () else raise error ("rational.sml: example failed"); |
168 if cont1=[(3,[0,1,0])] then () else error ("rational.sml: example failed"); |
169 |
169 |
170 val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])]; |
170 val pp1 = mv_pp [(1,[2,1,0]),(2,[2,1,0])]; |
171 (* [(1,[2,0,0])] *) |
171 (* [(1,[2,0,0])] *) |
172 if pp1=[(1,[2,0,0])] then () else raise error ("rational.sml: example failed"); |
172 if pp1=[(1,[2,0,0])] then () else error ("rational.sml: example failed"); |
173 |
173 |
174 val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])]; |
174 val cont2 = mv_content [(4,[1,2,0]),(2,[2,1,0])]; |
175 (* [(2,[0,1,0])] *) |
175 (* [(2,[0,1,0])] *) |
176 if cont2=[(2,[0,1,0])] then () else raise error ("rational.sml: example failed"); |
176 if cont2=[(2,[0,1,0])] then () else error ("rational.sml: example failed"); |
177 |
177 |
178 val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])]; |
178 val pp2 = mv_pp [(4,[1,2,0]),(2,[2,1,0])]; |
179 (* [(1,[2,0,0]),(2,[1,1,0])] *) |
179 (* [(1,[2,0,0]),(2,[1,1,0])] *) |
180 if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else raise error ("rational.sml: example failed"); |
180 if pp2=[(1,[2,0,0]),(2,[1,1,0])] then () else error ("rational.sml: example failed"); |
181 |
181 |
182 print("\n\n\n\n********************************************************\n\n"); |
182 print("\n\n\n\n********************************************************\n\n"); |
183 val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])]; |
183 val cont3=mv_content [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])]; |
184 if cont3=[(5,[0,2,1]),(4,[0,2,0]),(2,[0,1,1])] then () else raise error ("rational.sml: example failed"); |
184 if cont3=[(5,[0,2,1]),(4,[0,2,0]),(2,[0,1,1])] then () else error ("rational.sml: example failed"); |
185 val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])]; |
185 val pp3=mv_pp [(65,[3,2,2]),(52,[3,2,1]),(26,[3,1,2]),(~95,[2,2,3]),(~76,[2,2,2]),(35,[2,2,1]),(28,[2,2,0]),(~38,[2,1,3]),(14,[2,1,1])]; |
186 |
186 |
187 |
187 |
188 "-------- fun monom2term, fun poly2term' ------------------------"; |
188 "-------- fun monom2term, fun poly2term' ------------------------"; |
189 "-------- fun monom2term, fun poly2term' ------------------------"; |
189 "-------- fun monom2term, fun poly2term' ------------------------"; |
211 fun parse_rat str = (term_of o the o (parse thy)) str; |
211 fun parse_rat str = (term_of o the o (parse thy)) str; |
212 |
212 |
213 print("\n\n***** mv_gcd-tests *****\n"); |
213 print("\n\n***** mv_gcd-tests *****\n"); |
214 val ggt1 = mv_gcd [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])]; |
214 val ggt1 = mv_gcd [(4,[2,2]),(8,[1,1]),(4,[0,0])] [(2,[1,1]),(2,[0,0])]; |
215 (* [(2,[1,1]),(2,[0,0])] *) |
215 (* [(2,[1,1]),(2,[0,0])] *) |
216 if ggt1=[(2,[1,1]),(2,[0,0])] then () else raise error ("rational.sml: example failed"); |
216 if ggt1=[(2,[1,1]),(2,[0,0])] then () else error ("rational.sml: example failed"); |
217 |
217 |
218 val ggt2 = mv_gcd [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
218 val ggt2 = mv_gcd [(8,[2,1,1]),(12,[1,0,2]),(10,[2,2,0]),(15,[1,1,1])] [(2,[2,1,0]),(3,[1,0,1]),(2,[1,1,0]),(3,[0,0,1])]; |
219 (* [(2,[1,1,0]),(3,[0,0,1])] *) |
219 (* [(2,[1,1,0]),(3,[0,0,1])] *) |
220 if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else raise error ("rational.sml: example failed"); |
220 if ggt2=[(2,[1,1,0]),(3,[0,0,1])] then () else error ("rational.sml: example failed"); |
221 |
221 |
222 |
222 |
223 val ggt3 = mv_gcd [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])]; |
223 val ggt3 = mv_gcd [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])]; |
224 (* [(1,[1,0]),(~1,[0,1])] *) |
224 (* [(1,[1,0]),(~1,[0,1])] *) |
225 if ggt3=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed"); |
225 if ggt3=[(1,[1,0]),(~1,[0,1])] then () else error ("rational.sml: example failed"); |
226 |
226 |
227 |
227 |
228 val ggt4 = mv_gcd [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])]; |
228 val ggt4 = mv_gcd [(1,[2,1,0]),(2,[2,1,0])] [(5,[1,0,0])]; |
229 (* [(1,[1,0,0])] *) |
229 (* [(1,[1,0,0])] *) |
230 if ggt4=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed"); |
230 if ggt4=[(1,[1,0,0])] then () else error ("rational.sml: example failed"); |
231 |
231 |
232 |
232 |
233 val ggt5 = mv_gcd [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])]; |
233 val ggt5 = mv_gcd [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])]; |
234 (* [(1,[1,0]),(~1,[0,1])] *) |
234 (* [(1,[1,0]),(~1,[0,1])] *) |
235 if ggt5=[(1,[1,0]),(~1,[0,1])] then () else raise error ("rational.sml: example failed"); |
235 if ggt5=[(1,[1,0]),(~1,[0,1])] then () else error ("rational.sml: example failed"); |
236 |
236 |
237 |
237 |
238 val ggt6 = mv_gcd [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])]; |
238 val ggt6 = mv_gcd [(10,[2,1,1]),(14,[1,1,0]),(3,[1,0,1]),(20,[1,2,1])] [(5,[1,1,1]),(7,[2,1,1])]; |
239 (* [(1,[0,0,0])] *) |
239 (* [(1,[0,0,0])] *) |
240 if ggt6=[(1,[1,0,0])] then () else raise error ("rational.sml: example failed"); |
240 if ggt6=[(1,[1,0,0])] then () else error ("rational.sml: example failed"); |
241 |
241 |
242 print("\n\n***** kgv-tests *****\n"); |
242 print("\n\n***** kgv-tests *****\n"); |
243 val kgv1=mv_lcm [(10,[])] [(15,[])]; |
243 val kgv1=mv_lcm [(10,[])] [(15,[])]; |
244 (* [(30,[])] *) |
244 (* [(30,[])] *) |
245 if kgv1=[(30,[])] then () else raise error ("rational.sml: example failed"); |
245 if kgv1=[(30,[])] then () else error ("rational.sml: example failed"); |
246 |
246 |
247 val kgv2=mv_lcm [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])]; |
247 val kgv2=mv_lcm [(1,[2,0]),(~2,[1,1]),(1,[0,2])] [(1,[1,0]),(~1,[0,1])]; |
248 (* [(1,[2,0]),(~2,[1,1]),(1,[0,2])] *) |
248 (* [(1,[2,0]),(~2,[1,1]),(1,[0,2])] *) |
249 if kgv2=[(1,[2,0]),(~2,[1,1]),(1,[0,2])] then () else raise error ("rational.sml: example failed"); |
249 if kgv2=[(1,[2,0]),(~2,[1,1]),(1,[0,2])] then () else error ("rational.sml: example failed"); |
250 |
250 |
251 val kgv3=mv_lcm [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])]; |
251 val kgv3=mv_lcm [(4,[2,0]),(~8,[1,1]),(4,[0,2])] [(1,[2,0]),(~1,[0,2])]; |
252 (* [(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] *) |
252 (* [(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] *) |
253 if kgv3=[(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] then () else raise error ("rational.sml: example failed"); |
253 if kgv3=[(4,[3,0]),(~4,[2,1]),(~4,[1,2]),(4,[0,3])] then () else error ("rational.sml: example failed"); |
254 |
254 |
255 (*!!!-------- |
255 (*!!!-------- |
256 print("\n\n***** STEP_CANCEL_TESTS: *****\n"); |
256 print("\n\n***** STEP_CANCEL_TESTS: *****\n"); |
257 |
257 |
258 val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) / (6 * a * c)"; |
258 val term2 = (term_of o the o (parse thy)) " (9 * a^^^2 * b) / (6 * a * c)"; |
259 val div2 = term2str (step_cancel term2); |
259 val div2 = term2str (step_cancel term2); |
260 if div2 = "3 * (a * b) * (3 * a) / (2 * c * (3 * a))" then () else raise error ("rational.sml: example failed"); |
260 if div2 = "3 * (a * b) * (3 * a) / (2 * c * (3 * a))" then () else error ("rational.sml: example failed"); |
261 |
261 |
262 |
262 |
263 val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) / a"; |
263 val term1 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c + 14 * a * b + 3 * a * c + 20 * a * b^^^2 * c) / a"; |
264 val div1 = term2str(step_cancel term1); |
264 val div1 = term2str(step_cancel term1); |
265 if div1 = "(3 * c + 14 * b + 20 * (b ^^^ 2 * c) + 10 * (a * (b * c))) * a / (1 * a)" then () else raise error ("rational.sml: example failed"); |
265 if div1 = "(3 * c + 14 * b + 20 * (b ^^^ 2 * c) + 10 * (a * (b * c))) * a / (1 * a)" then () else error ("rational.sml: example failed"); |
266 |
266 |
267 val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) / (1 * x * y * z) "; |
267 val term3 = (term_of o the o (parse thy)) "(10 * a^^^2 * b * c) / (1 * x * y * z) "; |
268 val div3 = term2str(step_cancel term3); |
268 val div3 = term2str(step_cancel term3); |
269 if div3="10 * a ^^^ 2 * b * c / (1 * x * y * z)" then () else raise error ("rational.sml: example failed"); |
269 if div3="10 * a ^^^ 2 * b * c / (1 * x * y * z)" then () else error ("rational.sml: example failed"); |
270 |
270 |
271 --------------------------------------------------------------------------!!!*) |
271 --------------------------------------------------------------------------!!!*) |
272 |
272 |
273 (*-----versuche 13.3.03----- |
273 (*-----versuche 13.3.03----- |
274 val t = str2term "1 - x^^^2 - 5 * x^^^5"; |
274 val t = str2term "1 - x^^^2 - 5 * x^^^5"; |
428 val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)"; |
428 val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2) + 1 / (x - y)"; |
429 val SOME (t',_) = common_nominator_ thy t; |
429 val SOME (t',_) = common_nominator_ thy t; |
430 val SOME (t'',_) = add_fraction_ thy t; |
430 val SOME (t'',_) = add_fraction_ thy t; |
431 if term2str t' = "(-1 * y ^^^ 2 + x ^^^ 2) / ((-1 * y + x) * (-1 * y + x))\ |
431 if term2str t' = "(-1 * y ^^^ 2 + x ^^^ 2) / ((-1 * y + x) * (-1 * y + x))\ |
432 \ +\n1 * (-1 * y + x) / ((-1 * y + x) * (-1 * y + x))" then () |
432 \ +\n1 * (-1 * y + x) / ((-1 * y + x) * (-1 * y + x))" then () |
433 else raise error "rational.sml lex-ord 1"; |
433 else error "rational.sml lex-ord 1"; |
434 if term2str t'' = "(-1 - y - x) / (y - x)" then () |
434 if term2str t'' = "(-1 - y - x) / (y - x)" then () |
435 else raise error "rational.sml lex-ord 2"; |
435 else error "rational.sml lex-ord 2"; |
436 (*WN.16.10.02 WN070905 lexicographische Ordnung erhalten ! SK.ord*) |
436 (*WN.16.10.02 WN070905 lexicographische Ordnung erhalten ! SK.ord*) |
437 |
437 |
438 |
438 |
439 val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2)"; |
439 val t = str2term "(x^^^2 - y^^^2)/(x^^^2 - 2*x*y + y^^^2)"; |
440 val SOME (t',_) = norm_expanded_rat_ thy t; |
440 val SOME (t',_) = norm_expanded_rat_ thy t; |
441 if term2str t' = "(x + y) / (x - y)" then () |
441 if term2str t' = "(x + y) / (x - y)" then () |
442 else raise error "rational.sml term2poly: invalid x ^^^ 2 - y ^^^ 2 1"; |
442 else error "rational.sml term2poly: invalid x ^^^ 2 - y ^^^ 2 1"; |
443 (*val SOME (t'',_) = norm_rational_ thy t; |
443 (*val SOME (t'',_) = norm_rational_ thy t; |
444 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial |
444 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial |
445 WN.16.10.02 ?! + WN060831???SK4 |
445 WN.16.10.02 ?! + WN060831???SK4 |
446 WN070905 *** term2poly: invalid = x ^^^ 2 - y ^^^ 2*) |
446 WN070905 *** term2poly: invalid = x ^^^ 2 - y ^^^ 2*) |
447 |
447 |
448 |
448 |
449 val t = str2term "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)"; |
449 val t = str2term "(9 - x^^^2)/(9 - 6*x + x^^^2) + (1)/(3 + x)"; |
450 val SOME (t',_) = norm_expanded_rat_ thy t; |
450 val SOME (t',_) = norm_expanded_rat_ thy t; |
451 if term2str t' = "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)" then () |
451 if term2str t' = "(12 + 5 * x + x ^^^ 2) / (9 - x ^^^ 2)" then () |
452 else raise error "rational.sml (9 - x^^^2)/(9 - 6*x + x^^^2) +..."; |
452 else error "rational.sml (9 - x^^^2)/(9 - 6*x + x^^^2) +..."; |
453 (*val SOME (t'',_) = norm_rational_ thy t; |
453 (*val SOME (t'',_) = norm_rational_ thy t; |
454 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial WN.16.10.02 ?! |
454 *** RATIONALS_TERM2POLY_EXCEPTION: Invalid Polynomial WN.16.10.02 ?! |
455 WN070906 *** term2poly: invalid = 9 - x ^^^ 2 SK.term2poly*) |
455 WN070906 *** term2poly: invalid = 9 - x ^^^ 2 SK.term2poly*) |
456 |
456 |
457 val t=(term_of o the o (parse thy)) |
457 val t=(term_of o the o (parse thy)) |
508 val e188a'="(-8 + 8 * x) / (-9 + 9 * x)";(*SRC*) |
508 val e188a'="(-8 + 8 * x) / (-9 + 9 * x)";(*SRC*) |
509 val e188a = the (rewrite_set thy' false "cancel" e188a'); |
509 val e188a = the (rewrite_set thy' false "cancel" e188a'); |
510 is_expanded (parse_rat "8 * x + -8"); |
510 is_expanded (parse_rat "8 * x + -8"); |
511 (* e188a = ("8 / 9",["not ((-1) + x = 0)"]) then () 13.3.03*) |
511 (* e188a = ("8 / 9",["not ((-1) + x = 0)"]) then () 13.3.03*) |
512 if e188a = ("8 / 9",["-1 + x ~= 0"]) then () |
512 if e188a = ("8 / 9",["-1 + x ~= 0"]) then () |
513 else raise error "rational.sml: e188a new behaviour"; |
513 else error "rational.sml: e188a new behaviour"; |
514 val SOME (t,_) = rewrite_set thy' false mp |
514 val SOME (t,_) = rewrite_set thy' false mp |
515 "(8*((-1) + x))/(9*((-1) + x))"; |
515 "(8*((-1) + x))/(9*((-1) + x))"; |
516 print("b)\n"); |
516 print("b)\n"); |
517 val e188b'="(-15 + 5 * x) / (-18 + 6 * x)";(*SRC*) |
517 val e188b'="(-15 + 5 * x) / (-18 + 6 * x)";(*SRC*) |
518 val SOME (t,_) = rewrite_set thy' false "cancel" e188b'; |
518 val SOME (t,_) = rewrite_set thy' false "cancel" e188b'; |
523 val e188c = the (rewrite_set thy' false "cancel_p" e188c'); |
523 val e188c = the (rewrite_set thy' false "cancel_p" e188c'); |
524 (*is_expanded (parse_rat "a + -1 * b");*) |
524 (*is_expanded (parse_rat "a + -1 * b");*) |
525 val SOME (t,_) = |
525 val SOME (t,_) = |
526 rewrite_set thy' false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))"; |
526 rewrite_set thy' false mp "((-1)*(b + (-1) * a))/(1*(b + (-1) * a))"; |
527 if t= "(a + -1 * b) / (-1 * a + b)" then() |
527 if t= "(a + -1 * b) / (-1 * a + b)" then() |
528 else raise error "rational.sml: e188c new behaviour"; |
528 else error "rational.sml: e188c new behaviour"; |
529 |
529 |
530 print("\n\nexample 190:\n"); |
530 print("\n\nexample 190:\n"); |
531 print("c)\n"); |
531 print("c)\n"); |
532 val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )"; |
532 val e190c'="( 27 * a^^^3 + 9 * a^^^2 + 3 * a + 1 ) / ( 27 * a^^^3 + 18 * a^^^2 + 3 * a )"; |
533 val e190c = the (rewrite_set thy' false "cancel" e190c'); |
533 val e190c = the (rewrite_set thy' false "cancel" e190c'); |
534 val SOME (t,_) = rewrite_set thy' false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))"; |
534 val SOME (t,_) = rewrite_set thy' false mp "((1 + 9 * a ^^^ 2)*(1 + 3 * a))/((3 * a + 9 * a ^^^ 2)*(1 + 3 * a))"; |
535 if t = "(1 + 3 * a + 9 * a ^^^ 2 + 27 * a ^^^ 3) /\n(3 * a + 18 * a ^^^ 2 + 27 * a ^^^ 3)" then () |
535 if t = "(1 + 3 * a + 9 * a ^^^ 2 + 27 * a ^^^ 3) /\n(3 * a + 18 * a ^^^ 2 + 27 * a ^^^ 3)" then () |
536 else raise error "rational.sml: e190c new behaviour"; |
536 else error "rational.sml: e190c new behaviour"; |
537 |
537 |
538 print("\n\nexample 191:\n"); |
538 print("\n\nexample 191:\n"); |
539 print("a)\n"); |
539 print("a)\n"); |
540 val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )"; |
540 val e191a'="( x^^^2 + -1 * y^^^2 ) / ( x + y )"; |
541 (*WN.23.10.02------- |
541 (*WN.23.10.02------- |
545 is_expanded (parse_rat "x + y"); |
545 is_expanded (parse_rat "x + y"); |
546 true; -----------*) |
546 true; -----------*) |
547 val SOME (t,_) = rewrite_set thy' false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))"; |
547 val SOME (t,_) = rewrite_set thy' false mp "((x + (-1) * y)*(x + y))/((1)*(x + y))"; |
548 (* t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() WN.13.3.03*) |
548 (* t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() WN.13.3.03*) |
549 if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() |
549 if t="(x ^^^ 2 + -1 * y ^^^ 2) / (x + y)" then() |
550 else raise error "rational.sml: e191a new behaviour"; |
550 else error "rational.sml: e191a new behaviour"; |
551 |
551 |
552 print("c)\n"); |
552 print("c)\n"); |
553 val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )"; |
553 val e191c'="( 9 * x^^^2 + -30 * x + 25 ) / ( 9 * x^^^2 + -25 )"; |
554 (*WN.23.10.02------- |
554 (*WN.23.10.02------- |
555 val e191c = the (rewrite_set thy' false "cancel" e191c'); |
555 val e191c = the (rewrite_set thy' false "cancel" e191c'); |
560 is_expanded (parse_rat "-25 + 9*x^^^2"); |
560 is_expanded (parse_rat "-25 + 9*x^^^2"); |
561 true;------------*) |
561 true;------------*) |
562 val SOME (t,_) = rewrite_set thy' false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))"; |
562 val SOME (t,_) = rewrite_set thy' false mp "(((-5) + 3 * x)*((-5) + 3 * x))/((5 + 3 * x)*((-5) + 3 * x))"; |
563 (* t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then() 13.3.03*) |
563 (* t="(25 + ((-30) * x + 9 * x ^^^ 2)) / ((-25) + 9 * x ^^^ 2)"then() 13.3.03*) |
564 if t= "(25 + -30 * x + 9 * x ^^^ 2) / (-25 + 9 * x ^^^ 2)" then() |
564 if t= "(25 + -30 * x + 9 * x ^^^ 2) / (-25 + 9 * x ^^^ 2)" then() |
565 else raise error "rational.sml: 'e191c' new behaviour"; |
565 else error "rational.sml: 'e191c' new behaviour"; |
566 |
566 |
567 |
567 |
568 print("\n\nexample 192:\n"); |
568 print("\n\nexample 192:\n"); |
569 print("b)\n"); |
569 print("b)\n"); |
570 val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )"; |
570 val e192b'="( 7 * x^^^3 + -1 * x^^^2 * y ) / ( 7 * x * y^^^2 + -1 * y^^^3 )"; |
572 val e192b = the (rewrite_set thy' false "cancel" e192b'); |
572 val e192b = the (rewrite_set thy' false "cancel" e192b'); |
573 -------------------*) |
573 -------------------*) |
574 val SOME (t',_) = rewrite_set thy' false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
574 val SOME (t',_) = rewrite_set thy' false mp "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
575 if t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" |
575 if t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" |
576 (*"(-1 * y * x ^^^ 2 + 7 * x ^^^ 3) / (-1 * y ^^^ 3 + 7 * x * y ^^^ 2)"WN050929*) |
576 (*"(-1 * y * x ^^^ 2 + 7 * x ^^^ 3) / (-1 * y ^^^ 3 + 7 * x * y ^^^ 2)"WN050929*) |
577 then () else raise error "rational.sml: 'e192b' new behaviour"; |
577 then () else error "rational.sml: 'e192b' new behaviour"; |
578 (*^^^ works with MG's simplifier vvv*) |
578 (*^^^ works with MG's simplifier vvv*) |
579 val t =str2term"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
579 val t =str2term"((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
580 val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t; |
580 val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t; |
581 if term2str t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" then () else raise error "rational.sml: 'e192b'MG new behaviour"; |
581 if term2str t' = "(7 * x ^^^ 3 + -1 * x ^^^ 2 * y) / (7 * x * y ^^^ 2 + -1 * y ^^^ 3)" then () else error "rational.sml: 'e192b'MG new behaviour"; |
582 |
582 |
583 |
583 |
584 print("\n\nexample 193:\n"); |
584 print("\n\nexample 193:\n"); |
585 print("a)\n"); |
585 print("a)\n"); |
586 val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )"; |
586 val e193a'="( x^^^2 + -6 * x + 9 ) / ( x^^^2 + -9 )"; |
598 |
598 |
599 val wn01 = "(-25 + 9*x^^^2)/(5 + 3*x)"; |
599 val wn01 = "(-25 + 9*x^^^2)/(5 + 3*x)"; |
600 val SOME (t,_) = rewrite_set thy' false "cancel" wn01; |
600 val SOME (t,_) = rewrite_set thy' false "cancel" wn01; |
601 (* t = "((-5) + 3 * x) / 1" then () WN.13.3.03*) |
601 (* t = "((-5) + 3 * x) / 1" then () WN.13.3.03*) |
602 if t = "(-5 + 3 * x) / 1" then () |
602 if t = "(-5 + 3 * x) / 1" then () |
603 else raise error "rational.sml: new behav. in cancel wn01"; |
603 else error "rational.sml: new behav. in cancel wn01"; |
604 |
604 |
605 |
605 |
606 "-------- common_nominator_p ---------------------------- --------"; |
606 "-------- common_nominator_p ---------------------------- --------"; |
607 "-------- common_nominator_p ---------------------------- --------"; |
607 "-------- common_nominator_p ---------------------------- --------"; |
608 "-------- common_nominator_p ---------------------------- --------"; |
608 "-------- common_nominator_p ---------------------------- --------"; |
836 val rls' = "common_nominator_p"; |
836 val rls' = "common_nominator_p"; |
837 print("\n\nexample stiefel:\n"); |
837 print("\n\nexample stiefel:\n"); |
838 val est1'="(7) / (-14) + (-2) / (4)"; |
838 val est1'="(7) / (-14) + (-2) / (4)"; |
839 val est1 = the (rewrite_set thy' false "common_nominator_p" est1'); |
839 val est1 = the (rewrite_set thy' false "common_nominator_p" est1'); |
840 if est1 = ("-1 / 1",[]) then () |
840 if est1 = ("-1 / 1",[]) then () |
841 else raise error "new behaviour in rational.sml: est1'"; |
841 else error "new behaviour in rational.sml: est1'"; |
842 |
842 |
843 val t = (term_of o the o (parse thy)) |
843 val t = (term_of o the o (parse thy)) |
844 "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)"; |
844 "(9 - x ^^^ 2) / (9 - 6 * x + x ^^^ 2)"; |
845 val SOME (t',_) = factout_ thy t; |
845 val SOME (t',_) = factout_ thy t; |
846 term2str t'; |
846 term2str t'; |
907 |
907 |
908 val SOME r = nex revsets t; |
908 val SOME r = nex revsets t; |
909 val (r,(t,asm))::_ = loc revsets t r; |
909 val (r,(t,asm))::_ = loc revsets t r; |
910 val ss = term2str t; |
910 val ss = term2str t; |
911 if ss = "(3 - x) / (3 + x)" then () |
911 if ss = "(3 - x) / (3 + x)" then () |
912 else raise error "rational.sml: new behav. in rev-set cancel"; |
912 else error "rational.sml: new behav. in rev-set cancel"; |
913 terms2str asm; |
913 terms2str asm; |
914 |
914 |
915 |
915 |
916 "-------- 'reverse-ruleset' cancel_p -----------------------------"; |
916 "-------- 'reverse-ruleset' cancel_p -----------------------------"; |
917 "-------- 'reverse-ruleset' cancel_p -----------------------------"; |
917 "-------- 'reverse-ruleset' cancel_p -----------------------------"; |
961 "-------- norm_Rational ------------------------------------------"; |
961 "-------- norm_Rational ------------------------------------------"; |
962 "-------- norm_Rational ------------------------------------------"; |
962 "-------- norm_Rational ------------------------------------------"; |
963 "-------- norm_Rational ------------------------------------------"; |
963 "-------- norm_Rational ------------------------------------------"; |
964 val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0"; |
964 val t = str2term "(3*x+5)/18 - x/2 - -(3*x - 2)/9 = 0"; |
965 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
965 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
966 if term2str t' = "1 / 18 = 0" then () else raise error "rational.sml 1"; |
966 if term2str t' = "1 / 18 = 0" then () else error "rational.sml 1"; |
967 |
967 |
968 val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0"; |
968 val t = str2term "(17*x - 51)/9 - (-(13*x - 3)/6) + 11 - (9*x - 7)/4 = 0"; |
969 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
969 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
970 if term2str t' = "(237 + 65 * x) / 36 = 0" then () |
970 if term2str t' = "(237 + 65 * x) / 36 = 0" then () |
971 else raise error "rational.sml 2"; |
971 else error "rational.sml 2"; |
972 |
972 |
973 val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29"; |
973 val t = str2term "(1/2 + (5*x)/2)^^^2 - ((13*x)/2 - 5/2)^^^2 - (6*x)^^^2 + 29"; |
974 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
974 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
975 (*before 040209:if term2str t' = "(23 + (35 * x + -72 * x ^^^ 2)) / 1"then()*) |
975 (*before 040209:if term2str t' = "(23 + (35 * x + -72 * x ^^^ 2)) / 1"then()*) |
976 if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then () |
976 if term2str t' = "23 + 35 * x + -72 * x ^^^ 2" then () |
977 else raise error "rational.sml 3"; |
977 else error "rational.sml 3"; |
978 (*trace_rewrite:=true;*) |
978 (*trace_rewrite:=true;*) |
979 val t = str2term "Not (6*x is_atom)"; |
979 val t = str2term "Not (6*x is_atom)"; |
980 val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t'; |
980 val SOME (t',_) = rewrite_set_ thy false powers_erls t; term2str t'; |
981 "True"; |
981 "True"; |
982 val t = str2term "1 < 2"; |
982 val t = str2term "1 < 2"; |
988 term2str t'; |
988 term2str t'; |
989 trace_rewrite:=false; |
989 trace_rewrite:=false; |
990 |
990 |
991 val t = str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))"; |
991 val t = str2term "-1 * (-2 * (5 / 2 * (13 * x / 2)))"; |
992 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
992 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
993 if term2str t' = "65 * x / 2" then () else raise error "rational.sml 4"; |
993 if term2str t' = "65 * x / 2" then () else error "rational.sml 4"; |
994 |
994 |
995 val t = str2term "1 - ((13*x)/2 - 5/2)^^^2"; |
995 val t = str2term "1 - ((13*x)/2 - 5/2)^^^2"; |
996 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
996 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
997 (*bef.040209: if term2str t' = "(-21 + (130 * x + -169 * x ^^^ 2)) / 4"then()*) |
997 (*bef.040209: if term2str t' = "(-21 + (130 * x + -169 * x ^^^ 2)) / 4"then()*) |
998 if term2str t' = "(-21 + 130 * x + -169 * x ^^^ 2) / 4" then () |
998 if term2str t' = "(-21 + 130 * x + -169 * x ^^^ 2) / 4" then () |
999 else raise error "rational.sml 5"; |
999 else error "rational.sml 5"; |
1000 |
1000 |
1001 (*SRAM Schalk I, p.92 Nr. 609a*) |
1001 (*SRAM Schalk I, p.92 Nr. 609a*) |
1002 val t = str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54"; |
1002 val t = str2term "2*(3 - x/5)/3 - 4*(1 - x/3) - x/3 - 2*(x/2 - 1/4)/27 +5/54"; |
1003 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1003 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1004 if term2str t' = "(-255 + 112 * x) / 135" then () |
1004 if term2str t' = "(-255 + 112 * x) / 135" then () |
1005 else raise error "rational.sml 6"; |
1005 else error "rational.sml 6"; |
1006 |
1006 |
1007 (*SRAM Schalk I, p.92 Nr. 610c*) |
1007 (*SRAM Schalk I, p.92 Nr. 610c*) |
1008 val t = str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2"; |
1008 val t = str2term "((x- 1)/(x+1) + 1) / ((x- 1)/(x+1) - (x+1)/(x- 1)) - 2"; |
1009 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1009 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1010 if term2str t' = "(-3 + -1 * x) / 2" then () else raise error "rational.sml 7"; |
1010 if term2str t' = "(-3 + -1 * x) / 2" then () else error "rational.sml 7"; |
1011 |
1011 |
1012 (*SRAM Schalk I, p.92 Nr. 476a*) |
1012 (*SRAM Schalk I, p.92 Nr. 476a*) |
1013 val t = str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) *\ |
1013 val t = str2term "(x^^^2/(1 - x^^^2) + 1)/(x/(1 - x) + 1) *\ |
1014 \ (1 + x)";(*. a/b : c/d translated to a/b * d/c .*) |
1014 \ (1 + x)";(*. a/b : c/d translated to a/b * d/c .*) |
1015 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1015 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1016 (*if term2str t' = "1 / 1" then () else raise error "rational.sml 8";3.6.03*) |
1016 (*if term2str t' = "1 / 1" then () else error "rational.sml 8";3.6.03*) |
1017 if term2str t' = "1" then () else raise error "rational.sml 8"; |
1017 if term2str t' = "1" then () else error "rational.sml 8"; |
1018 |
1018 |
1019 (*............................vvv---TODO: sollte gehen mit poly_order *) |
1019 (*............................vvv---TODO: sollte gehen mit poly_order *) |
1020 (*Schalk I, p.92 Nr. 472a*) |
1020 (*Schalk I, p.92 Nr. 472a*) |
1021 val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))"; |
1021 val t = str2term "((8*x^^^2 - 32*y^^^2)/(2*x + 4*y))/((4*x - 8*y)/(x + y))"; |
1022 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1022 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1023 if term2str t' = "x + y" then () else raise error "rational.sml p.92 Nr. 472a"; |
1023 if term2str t' = "x + y" then () else error "rational.sml p.92 Nr. 472a"; |
1024 |
1024 |
1025 (*Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*) |
1025 (*Schalk I, p.70 Nr. 480b; a/b : c/d translated to a/b * d/c*) |
1026 val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\ |
1026 val t = str2term "((12*x*y/(9*x^^^2 - y^^^2))/\ |
1027 \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\ |
1027 \(1/(3*x - y)^^^2 - 1/(3*x + y)^^^2)) *\ |
1028 \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\ |
1028 \(1/(x - 5*y)^^^2 - 1/(x + 5*y)^^^2)/\ |
1065 (*SRA Schalk I, p.40 Nr. 164b *) |
1065 (*SRA Schalk I, p.40 Nr. 164b *) |
1066 val t = str2term "(47/6 - 76/9 + 13/4)/(35/12)"; |
1066 val t = str2term "(47/6 - 76/9 + 13/4)/(35/12)"; |
1067 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1067 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1068 term2str t; |
1068 term2str t; |
1069 if (term2str t) = "19 / 21" then () |
1069 if (term2str t) = "19 / 21" then () |
1070 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 1"; |
1070 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 1"; |
1071 |
1071 |
1072 (*SRA Schalk I, p.40 Nr. 166a *) |
1072 (*SRA Schalk I, p.40 Nr. 166a *) |
1073 val t = str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)"; |
1073 val t = str2term "((5/4)/(4+22/7) + 37/20)*(110/3 - 110/9 * 23/11)"; |
1074 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1074 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1075 term2str t; |
1075 term2str t; |
1076 if (term2str t) = "45 / 2" then () |
1076 if (term2str t) = "45 / 2" then () |
1077 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 2"; |
1077 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 2"; |
1078 |
1078 |
1079 |
1079 |
1080 "-------- cancellation -------------------------------------------"; |
1080 "-------- cancellation -------------------------------------------"; |
1081 "-------- cancellation -------------------------------------------"; |
1081 "-------- cancellation -------------------------------------------"; |
1082 "-------- cancellation -------------------------------------------"; |
1082 "-------- cancellation -------------------------------------------"; |
1087 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1087 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1088 term2str t; |
1088 term2str t; |
1089 if (term2str t) = |
1089 if (term2str t) = |
1090 "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)" |
1090 "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)" |
1091 then () |
1091 then () |
1092 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 3"; |
1092 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 3"; |
1093 |
1093 |
1094 (* e192b Stefan K.*) |
1094 (* e192b Stefan K.*) |
1095 val t = str2term |
1095 val t = str2term |
1096 "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
1096 "((x ^^^ 2)*(7 * x + (-1) * y))/((y ^^^ 2)*(7 * x + (-1) * y))"; |
1097 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1097 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1098 term2str t; |
1098 term2str t; |
1099 if (term2str t) = |
1099 if (term2str t) = |
1100 "x ^^^ 2 / y ^^^ 2" |
1100 "x ^^^ 2 / y ^^^ 2" |
1101 then () |
1101 then () |
1102 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 4"; |
1102 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 4"; |
1103 |
1103 |
1104 (*SRC Schalk I, p.66 Nr. 379c *) |
1104 (*SRC Schalk I, p.66 Nr. 379c *) |
1105 val t = str2term |
1105 val t = str2term |
1106 "(a - b)/(b - a)"; |
1106 "(a - b)/(b - a)"; |
1107 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1107 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1108 term2str t; |
1108 term2str t; |
1109 if (term2str t) = |
1109 if (term2str t) = |
1110 "-1" |
1110 "-1" |
1111 then () |
1111 then () |
1112 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 5"; |
1112 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 5"; |
1113 |
1113 |
1114 (*SRC Schalk I, p.66 Nr. 380b *) |
1114 (*SRC Schalk I, p.66 Nr. 380b *) |
1115 val t = str2term |
1115 val t = str2term |
1116 "15*(3*x+3)*(4*x+9)/(12*(2*x+7)*(5*x+5))"; |
1116 "15*(3*x+3)*(4*x+9)/(12*(2*x+7)*(5*x+5))"; |
1117 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1117 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1118 term2str t; |
1118 term2str t; |
1119 if (term2str t) = |
1119 if (term2str t) = |
1120 "(27 + 12 * x) / (28 + 8 * x)" |
1120 "(27 + 12 * x) / (28 + 8 * x)" |
1121 then () |
1121 then () |
1122 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 6"; |
1122 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 6"; |
1123 |
1123 |
1124 (*Schalk I, p.60 Nr. 215c *) |
1124 (*Schalk I, p.60 Nr. 215c *) |
1125 (* Falsches Ergebnis: rechnet lange und cancel_p kann nicht weiter krzen!!!*) |
1125 (* Falsches Ergebnis: rechnet lange und cancel_p kann nicht weiter krzen!!!*) |
1126 (* WN060831????MG1 |
1126 (* WN060831????MG1 |
1127 val t = str2term "(a+b)^^^4*(x - y)/((x - y)^^^3*(a+b)^^^2)"; |
1127 val t = str2term "(a+b)^^^4*(x - y)/((x - y)^^^3*(a+b)^^^2)"; |
1128 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1128 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1129 term2str t; |
1129 term2str t; |
1130 if (term2str t) = |
1130 if (term2str t) = |
1131 "(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)" |
1131 "(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)" |
1132 then () |
1132 then () |
1133 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 7"; |
1133 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 7"; |
1134 *) |
1134 *) |
1135 (*val t = str2term |
1135 (*val t = str2term |
1136 "(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)" |
1136 "(a ^^^ 4 * x + -1 * a ^^^ 4 * y + 4 * a ^^^ 3 * b * x + -4 * a ^^^ 3 * b * y + 6 * a ^^^ 2 * b ^^^ 2 * x + -6 * a ^^^ 2 * b ^^^ 2 * y + 4 * a * b ^^^ 3 * x + -4 * a * b ^^^ 3 * y + b ^^^ 4 * x + -1 * b ^^^ 4 * y) /(a ^^^ 2 * x ^^^ 3 + -3 * a ^^^ 2 * x ^^^ 2 * y + 3 * a ^^^ 2 * x * y ^^^ 2 + -1 * a ^^^ 2 * y ^^^ 3 + 2 * a * b * x ^^^ 3 + -6 * a * b * x ^^^ 2 * y + 6 * a * b * x * y ^^^ 2 + -2 * a * b * y ^^^ 3 + b ^^^ 2 * x ^^^ 3 + -3 * b ^^^ 2 * x ^^^ 2 * y + 3 * b ^^^ 2 * x * y ^^^ 2 + -1 * b ^^^ 2 * y ^^^ 3)" |
1137 val SOME (t,_) = rewrite_set_ thy false cancel_p t; |
1137 val SOME (t,_) = rewrite_set_ thy false cancel_p t; |
1138 term2str t;*) |
1138 term2str t;*) |
1145 val t = str2term "18*(a+b)^^^3*(a - b)^^^2/(72*(a - b)^^^3*(a+b)^^^2)"; |
1145 val t = str2term "18*(a+b)^^^3*(a - b)^^^2/(72*(a - b)^^^3*(a+b)^^^2)"; |
1146 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1146 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1147 term2str t; |
1147 term2str t; |
1148 if (term2str t) = |
1148 if (term2str t) = |
1149 "(a + b) / (4 * a + -4 * b)" |
1149 "(a + b) / (4 * a + -4 * b)" |
1150 then () else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 8"; |
1150 then () else error "rational.sml.sml: diff.behav. in norm_Rational_mg 8"; |
1151 *) |
1151 *) |
1152 |
1152 |
1153 (*SRC Schalk I, p.66 Nr. 381b *) |
1153 (*SRC Schalk I, p.66 Nr. 381b *) |
1154 val t = str2term |
1154 val t = str2term |
1155 "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3"; |
1155 "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3"; |
1156 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1156 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1157 term2str t; |
1157 term2str t; |
1158 if (term2str t) = |
1158 if (term2str t) = |
1159 "-1 / (5 + -2 * x)" |
1159 "-1 / (5 + -2 * x)" |
1160 then () |
1160 then () |
1161 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 9"; |
1161 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 9"; |
1162 |
1162 |
1163 (*SRC Schalk I, p.66 Nr. 381c *) |
1163 (*SRC Schalk I, p.66 Nr. 381c *) |
1164 val t = str2term |
1164 val t = str2term |
1165 "(27*a^^^3+9*a^^^2+3*a+1)/(27*a^^^3+18*a^^^2+3*a)"; |
1165 "(27*a^^^3+9*a^^^2+3*a+1)/(27*a^^^3+18*a^^^2+3*a)"; |
1166 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1166 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1167 term2str t; |
1167 term2str t; |
1168 if (term2str t) = |
1168 if (term2str t) = |
1169 "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)" |
1169 "(1 + 9 * a ^^^ 2) / (3 * a + 9 * a ^^^ 2)" |
1170 then () |
1170 then () |
1171 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 10"; |
1171 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 10"; |
1172 |
1172 |
1173 (*SRC Schalk I, p.66 Nr. 383a *) |
1173 (*SRC Schalk I, p.66 Nr. 383a *) |
1174 val t = str2term |
1174 val t = str2term |
1175 "(5*a^^^2 - 5*a*b)/(a - b)^^^2"; |
1175 "(5*a^^^2 - 5*a*b)/(a - b)^^^2"; |
1176 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1176 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1177 term2str t; |
1177 term2str t; |
1178 if (term2str t) = |
1178 if (term2str t) = |
1179 "5 * a / (a + -1 * b)" |
1179 "5 * a / (a + -1 * b)" |
1180 then () |
1180 then () |
1181 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 11"; |
1181 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 11"; |
1182 |
1182 |
1183 "-------- common denominator -------------------------------------"; |
1183 "-------- common denominator -------------------------------------"; |
1184 "-------- common denominator -------------------------------------"; |
1184 "-------- common denominator -------------------------------------"; |
1185 "-------- common denominator -------------------------------------"; |
1185 "-------- common denominator -------------------------------------"; |
1186 |
1186 |
1190 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1190 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1191 term2str t; |
1191 term2str t; |
1192 if (term2str t) = |
1192 if (term2str t) = |
1193 "(-3 * x + 4 * y + -1 * x * y) / (x * y)" |
1193 "(-3 * x + 4 * y + -1 * x * y) / (x * y)" |
1194 then () |
1194 then () |
1195 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 12"; |
1195 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 12"; |
1196 |
1196 |
1197 (*SRA Schalk I, p.67 Nr. 407b *) |
1197 (*SRA Schalk I, p.67 Nr. 407b *) |
1198 val t = str2term |
1198 val t = str2term |
1199 "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)"; |
1199 "(2*a+3*b)/(b*c) + (3*c+a)/(a*c) - (2*a^^^2+3*b*c)/(a*b*c)"; |
1200 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1200 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1201 term2str t; |
1201 term2str t; |
1202 if (term2str t) = |
1202 if (term2str t) = |
1203 "4 / c" |
1203 "4 / c" |
1204 then () |
1204 then () |
1205 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 13"; |
1205 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 13"; |
1206 |
1206 |
1207 (*SRA Schalk I, p.67 Nr. 410b *) |
1207 (*SRA Schalk I, p.67 Nr. 410b *) |
1208 val t = str2term |
1208 val t = str2term |
1209 "1/(x+1) + 1/(x+2) - 2/(x+3)"; |
1209 "1/(x+1) + 1/(x+2) - 2/(x+3)"; |
1210 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1210 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1211 term2str t; |
1211 term2str t; |
1212 if (term2str t) = |
1212 if (term2str t) = |
1213 "(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)" |
1213 "(5 + 3 * x) / (6 + 11 * x + 6 * x ^^^ 2 + x ^^^ 3)" |
1214 then () |
1214 then () |
1215 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 14"; |
1215 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 14"; |
1216 |
1216 |
1217 (*SRA Schalk I, p.67 Nr. 413b *) |
1217 (*SRA Schalk I, p.67 Nr. 413b *) |
1218 val t = str2term |
1218 val t = str2term |
1219 "(1+x)/(1 - x) - (1 - x)/(1+x) + 2*x/(1 - x^^^2)"; |
1219 "(1+x)/(1 - x) - (1 - x)/(1+x) + 2*x/(1 - x^^^2)"; |
1220 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1220 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1221 term2str t; |
1221 term2str t; |
1222 if (term2str t) = |
1222 if (term2str t) = |
1223 "6 * x / (1 + -1 * x ^^^ 2)" |
1223 "6 * x / (1 + -1 * x ^^^ 2)" |
1224 then () |
1224 then () |
1225 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 15"; |
1225 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 15"; |
1226 |
1226 |
1227 (*SRA Schalk I, p.68 Nr. 414a *) |
1227 (*SRA Schalk I, p.68 Nr. 414a *) |
1228 val t = str2term |
1228 val t = str2term |
1229 "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))"; |
1229 "(x + 2)/(x - 1) + (x - 3)/(x - 2) - (x + 1)/((x - 1)*(x - 2))"; |
1230 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1230 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1231 term2str t; |
1231 term2str t; |
1232 if (term2str t) = |
1232 if (term2str t) = |
1233 "(-2 + -5 * x + 2 * x ^^^ 2) / (2 + -3 * x + x ^^^ 2)" |
1233 "(-2 + -5 * x + 2 * x ^^^ 2) / (2 + -3 * x + x ^^^ 2)" |
1234 then () |
1234 then () |
1235 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 16"; |
1235 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 16"; |
1236 |
1236 |
1237 (*SRA Schalk I, p.68 Nr. 423a *) |
1237 (*SRA Schalk I, p.68 Nr. 423a *) |
1238 val t = str2term |
1238 val t = str2term |
1239 "(2*x+3*y)/x + (4*x^^^3 - x*y^^^2 - 3*y^^^3)/(x^^^3 - 2*x^^^2*y+x*y^^^2) - (5*x+6*y)/(x - y)"; |
1239 "(2*x+3*y)/x + (4*x^^^3 - x*y^^^2 - 3*y^^^3)/(x^^^3 - 2*x^^^2*y+x*y^^^2) - (5*x+6*y)/(x - y)"; |
1240 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1240 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1241 term2str t; |
1241 term2str t; |
1242 if (term2str t) = |
1242 if (term2str t) = |
1243 "1" |
1243 "1" |
1244 then () |
1244 then () |
1245 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 17"; |
1245 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 17"; |
1246 |
1246 |
1247 (*SRA Schalk I, p.68 Nr. 428b *) |
1247 (*SRA Schalk I, p.68 Nr. 428b *) |
1248 val t = str2term |
1248 val t = str2term |
1249 "1/(a - b)^^^2 + 1/(a+b)^^^2 - 2/(a^^^2 - b^^^2) - 4*(b^^^2 - 1)/(a^^^2 - b^^^2)^^^2"; |
1249 "1/(a - b)^^^2 + 1/(a+b)^^^2 - 2/(a^^^2 - b^^^2) - 4*(b^^^2 - 1)/(a^^^2 - b^^^2)^^^2"; |
1250 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1250 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1251 term2str t; |
1251 term2str t; |
1252 if (term2str t) = |
1252 if (term2str t) = |
1253 "4 / (a ^^^ 4 + -2 * a ^^^ 2 * b ^^^ 2 + b ^^^ 4)" |
1253 "4 / (a ^^^ 4 + -2 * a ^^^ 2 * b ^^^ 2 + b ^^^ 4)" |
1254 then () |
1254 then () |
1255 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 18"; |
1255 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 18"; |
1256 |
1256 |
1257 (*SRA Schalk I, p.68 Nr. 430b *) |
1257 (*SRA Schalk I, p.68 Nr. 430b *) |
1258 val t = str2term |
1258 val t = str2term |
1259 "a^^^2/(a - 3*b) - 108*a*b^^^3/((a+3*b)*(a^^^2 - 9*b^^^2)) - 9*b^^^2*(a - 3*b)/(a+3*b)^^^2"; |
1259 "a^^^2/(a - 3*b) - 108*a*b^^^3/((a+3*b)*(a^^^2 - 9*b^^^2)) - 9*b^^^2*(a - 3*b)/(a+3*b)^^^2"; |
1260 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1260 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1261 term2str t; |
1261 term2str t; |
1262 if (term2str t) = |
1262 if (term2str t) = |
1263 "a + 3 * b" |
1263 "a + 3 * b" |
1264 then () |
1264 then () |
1265 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 19"; |
1265 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 19"; |
1266 |
1266 |
1267 |
1267 |
1268 (*SRA Schalk I, p.68 Nr. 432 *) |
1268 (*SRA Schalk I, p.68 Nr. 432 *) |
1269 val t = str2term |
1269 val t = str2term |
1270 "(a^^^2+a*b)/(a^^^2 - b^^^2) - (b^^^2 - a*b)/(b^^^2 - a^^^2) + a^^^2*(a - b)/(a^^^3 - a^^^2*b) - 2*a*(a^^^2 - b^^^2)/(a^^^3 - a*b^^^2) - 2*b^^^2/(a^^^2 - b^^^2)"; |
1270 "(a^^^2+a*b)/(a^^^2 - b^^^2) - (b^^^2 - a*b)/(b^^^2 - a^^^2) + a^^^2*(a - b)/(a^^^3 - a^^^2*b) - 2*a*(a^^^2 - b^^^2)/(a^^^3 - a*b^^^2) - 2*b^^^2/(a^^^2 - b^^^2)"; |
1271 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1271 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1272 term2str t; |
1272 term2str t; |
1273 if (term2str t) = |
1273 if (term2str t) = |
1274 "0" |
1274 "0" |
1275 then () |
1275 then () |
1276 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 20"; |
1276 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 20"; |
1277 |
1277 |
1278 (*Eigenes*) |
1278 (*Eigenes*) |
1279 val t = str2term |
1279 val t = str2term |
1280 "3*a/(a*b) + x/y"; |
1280 "3*a/(a*b) + x/y"; |
1281 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1281 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1282 term2str t; |
1282 term2str t; |
1283 if (term2str t) = |
1283 if (term2str t) = |
1284 "(3 * y + b * x) / (b * y)" |
1284 "(3 * y + b * x) / (b * y)" |
1285 then () |
1285 then () |
1286 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 21"; |
1286 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 21"; |
1287 |
1287 |
1288 |
1288 |
1289 "-------- multiply and cancel ------------------------------------"; |
1289 "-------- multiply and cancel ------------------------------------"; |
1290 "-------- multiply and cancel ------------------------------------"; |
1290 "-------- multiply and cancel ------------------------------------"; |
1291 "-------- multiply and cancel ------------------------------------"; |
1291 "-------- multiply and cancel ------------------------------------"; |
1296 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1296 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1297 term2str t; |
1297 term2str t; |
1298 if (term2str t) = |
1298 if (term2str t) = |
1299 "(5 * x + -5 * y) / (18 * x + 18 * y)" |
1299 "(5 * x + -5 * y) / (18 * x + 18 * y)" |
1300 then () |
1300 then () |
1301 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 22"; |
1301 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 22"; |
1302 |
1302 |
1303 (*SRM.test Schalk I, p.68 Nr. 436b *) |
1303 (*SRM.test Schalk I, p.68 Nr. 436b *) |
1304 (*WN060420???MG3 crashes with method 'simplify' in |
1304 (*WN060420???MG3 crashes with method 'simplify' in |
1305 IsacCore > Simplification > Rational Terms > Multiplication > No.2*) |
1305 IsacCore > Simplification > Rational Terms > Multiplication > No.2*) |
1306 val t = str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3"; |
1306 val t = str2term "5*a*(a - b)^^^2*(a + b)^^^3/(7*b*(a - b)^^^3) * 7*b/(a + b)^^^3"; |
1307 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1307 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1308 term2str t; |
1308 term2str t; |
1309 if (term2str t) = |
1309 if (term2str t) = |
1310 "5 * a / (a + -1 * b)" |
1310 "5 * a / (a + -1 * b)" |
1311 then () |
1311 then () |
1312 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 23"; |
1312 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 23"; |
1313 |
1313 |
1314 (*Schalk I, p.68 Nr. 437a *) |
1314 (*Schalk I, p.68 Nr. 437a *) |
1315 val t = str2term "(3*a - 4*b)/(4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)"; |
1315 val t = str2term "(3*a - 4*b)/(4*c+3*e) * (3*a+4*b)/(9*a^^^2 - 16*b^^^2)"; |
1316 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1316 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1317 if (term2str t) = "1 / (4 * c + 3 * e)" then () |
1317 if (term2str t) = "1 / (4 * c + 3 * e)" then () |
1318 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24"; |
1318 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 24"; |
1319 |
1319 |
1320 "----- S.K. corrected non-termination 060904"; |
1320 "----- S.K. corrected non-termination 060904"; |
1321 val t = str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))"; |
1321 val t = str2term "(3*a - 4*b) * (3*a+4*b)/((4*c+3*e)*(9*a^^^2 - 16*b^^^2))"; |
1322 val SOME (t',_) = rewrite_set_ thy false make_polynomial t; |
1322 val SOME (t',_) = rewrite_set_ thy false make_polynomial t; |
1323 if term2str t' = "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\n(36 * a ^^^ 2 * c + 27 * a ^^^ 2 * e + -64 * b ^^^ 2 * c +\n -48 * b ^^^ 2 * e)" then () |
1323 if term2str t' = "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\n(36 * a ^^^ 2 * c + 27 * a ^^^ 2 * e + -64 * b ^^^ 2 * c +\n -48 * b ^^^ 2 * e)" then () |
1324 else raise error "rational.sml.sml: S.K.8..corrected 060904-6"; |
1324 else error "rational.sml.sml: S.K.8..corrected 060904-6"; |
1325 |
1325 |
1326 "----- S.K. corrected non-termination of cancel_p_"; |
1326 "----- S.K. corrected non-termination of cancel_p_"; |
1327 val t'' = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
1327 val t'' = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
1328 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
1328 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
1329 val SOME (t',_) = rewrite_set_ thy false cancel_p t''; |
1329 val SOME (t',_) = rewrite_set_ thy false cancel_p t''; |
1330 if term2str t' = "1 / (4 * c + 3 * e)" then () |
1330 if term2str t' = "1 / (4 * c + 3 * e)" then () |
1331 else raise error "rational.sml.sml: diff.behav. in cancel_p S.K.8"; |
1331 else error "rational.sml.sml: diff.behav. in cancel_p S.K.8"; |
1332 |
1332 |
1333 (**) |
1333 (**) |
1334 |
1334 |
1335 (*Schalk I, p.68 Nr. 437b *) |
1335 (*Schalk I, p.68 Nr. 437b *) |
1336 (* nonterm.SK9 loops: cancel_p kann nicht weiter kuerzen!!! *) |
1336 (* nonterm.SK9 loops: cancel_p kann nicht weiter kuerzen!!! *) |
1352 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1352 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1353 term2str t; |
1353 term2str t; |
1354 if (term2str t) = |
1354 if (term2str t) = |
1355 "x ^^^ 2" |
1355 "x ^^^ 2" |
1356 then () |
1356 then () |
1357 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 24"; |
1357 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 24"; |
1358 |
1358 |
1359 (*SRM Schalk I, p.68 Nr. 439b *) |
1359 (*SRM Schalk I, p.68 Nr. 439b *) |
1360 val t = str2term |
1360 val t = str2term |
1361 "(4*x^^^2+4*x+1)*((x^^^2 - 2*x^^^3)/(4*x^^^2+2*x))"; |
1361 "(4*x^^^2+4*x+1)*((x^^^2 - 2*x^^^3)/(4*x^^^2+2*x))"; |
1362 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1362 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1363 term2str t; |
1363 term2str t; |
1364 if (term2str t) = |
1364 if (term2str t) = |
1365 "(x + -4 * x ^^^ 3) / 2" |
1365 "(x + -4 * x ^^^ 3) / 2" |
1366 then () |
1366 then () |
1367 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 25"; |
1367 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 25"; |
1368 |
1368 |
1369 (*SRM Schalk I, p.68 Nr. 440a *) |
1369 (*SRM Schalk I, p.68 Nr. 440a *) |
1370 val t = str2term |
1370 val t = str2term |
1371 "(x^^^2 - 2*x)/(x^^^2 - 3*x) * (x - 3)^^^2/(x^^^2 - 4)"; |
1371 "(x^^^2 - 2*x)/(x^^^2 - 3*x) * (x - 3)^^^2/(x^^^2 - 4)"; |
1372 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1372 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1373 term2str t; |
1373 term2str t; |
1374 if (term2str t) = |
1374 if (term2str t) = |
1375 "(-3 + x) / (2 + x)" |
1375 "(-3 + x) / (2 + x)" |
1376 then () |
1376 then () |
1377 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 26"; |
1377 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 26"; |
1378 |
1378 |
1379 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx"; |
1379 "----- Schalk I, p.68 Nr. 440b SK11 works since 0707xx"; |
1380 val t = str2term |
1380 val t = str2term |
1381 "(a^^^3 - 9*a)/(a^^^3*b - a*b^^^3)*(a^^^2*b+a*b^^^2)/(a+3)"; |
1381 "(a^^^3 - 9*a)/(a^^^3*b - a*b^^^3)*(a^^^2*b+a*b^^^2)/(a+3)"; |
1382 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1382 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1383 if term2str t = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then () |
1383 if term2str t = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then () |
1384 else raise error "rational.sml.sml: diff.behav. in norm_Rational 27"; |
1384 else error "rational.sml.sml: diff.behav. in norm_Rational 27"; |
1385 |
1385 |
1386 "----- SK12 works since 0707xx"; |
1386 "----- SK12 works since 0707xx"; |
1387 val t = str2term "(a^^^3 - 9*a)*(a^^^2*b+a*b^^^2)/((a^^^3*b - a*b^^^3)*(a+3))"; |
1387 val t = str2term "(a^^^3 - 9*a)*(a^^^2*b+a*b^^^2)/((a^^^3*b - a*b^^^3)*(a+3))"; |
1388 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1388 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; term2str t'; |
1389 if term2str t' = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then () |
1389 if term2str t' = "(-3 * a + a ^^^ 2) / (a + -1 * b)" then () |
1390 else raise error "rational.sml.sml: diff.behav. in norm_Rational 28"; |
1390 else error "rational.sml.sml: diff.behav. in norm_Rational 28"; |
1391 |
1391 |
1392 |
1392 |
1393 "-------- common denominator and multiplication ------------------"; |
1393 "-------- common denominator and multiplication ------------------"; |
1394 "-------- common denominator and multiplication ------------------"; |
1394 "-------- common denominator and multiplication ------------------"; |
1395 "-------- common denominator and multiplication ------------------"; |
1395 "-------- common denominator and multiplication ------------------"; |
1404 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1404 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1405 term2str t; |
1405 term2str t; |
1406 if (term2str t) = |
1406 if (term2str t) = |
1407 "(36 * b ^^^ 3 + 3 * a ^^^ 2 * b ^^^ 2 + 16 * a ^^^ 4 * b) / (9 * a ^^^ 4)" |
1407 "(36 * b ^^^ 3 + 3 * a ^^^ 2 * b ^^^ 2 + 16 * a ^^^ 4 * b) / (9 * a ^^^ 4)" |
1408 then () |
1408 then () |
1409 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 28"; |
1409 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 28"; |
1410 |
1410 |
1411 (*SRAM Schalk I, p.69 Nr. 442b *) |
1411 (*SRAM Schalk I, p.69 Nr. 442b *) |
1412 val t = str2term "(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x)*(x^^^3/(5*a*b^^^3*c^^^3)) + 1/c^^^3 * (b*x/a - 3*a/b^^^3)"; |
1412 val t = str2term "(15*a^^^2/x^^^3 - 5*b^^^4/x^^^2 + 25*c^^^2/x)*(x^^^3/(5*a*b^^^3*c^^^3)) + 1/c^^^3 * (b*x/a - 3*a/b^^^3)"; |
1413 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1413 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1414 term2str t; |
1414 term2str t; |
1415 if (term2str t) = |
1415 if (term2str t) = |
1416 "5 * x ^^^ 2 / (a * b ^^^ 3 * c)" |
1416 "5 * x ^^^ 2 / (a * b ^^^ 3 * c)" |
1417 then () |
1417 then () |
1418 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 29"; |
1418 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 29"; |
1419 |
1419 |
1420 (*SRAM Schalk I, p.69 Nr. 443b *) |
1420 (*SRAM Schalk I, p.69 Nr. 443b *) |
1421 val t = str2term "(a/2 + b/3)*(b/3 - a/2)"; |
1421 val t = str2term "(a/2 + b/3)*(b/3 - a/2)"; |
1422 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1422 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1423 term2str t; |
1423 term2str t; |
1424 if (term2str t) = |
1424 if (term2str t) = |
1425 "(-9 * a ^^^ 2 + 4 * b ^^^ 2) / 36" |
1425 "(-9 * a ^^^ 2 + 4 * b ^^^ 2) / 36" |
1426 then () |
1426 then () |
1427 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 30"; |
1427 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 30"; |
1428 |
1428 |
1429 (*SRAM Schalk I, p.69 Nr. 445b *) |
1429 (*SRAM Schalk I, p.69 Nr. 445b *) |
1430 val t = str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3"; |
1430 val t = str2term "(a^^^2/9 + 2*a/(3*b) + 4/b^^^2)*(a/3 - 2/b) + 8/b^^^3"; |
1431 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1431 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1432 term2str t; |
1432 term2str t; |
1433 if (term2str t) = |
1433 if (term2str t) = |
1434 "a ^^^ 3 / 27" |
1434 "a ^^^ 3 / 27" |
1435 then () |
1435 then () |
1436 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 31"; |
1436 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 31"; |
1437 |
1437 |
1438 (*SRAM Schalk I, p.69 Nr. 446b *) |
1438 (*SRAM Schalk I, p.69 Nr. 446b *) |
1439 val t = str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)"; |
1439 val t = str2term "(x/(5*x + 4*y) - y/(5*x - 4*y) + 1)*(25*x^^^2 - 16*y^^^2)"; |
1440 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1440 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1441 term2str t; |
1441 term2str t; |
1442 if (term2str t) = |
1442 if (term2str t) = |
1443 "30 * x ^^^ 2 + -9 * x * y + -20 * y ^^^ 2" |
1443 "30 * x ^^^ 2 + -9 * x * y + -20 * y ^^^ 2" |
1444 then () |
1444 then () |
1445 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 32"; |
1445 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 32"; |
1446 |
1446 |
1447 (*SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*) |
1447 (*SRAM Schalk I, p.69 Nr. 449a *)(*Achtung: rechnet ca 8 Sekunden*) |
1448 val t = str2term |
1448 val t = str2term |
1449 "(2*x^^^2/(3*y)+x/y^^^2)*(4*x^^^4/(9*y^^^2)+x^^^2/y^^^4)*(2*x^^^2/(3*y) - x/y^^^2)"; |
1449 "(2*x^^^2/(3*y)+x/y^^^2)*(4*x^^^4/(9*y^^^2)+x^^^2/y^^^4)*(2*x^^^2/(3*y) - x/y^^^2)"; |
1450 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1450 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1451 term2str t; |
1451 term2str t; |
1452 if (term2str t) = |
1452 if (term2str t) = |
1453 "(-81 * x ^^^ 4 + 16 * x ^^^ 8 * y ^^^ 4) / (81 * y ^^^ 8)" |
1453 "(-81 * x ^^^ 4 + 16 * x ^^^ 8 * y ^^^ 4) / (81 * y ^^^ 8)" |
1454 then () |
1454 then () |
1455 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 33"; |
1455 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 33"; |
1456 |
1456 |
1457 (*SRAM Schalk I, p.69 Nr. 450a *) |
1457 (*SRAM Schalk I, p.69 Nr. 450a *) |
1458 val t = str2term |
1458 val t = str2term |
1459 "(4*x/(3*y)+2*y/(3*x))^^^2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)"; |
1459 "(4*x/(3*y)+2*y/(3*x))^^^2 - (2*y/(3*x) - 2*x/y)*(2*y/(3*x)+2*x/y)"; |
1460 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1460 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1461 term2str t; |
1461 term2str t; |
1462 if (term2str t) = |
1462 if (term2str t) = |
1463 "(52 * x ^^^ 2 + 16 * y ^^^ 2) / (9 * y ^^^ 2)" |
1463 "(52 * x ^^^ 2 + 16 * y ^^^ 2) / (9 * y ^^^ 2)" |
1464 then () |
1464 then () |
1465 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 34"; |
1465 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 34"; |
1466 |
1466 |
1467 "-------- double fractions ---------------------------------------"; |
1467 "-------- double fractions ---------------------------------------"; |
1468 "-------- double fractions ---------------------------------------"; |
1468 "-------- double fractions ---------------------------------------"; |
1469 "-------- double fractions ---------------------------------------"; |
1469 "-------- double fractions ---------------------------------------"; |
1470 |
1470 |
1474 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1474 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1475 term2str t; |
1475 term2str t; |
1476 if (term2str t) = |
1476 if (term2str t) = |
1477 "(-4 + 4 * x + -1 * x ^^^ 2) / (4 * a ^^^ 2)" |
1477 "(-4 + 4 * x + -1 * x ^^^ 2) / (4 * a ^^^ 2)" |
1478 then () |
1478 then () |
1479 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 35"; |
1479 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 35"; |
1480 |
1480 |
1481 (*SRD Schalk I, p.69 Nr. 455a *) |
1481 (*SRD Schalk I, p.69 Nr. 455a *) |
1482 val t = str2term |
1482 val t = str2term |
1483 "(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))"; |
1483 "(a^^^2 + 1)/(a^^^2 - 1) / ((a+1)/(a - 1))"; |
1484 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1484 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1485 term2str t; |
1485 term2str t; |
1486 if (term2str t) = |
1486 if (term2str t) = |
1487 "(1 + a ^^^ 2) / (1 + 2 * a + a ^^^ 2)" then () |
1487 "(1 + a ^^^ 2) / (1 + 2 * a + a ^^^ 2)" then () |
1488 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 36"; |
1488 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 36"; |
1489 |
1489 |
1490 |
1490 |
1491 "----- Schalk I, p.69 Nr. 455b"; |
1491 "----- Schalk I, p.69 Nr. 455b"; |
1492 val t = str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))"; |
1492 val t = str2term "(x^^^2 - 4)/(y^^^2 - 9)/((2+x)/(3 - y))"; |
1493 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1493 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1494 if term2str t = "(2 + -1 * x) / (3 + y)" then () |
1494 if term2str t = "(2 + -1 * x) / (3 + y)" then () |
1495 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37"; |
1495 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 37"; |
1496 |
1496 |
1497 "----- SK060904-1a non-termination of cancel_p_ ?: worked before 0707xx"; |
1497 "----- SK060904-1a non-termination of cancel_p_ ?: worked before 0707xx"; |
1498 val t = str2term "(x^^^2 - 4)*(3 - y)/((y^^^2 - 9)*(2+x))"; |
1498 val t = str2term "(x^^^2 - 4)*(3 - y)/((y^^^2 - 9)*(2+x))"; |
1499 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1499 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1500 if term2str t = "(2 + -1 * x) / (3 + y)" then () |
1500 if term2str t = "(2 + -1 * x) / (3 + y)" then () |
1501 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 37b"; |
1501 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 37b"; |
1502 |
1502 |
1503 "----- ?: worked before 0707xx"; |
1503 "----- ?: worked before 0707xx"; |
1504 val t = str2term "(3 + -1 * y) / (-9 + y ^^^ 2)"; |
1504 val t = str2term "(3 + -1 * y) / (-9 + y ^^^ 2)"; |
1505 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1505 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1506 if term2str t = "-1 / (3 + y)" then () |
1506 if term2str t = "-1 / (3 + y)" then () |
1507 else raise error "rational.sml: -1 / (3 + y) norm_Rational"; |
1507 else error "rational.sml: -1 / (3 + y) norm_Rational"; |
1508 |
1508 |
1509 (*SRD Schalk I, p.69 Nr. 456b *) |
1509 (*SRD Schalk I, p.69 Nr. 456b *) |
1510 val t = str2term |
1510 val t = str2term |
1511 "(b^^^3 - b^^^2)/(b^^^2+b)/(b^^^2 - 1)"; |
1511 "(b^^^3 - b^^^2)/(b^^^2+b)/(b^^^2 - 1)"; |
1512 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1512 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1513 term2str t; |
1513 term2str t; |
1514 if (term2str t) = "b / (1 + 2 * b + b ^^^ 2)" then () |
1514 if (term2str t) = "b / (1 + 2 * b + b ^^^ 2)" then () |
1515 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 38"; |
1515 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 38"; |
1516 |
1516 |
1517 (*SRD Schalk I, p.69 Nr. 457b *) |
1517 (*SRD Schalk I, p.69 Nr. 457b *) |
1518 val t = str2term |
1518 val t = str2term |
1519 "(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))"; |
1519 "(16*a^^^2 - 9*b^^^2)/(2*a+3*a*b) / ((4*a+3*b)/(4*a^^^2 - 9*a^^^2*b^^^2))"; |
1520 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1520 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1521 term2str t; |
1521 term2str t; |
1522 if (term2str t) = |
1522 if (term2str t) = |
1523 "8 * a ^^^ 2 + -6 * a * b + -12 * a ^^^ 2 * b + 9 * a * b ^^^ 2" |
1523 "8 * a ^^^ 2 + -6 * a * b + -12 * a ^^^ 2 * b + 9 * a * b ^^^ 2" |
1524 then () |
1524 then () |
1525 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39"; |
1525 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 39"; |
1526 |
1526 |
1527 "----- Schalk I, p.69 Nr. 458b works since 0707"; |
1527 "----- Schalk I, p.69 Nr. 458b works since 0707"; |
1528 val t = str2term |
1528 val t = str2term |
1529 "(2*a^^^2*x - a^^^2)/(a*x - b*x) / (b^^^2*(2*x - 1)/(x*(a - b)))"; |
1529 "(2*a^^^2*x - a^^^2)/(a*x - b*x) / (b^^^2*(2*x - 1)/(x*(a - b)))"; |
1530 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1530 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1531 if term2str t = "a ^^^ 2 / b ^^^ 2" then () |
1531 if term2str t = "a ^^^ 2 / b ^^^ 2" then () |
1532 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 39b"; |
1532 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 39b"; |
1533 |
1533 |
1534 (*SRD Schalk I, p.69 Nr. 459b *) |
1534 (*SRD Schalk I, p.69 Nr. 459b *) |
1535 val t = str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)"; |
1535 val t = str2term "(a^^^2 - b^^^2)/(a*b) / (4*(a+b)^^^2/a)"; |
1536 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1536 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1537 if term2str t = "(a + -1 * b) / (4 * a * b + 4 * b ^^^ 2)" then () |
1537 if term2str t = "(a + -1 * b) / (4 * a * b + 4 * b ^^^ 2)" then () |
1538 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 41"; |
1538 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 41"; |
1539 |
1539 |
1540 |
1540 |
1541 (*Schalk I, p.69 Nr. 460b nonterm.SK |
1541 (*Schalk I, p.69 Nr. 460b nonterm.SK |
1542 val t = str2term |
1542 val t = str2term |
1543 "(9*(x^^^2 - 8*x+16)/(4*(y^^^2 - 2*y+1)))/((3*x - 12)/(16*y - 16))"; |
1543 "(9*(x^^^2 - 8*x+16)/(4*(y^^^2 - 2*y+1)))/((3*x - 12)/(16*y - 16))"; |
1544 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1544 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1545 if term2str t = |
1545 if term2str t = |
1546 then () |
1546 then () |
1547 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 42"; |
1547 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 42"; |
1548 |
1548 |
1549 val t = str2term |
1549 val t = str2term |
1550 "9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))"; |
1550 "9*(x^^^2 - 8*x+16)*(16*y - 16)/(4*(y^^^2 - 2*y+1)*(3*x - 12))"; |
1551 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; |
1551 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; |
1552 ... non terminating. |
1552 ... non terminating. |
1561 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1561 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1562 term2str t; |
1562 term2str t; |
1563 if (term2str t) = |
1563 if (term2str t) = |
1564 "x + y" |
1564 "x + y" |
1565 then () |
1565 then () |
1566 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 43"; |
1566 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 43"; |
1567 |
1567 |
1568 |
1568 |
1569 (*----------------------------------------------------------------------*) |
1569 (*----------------------------------------------------------------------*) |
1570 (*---------------------- Einfache Dppelbrche --------------------------*) |
1570 (*---------------------- Einfache Dppelbrche --------------------------*) |
1571 (*----------------------------------------------------------------------*) |
1571 (*----------------------------------------------------------------------*) |
1576 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1576 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1577 term2str t; |
1577 term2str t; |
1578 if (term2str t) = |
1578 if (term2str t) = |
1579 "1 / 2" |
1579 "1 / 2" |
1580 then () |
1580 then () |
1581 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 44"; |
1581 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 44"; |
1582 |
1582 |
1583 (*SRD Schalk I, p.69 Nr. 464b *) |
1583 (*SRD Schalk I, p.69 Nr. 464b *) |
1584 val t = str2term |
1584 val t = str2term |
1585 "(a - a/(a - 2)) / (a + a/(a - 2))"; |
1585 "(a - a/(a - 2)) / (a + a/(a - 2))"; |
1586 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1586 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1587 term2str t; |
1587 term2str t; |
1588 if (term2str t) = |
1588 if (term2str t) = |
1589 "(3 + -1 * a) / (1 + -1 * a)" |
1589 "(3 + -1 * a) / (1 + -1 * a)" |
1590 then () |
1590 then () |
1591 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 45"; |
1591 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 45"; |
1592 |
1592 |
1593 (*SRD Schalk I, p.69 Nr. 465b *) |
1593 (*SRD Schalk I, p.69 Nr. 465b *) |
1594 val t = str2term |
1594 val t = str2term |
1595 "((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) /(x/9+y/6+z/4)"; |
1595 "((x+3*y)/9 + (4*y^^^2 - 9*z^^^2)/(16*x)) /(x/9+y/6+z/4)"; |
1596 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1596 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1597 term2str t; |
1597 term2str t; |
1598 if (term2str t) = |
1598 if (term2str t) = |
1599 "(4 * x + 6 * y + -9 * z) / (4 * x)" |
1599 "(4 * x + 6 * y + -9 * z) / (4 * x)" |
1600 then () |
1600 then () |
1601 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 46"; |
1601 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 46"; |
1602 |
1602 |
1603 (*SRD Schalk I, p.69 Nr. 466b *) |
1603 (*SRD Schalk I, p.69 Nr. 466b *) |
1604 val t = str2term |
1604 val t = str2term |
1605 "((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))"; |
1605 "((1 - 7*(x - 2)/(x^^^2 - 4)) / (6/(x+2))) / (3/(x+5)+30/(x^^^2 - 25))"; |
1606 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1606 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1607 term2str t; |
1607 term2str t; |
1608 if (term2str t) = |
1608 if (term2str t) = |
1609 "(25 + -10 * x + x ^^^ 2) / 18" |
1609 "(25 + -10 * x + x ^^^ 2) / 18" |
1610 then () |
1610 then () |
1611 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 47"; |
1611 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 47"; |
1612 |
1612 |
1613 (*SRD Schalk I, p.70 Nr. 469 *) |
1613 (*SRD Schalk I, p.70 Nr. 469 *) |
1614 val t = str2term |
1614 val t = str2term |
1615 "3*b^^^2/(4*a^^^2 - 8*a*b + 4*b^^^2)/(a/(a^^^2*b - b^^^3) + (a - b)/(4*a*b^^^2+4*b^^^3) - 1/(4*b^^^2))"; |
1615 "3*b^^^2/(4*a^^^2 - 8*a*b + 4*b^^^2)/(a/(a^^^2*b - b^^^3) + (a - b)/(4*a*b^^^2+4*b^^^3) - 1/(4*b^^^2))"; |
1616 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1616 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1617 term2str t; |
1617 term2str t; |
1618 if (term2str t) = |
1618 if (term2str t) = |
1619 "3 * b ^^^ 3 / (2 * a + -2 * b)" |
1619 "3 * b ^^^ 3 / (2 * a + -2 * b)" |
1620 then () |
1620 then () |
1621 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 48"; |
1621 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 48"; |
1622 |
1622 |
1623 (*----------------------------------------------------------------------*) |
1623 (*----------------------------------------------------------------------*) |
1624 (*---------------------- Mehrfache Dppelbrueche ------------------------*) |
1624 (*---------------------- Mehrfache Dppelbrueche ------------------------*) |
1625 (*----------------------------------------------------------------------*) |
1625 (*----------------------------------------------------------------------*) |
1626 |
1626 |
1628 (*WN060419 crashes with method 'simplify' ????SK*) |
1628 (*WN060419 crashes with method 'simplify' ????SK*) |
1629 val t = str2term |
1629 val t = str2term |
1630 "((a^^^2 - b^^^2)/(2*a*b)+2*a*b/(a^^^2 - b^^^2))/((a^^^2+b^^^2)/(2*a*b)+1) / ((a^^^2+b^^^2)^^^2/(a+b)^^^2)"; |
1630 "((a^^^2 - b^^^2)/(2*a*b)+2*a*b/(a^^^2 - b^^^2))/((a^^^2+b^^^2)/(2*a*b)+1) / ((a^^^2+b^^^2)^^^2/(a+b)^^^2)"; |
1631 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1631 val SOME (t,_) = rewrite_set_ thy false norm_Rational t; |
1632 if term2str t = "1 / (a ^^^ 2 + -1 * b ^^^ 2)" then () |
1632 if term2str t = "1 / (a ^^^ 2 + -1 * b ^^^ 2)" then () |
1633 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 49"; |
1633 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 49"; |
1634 |
1634 |
1635 "----- Schalk I, p.70 Nr. 477a"; |
1635 "----- Schalk I, p.70 Nr. 477a"; |
1636 (* MG Achtung: terme explodieren; Bsp zu komplex; |
1636 (* MG Achtung: terme explodieren; Bsp zu komplex; |
1637 L???ung sollte (ziemlich grosser) Faktorisierter Ausdruck sein |
1637 L???ung sollte (ziemlich grosser) Faktorisierter Ausdruck sein |
1638 val t = str2term "b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /\ |
1638 val t = str2term "b*y/(b - 2*y)/((b^^^2 - y^^^2)/(b+2*y)) /\ |
1651 \((a - a^^^2/(a+b))/(a+(a*b)/(a - b)))"; |
1651 \((a - a^^^2/(a+b))/(a+(a*b)/(a - b)))"; |
1652 val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1652 val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1653 if term2str t' = |
1653 if term2str t' = |
1654 "(2 * a ^^^ 3 + 2 * a ^^^ 2 * b) / (a ^^^ 2 * b + b ^^^ 3)" |
1654 "(2 * a ^^^ 3 + 2 * a ^^^ 2 * b) / (a ^^^ 2 * b + b ^^^ 3)" |
1655 then () |
1655 then () |
1656 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 51"; |
1656 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 51"; |
1657 |
1657 |
1658 (* TODO.new_c:WN050820 STOP_REW_SUB introduced gave ... |
1658 (* TODO.new_c:WN050820 STOP_REW_SUB introduced gave ... |
1659 if term2str t' = "(a ^^^ 4 + -1 * a ^^^ 2 * b ^^^ 2) /\n(a * b * (b + (a * (a + -1 * b) + -1 * b * (a + -1 * b)) / (2 * a)) *\n (a + -1 * b))" then () |
1659 if term2str t' = "(a ^^^ 4 + -1 * a ^^^ 2 * b ^^^ 2) /\n(a * b * (b + (a * (a + -1 * b) + -1 * b * (a + -1 * b)) / (2 * a)) *\n (a + -1 * b))" then () |
1660 else raise error "rational.sml: works again"; |
1660 else error "rational.sml: works again"; |
1661 re-outcommented with TODO.new_c: cvs before 071227, 11:50*) |
1661 re-outcommented with TODO.new_c: cvs before 071227, 11:50*) |
1662 |
1662 |
1663 |
1663 |
1664 |
1664 |
1665 (*Schalk I, p.70 Nr. 480a *) |
1665 (*Schalk I, p.70 Nr. 480a *) |
1669 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1669 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1670 term2str t; |
1670 term2str t; |
1671 if (term2str t) = |
1671 if (term2str t) = |
1672 |
1672 |
1673 then () |
1673 then () |
1674 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 52"; |
1674 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 52"; |
1675 |
1675 |
1676 (*MG Berechne Zwischenergebnisse: WN060831 nonterm.SK00*) |
1676 (*MG Berechne Zwischenergebnisse: WN060831 nonterm.SK00*) |
1677 val t = str2term |
1677 val t = str2term |
1678 "(1/x+1/y+1/z)/(1/x - 1/y - 1/z)"; |
1678 "(1/x+1/y+1/z)/(1/x - 1/y - 1/z)"; |
1679 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1679 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1749 (*--------------------------------------------------------------------*) |
1749 (*--------------------------------------------------------------------*) |
1750 "---- MGs test set"; |
1750 "---- MGs test set"; |
1751 val t = str2term " (1 + x^^^5) / (y + x) + x^^^3 / x "; |
1751 val t = str2term " (1 + x^^^5) / (y + x) + x^^^3 / x "; |
1752 val SOME (t,_) = rewrite_set_ thy false common_nominator_p t; |
1752 val SOME (t,_) = rewrite_set_ thy false common_nominator_p t; |
1753 if term2str t = "(1 + x ^^^ 3 + x ^^^ 5 + y * x ^^^ 2) / (x + y)" then() |
1753 if term2str t = "(1 + x ^^^ 3 + x ^^^ 5 + y * x ^^^ 2) / (x + y)" then() |
1754 else raise error ""; |
1754 else error ""; |
1755 |
1755 |
1756 (*--------------------------------------------------------------------*) |
1756 (*--------------------------------------------------------------------*) |
1757 (* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3b |
1757 (* cancel_p liefert nicht immer Polynomnormalform (2): WN060831???SK3b |
1758 ---> Sortierung FALSCH !! *) |
1758 ---> Sortierung FALSCH !! *) |
1759 val t = str2term "b^^^3 * a^^^5/a "; |
1759 val t = str2term "b^^^3 * a^^^5/a "; |
1791 (* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *) |
1791 (* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *) |
1792 "----- MGs test set"; |
1792 "----- MGs test set"; |
1793 val t = str2term "(a^^^2 + -1)/(a+1)"; |
1793 val t = str2term "(a^^^2 + -1)/(a+1)"; |
1794 val SOME (t',_) = rewrite_set_ thy false cancel_p t; |
1794 val SOME (t',_) = rewrite_set_ thy false cancel_p t; |
1795 if term2str t' = "(-1 + a) / 1" then () |
1795 if term2str t' = "(-1 + a) / 1" then () |
1796 else raise error "rational.sml MG tests 3d"; |
1796 else error "rational.sml MG tests 3d"; |
1797 |
1797 |
1798 "----- NOT TERMINATING ?: worked before 0707xx"; |
1798 "----- NOT TERMINATING ?: worked before 0707xx"; |
1799 val t = str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))"; |
1799 val t = str2term "(a^^^2 - 1)*(b + 1) / ((b^^^2 - 1)*(a+1))"; |
1800 val SOME (t'',_) = rewrite_set_ thy false norm_Rational t; |
1800 val SOME (t'',_) = rewrite_set_ thy false norm_Rational t; |
1801 if term2str t'' = "(1 + -1 * a) / (1 + -1 * b)" then () |
1801 if term2str t'' = "(1 + -1 * a) / (1 + -1 * b)" then () |
1802 else raise error "rational.sml MG tests 3e"; |
1802 else error "rational.sml MG tests 3e"; |
1803 |
1803 |
1804 "----- corrected SK060905"; |
1804 "----- corrected SK060905"; |
1805 val t = str2term "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3"; |
1805 val t = str2term "(4*x^^^2 - 20*x + 25)/(2*x - 5)^^^3"; |
1806 val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1806 val SOME (t',_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1807 if term2str t' = "-1 / (5 + -2 * x)" then () |
1807 if term2str t' = "-1 / (5 + -2 * x)" then () |
1808 else raise error "rational.sml corrected SK060905"; |
1808 else error "rational.sml corrected SK060905"; |
1809 |
1809 |
1810 |
1810 |
1811 "--------------------------------------------------------------------"; |
1811 "--------------------------------------------------------------------"; |
1812 "----------------------- Muster-Beispiele fuer DA -------------------"; |
1812 "----------------------- Muster-Beispiele fuer DA -------------------"; |
1813 "--------------------------------------------------------------------"; |
1813 "--------------------------------------------------------------------"; |
1818 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1818 val SOME (t,_) = rewrite_set_ thy false norm_Rational(*_mg*) t; |
1819 term2str t; |
1819 term2str t; |
1820 if (term2str t) = |
1820 if (term2str t) = |
1821 "5 * x ^^^ 2 / (b ^^^ 3 * c)" |
1821 "5 * x ^^^ 2 / (b ^^^ 3 * c)" |
1822 then () |
1822 then () |
1823 else raise error "rational.sml.sml: diff.behav. in norm_Rational_mg 53"; |
1823 else error "rational.sml.sml: diff.behav. in norm_Rational_mg 53"; |
1824 |
1824 |
1825 "-------- me Schalk I No.186 -------------------------------------"; |
1825 "-------- me Schalk I No.186 -------------------------------------"; |
1826 "-------- me Schalk I No.186 -------------------------------------"; |
1826 "-------- me Schalk I No.186 -------------------------------------"; |
1827 "-------- me Schalk I No.186 -------------------------------------"; |
1827 "-------- me Schalk I No.186 -------------------------------------"; |
1828 val fmz = ["TERM ((14 * x * y) / ( x * y ))", |
1828 val fmz = ["TERM ((14 * x * y) / ( x * y ))", |
1843 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; |
1843 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; |
1844 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*) |
1844 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*) |
1845 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*) |
1845 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;(*++ for explicit script*) |
1846 case (f2str f, nxt) of |
1846 case (f2str f, nxt) of |
1847 ("14", ("End_Proof'", _)) => () |
1847 ("14", ("End_Proof'", _)) => () |
1848 | _ => raise error "rational.sml diff.behav. in me Schalk I No.186"; |
1848 | _ => error "rational.sml diff.behav. in me Schalk I No.186"; |
1849 |
1849 |
1850 |
1850 |
1851 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1851 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1852 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1852 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1853 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1853 "-------- interSteps ..Simp_Rat_Double_No-1.xml ------------------"; |
1887 interSteps 1 ([2,1],Res); |
1887 interSteps 1 ([2,1],Res); |
1888 val ((pt,p),_) = get_calc 1; show_pt pt; |
1888 val ((pt,p),_) = get_calc 1; show_pt pt; |
1889 val newnds = children (get_nd pt [2,1]) (*see "fun detailrls"*); |
1889 val newnds = children (get_nd pt [2,1]) (*see "fun detailrls"*); |
1890 (*if length newnds = 12 then () WN060905*) |
1890 (*if length newnds = 12 then () WN060905*) |
1891 if length newnds = 13 then () |
1891 if length newnds = 13 then () |
1892 else raise error "rational.sml: interSteps cancel_p rev_rew_p"; |
1892 else error "rational.sml: interSteps cancel_p rev_rew_p"; |
1893 |
1893 |
1894 val p = ([2,1,9],Res); |
1894 val p = ([2,1,9],Res); |
1895 getTactic 1 p; |
1895 getTactic 1 p; |
1896 val (_, tac, _) = pt_extract (pt, p); |
1896 val (_, tac, _) = pt_extract (pt, p); |
1897 (*case tac of SOME (Rewrite ("sym_real_plus_binom_times1", _)) => () |
1897 (*case tac of SOME (Rewrite ("sym_real_plus_binom_times1", _)) => () |
1898 WN060905*) |
1898 WN060905*) |
1899 case tac of SOME (Rewrite ("sym_real_add_mult_distrib2", _)) => () |
1899 case tac of SOME (Rewrite ("sym_real_add_mult_distrib2", _)) => () |
1900 | _ => raise error "rational.sml: getTactic, sym_real_plus_binom_times1"; |
1900 | _ => error "rational.sml: getTactic, sym_real_plus_binom_times1"; |
1901 |
1901 |
1902 |
1902 |
1903 "-------- investigate rulesets for cancel_p ----------------------"; |
1903 "-------- investigate rulesets for cancel_p ----------------------"; |
1904 "-------- investigate rulesets for cancel_p ----------------------"; |
1904 "-------- investigate rulesets for cancel_p ----------------------"; |
1905 "-------- investigate rulesets for cancel_p ----------------------"; |
1905 "-------- investigate rulesets for cancel_p ----------------------"; |
1996 |
1996 |
1997 "----- SK060904-1a non-termination of cancel_p_ ? worked before 0707xx"; |
1997 "----- SK060904-1a non-termination of cancel_p_ ? worked before 0707xx"; |
1998 val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))"; |
1998 val t = str2term "(x^^^2 - 4)*(3 - y) / ((y^^^2 - 9)*(2+x))"; |
1999 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; |
1999 val SOME (t',_) = rewrite_set_ thy false norm_Rational t; |
2000 if term2str t' = "(2 + -1 * x) / (3 + y)" then () |
2000 if term2str t' = "(2 + -1 * x) / (3 + y)" then () |
2001 else raise error "rational.sml SK060904-1a worked since 0707xx"; |
2001 else error "rational.sml SK060904-1a worked since 0707xx"; |
2002 |
2002 |
2003 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2003 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2004 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2004 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2005 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2005 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2006 val SOME (t',_) = cancel_p_ thy t; |
2006 val SOME (t',_) = cancel_p_ thy t; |
2007 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2007 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2008 else raise error "rational.sml SK060904-1b"; |
2008 else error "rational.sml SK060904-1b"; |
2009 |
2009 |
2010 |
2010 |
2011 "----- SK060904-2a non-termination of add_fraction_p_"; |
2011 "----- SK060904-2a non-termination of add_fraction_p_"; |
2012 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2012 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2013 \ (-1 * a + b * x) / (a + b * x) "; |
2013 \ (-1 * a + b * x) / (a + b * x) "; |
2025 |
2025 |
2026 |
2026 |
2027 "-------- how to stepwise construct Scripts ----------------------"; |
2027 "-------- how to stepwise construct Scripts ----------------------"; |
2028 "-------- how to stepwise construct Scripts ----------------------"; |
2028 "-------- how to stepwise construct Scripts ----------------------"; |
2029 "-------- how to stepwise construct Scripts ----------------------"; |
2029 "-------- how to stepwise construct Scripts ----------------------"; |
2030 lse raise error "rational.sml SK060904-1a worked since 0707xx"; |
2030 lse error "rational.sml SK060904-1a worked since 0707xx"; |
2031 |
2031 |
2032 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2032 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2033 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2033 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2034 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2034 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2035 val SOME (t',_) = cancel_p_ thy t; |
2035 val SOME (t',_) = cancel_p_ thy t; |
2036 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2036 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2037 else raise error "rational.sml SK060904-1b"; |
2037 else error "rational.sml SK060904-1b"; |
2038 |
2038 |
2039 |
2039 |
2040 "----- SK060904-2a non-termination of add_fraction_p_"; |
2040 "----- SK060904-2a non-termination of add_fraction_p_"; |
2041 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2041 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2042 \ (-1 * a + b * x) / (a + b * x) "; |
2042 \ (-1 * a + b * x) / (a + b * x) "; |
2054 |
2054 |
2055 |
2055 |
2056 "-------- how to stepwise construct Scripts ----------------------"; |
2056 "-------- how to stepwise construct Scripts ----------------------"; |
2057 "-------- how to stepwise construct Scripts ----------------------"; |
2057 "-------- how to stepwise construct Scripts ----------------------"; |
2058 "-------- how to stepwise construct Scripts ----------------------"; |
2058 "-------- how to stepwise construct Scripts ----------------------"; |
2059 lse raise error "rational.sml SK060904-1a worked since 0707xx"; |
2059 lse error "rational.sml SK060904-1a worked since 0707xx"; |
2060 |
2060 |
2061 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2061 "----- SK060904-1b non-termination of cancel_p_ ... worked before 0707xx"; |
2062 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2062 val t = str2term "(9 * a ^^^ 2 + -16 * b ^^^ 2) /\ |
2063 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2063 \(36 * a^^^2 * c + (27 * a^^^2 * e + (-64 * b^^^2 * c + -48 * b^^^2 * e)))"; |
2064 val SOME (t',_) = cancel_p_ thy t; |
2064 val SOME (t',_) = cancel_p_ thy t; |
2065 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2065 if term2str t' = "1 / (4 * c + 3 * e)" then () |
2066 else raise error "rational.sml SK060904-1b"; |
2066 else error "rational.sml SK060904-1b"; |
2067 |
2067 |
2068 |
2068 |
2069 "----- SK060904-2a non-termination of add_fraction_p_"; |
2069 "----- SK060904-2a non-termination of add_fraction_p_"; |
2070 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2070 val t = str2term " (a + b * x) / (a + -1 * (b * x)) + \ |
2071 \ (-1 * a + b * x) / (a + b * x) "; |
2071 \ (-1 * a + b * x) / (a + b * x) "; |