loonwerks / formal-methods-workbench

Other
20 stars 7 forks source link

AGREE and AADL string types #22

Open kfhoech opened 5 years ago

kfhoech commented 5 years ago

Would it be useful to have very limited support for AADL string types?

It would be fairly simple to implement a very limited semantics where only two operations are available: assignment from a literal constant or another string, and comparison.

An implementation would use a hash of the string literal (as an integer) as the string value. Thus, only assignment and comparison would be directly supported.

konrad-slind commented 5 years ago

I am confused about the hashing. You'd need a perfect hash to support equality and an order-preserving hash (does such a thing even exist?) for comparisons. What am I missing?

Konrad.

On Thu, Jun 6, 2019 at 1:23 PM kfhoech notifications@github.com wrote:

Would it be useful to have very limited support for AADL string types?

It would be fairly simple to implement a very limited semantics where only two operations are available: assignment from a literal constant or another string, and comparison.

An implementation would use a hash of the string literal (as an integer) as the string value. Thus, only assignment and comparison would be directly supported.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/loonwerks/formal-methods-workbench/issues/22?email_source=notifications&email_token=AAIOAD2CTGRQ3SLZCQMG3A3PZFIYHA5CNFSM4HVGXGI2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GYC4NVQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIOADZGIUFF3LCSJVMORHLPZFIYHANCNFSM4HVGXGIQ .

konrad-slind commented 5 years ago

I guess there is indeed such a thing!

https://stackoverflow.com/questions/28043857/hash-function-with-order-preserving

On Thu, Jun 6, 2019 at 2:48 PM Konrad Slind konrad.slind@gmail.com wrote:

I am confused about the hashing. You'd need a perfect hash to support equality and an order-preserving hash (does such a thing even exist?) for comparisons. What am I missing?

Konrad.

On Thu, Jun 6, 2019 at 1:23 PM kfhoech notifications@github.com wrote:

Would it be useful to have very limited support for AADL string types?

It would be fairly simple to implement a very limited semantics where only two operations are available: assignment from a literal constant or another string, and comparison.

An implementation would use a hash of the string literal (as an integer) as the string value. Thus, only assignment and comparison would be directly supported.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/loonwerks/formal-methods-workbench/issues/22?email_source=notifications&email_token=AAIOAD2CTGRQ3SLZCQMG3A3PZFIYHA5CNFSM4HVGXGI2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GYC4NVQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIOADZGIUFF3LCSJVMORHLPZFIYHANCNFSM4HVGXGIQ .

kfhoech commented 5 years ago

For comparison, I meant only equality/non-equality. Not sort ordering. But with that hash, I suppose that's possible too.

mwwhalen commented 5 years ago

Might be overkill for what you need. Perfect hashes are usually expensive to compute.

Mike

On Thu, Jun 6, 2019 at 2:59 PM kfhoech notifications@github.com wrote:

For comparison, I meant only equality/non-equality. Not sort ordering. But with that hash, I suppose that's possible too.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/loonwerks/formal-methods-workbench/issues/22?email_source=notifications&email_token=ABHZVORS73ZP24ZZMNV54GLPZFUD5A5CNFSM4HVGXGI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXD7TKI#issuecomment-499644841, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHZVOUCDJBFTWCO5FNTXULPZFUD5ANCNFSM4HVGXGIQ .

-- Michael Whalen Adjunct Professor, University of Minnesota Software Engineering Center (UMSEC) 200 Union St. 4-192 Minneapolis, MN 55455 Office: 612-624-5130 Cell: 651-442-8834

kfhoech commented 5 years ago

The hash computation would need be done only for string literals at translation time, right? That should be fairly inexpensive as we would expect the count of such hashes to be small.

jendavis commented 5 years ago

In my work to date, I haven't come across a need for AADL string types.