Skip to content

Commit f819c03

Browse files
committed
Just disable all unsound rules, probably we can bring some back
1 parent 6b7931d commit f819c03

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/core/prove-rules.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@
172172
(hang-0m-tan-rev (implies (== (cos a) -1) (== (cos (/ (neg a) 2)) 0)))
173173
(tanh-sum (implies (== (* (tanh x) (tanh y)) -1) (FALSE)))
174174
(tanh-def-a (implies (== (+ (exp x) (exp (neg x))) 0) (FALSE)))
175-
(acosh-def (implies (< x -1) (< x 1)) (implies (== x -1) (< x 1)) (implies (< (fabs x) 1) (< x 1)))
175+
(acosh-def (implies (< x -1) (< x 1))
176+
(implies (== x -1) (< x 1))
177+
(implies (< (fabs x) 1) (< x 1)))
176178
(acosh-def-rev (implies (< x 1) (or (< x -1) (== x -1) (< (fabs x) 1))))
177179
(sqrt-undiv (implies (< (/ x y) 0) (or (< x 0) (< y 0))))
178180
(sqrt-unprod (implies (< (* x y) 0) (or (< x 0) (< y 0))))

src/core/rules.rkt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@
166166

167167
; Fractions
168168
(define-rules arithmetic
169-
[sum-to-mult (+ a b) (* (+ 1 (/ b a)) a) #:unsound] ; unsound @ a = 0, b = 1
169+
#;[sum-to-mult (+ a b) (* (+ 1 (/ b a)) a) #:unsound] ; unsound @ a = 0, b = 1
170170
[sum-to-mult-rev (* (+ 1 (/ b a)) a) (+ a b)]
171-
[sub-to-mult (- a b) (* (- 1 (/ b a)) a) #:unsound] ; unsound @ a = 0, b = 1
171+
#;[sub-to-mult (- a b) (* (- 1 (/ b a)) a) #:unsound] ; unsound @ a = 0, b = 1
172172
[sub-to-mult-rev (* (- 1 (/ b a)) a) (- a b)]
173173
[add-to-fraction (+ c (/ b a)) (/ (+ (* c a) b) a)]
174174
[add-to-fraction-rev (/ (+ (* c a) b) a) (+ c (/ b a))]
@@ -177,7 +177,7 @@
177177
[common-denominator (+ (/ a b) (/ c d)) (/ (+ (* a d) (* c b)) (* b d))])
178178

179179
(define-rules polynomials
180-
[sqr-pow (pow a b) (* (pow a (/ b 2)) (pow a (/ b 2))) #:unsound] ; unsound @ a = -1, b = 1
180+
[sqr-pow (pow a b) (copysign (* (pow (fabs a) (/ b 2)) (pow (fabs a) (/ b 2))) a)]
181181
[flip-+ (+ a b) (sound-/ (- (* a a) (* b b)) (- a b) (+ a b))]
182182
[flip-- (- a b) (sound-/ (- (* a a) (* b b)) (+ a b) (- a b))])
183183

@@ -254,7 +254,7 @@
254254
(define-rules arithmetic
255255
[sqrt-prod (sqrt (* x y)) (* (sqrt (fabs x)) (sqrt (fabs y)))]
256256
[sqrt-div (sqrt (/ x y)) (/ (sqrt (fabs x)) (sqrt (fabs y)))]
257-
[add-sqr-sqrt x (* (sqrt x) (sqrt x)) #:unsound]) ; unsound @ x = -1
257+
[add-sqr-sqrt x (copysign (* (sqrt (fabs x)) (sqrt (fabs x))) x)])
258258

259259
; Cubing
260260
(define-rules arithmetic
@@ -296,7 +296,7 @@
296296
; Exponentials
297297
(define-rules exponents
298298
[add-log-exp x (log (exp x))]
299-
[add-exp-log x (exp (log x)) #:unsound] ; unsound @ x = 0
299+
#;[add-exp-log x (exp (log x)) #:unsound] ; unsound @ x = -1
300300
[rem-exp-log (exp (log x)) x]
301301
[rem-log-exp (log (exp x)) x])
302302

@@ -355,13 +355,14 @@
355355
[pow-div (/ (pow a b) (pow a c)) (pow a (- b c))])
356356

357357
(define-rules exponents
358-
[pow-plus-rev (pow a (+ b 1)) (* (pow a b) a) #:unsound] ; unsound @ a = 0, b = -1/2
359-
[pow-neg (pow a (neg b)) (/ 1 (pow a b)) #:unsound]) ; unsound @ a = 0, b = -1
358+
[pow-plus-rev (pow a (+ b 1)) (* (sound-pow a b 1) a)]
359+
[pow-neg (pow a (neg b)) (sound-/ 1 (sound-pow a b 0) 0)])
360360

361361
(define-rules exponents
362-
[pow-to-exp (pow a b) (exp (* (log a) b)) #:unsound] ; unsound @ a = -1, b = 1
363-
[pow-add (pow a (+ b c)) (* (pow a b) (pow a c)) #:unsound] ; unsound @ a = -1, b = c = 1/2
364-
[pow-sub (pow a (- b c)) (/ (pow a b) (pow a c)) #:unsound] ; unsound @ a = -1, b = c = 1/2
362+
#;[pow-to-exp (pow a b) (exp (* (log a) b)) #:unsound] ; unsound @ a = -1, b = 1
363+
#;[pow-add (pow a (+ b c)) (* (pow a b) (pow a c)) #:unsound] ; unsound @ a = -1, b = c = 1/2
364+
#;[pow-sub (pow a (- b c)) (/ (pow a b) (pow a c)) #:unsound] ; unsound @ a = -1, b = c = 1/2
365+
#;
365366
[unpow-prod-down (pow (* b c) a) (* (pow b a) (pow c a)) #:unsound]) ; unsound @ a = 1/2, b = c = -1
366367

367368
; Logarithms
@@ -373,7 +374,7 @@
373374
(define-rules exponents
374375
[log-prod (log (* a b)) (+ (log (fabs a)) (log (fabs b)))]
375376
[log-div (log (/ a b)) (- (log (fabs a)) (log (fabs b)))]
376-
[log-pow (log (pow a b)) (* b (log (fabs a))) #:unsound]) ; unsound @ a == b == 0
377+
[log-pow (log (pow a b)) (* b (sound-log (fabs a) 0))])
377378

378379
(define-rules exponents
379380
[sum-log (+ (log a) (log b)) (log (* a b))]

0 commit comments

Comments
 (0)