From glauber.sp at gmail.com Wed Feb 27 20:49:40 2008 From: glauber.sp at gmail.com (Glauber Cabral) Date: Wed, 27 Feb 2008 16:49:40 -0300 Subject: [Hets-devel] Error with fitting argument Message-ID: Hi. This is my first message to the list. My name is Glauber and I'm studying HasCASL to my master thesis at UNICAMP, BRAZIL. I've read CASL tutorial, HasCASL definition and some papers from HasCASL group, already. I'm trying to instantiate INTEGER specification with a specification that contains the WorldLenth operation defined. hets-2008-01-25 gives me an error about logic fitting: Analysis of fitting argument: Logic HasCASL expected, but CASL found The code is inlined later in this email. I've revised the CASL manual, and I could not solve this problem. I guess I should HetCASL to do the morphism (with logic -> HasCASL), but this didn't solved the problem. Thanks in advance for any comment or reading suggestion. Glauber Cabral The code is: logic HasCASL from Basic/Numbers get Int |-> APInt from Basic/MachineNumbers get INTEGER |-> FPInt %% Int has at least the range [-2^29 .. 2^29-1] spec FPIntInstanciation = APInt then fun WordLength: Int = 29 spec Enum = FPInt[FPIntInstanciation] then class Enum { var a: Enum fun successor: a -> a fun predecessor: a -> a fun toEnum: Int } and the error points to [FPIntInstanciation]. From Christian.Maeder at dfki.de Thu Feb 28 13:01:13 2008 From: Christian.Maeder at dfki.de (Christian Maeder) Date: Thu, 28 Feb 2008 13:01:13 +0100 Subject: [Hets-devel] Error with fitting argument In-Reply-To: References: Message-ID: <47C6A289.4090404@dfki.de> Glauber Cabral wrote: > logic HasCASL > > from Basic/Numbers get Int |-> APInt > from Basic/MachineNumbers get INTEGER |-> FPInt the import does not change the logics of APInt and FPInt. > %% Int has at least the range [-2^29 .. 2^29-1] > spec FPIntInstanciation = APInt then at this point APInt is translated to HasCASL > fun WordLength: Int = 29 (and extended to FPIntInstanciation) > spec Enum = FPInt[FPIntInstanciation] then here the generic CASL spec FPInt is instantiated with a HasCASL spec, which is not possible, currently. (the error that you reported) If you move "logic HasCASL" before "spec Enum", "spec FPIntInstanciation" will be CASL (after changing "fun" to "op") and "FPInt[FPIntInstanciation]" can be translated to HasCASL. Still I get an instantiation error, because "WordLength" must be of type "Nat", not "Int"! "INTEGER" and "FPIntInstanciation" both contain "Int" which causes the next instantiation error, because INTEGER only allows "Nat" as common part of the parameter and the body (via "given Nat"). So if I start with: from Basic/Numbers get Nat |-> APInt everything goes through, finally. HTH Christian from Basic/Numbers get Nat |-> APInt from Basic/MachineNumbers get INTEGER |-> FPInt %% Int has at least the range [-229 .. 229-1] spec FPIntInstanciation = APInt then op WordLength: Nat = 29 logic HasCASL spec Enum = FPInt [FPIntInstanciation] then ... > class Enum > { > var a: Enum > fun successor: a -> a > fun predecessor: a -> a > fun toEnum: Int > } From glauber.sp at gmail.com Thu Feb 28 13:27:23 2008 From: glauber.sp at gmail.com (Glauber Cabral) Date: Thu, 28 Feb 2008 09:27:23 -0300 Subject: [Hets-devel] Error with fitting argument In-Reply-To: <47C6A289.4090404@dfki.de> References: <47C6A289.4090404@dfki.de> Message-ID: Dear Christian, Thanks a lot by the correction and explanations. It indeed helped a lot! Yesterday night I had the idea of writing the generic instantiations in CASL and later the Enum spec in HasCASL as the only thing I hadn't tried, but I didn't know if it would be the right way, I was thinking everything should be in HasCASL and HetCASL. If I got your explanation, I should keep all the specs that can be used to instantiate another one in CASL logic, right? I guess I've read in "HasCASL - Integrated Higher-Order Specification and Program Development" something about impossibility or difficulties of translating HasCASL to CASL, but there were too categorical stuff involved and I didn't fully understand that yet. Many thanks, Glauber On Thu, Feb 28, 2008 at 9:01 AM, Christian Maeder wrote: > Glauber Cabral wrote: > > logic HasCASL > > > > from Basic/Numbers get Int |-> APInt > > from Basic/MachineNumbers get INTEGER |-> FPInt > > the import does not change the logics of APInt and FPInt. > > > > %% Int has at least the range [-2^29 .. 2^29-1] > > spec FPIntInstanciation = APInt then > > at this point APInt is translated to HasCASL > > > fun WordLength: Int = 29 > > (and extended to FPIntInstanciation) > > > > spec Enum = FPInt[FPIntInstanciation] then > > here the generic CASL spec FPInt is instantiated with a HasCASL spec, > which is not possible, currently. (the error that you reported) > > If you move "logic HasCASL" before "spec Enum", "spec > FPIntInstanciation" will be CASL (after changing "fun" to "op") and > "FPInt[FPIntInstanciation]" can be translated to HasCASL. > > Still I get an instantiation error, because "WordLength" must be of type > "Nat", not "Int"! > > "INTEGER" and "FPIntInstanciation" both contain "Int" which causes the > next instantiation error, because INTEGER only allows "Nat" as common > part of the parameter and the body (via "given Nat"). > > So if I start with: > > from Basic/Numbers get Nat |-> APInt > > everything goes through, finally. > > HTH Christian > > from Basic/Numbers get Nat |-> APInt > > from Basic/MachineNumbers get INTEGER |-> FPInt > > %% Int has at least the range [-229 .. 229-1] > spec FPIntInstanciation = APInt then > op WordLength: Nat = 29 > > logic HasCASL > > > > spec Enum = FPInt [FPIntInstanciation] then > ... > > class Enum > > { > > var a: Enum > > fun successor: a -> a > > fun predecessor: a -> a > > fun toEnum: Int > > } > > From Christian.Maeder at dfki.de Thu Feb 28 13:45:14 2008 From: Christian.Maeder at dfki.de (Christian Maeder) Date: Thu, 28 Feb 2008 13:45:14 +0100 Subject: [Hets-devel] Error with fitting argument In-Reply-To: References: <47C6A289.4090404@dfki.de> Message-ID: <47C6ACDA.4050603@dfki.de> Glauber Cabral wrote: > If I got your explanation, I should keep all the specs that can be > used to instantiate another one in CASL logic, right? Of course, after "logic HasCASL" you can write your own generic HasCASL spec (or import them from elsewhere, i.e. Hets-lib/HasCASL) and instantiate it with another HasCASL (or CASL!) specs, because non-generic CASL specs can be translated to HasCASL. It's just not possible to translate uninstantiated specs. Christian And right, translating HasCASL back to CASL is not supported, although it would be possible for the CASL subset of HasCASL. From Till.Mossakowski at dfki.de Thu Feb 28 14:04:23 2008 From: Till.Mossakowski at dfki.de (Till Mossakowski) Date: Thu, 28 Feb 2008 14:04:23 +0100 Subject: [Hets-devel] Error with fitting argument In-Reply-To: <47C6ACDA.4050603@dfki.de> References: <47C6A289.4090404@dfki.de> <47C6ACDA.4050603@dfki.de> Message-ID: <47C6B157.2060500@dfki.de> Christian Maeder schrieb: > And right, translating HasCASL back to CASL is not supported, although > it would be possible for the CASL subset of HasCASL. This is an institution morphism. I have added the HasCASL -> CASL example to ticket #68: http://trac.informatik.uni-bremen.de:8080/hets/ticket/68 Greetings, Till -- Till Mossakowski Cartesium, room 2.051 Phone +49-421-218-64226 DFKI Lab Bremen Fax +49-421-218-9864226 Safe & Secure Cognitive Systems Till.Mossakowski at dfki.de Enrique-Schmidt-Str. 5, D-28359 Bremen http://www.dfki.de/sks/till Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH principal office, *not* the address for mail etc.!!!: Trippstadter Str. 122, D-67663 Kaiserslautern management board: Prof. Wolfgang Wahlster (chair), Dr. Walter Olthoff supervisory board: Prof. Hans A. Aukes (chair) Amtsgericht Kaiserslautern, HRB 2313