Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a way to express that all objects of Sig2 are either related by a rel relation to elements of Sig1 or are subsigs? I want something like either_rel_or_subsig but the code might be extended and someone else might introduce SubSigC. Then, either_rel_or_subsig would forbid any SubSigC object.

module test

sig Sig1 {}

sig Sig2 {
  rel: lone Sig1    
}

sig SubSigA extends Sig2 {}
sig SubSigB extends Sig2 {}

fact either_rel_or_subsig{Sig2 in rel.Sig1 + SubSigA + SubSigB}

run {}
question from:https://stackoverflow.com/questions/66054570/alloy-term-to-get-all-subsig

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
248 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...