5 minute read

ReferencesPermalink

  • https://staff.fnwi.uva.nl/d.j.n.vaneijck2/software/demo_s5/EREL.pdf
  • https://doi.org/10.1016/B978-0-12-820656-0.00009-5
  • https://people.cs.rutgers.edu/~elgammal/classes/cs205/chapt74.pdf
  • https://en.wikipedia.org/wiki/Closure_(mathematics)
  • https://en.wikipedia.org/wiki/Relation_(mathematics)
  • https://en.wikipedia.org/wiki/Composition_of_relations

Closure (Math)Permalink

完整的 closure 场景应该包含这么几个元素:一个全集 Σ,一个子集 SΣ,一个 “closure operator” f:ΣΣ.

主谓宾关系上有:S+=f(S)S 称为 S 的 closure“

一般的要求是:若 S+S 的 closure under some operations (这些 operations 可能是 Σ 上的,或者说 (Σ,op) 本身是个 Algebraic Structure),则 S+ is the smallest superset of S that is closed under these operations. 这些 “closed under operations” 的性质也被称为 “closure properties”. (所以我们经常是脱离了 S+=f(S) 这个 closure 本体,而直接讨论某个集合 X 是否有 closure properties)

除了 “closed under operations”,还有一类的要求是 “qualified as the same algebraic structure (with Σ’s)” 或者 “having some properties”. 比如说:

  1. 假定 Σ 是个 group,那么 subset SΣ 是否同样构成 group?如果不构成,如何找到一个 smallest superset of S that is a group?此时这个 smallest superset S+ 就是 S 的 group closure
    • 此时一般还称 S+ is generated/spanned by S, and S is the generating set of S+
  2. 假定 Σ 是个 reflexive relation,那么 subset SΣ 是否同样是 reflexive?如果不是,如何找到一个 smallest superset of S that is reflexive?此时这个 smallest superset S+ 就是 S 的 reflexivity closure

有时候 “having some property” 可以被转化成 “closed under some operation”,比如 relation 的 symmetry 和 transitivity (reflexivity 很难用 operation 来表示)

  • symmetry 可以表示为一个 unary operation sym:Σ×ΣΣ×Σ,它要求 x,yΣ,sym(x,y)=(y,x)
    • S is symmetric if it is closed under sym
  • transitivity 可以表示为一个 binary operation trn:(Σ×Σ)×(Σ×Σ)Σ×Σ,它要求 x,y,zΣ,trn((x,y),(y,z))=(x,z)
    • S is transitive if it is closed under trn

Closures of RelationsPermalink

DefinitionsPermalink

Following the definition of closure (Math):

  • S+ is the reflexive closure of S if S+ is the smallest superset of S that is reflexive
  • S+ is the symmetric closure of S if S+ is the smallest superset of S that is symmetric
  • S+ is the transitive closure of S if S+ is the smallest superset of S that is transitive

Proposition 2: The transitive closure of a similarity (relation) is an equivalence (relation).

Proof: Suppose S is a similarity on A, S+ is the transitive closure of S.

(Reflexivity) Construct I={(x,x)xA}. Since S is reflexive, IS; since S+ is a superset of S, SS+. Therefore IS+, i.e. S+ is reflexive.

(Symmetry) x,y such that xS+y, there are 2 possibilities:

  1. xSy originally. Since S is symmetric, ySx, thus yS+x.
  2. xSy, but there is a path x1,,xn with xiSxi+1 and x1=x,xn=y. This path makes xS+y stand in S+ (by transitivity). Since S is symmetric, there should also be a path xn,,x1 with xi+1Sxi. Thus, yS+x.

Either case, S+ is symmetric.

(Transitivity) S+ is transitive by definition.

Therefore, S+ is an equivalence.

Transitive Paths & Relation CompositionPermalink

Definition: If RΣ1×Σ2 and SΣ2×Σ3 are two relations, then the relative product RS={(x,z)yΣ2 such that xRy and ySz} is a relation Σ1×Σ3.

Definition: Given relations R,S,T, then (RS=T)(xRySzxTz)

比较常见的情况是:没有 SΣ2×Σ3 这种 cross-domain 的 relation,都是 SΣ×Σ 类型的,于是可以简写成:

S2=SSSn=Sn1S

Theorem: Given a relation S, ( a path x0,,xn of length n, with xiSxi+1) (x0,xn)Sn

Proof: (by induction)

(1) when n=1, since x0Sx1, and S1=S, the assertion is true.

(2) Assume the assertion is true for n.

Suppose there is a path x0,,xn+1, by hypotheses:

x0,,xn is a path of length n(x0,xn)Snxn,xn+1 is a path of length 1(xn,xn+1)S

Therefore (x0,xn)SnS=Sn+1. The assertion is true.

Closures of Relations 的具体算法Permalink

假定:

  • reflexive closure 的 operator 为 kr
  • symmetric closure 的 operator 为 ks
  • transitive closure 的 operator 为 kt
  • S is a relation on Σ

算法上有:

  • kr(S)=SIΣ, where IΣ={(x,x)xΣ} is the diagonal relation on Σ
  • ks(S)=SS1, where S1={(y,x)(x,y)S} is the converse relation of S
  • kt(S)=SS2Sn where n=|Σ|

为何 kt(S)n=|Σ|Permalink

Theorem: S is transitive n,SnS.

Definition: The connectivity relation or the star closure of relation S, denoted by S, is given by S=n=1Sn

Theorem: The transitive closure of S is equal to S.

Proof: We must show that:

  1. S is a superset of S
  2. S is transitive
  3. S is the smallest superset of S that is transitive

(1) SS by definition

(2) Suppose (x,y)Sm for some m, and (y,z)Sn for some n. Then (x,z)Sm+n.

Since Sm,Sn,Sm+nS, we have (x,y),(y,z),(x,z)S. Therefore S is transitive.

(3) Suppose T is an arbitrary superset of S that is transitive.

Since ST, then S2T2. Plus T2T itself since T is transitive already. Therefore S2T.

Similarly we can show that n,SnT. Therefore S is a union of T’s subsets, and thus ST, which means S is the smallest superset of S that is transitive.

所以理论上来说,若按 S 计算,要算到 n,但在实际应用中我们明显不可能这么做。

Theorem: If |Σ|=k, then any path of length >k in relation SΣ×Σ must contain a cycle.

Proof: Obviously true by Pigeon Hole Principle.

Therefore n>k, Sn does not contain any (x,y) pair that’s already contained in n=1kSn. 所以我们计算到 n=|Σ| 即可。

Corollary: If |Σ|=n, then kt(S)=SS2Sn=S

Closure OperatorsPermalink

前面的 kr,ks,kt 都是很好的 closure operator 的例子。现在我们来看下 closure operator 具体的性质。

不管 Si 是 algebraic structure 还是 relation,我们都可以组一个 poset S={S1,S2,,Sn} with SiSjSiSj. 或者更宽泛一点,我们认为 poset (S,),都可以定义一个函数 f:SS 满足:

  1. (increasing) SS,Sf(S)
  2. (monotonic) S1S2f(S1)f(S2)
  3. (idempotent) f(f())=f()

这个 f 就可以被视为 S 上的一个 closure operator.

Definition: S is “closed” (or having some property w.r.t. to the closure operator f) if S=f(S)

Categories:

Updated:

Comments