Skip to content

Commit

Permalink
Merge pull request #29 from stefan-hoeck/total
Browse files Browse the repository at this point in the history
[ compat ] temporary fix for idris issue 2954
  • Loading branch information
stefan-hoeck authored Apr 25, 2023
2 parents 8080c4b + 3b97f2d commit 80a7c46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Algebra/Solver/Ring/Sum.idr
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ normalize e = normSum (norm e)
--------------------------------------------------------------------------------

-- Adding two sums via `add` preserves the evaluation result.
-- Note: `assert_total` in here is a temporary fix for idris issue #2954
0 padd : SolvableRing a
=> (x,y : Sum a as)
-> esum x + esum y === esum (add x y)
Expand All @@ -125,7 +126,7 @@ padd (T m x :: xs) (T n y :: ys) with (compProd x y) proof eq
~~ n * eprod y + ((m * eprod x + esum xs) + esum ys)
..< p213
~~ n * eprod y + esum (add (T m x :: xs) ys)
... cong (n * eprod y +) (padd (T m x :: xs) ys)
... cong (n * eprod y +) (assert_total $ padd (T m x :: xs) ys)

_ | EQ = case pcompProd x y eq of
Refl => Calc $
Expand Down
3 changes: 2 additions & 1 deletion src/Algebra/Solver/Semiring/Sum.idr
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ normalize e = normSum (norm e)
--------------------------------------------------------------------------------

-- Adding two sums via `add` preserves the evaluation result.
-- Note: `assert_total` in here is a temporary fix for idris issue #2954
0 padd : SolvableSemiring a
=> (x,y : Sum a as)
-> esum x + esum y === esum (add x y)
Expand All @@ -111,7 +112,7 @@ padd (T m x :: xs) (T n y :: ys) with (compProd x y) proof eq
~~ n * eprod y + ((m * eprod x + esum xs) + esum ys)
..< p213
~~ n * eprod y + esum (add (T m x :: xs) ys)
... cong (n * eprod y +) (padd (T m x :: xs) ys)
... cong (n * eprod y +) (assert_total $ padd (T m x :: xs) ys)

_ | EQ = case pcompProd x y eq of
Refl => Calc $
Expand Down

0 comments on commit 80a7c46

Please sign in to comment.