set show timing off .
set show advisories off .

select META-MODULE .
red (subsort 'Foo < 'Bar .) .
red (op 'f : 'Foo -> 'Bar [none] .) .
red (ceq 'f['X:Foo] = 'a.Bar if 'g['a.Foo,'Y:Foo] := 'X:Foo [none] .) .
red 'g['a.Foo,'Y:Foo] := 'X:Foo .

red
(fmod 'FOO is
  including 'MACHINE-INT .
  sorts 'Foo ; 'Bar .
  subsort 'Foo < 'Bar .
  op 'f : 'Foo -> 'Bar [none] .
  op 'g : '`[Bar`] -> '`[Bar`] [none] .
  cmb 'X:Bar : 'Foo if 'f['Y:Bar] := 'f['X:Bar] /\
		       'g['Y:Bar, 'a.Foo] = 'a.Foo [none] .
  eq 'f['X:Foo] = 'g['a.Foo,'X:Foo] [none] .
  ceq 'f['X:Foo] = 'a.Bar if 'g['a.Foo,'Y:Foo] := 'X:Foo [none] .
endfm)
.

red (fmod 'FOO is including 'MACHINE-INT . sorts 'Foo ; 'Bar .
    subsort 'Foo < 'Bar . op 'f : 'Foo -> 'Bar[none]. op 'g : '`[Bar`] ->
    '`[Bar`][none]. none eq 'f['X:Foo] = 'g['a.Foo,'X:Foo] [none] . endfm).
