[Maude-help] LIST{X} question
Scott Christley
schristley at mac.com
Thu Apr 20 18:20:28 CDT 2006
Hello,
I recently downloaded Maude, read through the tutorial and documentation, and am trying to write some modules. I wanted to do a simple biological example for DNA transcription to RNA; a tricky part is that DNA and RNA share the bases A, C, and G but DNA has T while RNA has U. So I created a module for nucleotides:
fmod nucleic is
sorts Nucleotide .
ops A C G : -> Nucleotide .
endfm
Then I wanted sequences of DNA and RNA to be lists so that I could easily concatenate bases, e.g. (A T G T C C) for DNA or (A U G U C C) for RNA. I want Maude to recognize one as DNASequence and the other as RNASequence thus not allow U's in DNA nor allow T's in RNA. So I defined these modules:
fmod DNA is
protecting nucleic .
sorts DNANucleotide .
subsort Nucleotide < DNANucleotide .
op T : -> DNANucleotide .
endfm
view DNA from TRIV to DNA is
sort Elt to DNANucleotide .
endv
fmod DNASequence is
protecting LIST{DNA} * (sort NeList{DNA} to DNASequence) .
endfm
fmod RNA is
protecting nucleic .
sorts RNANucleotide .
subsort Nucleotide < RNANucleotide .
op U : -> RNANucleotide .
endfm
view RNA from TRIV to RNA is
sort Elt to RNANucleotide .
endv
fmod RNASequence is
protecting LIST{RNA} * (sort NeList{RNA} to RNASequence) .
endfm
Lastly I make a module which is the transcription machinery, and there is where the problem comes in.
fmod transcription is
protecting DNASequence .
protecting RNASequence .
op translate : DNASequence -> RNASequence .
var aSequence : DNASequence .
eq translate(A) = A .
eq translate(C) = C .
eq translate(G) = G .
eq translate(T) = U .
eq translate(A aSequence) = A translate(aSequence) .
eq translate(C aSequence) = C translate(aSequence) .
eq translate(G aSequence) = G translate(aSequence) .
eq translate(T aSequence) = U translate(aSequence) .
endfm
When I load up this module, I get advisories:
Advisory: "transcription.maude", line 7 (fmod transcription): operator nil has
been imported from both "prelude.maude", line 939 (fmod LIST) and
"prelude.maude", line 939 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator __ has
been imported from both "prelude.maude", line 940 (fmod LIST) and
"prelude.maude", line 940 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator append
has been imported from both "prelude.maude", line 948 (fmod LIST) and
"prelude.maude", line 948 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator head has
been imported from both "prelude.maude", line 953 (fmod LIST) and
"prelude.maude", line 953 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator tail has
been imported from both "prelude.maude", line 956 (fmod LIST) and
"prelude.maude", line 956 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator last has
been imported from both "prelude.maude", line 959 (fmod LIST) and
"prelude.maude", line 959 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator front
has been imported from both "prelude.maude", line 962 (fmod LIST) and
"prelude.maude", line 962 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator occurs
has been imported from both "prelude.maude", line 965 (fmod LIST) and
"prelude.maude", line 965 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator reverse
has been imported from both "prelude.maude", line 969 (fmod LIST) and
"prelude.maude", line 969 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator $reverse
has been imported from both "prelude.maude", line 973 (fmod LIST) and
"prelude.maude", line 973 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator size has
been imported from both "prelude.maude", line 977 (fmod LIST) and
"prelude.maude", line 977 (fmod LIST) with no common ancestor.
Advisory: "transcription.maude", line 7 (fmod transcription): operator $size
has been imported from both "prelude.maude", line 981 (fmod LIST) and
"prelude.maude", line 981 (fmod LIST) with no common ancestor.
And the reduce doesn't work:
reduce in transcription : translate(A T G T C C) .
Warning: sort declarations for constant nil do not have an unique least sort.
reduce in transcription : translate(A T G T C C) .
rewrites: 0 in 0ms cpu (0ms real) (~ rewrites/second)
result [EmDNASequence,EmRNASequence,NucleotideSequence]: translate(A T G T C C)
Can anybody tell me what I'm doing wrong?
thanks
Scott
More information about the Maude-help
mailing list