maude-help AT lists.siebelschool.illinois.edu
Subject: Maude-help mailing list
List archive
- From: Mandy Martin <tesleft AT hotmail.com>
- To: Francisco Durán <duran AT lcc.uma.es>
- Cc: "maude-help AT cs.uiuc.edu" <maude-help AT cs.uiuc.edu>
- Subject: [Maude-help] why sign of two terms exchanged in minus case
- Date: Sun, 14 Jun 2015 05:00:26 +0800
- Importance: Normal
- List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help/>
- List-id: <maude-help.cs.uiuc.edu>
Hi Francisco,
i discover that it miss minus definition, i add back minus definition,
but it reverse sign of two terms make 3 x^5 -1 x^5 become 1 x^5-3 x^5
expect 2*x^5 , but it return -2*x^5
Maude> red in QID-RAT-POLY : ((3) ('X ^ 2) ('X ^ 3)) -- ((1) ('X ^ 5)) .
Warning: <standard input>, line 82: ambiguous term, two parses are:
(3 ('X ^ 2) 'X ^ 3) -- (1 'X ^ 5)
-versus-
(3 ('X ^ 2) 'X ^ 3) -- (1 'X ^ 5)
Arbitrarily taking the first as correct.
reduce in QID-RAT-POLY : (1 'X ^ 5) -- (3 ('X ^ 2) 'X ^ 3) .
rewrites: 5 in 0ms cpu (0ms real) (~ rewrites/second)
result Poly{RingToRat,Qid}: -2 'X ^ 5
fth RING is
sort Ring .
ops z e : -> Ring .
op _+_ : Ring Ring -> Ring [assoc comm id: z] .
op _-_ : Ring Ring -> Ring [assoc comm id: z] .
op _*_ : Ring Ring -> Ring [assoc comm id: e] .
op -_ : Ring -> Ring .
vars A B C : Ring .
eq A + (- A) = z [nonexec] .
eq A * (B + C) = (A * B) + (A * C) [nonexec] .
eq A * (B - C) = (A * B) - (A * C) [nonexec] .
endfth
fmod MONOMIAL{X :: TRIV} is
protecting NAT .
sorts Pow{X} Mon{X} .
subsorts Pow{X} < Mon{X} .
*** multiplication
op __ : Mon{X} Mon{X} -> Mon{X} [assoc comm] .
op _^_ : X$Elt NzNat -> Pow{X} .
var X : X$Elt .
vars N M : NzNat .
eq (X ^ N) (X ^ M) = X ^ (N + M) .
endfm
fmod POLYNOMIAL{R :: RING, X :: TRIV} is
protecting MONOMIAL{X} .
sorts Poly{R, X} .
subsorts R$Ring < Poly{R, X} .
*** multiplication
op __ : Poly{R, X} Poly{R, X} -> Poly{R, X} [assoc comm] .
*** addition
op _++_ : Poly{R, X} Poly{R, X} -> Poly{R, X} [assoc comm] .
op _--_ : Poly{R, X} Poly{R, X} -> Poly{R, X} [assoc comm] .
op --_ : Poly{R, X} -> Poly{R, X} .
op __ : R$Ring Mon{X} -> Poly{R, X} .
vars A B : R$Ring .
vars U V : Mon{X} .
vars P Q R : Poly{R, X} .
eq P ++ z = P .
eq P ++ (-- P) = z .
eq P e = P .
eq -- (P ++ Q) = (-- P) ++ (-- Q) .
eq -- (A U) = (- A) U .
eq P (Q ++ R) = (P Q) ++ (P R) .
eq P (Q -- R) = (P Q) -- (P R) .
eq z U = z .
eq z P = z .
eq A (B U) = (A B) U .
eq (A U) ++ (B U) = (A ++ B) U .
eq (A U) -- (B U) = (A -- B) U .
eq (A U) (B V) = (A B) (U V) .
eq A B = A * B .
eq A ++ B = A + B .
eq A -- B = A - B .
endfm
view RingToRat from RING to RAT is
sort Ring to Rat .
op e to term 1 .
op z to 0 .
endv
fmod RAT-POLY{X :: TRIV} is
protecting POLYNOMIAL{RingToRat, X} .
endfm
fmod QID-RAT-POLY is
pr RAT-POLY{Qid} .
endfm
Regards,
Martin Lee
- Re: [Maude-help] how to simulate this natural numbers system, (continued)
- Re: [Maude-help] how to simulate this natural numbers system, Mandy Martin, 06/10/2015
- Re: [Maude-help] how to simulate this natural numbers system, Mandy Martin, 06/10/2015
- [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/11/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Francisco Durán, 06/12/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/12/2015
- [Maude-help] how to use predicates.maude in Igor2.3 and how to get the result from Rewrite Result, Mandy Martin, 06/12/2015
- [Maude-help] bad token ^ when using default code in prelude.maude and redefine again, Mandy Martin, 06/14/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/13/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/13/2015
- [Maude-help] why minus result is wrong and how to return understandable result from haskell maude, Mandy Martin, 06/13/2015
- [Maude-help] how to use predicates.maude in Igor2.3 and how to get the result from Rewrite Result, Mandy Martin, 06/12/2015
- [Maude-help] why sign of two terms exchanged in minus case, Mandy Martin, 06/13/2015
- Re: [Maude-help] why sign of two terms exchanged in minus case, Mandy Martin, 06/13/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/12/2015
- Re: [Maude-help] how to use the traditional polynomials example in manual, Francisco Durán, 06/12/2015
- [Maude-help] how to use the traditional polynomials example in manual, Mandy Martin, 06/11/2015
- Re: [Maude-help] how to simulate this natural numbers system, Mandy Martin, 06/10/2015
- Re: [Maude-help] how to simulate this natural numbers system, Mandy Martin, 06/10/2015
Archive powered by MHonArc 2.6.16.