简体   繁体   English

我施加的条件在范畴论/集合论中是否有名字?

[英]Does My imposed Condition have a name in category theory/Set theory?

There's a requirement i'm placing on the signature of a total & referencially transparent function: 我要求对总体功能和相当透明的功能进行签名:

def add[T](a: T)(b: T): T
//requirement is type T under e.g. addition must always bear antoher type T
// and is not allowed to throw runtime arithmetic exceptions or such.

this requirement can be easily fulfilled for many types such as Int , String , Nat (natural numbers); 对于许多类型(例如IntStringNat (自然数)),可以轻松满足此要求; yet is also easily violated by types such as NonZeroInt as addition of two non-zero integers can in fact be zero. 但是也很容易被诸如NonZeroInt类的类型所NonZeroInt因为两个非零整数的加法实际上可以为零。

My question is there a coined term for this condition? 我的问题是这种情况有专门的术语吗? Monoid comes to mind but it's obvious I'm not imposing all the rules for monoids here. 人们会想到Monoid,但很明显,我并没有在这里强加所有适用于Monoid的规则。

If I understand what you're asking, then the term you are looking for is "closure" for a set given an operation. 如果我了解您的要求,那么您所寻找的术语是给定操作的集合的“关闭”。 Refer to the mathematical definition in Wikipedia here . 请在此处参考Wikipedia中的数学定义。 In short: 简而言之:

A set has closure under an operation if performance of that operation on members of the set always produces a member of the same set 如果在集合的成员上执行该操作总是产生同一集合的成员,则该集合在操作下具有闭包

However, "closure" seems to have a different meaning in computer science. 但是,“闭包”在计算机科学中似乎具有不同的含义。 See the link here . 请参阅此处的链接。 And my searches pertaining to closure in the context of Scala, even when also putting it in the context of mathematics or set-theory, doesn't lead to any helpful results. 而且我在Scala上下文中进行的关于闭包的搜索,即使也将其放在数学或集合论的上下文中,都不会产生任何有用的结果。 Perhaps this is why you've had trouble finding the coined term. 也许这就是为什么您很难找到创造的术语。

Without any laws required it is just anot operation on a set T, nothing more. 不需要任何定律,它只是对集合T的非运算,仅此而已。 If add is associative you can call it Semigroup. 如果add是关联的,则可以将其称为Semigroup。

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

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