Skip to content

Instantly share code, notes, and snippets.

@tonyg
Last active December 22, 2015 04:48
Show Gist options
  • Save tonyg/6419046 to your computer and use it in GitHub Desktop.
Save tonyg/6419046 to your computer and use it in GitHub Desktop.
Maude example showing overlapping subsorts
fmod T is
var XX : X .
var YY : Y .
var TT : Thing .
sort Thing .
op a : -> Thing [ctor] .
op b : -> Thing [ctor] .
op _|_ : Thing Thing -> Thing [ctor] .
sort X .
subsort X < Thing .
mb a | TT : X .
sort Y .
subsort Y < Thing .
mb TT | a : Y .
endfm
match [5] XX <=? a | a . *** expected: a solution. actual: no solution. BAD
match [5] XX <=? a | b . *** expected: a solution. actual: a solution. OK
match [5] XX <=? b | a . *** expected: no solution. actual: no solution. OK
match [5] XX <=? b | b . *** expected: no solution. actual: no solution. OK
match [5] YY <=? a | a . *** expected: a solution. actual: a solution. OK
match [5] YY <=? a | b . *** expected: no solution. actual: no solution. OK
match [5] YY <=? b | a . *** expected: a solution. actual: a solution. OK
match [5] YY <=? b | b . *** expected: no solution. actual: no solution. OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment