简体   繁体   English

合金模型代数群

[英]Alloy model an algebraic group

I am trying to model the structure of an algebraic group with Alloy. 我正在尝试用Alloy模拟代数群的结构。

A group just has a set of elements and a binary relation with certain properties so I thought it would be a good fit for alloy. 一组只具有一组元素和具有某些性质的二元关系,所以我认为它非常适合合金。

This is what I started with 这就是我开始的目的

sig Number{}
/* I call it Number but this is really just a name for some objects that are going to be in the group */

sig Group{
member: set Number,
product: member->member->member, /*This is the part I'm really not sure about the Group is supposed to have a a well-defined binary relation so I thought maybe I could write it like this, sort of as a Curried function...I think it's actually a ternary relation in Alloy language since it takes two members and returns a third member */
}{//I want to write the other group properties as appended facts here.

 some e:member | all g:member| g->e->g in product //identity element
all g:member | some i:member| g->i->e in product /* inverses exist I think there's a problem here because i want the e to be the same as in the previous line*/
all a,b,c:member| if a->b->c and c->d->e and b->c->f then a->f->e //transitivity
all a,b:member| a->b->c in product// product is well defined

}

I've only just learned a bit of Alloy myself, but your "inverses exist" problem looks straightforward from a predicate logic perspective; 我本人只是对Alloy有所了解,但是从谓词逻辑的角度来看,您的“逆存在”问题看起来很简单。 replace your first two properties with 将您的前两个属性替换为

some e:member {
  all g:member | g->e->g in product //identity element
  all g:member | some i:member | g->i->e in product // inverses exist
}

By putting the inverse property in the scope of the quantifier of e , it is referring to that same e . 通过将逆属性置于e的量词的范围内,它表示该e

I haven't tested this. 我还没有测试。

Here is one way of encoding groups in Alloy: 这是在Alloy中编码组的一种方法:

module group[E]

pred associative[o : E->E->E]{  all x, y, z : E | (x.o[y]).o[z] = x.o[y.o[z]]   }

pred commutative[o : E->E->E]{  all x, y : E | x.o[y] = y.o[x]  }

pred is_identity[i : E, o : E->E->E]{   all x : E | (i.o[x] = x and x = x.o[i]) }

pred is_inverse[b : E->E, i : E, o : E->E->E]{  all x : E | (b[x].o[x] = i and i = x.o[b[x]])   }

sig Group{
op : E -> E->one E, inv : E one->one E, id : E
}{
associative[op] and is_identity[id, op] and is_inverse[inv, id, op] }

sig Abelian extends Group{}{    commutative[op] }

unique_identity: check {
all g : Group, id' : E | (is_identity[id', g.op] implies id' = g.id)
} for 13 but exactly 1 Group

unique_inverse: check {
all g : Group, inv' : E->E | (is_inverse[inv', g.id, g.op] implies inv' = g.inv)
} for 13 but exactly 1 Group

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM