A Fibrational Method of Indexed Coinductive Data Types

: As a fundamental issue in type theory, indexed coinductive data types (ICDT, for short) is of crucial importance, which is essentially semantic computing p r oblem in programming. Based on fibrational method, this paper analyses semantic behaviours of ICDT and describes their universal coinductive rules. We executed some works in semantic computing and program logic of ICDT including their math structures and categorical properties. Example analyses prove the effectiveness of the proposed fibrational method and its applicability in program languages. Our work is based on fibration; a general math setting that can compute semantics automatically rather than depend on particular computing environments and syntactic forms of ICDT.


INTRODUCTION
The coinductive data type [1] analyses the semantic behaviours of data types in program languages and type theory; it is a dual concept of inductive data types with coalgebra as its math support [2,3]. It observes the dynamic behaviours of languages during program execution. Inductive and coinductive data types form a complementary solution to improve the abilities of syntax construction and the semantic computation of program languages. ICDT, one kind of coinductive data type, has more semantic computing power and is capable of dealing with more complex data structures in programming. ICDT is an important part of programming and type theory. Traditional methods of ICDT, including category theory and coalgebra, make type theory models in the local Cartesian closed category, which then gives rise to two consequences: one is that indexed coinductive data types and the relation categories which describe their semantics co-exist in the same category together; another is that functor and its lifting are identical. Thus, this has some limitations to analyse semantic behaviours and depict coinductive rules.
Fibrations are a recently emerging trend in computer science, especially in categorical methods; they have many applications, such as database system modelling [4,5], software specifications [6], and programming [7,8]. In a fibrational setting, depicting the semantic behaviours of ICDT is no longer restricted to functions or morphisms, but is generalized to objects in a total category. More importantly, ICDTs and relation categories do not coexist in the same category any longer, but the latter constructs functor which is lifted in corresponding total categories to represent its abstracted semantic computing and program logic of ICDT. Hermida and Jacobs performed a great deal of work in this field [9].
We used fibrations to discuss ICDT in our works, firstly taking it to be the object set in the base category and taking its semantic behaviours to be the object set in total category; next we established the responsible relations in program logic directly between the ICDT and its semantic behaviours using an equation and quotient functor; lastly, we constructed the ICDT corecursive operations to describe abstract coinductive rules with universality using selffunctor constructed in base category and their corresponding lifting equation-preserving in the total category.
Our primary works have researched the semantic behaviours of ICDT and its coinductive rules using fibrations. The rest of the structure of our paper is as follows. In Section 2, we study some current related works. In Section 3 we introduce some basic concepts, such as the bifibration and reindexed functor. In Section 4, we present a single-sorted indexed fibration on slice categories to analyse the semantic behaviour of single-sorted ICDT and abstractly depict its coinductive rule with universality. In Section 5, we extend a discrete indexed object to the indexed category, developing single-sorted indexed fibration to many-sorted indexed fibration, and analysing the semantic behaviours of many-sorted ICDT and abstractly depicting its coinductive rule with universality. Lastly, we summarize our conclusions and discuss future researching work.

RELATED WORKS
As a coinductive data type whose abilities of semantic computation are stronger, ICDT takes coalgebra as its math foundation, introducing tools such as terminality and bisimulation to type theory, which has particular advantages in analyzing and describing the dynamic semantic behaviors of programming. From the perspective of document retrieval, Hagino maybe is the first one who worked on relationship between inductive and coinductive data type systematically using the dialgebras structure in [10]; his work laid the research foundation of the coinductive data type. However, there exist certain deficiencies in the polymorphism type system, the relationship between syntax construction and dynamic behaviors, the applications of coinduction data types.
Scholars' joint efforts provided the impetus for the further development of coinductive data types. Nogueira studied the relationship between inductive and coinductive data types and their application in polymorphism programming using bialgebra in [11]. Authors in [12] further melted the inductive and coinductive data type by λ bialgebra and distributive laws, which explored the relationship between syntax construction and dynamic behaviors of data types. Poll et al. extended the works of Hagino based on sub-type and inheritance, and they obtained results on the connections of inductive and coinductive data types using the dual properties of algebra and coalgebra [13]. Greiner et al. brought coinductive principles in program languages. They studied coinductive data types in programming [1,14]. Authors in [15] described indexed coinduction by co-recursion. All of the above results solved the aforementioned questions to some extent. Meanwhile, in the field of applications of coinductive data types, Gimenez studied some applications by Coq, the formal theory proof tool in [16]. Vene researched coinductive data types in the functional program language Haskell [17]. Most of the above results applied the methods of category theory and coalgebra, and those based on fibrations only focused on certain respects, such as the logic reason of coinductive data types and the validations of coinductive rules. For example, Hermida demonstrated the coinductive rules of final coalgebra with quotient types in [9]. Subsequently, Ghani et al. broke through the limitations of polynomial functors in [9], and developed their work to generic functors. Recently, they also presented λ 1 -fibration, constructed parameterized units of measure fibration UoM, and proved basic propositions of [18]. Based on [9], [19] proved the soundness of bisimulation coinduction in a fibrational setting, and provided a new categorical method of weak bisimulation by changing parameters. Chen and Urbatput forward a categorical method of automata theory, applied partial order set opfibration to study some concepts of the theory of algebraic automata in [20]. Based on seminal work by Worrell in [21], Hasuo et al. discussed coinductive predicates and final sequences in a fibration in [22], they identified some categorical 'size restriction' axioms that guarantee stabilization of final sequences after ω steps.
The current studies focus largely on coinductive data types; and the research on ICDT is still in its preliminary stage.There are many interesting questions in the field of semantics and programming; for instance, analyzing semantics behaviors and representing coinductive rules, particularly the latter are almost produced automatically. Those automatically produced coinductive rules lack a stable mathematical basis and concise formal specification. Our work focuses on semantics behaviors and coinductive rules of ICDT through fibrations. Comparing with conventional methods such as coalgebra and categoretical theory, this paper achieved the following: it analyzed semantic behaviors of ICDT succinctly using fibrations, it improved program languages processing and proving abilities for the semantic behaviors of ICDT, and it presented and described the coinductive rule with universality of ICDT. Meanwhile, all such works do not depend on specific computing enviroment, but they supply a sturdy mathematic basis as well as brief and unified description modes to semantics computing and logic of programming.
Using fibrational methods to study ICDT in formal languages extends and deepens the conventional ways of coinductive data types at categoretical theory, especially after coalgebras emerged, combining dually some category notions, including the fibration and the opposite fibration, reindexed functor and opposite reindexed functor, presents powerful vitality for fibrations in researching ICDT. There are wide development prospects in computer science theory foundations and engineering practice. Moreover, using fibrational method to research ICDT in formal semantics is not purely math research, but from the perspective of soft theory, integrating fibration method to the up-to-date results of type theory, formal languages and monads, this collaborates with fundamental study systematically and deeply for certain ICDT kernel problems including category interpreting of key notions, semantics behaviors and formal rules.

FIBRATION AND OPFIBRATION 3.1 Fibration and Reindexed Functor
We assume readers have some categorical foundations, such as functor, adjunction,and natural transformation. Considering they have not presupposed the set theoretical models based on mathematical logic, some current basic math literature does not require all morphisms to be set when category is defined, but rather analyzing from the practical application perspective of computer science, we deem it is reasonable to confine all morphisms to a set. If all objects and morphisms can form two sets, respectively, in a category, the category is called a small category in [23]. The whole objects discussed in our works are in view of the concept of small category; readers can find other details for fibrations in [23][24][25]. For a category  , let Obj  to be the objects set, Mor  to be the morph isms set. Definition 1. Let : P →   be a functor between two small categories  and  , : Cartesian arrow of f and Y, if the following three are satisfied: (1) (3) There exists a unique : w Z X or → ∈M  such that u w v ⋅ = and P(w) = h. For the Cartesian arrow u of f and Y, we say u lies above f; similarly, Y lies above D. If u is a cone [23] in category  , then by the uniqueness of the cones morphism w, the Cartesian arrow u in Definition 1 is also a universal cone i  ,namely, the limit cone. Accordingly, the vertex X of universal cone u is the terminal object of u [26]. Then by the universal properties of universal cones, the Morphism f is the relationship between ICDTs in the base category, and reindexed functor * f is a lifting of f in the total category, which is related to their semantic behaviors. Similar to Definition 1, if u is a cocone [23] in category  , then the opposite Cartesian arrow u in Definition 4 is a universal cocone in  through the uniqueness of the cocones morphism w, namely, the colimit cocone. Accordingly, the vertex Y of the universal cocone u is the initial object of u in [26], while the opposite Cartesian arrow u is an isomorphism by the universal properties of universal cocones. between fibers C  and D  , then * f is an opposite reindexed functor induced by morphism f.

Adjoint Properties of Reindexed and Opposite
Reindexed Functor  is a pair of adjoint functors, η, ε is the unit and counit, respectively, and for X bj ∈M  , the transpose of f and g are G(f)η X and ε Y F(g), respectively. Theorem 1. Let : P →   be a fibration between the two small categories  and  , then P is a bifibration iff  be a pair of adjoint functors, let η be the unit, ε be the counit, and : be a fibration between two small categories  and  . Then Y bj D ∃ ∈O  ; we can construct a Cartesian arrow be the morphism above f. In the following, we prove that l is an opposite Cartesian arrow above f. This is another morphism above f, let : By ; it satisfies diagram commuting, that is, Then the transpose φ ∧ of φ is the unique morphism from l to g, and ( ) Then by Definition 4, l is an opposite Cartesian arrow X f ↓ above f.
We write Consequently, the left part of diagram in Fig. 2 commutes. Similarly, we have , i.e., the right part of diagram in Fig. 2 also commutes. Hence ϕ x, y is a natural isomorphism. We thus prove * f * f by definition of adjoint functors in [26].

SEMANTIC BEHAVIOURS OF SINGLE-SORTED ICDT AND ITS COINDUCTIVE RULE
From the viewpoint of fibrations, single-sorted ICDT is an ICDT with discrete indexed objects, such as streams, lists, and trees. Based on the results from [27] and [28], this section constructs single-sorted indexed fibration by fibrations, analyzes semantic behaviors of single-sorted ICDT, and presents a coinductive rule of single-sorted ICDT with universality.

Semantic Behaviours of Single-Sorted ICDT 4.1.1 Truth Functor and Relation Fibration
Definition 9. Let :  is a terminal object in fiber D  , and for : is a terminal object in fiber C  , i.e., the reindexed functor * f preserves terminal objects, then we state that fibration P has fibered terminal objects.
The fibered terminal object of predicate fibration Pre in Example 1 is a function map of all elements in the set X to a singleton set. The fibered terminal object of the codomain fibration cod in Example 2 is an identity function. The sub-object fibration S in Example 3 is an equivalence class of identity function. Definition 10. Let : P →   be a fibration between two small categories  and  , and the functor : Then T P is a truth functor of fibration P. If T P has one right adjoint functor {−}, then we call{−} a comprehension functor of P.
Let 1  and 1  be the terminal objects of the base category  and the total category  , respectively. Then , and the truth functor T P maps f to its Cartesian arrow ( ) Definition 11. Let : P →   be a fibration between two small categories  and  ; its base category  has products. Let Δ: →   be a diagonal endo-functor above  , which maps C Obj ∀ ∈  to the product object C × C. Then the pullback of P along Δ forms fibration The object of the total category ( ) Fig. 3 maps the relation (C, D) to object C in the base category  ; functor Π maps (C, D) to object D in  , and P(D) = Δ(C). Moreover, the property pullbackpreserving of Definition 11 ensures that fiber The procedure of building new fibration using specific fibration is called to be change of base. For instance, we can build Rel(P) using the change of base from P in Definition 11. The change of base keeps construction including preserving fibered terminal objects in [26]; if the fibration P has one truth functor T P , then its relation fibration Rel(P) has truth functor T Rel(P) . Meanwhile,we can gain T Rel(P) (C) = T P (C × C). The predicate fibration Pre in Example 1 constructs a relation fibration Rel(Pre) using a change of base, and its truth functor maps set X to a twotuple relation : Proof. Let η f be the unit of the adjoint functor * f * f , and let ε s be the counit of the adjoint functor * s * s (Fig.   4). Then f Id B η =  , s Id C ε =  . The following equation ⋅ , and the pullback square in Fig. 4 satisfies diagram commuting: f t g s ⋅ = ⋅ , and s is a pullback of f along g, t is a pullback of g along f. Using the pullback property of the reindexed functor, we have is an isomorphism. In other word, based on the pullback square in the base category on a bifibration, Theorem 2 defines a natural transformation whose functors preserve the structure between corresponding fibers in the total category  . The theorem further ensures the reindexed functor and the opposite reindexed functor satisfy appropriate properties of diagram commuting. For example, the predicate fibration Pre in Example 1 and the codomain fibration cod in Example 2 both satisfy the Beck-Chevalley condition in Theorem 2.
Definition 12. Let : P →   be a bifibration which is satisfying the Beck-Chevalley condition; the base category  has products, furthermore, T P is one truth functor of P. For any C bj ∀ ∈O  the active function The truth functor T P of T is mapping C to one terminate object T P (C) in fiber C  . From Definition 11, we can obtain that Rel(P) is the change of base of P along Δ. So if fibration P has one fibered terminate object, then its relation fibration Rel(P) has one fibered terminate object too. If the opposite reindexed functor * δ can map terminate , and the equation functor The intuitional implication of the equation functors is that identical parameters have identical results [9]. Take the predicate fibration Pre in Example 1 as an example; the object in its fiber

Single-Sorted Indexed Fibration and its Equation Functor
Theorem 3. Let : P →   be a fibration or bifibration between two small categories  and  . Then :  Definition 4, Z f ↓ is an opposite Cartesian arrow of f on functor P / I. Namely, if P is an opposite fibration, then the single-sorted indexed functor P / I is also an opposite fibration.
Therefore, if P is a fibration or bifibration, then the single-sorted indexed functor P / I is also a fibration or bifibration. , the fiber C  above C on P is an isomorphism to the fiber ( ( )) / T I α  above α on P / I [28], and if P has a truth functor, then the single-sorted indexed fibration P / I constructed by P also has a truth functor. Any

Quotient Functor and its Lifting
Let truth functor :   is a single-sorted index fibration for P . We make a relational fibration Rel(P / I), an equational functors Eq P/I with a quotient functor Q P/I of P / I. Presume F to be one self functor into the base categories / I  over Rel(P / I). Then F ⊥ is a self functor into the total categories

Semantic Behaviours of Single-Sorted ICDT
is made using action of selffunctor F. We call α the carrier of F coalgebras, the morphism between (α, r) and another F -coalgebra ( , : between their carriers, which satisfies the diagram commutes; that is, Fcoalgebras category is composed of F -coalgebras and corresponding morphisms, writes Colag F . If the terminal F -coalgebra ( , : exists, it is up to a unique isomorphism with the universal properties, which are determined by terminal coalgebra. The universal properties are our primary tool to research the semantic behaviors and coinductive rules of ICDT. The single-sorted ICDT vF, which is also the carrier of final F -coalgebras, is the max fixed points of the functor F. The functor F is the syntax destructors of vF. The corresponding morphism out describes a type of semantic behavior of vF during the syntax destruction externally. We apply equation functors Eq P/I of the single-sorted indexed fibration P / I, it mapped F -coalgebra (α, r) to an  , that is, Coalg(Q P/I )(q)= Q P/I (q). So Q P/I (q) be one of homomorphism images of q with the act of the functor Coalg(Q P/I ) (Fig. 8). If the morphism : is a F ⊥ -coalgebras morphism from q to Eq P/I (r), then the Fcoalgebras morphism : from Q P/I (q), to r is an F -coalgebras homomorphisms about g. Similarly, g is an F ⊥ -coalgebra homomorphism above h.
The left adjoint Coalg(Q P/I ) of functors Coalg(Eq P/I ) causes a presentative mutual deduction relations among F -coalgebras whose carrier is Q P/I (ω), F ⊥ -coalgebras whose carriers are ω, providing a concise and uniform model ways to the math specification of the coinductive rule of a single-sorted ICDT. The single-sorted ICDT vF is the carrier of terminal coalgebra, if functor Coalg(Eq P/I ) preserves terminal objects, then the lifting equationpreserving F ⊥ of F on Rel(P / I) generates a sound coinductive rule.

Coinductive Rule of Single-Sorted ICDT
One fibration equipping a quotient functor and equation functor, the math specifiction of coinductive rule is coherent to its semantics behaviors analysis of ICDT on this fibration [9]. If : -coalgebras, F have its lifting which is equation-preserving F ⊥ , then P / I have the coinductive rules whose carrier is the single-sorted ICDT vF. This provides a sound basis of validity judgment for F ⊥ applying F -coalgebra to generate a coinductive rule on a single-sorted ICDT. That is, if the single-sorted index fibration P / I equipping quotient functor and equation functor depicts semantics behaviors of the single-sorted ICDTs, their coinductive rules on account of final F -coalgebras are available in the procedure of semantics behaviors descrition in program. Now we can obtain an universal coinductive rule which is provided abstractly into fibrational settings for a singlesorted ICDT.
On the basis of categoretical theory, the corecursive computing of a coinductive data types rises in final coalgebras semantic [2]. Any , which is from (α, r) to the final F -coalgebra (vF, out) (Fig. 9). Co-recursive manipulation unfold origining in final coalgebras semantic is a corecursive parameterized manipulation of the ICDT in nature. The corecursive computings have many welldefined properties such as exact semantical description, adaptable expansibility and brief expressing.
coalgebras homo-morphism on unfold r. Example 4 presents some fibrational tools, including single-sorted indexed fibration, equation and quotient functor to analyze semantic behaviors deeply and coinductive rule of stream using fibrations, which establishes a mathematical foundation for researching semantic computing and the logic of program languages.

SEMANTIC BEHAVIORS AND COINDUCTIVE RULE OF MANY-SORTED ICDT
Modeling based on the slice category / I  analyzes semantic behaviors and describes the coinductive rule of single-sorted ICDT indexed by I. But I is only aimed at a single-sorted ICDTs, so hardly to process a more complicated many-sorted ICDTs effectively including reciprocal recursion types. On the basis of work ahead, we have extended the discrete indexed object I to an indexed category  , constructed a many-sorted indexed fibration, described a many-sorted ICDT in  indexed by bj O  , made a semantic behavior model of the many-sorted ICDTs in the indexed category  based on fibration : G →   and chose different program logics for different indexes. G ' →   be two fibered functors above the base category  . The fibred functor G is a right fibered adjoint functor to F, and F G is a pair of fibred adjunction above  , if G is a right adjoint functor to F, and the unit or counit of F G is vertical.

Fibered Fibration
Definition 17 and Definition 18 lift standard category structures to fibered structures; it is easy to process many practical problems of many-sorted ICDTs with different discrete indexed objects in computer science. Using fibrational tools, such as truth and quotient functors in the base category, we can combine many-sorted ICDTs with their semantic behaviors. Applying reindexed and opposite reindexed functors between fibers in the total category in order to analyze the deeply semantic behaviors of manysorted ICDTs, in order to construct corecursive operations on many-sorted ICDTs to abstractly describe coinductive rules with universality. This does not depend on particular computing environments, but improves the cohesion of many-sorted ICDTs, and further enhances the independence of program languages.
Let : P →   and : G →   be two fibrations between small categories. Given the composed property that composition of two fibrations is a fibration [23], GP is a fibration. For a bj ∀ ∈ O  , a  is a fiber in the total category  on fibration GP over a. The restriction : a a a P →   of P at a is a pullback of P along the including functor : a Inc →  , and a  is a fiber in the total category  on fibration G over a. Then given the structure-preserving property of pullbacks [23], P a is also a fibration.
Each P a deals with different indexed object a. Let P have a truth functor, so P a also has a truth functor, denoted as T a . For a bifibration P that satisfies the Beck-Chevalley condition in Theorem 2, the right adjoint of the reindexed functor preserves terminal objects. When a iterates each indexed object in the indexed category  , a set of T a constructs the truth functor T P , that is, Differing from T P constructed by T a , each restriction P a of P has the truth and comprehension functor, we do not determine P itself has a truth and comprehension functor; otherwise, P has truth and comprehension functor, we also do n'ot determine its restriction P a has a truth and comprehension functor. In the following, we introduce the definition of a fibered fibration and demonstrate the decidability of P and its restriction P a about the existences of the truth and comprehension functor. , and {−} preserves the Cartesian arrow, then P is a fibered fibration with a truth functor T P and a comprehension functor {−} over G.
Given Definition 18 and Definition 17, the truth functor : of P is a fibered fibration, T P is fibered right adjoint of P, P preserves the opposite Cartesian arrow and T P preserves the Cartesian arrow. Consequently, it is equivalent that P is a fibered fibration over G and that P is a fibration with a truth and comprehension functor. Then according to Theorem 4 below, we delve deeper into the decidability of fibered fibration P and its restriction P a at a.   of P at a is also a fibered fibration with a truth functor T a and a comprehension functor{−} a , and T a {−} a . In fact, P a is a subfibration of P [29], i.e., P a and P have the same fibration structures, semantic behaviors and logical properties. Similarly to subsection 4.1.2 and 4.1.3, the following are some tools of fibration, including: equation functor, quotient functor and lifting equationpreserving of many-sorted indexed fibration P a .

Semantic Behaviours of Many-Sorted ICDT
, the quotient functor Q Pa of the many-sorted indexed fibration P a maps Fig. 12). Let Coalg ⊥ to Coalg F establishes an intuitive mutual derivation relationship between G F ⊥ -coalgebra, whose carrier is Y and F -coalgebra whose carrier is Q Pa (Y). This presents a succinct and coherent model for describing coinductive rule of many-sorted ICDTs, with vF a as the carrier of terminal F -coalgebra. If the functor Coalg(Eq Pa ) preserves terminal objects, then the lifting equationpreserving G F ⊥ of F on Rel G (P a ) generates a sound coinductive rule.

Coinductive Rule of Many-Sorted ICDT
 , a coinductive rule of many-sorted ICDT with universality is as follows: Rel Rel   on relation fibration (Rel G (P a ), Rel G (P b )), we obtain the semantic set describing properties of (EVEN, ODD), that is, The mutual recursive type is a complex many-sorted ICDT. Traditional methods, including algebras and category theory, are difficult when effectively processing their semantic computing and program logic. Example 5 analyzes the deeply semantic properties of mutual recursive type using fibrations. The fibrational method is not strictly dependent on particular methods or tools, such as predicate logic or set theory, and abstractly depicts its coinductive rule with universality. Example 5 expands and deepens traditional methods in the level of category theory. It deals with the semantic computation of the mutual recursive type in the uniform settings of fibrations, and further develops the width and depth of traditional methods of ICDT in math.

CONCLUSIONS
Fibrations integrate conventional ideology regarding programming, with special ideas and studying methods, such as highly abstract, nimble development and brief description, produces a robust and significant effect on program languages and formal semantics, and boosts the application of categoretical theory in computer science. There is little literature on fibrations in computer science, especially regarding systematical and deep research aiming at programming; there is even less literature relating to its formal semantics. Fibrations have special superiorities in resolving the represention of speculative matters. At the same time, they are important in the application of theoretical computer science. This paper executed some preliminary works in analyzing semantical behaviors, coinductive rules representation of ICDTs. In general, we expect this work can promote interest for academics particularly in China regarding fibrational method, promoting the prospects of fibration itself and their applications in computer science.
Our future work will be a preliminary discussion on the soundness, completeness, and consistency of a formal system consisting of ICDT and its coinductive rule. Furthermore, we are expanding our ICDT work to include 2-categories using fibrations, with deep discussion regarding math structures and the categorical properties of syntax construction, semantics computation, behavoirs description and programming logic in 2-categories.