prosyslab-classroom / cs524-program-analysis

53 stars 13 forks source link

[Question][General]Different definitions of CPO (or domain) #31

Closed yusungsim closed 1 month ago

yusungsim commented 2 years ago

Hi. Not a serious question but I just want to clarify my previous understanding on domain theory.

In [Theories of Programming Languages] by John C. Reynolds, chain is is defined as follows

A chain is a countably infinite increasing sequence, x_0 < x_1 < x_2 < ... The least upper bound of a chain is called its limit. A chain is said to be interesting if it does not contain its own limit or, equivalently, if it contains an infinite number of distinct elements.

Under this definition, a concept of 'completeness of chain' corresponds to predomain. But predomain does not always have a least element, or bottom. A predomain with the bottom element is called domain. And least fixpoint theorem applies to this domain.

In contrast, our lecture defines a chain as any totally ordered subset of a poset.

Definition (Chain). Let (D, <) be a partial ordered set. A subset X \subset D is called chain if X is totally ordered

So under this definition, the increasing sequence in chain can be finite, or even empty (in case of the empty set). And in our lecture, a 'completeness of chain' concept corresponds to CPO, which every chain, even a finite one, has a lub. Thus, by lemma (lecture3, p25), CPO should always have a bottom element.


I understand that CPO is equivalent to domain in Reynold's definition. What I think somewhat counterintuitive is that chain can be a finite subset. While we're interested in finding lub of chains, defining finite, or "not-interesting" chains seems unnecessary (because finding its limit is very trivial).

Especially when we're reasoning with specific chains in the CPO (or domain), we are really interested in 'interesting' chains, because they are really a useful target of LFP theorem. Also any finite totally ordered sequence can be extended to infinite chain, (x_0 < x_1 < ... < x_n < x_n < x_n < ...). What really exceptional is when thinking under CPO, one should care exceptional case for empty set, which is not a really a sequence or something, but is defined to be 'chain' (because it is chain). In this sense, I think Reynold's definition is simpler, considering only 'interesting' infinite chains to be used in proofs or constructions or whatsoever.

Or, even if some set is not a CPO (or domain), one can define a partial order so that make the set as predomain, and reason about many chains exist in that set. This is also useful for some applications of abstract interpretation, when selecting initial state for analysis, or the 'bottom element' for transfer function. When computing lfp of transfer function, using specific element instead of global bottom can be utilized for situations when specific initial states for the runtime are defined.


Later in the same chapter, Reynolds mention that

It should be mentioned that the term "domain" has no universally accepted definition; it has been used with different meanings by different authors, and even by the same author in different publications.

So, I just wonder what is motivation behind defining CPO as always equipped with bottom elements. Also, what definitions of domains (for abstract interpretation's abstract domain) are generally accepted in academia?

Again, not a really important question but just came across this question while I was solving HW3, but would be happy to discuss about backgrounds for formal concepts.


Reference

John C. Reynolds, Theories of Programming Languages, Cambridge University Press, 1998

KihongHeo commented 2 years ago

Hi Yusung,

Very good question. Below I try to do my best to first summarize your questions and answer to them one by one. Any further discussions are always welcome.

yusungsim commented 2 years ago

Thank you for the comment, professor! I guess I'll check out the book from P. Cousot and study more about domain theory used in abstract interpretation, specifically ...:)