M Kebdani

G Dauphin-Tanguy

A Dazin

R Albach

P Dupont

Two-phase reservoir: Development of a transient thermo-hydraulic model based on Bond Graph approach with experimental validation

Keywords: Bond Graph, two-phase flow, dynamic, transient, heat transfer coefficient, convection, conduction, cooling loop, modeling, Presurizer

The main purpose of the project FUI THERMOFLUID is to study the feasibility of a new electronic cooling system embedded on flying objects (missile, satellite, and airplane). The technology chosen consists of a pumped two-phase flow cooling loop (PTPFL). It is an innovative technology with a transport capacity of the thermal power up to 10 MW.m, exceeding in this way the performance of all other technologies. A PTPFL is a cooling loop based on the exploitation of the latent heat properties of the fluid trapped inside the loop, and moved by a pump. The components constituting a PTPFL are: a two-phase reservoir (TP-R), a mini-channels evaporator, a brazed plate condenser, a pump and pipes. The global research work is devoted to propose a dynamic model and experimental validation of the PTPFL. The present article is exclusively dedicated to the TP-R two-phase reservoir (TP-R). Indeed this element plays a key role in the functioning of PTPFL. Historically, the TP-R did not equip the first cooling loop. However, due to its advantages its introduction was essential. The developed dynamic model will be used in another work to predict the thermal hydraulic efficiency of the PTPFL from its mechanical and fluidic parameters, to conduct the study of transitional regimes and instability problems, and provides an original tool dedicated to design the TP-R in function of the thermal power levels to be evacuated and the selected refrigerant. The bond graph methodology is adopted for modeling works because of its energetic approach and multi physics character of the studied system.

The new model proposed in this article has many originalities: First, it is based on bond graph approach. Nowadays, the open literature shows that no bond graph model has been developed for such thermo-fluid system. Second, the dynamic model of TP-R pays great attention to phenomena that have never been taken into account in works cited in the present article, such as evaporation and condensation. Third, different conducto-convective heat exchanges are modeled without any experimental recalibration of the thermal exchange coefficients, unlike models proposed in the literature. In fact, all coefficients are systematically calculated using adequate correlations.

INTRODUCTION AND STATE OF THE ART

An electronic device generates heat flows that require thermal management. For example the limit junction temperature of a silicon chip is about 125°C; if it is exceeded an important risk of malfunction and degradation is considered. Furthermore, the volume density of the power dissipated by Joule effect in a converter is quadrupled every four years, providing values that could reach 100 for the arrival of 2020 [START_REF] Serin | Hydrodynamic and thermal study of the vaporization in a square section of micro channel: application to two-phase micro capillary pumped loops[END_REF]. The cooling of electronic devices based only on exchanges by natural convection is dedicated to low power. Indeed, the heat transfer coefficient remains low: 15 W/cm² [START_REF] Riofrío | State of the art of efficient pumped two-phase flow cooling technologies[END_REF]. Furthermore, the finned radiators have exchange coefficients up to: 35 W/cm² [START_REF] Riofrío | State of the art of efficient pumped two-phase flow cooling technologies[END_REF]. For higher power, cooling loops are more adapted. The pumped two-phase flow cooling loop (PTPFL) is an effective technology in terms of heat flow transport capacity: 10 MW.m [START_REF] Lachasagne | Numerical modeling and experimental development of a capillary pumped two-phase loop by gravity environment: application to the cooling of power electronic components in automotive context[END_REF], with high level adaptability and an exchange coefficient up to: 600 W/cm². A (PTPFL) is a cooling system composed of five components as shown in Figure 1. A succinct description of the role accomplished by each element is given in a previous work [START_REF] Kebdani | Bond Graph Model of a mechanically Pumped Biphasic Loop[END_REF]. The current article deals especially with the two-phase reservoir noted TP-R in Figure 1. The first part of the current research work presents the different functions insured by a TP-R. Moreover, a modeling state-of-the-art is conducted in order to highlight better our contributions. A second part is devoted to describe the new dynamical model based on bond graph methodology. This model takes into consideration the physics of evaporation and condensation phenomena. Convection and conduction flows are modeled without any need of experimental recalibration of thermal exchange coefficients. The thermo-hydraulic behavior of the water and the steam filling the TP-R is validated thanks to experimental tests presented and detailed in the third part.

Main functions of a: TP-R

The TP-R is component of the PTPFL. It fulfills simultaneously three roles during the functioning of the system.

a) Thermodynamic control of the PTPFL

The lower part of the TP-R is filled with liquid. The vapor occupies the upper part as shown in Figure 2. Thus, it is possible to control the liquid pressure by acting on its temperature, using a suitable heating device. Then, taking into account some pressure losses it is possible to command the pressure within the evaporator and the condenser as well. Consequently, the saturation temperature is controlled inside the evaporator. Thanks to this temperature, the saturated nucleate boiling is launched allowing an efficient cooling based on the latent heat. b) The TP-R, a volume of control It is used to compensate for the expansion phenomenon of fluid. In fact, during PTPFL functioning, the fluid trapped in the loop passes through several transitional phases, during which its volume increases under the effect of heat received by the device to be cooled. This volume variation induces a pressure rise, jeopardizing in this way the whole structure of the loop. With the TP-R this risk does not exist, since the liquid volume in excess is directly injected into the TP-R.

c) TP-R is a pump protector

The TP-R permits to the pump to function without cavitation. Actually, it is necessary to heat first the liquid contained in the TP-R. The rise of liquid temperature induces an increase in pressure throughout the loop. Thus, the fluid filling the loop sees its pressure increasing while its initial temperature is maintained constant. These thermodynamic conditions force the vapor to condensate in the loop, and so provide a secure pump starting without cavitation.

State-of-the-art of TP-R modeling

Up to now, unlike Capillary Pumped Loops (CPL), the published literature lists absolutely no research work dedicated to PTPFL modeling. Nowadays, our research work [START_REF] Kebdani | Bond Graph Model of a mechanically Pumped Biphasic Loop[END_REF] is the only detailed work dedicated to PTPFL technology and published in the open scientific literature. However, TP-R remains a common component between the two cooling technologies (CPL) and (PTPFL). Then, it is important to carry on a state-of-the-art on how this component is modeled in the CPL to better position our work and highlight its originality compared to the previous works.

a) Classification of models

Considering the large number of CPL modeling [START_REF] Wang | Capillary heat loop technology: Space applications and recent canadian activities[END_REF] and [FHP11] made since their first introduction in 1978, an overall classification of existing models is proposed and structured as shown in

MODEL DESCRIPTION OF TP-R

2.1.Physical description of modeled phenomena

 The liquid receives power density ( / ²) q w m from the cartridge, which makes its temperature increasing. If this one reaches the saturation temperature sat T corresponding to the pressure liq P in the liquid volume, nucleate boiling is therefore initiated. So, vapor bubbles arise in the liquid. Then, bubbles ascend in the form of convection cells, to the interface where they are vaporized as represented in Figure 2.

 The steam temperature is the result of a complex process of evaporation happening at the liquid-vapor interface coupled with a process of condensation at the inner surface of the TP-R as shown in Figure 2. Actually, the steam in contact with the inner wall of the TP-R is likely to condense when its temperature is greater than the one of the wall ) where an experimental identification was needed to find thermal conductance.

2.2.Bond graph model of the TP-R About the theory of bond graphs

Industrial thermal fluids systems are multi-disciplinary. Their functioning involves systematically several domains of the physic (mechanic, hydraulic, thermal, chemical and electrical fields. This phenomenological complexity makes it difficult to develop a standard model based on partial differential equations.

The bond graph methodology is based on the principle of energy conservation. It allows to represent graphically the power transfer between components of a complex system. A bond graph model is a unified graphical representation for all areas of engineering science. It is based on the principle of analogy between different fields of physics. Also, a bond graph model is structural which allows simulation and analysis of the model properties (Dauphin -Tanguy et al, 1999) and behavioural. The bond graph allows modeling adapted to the evolutionary technological needs. In fact the model can be easily modified by adding or removing elements, permitting in this manner a modeling approach called "bottom-up" or "top down".

Bond graphs or standard approaches?

During recent decades, a significant number of tools and thermal modeling methodologies were developed for industry and research domains. These models are generally grouped into three categories: "black box models", "white box models" and " gray box models". The "black box models" simply allow a numerical solution of the problem without providing any physical interpretation of the studied system. However the "white box models" are based on the physics and explicitly describe the system. Therefore, they are more complex to generate, since they contain very few approximations, thus so many parameters. Indeed, they require a long calculation time and a large computing capacity. So the scientists used the "gray box models". These models combine the physical sense and spirit of simple models. The Bond graphs are part of this class of models. The advantage of this approach, compared to other simulation tools such as TRNSYS, is that they require writing new computer codes to model components that are not available in their libraries, while bond graphs, due to their graphic approach and with a minimum of input parameters, it is easier to model complex phenomena. Also they are very suitable for modeling the basic problems of heat transfer through a wall while TRNSYS, for example, is not dedicated to this type of problems. If the Bond graph language gives the physical structure of the system, it also gives the causal structure, in other words, the calculation structure. It provides systematically variables and equations of state.

Assumptions

 Steam is saturated.  TP-R is composed of two volumes. See Figure 3.

 The lower volume is exclusively liquid.  The upper volume is exclusively steam.  The interface thickness separating the two volumes is neglected.

 In the proposed model the interface separating liquid and gas is not considered at all. In reality, this phase is composed of a mixture of liquid and gas and should be taken into account in the modelling process, but studies and experimentations conducted by (Carey 1992) and [START_REF] Guo | Continuous liquid-vapor phase transition in microscale[END_REF] for water shows that the thickness of this interface is of some nanometers. This result leads us to neglect the presence of such interface.

Note:

The interaction between liquid and vapor volumes is considered by modelling the heat exchange taking place in both directions: liquid/vapor (evaporation phenomenon) and vapor/liquid (condensation phenomenon). Also, the mass flow of evaporation and condensation reflects how both volume are linked. All these phenomena are modeled by the multiport bond graph element R.

 No presence of non-condensable gas in the TP-R.  Temperature and pressure are considered uniform.  The material constituting the TP-R is assumed to be homogeneous, isotropic, of constant thermal conductivity λ.  The refrigerant used for the simulation is water; its thermo physical features are extracted from NIST [site 1]. Specific polynomial and Gaussian correlations were developed and are listed in Annex A.

Choice of thermodynamic variables

The product of effort and flux in a true bon graph is a power. However, to make profit of some simplifications related to the mathematical formalism, it is decided to develop a pseudo bond graph in which the product effort by flux is not a real power, but all the properties of a true bond graph remain the same.

The variables in the pseudo bond graph model are:

• Pressure and Mass flow for the hydraulic domain.

• Temperature and enthalpy flow rate (for convection) or heat flow rate (in case of conduction) for the thermal domain.

Discretization of the TP-R structure

The reservoir structure is discretized into five volumes as shown in Figure 3:

1. Liquid Volume: liq V . 2. Steam Volume: All of these volumes are modeled by a capacitive C-element, which characterize the storage of mass and heat inside the TP-R. The mass and energy conservation equations are represented in bond graph theory by junctions: 0 h for hydraulic part, and 0 t for the thermal. Also, these two junctions reflect the assumption of pressure and temperature uniformity.

Given the mathematical form of heat exchange laws (Fourier law), thermal transfer phenomena (convection and conduction) are modeled by dissipative R-elements shown in Figure 4.

The Figure 4 is a global representation of the pseudo bond graph model, developed for the two-phase reservoir.

After the qualitative description of modeled phenomena, the conservation equations governing the dynamic behaviour of the TP-R are now presented.

The unknowns are:

 the pressure of the liquid : The liquid pressure is given by the hydrostatic law representing one of constitutive laws of the element

liquid C :   ( ) ( ) ( ) liq vap liq liq P t P t g x t      (1)
where:

( ) ( ) liq TP R vap x t H x t   (2)
Vapor pressure T an input to the model.

,0 liq V is the initial volume of liquid occupying the TP-R:

    22 ,0 ,0 liq TP R liq cart cart V R x R H         (7)
,0 vap V the initial volume of vapor in the TP-R:

,0 ,0 vap TP R liq V V V   (8)
 The temperature of liquid

The accumulated mass of the liquid _ ()

liq acc
mt is given by equation (4).

b) Volume

_ inf

          (18)

Remark about interpolation fonctions:

It should be noted that the functions relating the thermodynamic quantities are valid for pressure interval of small amplitudes [0.1; 1.5 bar], that's why these functions (polynomials, Lagrangian, Gaussian) are of great precision (the correlation coefficient is equal to 1). A particular interest is devoted to the precision when developing these functions. The steam density

() vap t  is: _ () () () vap acc vap vap mt t Vt   (19)
The vapor volume ()

vap
Vt is calculated using the equation (55).

 The temperature of the vapor

() vap Tt
The temperature of saturated steam in the TP-R is related to the pressure (saturation conditions). The relationship between the two variables is obtained using a Gaussian interpolation which is valid for [0.1; 1.5 bar]:

P                                                                            22
vap P                                   (20)

Description of conducto-convective flows: R elements

This section presents expressions of the eight thermal flows involved in the heating process. These flows are shown in Figure 3 Research works on heat exchanges in a closed reservoir, (Nukiyama , 1934) led to set up an experiment allowing the visualization of different flow patterns appearing during heating. An analysis of the curve obtained Figure 6 shows that heat exchange mode is strongly associated to the observed pattern (liquid, bubbles, plug, slug and annular...). It is therefore important, from a modeling point of view, to identify, first, the flow regime using appropriate indicators to apply subsequently the corresponding heat exchange coefficient. Actually, the curve of Figure 6 shows that the evolution of the heat density ( / ²) q w m imposed by the heating block to the liquid depends on the difference between the temperature of the cartridge wall . A detailed study of the proposed correlations for this coefficient is discussed in this paragraph, in order to take them into account in the developed model. Finally, note that the heat flow provided by the heat source (cartridge) to the liquid is written as:

  . / , cart liq conv cart wall cart liq H h S T T     (21)
where:

2 cart cart cart S R H      (22)
Heat exchange coefficients related to different flow patterns Nukiyama drew the graph Figure 6, in which heat flow density ( / ²) q w cm is a function of :

 Heat transfer coefficient associated with the section AC : towards a Saturated Nucleate Boiling (SNB): Section AB: Nucleate boiling with isolated bubbles. Bubbles of vapor (or nucleation sites), are regularly distributed along the heating zone. They appear at this area and move in the form of steam columns towards the liquid/vapor interface of TP-R. At this interface, bubbles will evaporate increasing thereby the vapor pressure in the upper part of the two-phase reservoir.

Section BC : Saturated Nucleate Boiling (SNB) with slug forms. Vapor bubbles chaplets proliferate as long as the heat flux is emitted by the cartridge. They have shapes of slugs or vapor columns [START_REF] Delhaye | Transferts de chaleur : ébullition ou condensation des corps purs[END_REF]. Slugs intensify until they substantially isolate the entire exchange surface with a very unstable vapor film. The heat flow used to heat up the liquid is mainly due to the latent heat of vaporization.

The heat flux density

q transferred along the AC section presented in Figure 6 Indicator detecting the change of the flow pattern: OA or AC section? From a modeling standpoint, it is necessary to write an indicator making the code able to switch from the correlation of Churchil and Chu to the Rohsenow correlation.

According to the Figure 6, one can note that it is not enough to have the equality

then:

1 SNB  , this means that the (SNB) is initiated, and the correlation used is the Rohsenow equation (28). 0 SNB  , there is not yet (SNB) and the used correlation is then the Churchil and Chu equation (24).

Point C: known as the boiling crisis point, or burn out.

If the critical flow crit q density is reached, then a volume of steam envelops the entire exchange surface as shown in Figure 7, causing thereby a separation between the liquid and the cartridge.

Nukiyama experience shows that during a critical flow, the quantity The critical flow density is calculated in the proposed model of TP-R. If ever this value is reached the model user knows it. This is an output of the model.

The selected correlation of crit q is the one of Sun and Lienhard reported by J-M Delhaye [DEL90] :

1/2 1/2 * 1/ 4 0.116 0.3 exp( 3.44 ) ( ) vap q R L g crit v liq vap                     (31)
where * R is a dimensionless radius whose expression is: Gr is the Grashof number defined as :

  1/2 * cart
32 2 TP R liq liq D g T Gr          (35)
Finally, the heat flow transferred by natural convection is:

inf inf inf / _ int int int _ int () liq wall liq wall H h S T T     (36) with: inf int 2 TP R liq S R x       (37)

 Radial conduction inside the wall

The analytical expression for the thermal resistance inside of a hollow cylinder is:

, ,int ln 2 TP R TP R ext TP R liq R R R x             (38)
Thus, the radial heat flow transferred by conduction through the wall of the TP-R is written according to Newton's law:

  inf inf _ int _ 1 wall wall wall ext Q T T R    (39)
 Natural convection between wall and air.

The heat transfer coefficient by laminar convection is written as:

where: , and an internal diameter:

  inf 2 ext TP R TP R liq S R e x        (43

d) Heat flow exchanged between liquid and vapor:

_ int TP R d 
, its cross section is then:

  22 _ _ int 4 TP R TP R ext TP R S D d        (46)
The heat transfer resistance is:

TP R long TP R TP R H R S      (
v cond p liq vap wall L H c T T       (49)
The specific heat of condensation cond H  is calculated using the following equation:

Mass flow of condensation and evaporation

The condensate mass flow expression

cond m is established in Annex B :     3 2 3 liq vap film cond liq TP R liq g mR                (52)
The expression of the condensate thickness is also obtained in Annex B:

    sup 1/4 _ int 4 liq liq vap wall vap film cond liq liq vap x T T gH                      (53)

Calculation of the vapor height:

The total geometric volume of TP-R is the sum of two volumes: liquid and vapor:

TP R liq vap V V V   (54) Then:   _ 22 () ( ) ( ) ( ) liq acc vap TP R vap TP R liq TP R TP R liq mt V t R x t V V t R H                    (55)
And:

  _ 2 2 () () liq acc TP R TP R liq vap TP R mt RH xt R               (

Mass flow of evaporation

The heat balance shows that the flow of heat transferred by the heating element to the liquid volume , used to bring the temperature of the liquid mass to its saturation temperature.

Then:

  . / , , 0
H m H c T T      (58)

EXPERIMENTAL VALIDATION OF TRANSIENT THERMO HYDRAULIC MODEL OF THE TP-R

An experimental validation is necessary to evaluate the ability of the model to predict the thermo hydraulic behavior of a TP-R. After the description of the used test bench we propose two validation tests in which comparisons between time evolution of the measured and simulated pressures and temperatures are performed. Also, the dynamic model was lately tested for other power densities ranging from 1W to 200W (the maximal power delivered by the cartridge), the model showed good agreement with experimental data extracted from the same test rig, which leads to consider that the model is valid for all the domain of our application.

Test rig description

The test bench used in this study is developed in cooperation between LML, CRYStAL laboratories and Atmostat Company. As shown in Figure 8, the TP-R is equipped with:  K-type thermocouple, manufactured by TC direct. Its reference is 408-056 with a precision of: +/-1°C. The thermocouple is completely immersed in the liquid.  Pressure sensor manufactured by Keller Serie 23. Its reference is: PAA-23/25, with a precision of +/-0.5%.

Applied constraints

A crenel of power is applied to the heating block housed in the TP-R. The ambient temperature is 20°C.

Experiments

 First validation test: crenel of amplitude 90W. The initial temperature of the liquid contained in the TP-R is 20°C. The whole test lasts 2160s.

 Second validation test: crenel of amplitude 105W. The initial temperature of the liquid contained in the TP-R is 57°C. The whole test lasts 5436s.

a) Temperature evolution of the liquid and vapor

The time evolution of measured and simulated temperature of the liquid, shown in the Figure 9 for the first test and in Figure 10 for the second one is analyzed. In addition, the time evolution of the steam temperature (red curves) calculated by the model are plotted on the same figures for the sake of a comprehensive analysis. Recall that the current instrumentation bench does not allow the direct measurement of the steam temperature. The analysis begins with the observation of the liquid temperature (bleu curves) in both tests carried out. It is found that the model draws a monotonous evolution spread over two phases just like the one obtained experimentally. Hardly the heat is applied, liquid temperature starts increasing almost linearly until the exact moment when we cut the heat flow. At this time the temperature gradually falls until it stabilizes at a value corresponding to the second permanent regime. Both figures 10 and 11 show a clear ability of the model to predict the thermal behavior of the reservoir during two simultaneous transient. The first transient corresponding to the heating phases seems to be well estimated. This reflects the fact that numerous heat exchange coefficients implemented are representative of the real heat exchange taking place in the TP-R. The start of the second transitional (caused by the power cut) seems to be less well reflected. Note also that in addition to measurement uncertainties (1.5°C), the observed difference may also be related to the discretization into 5 volumes. Actually, the cell containing the liquid is represented by a single control volume whose temperature is assumed to be homogeneous. In fact, the dynamics of heat transfer within the liquid is in the form of convective cells, which, to be faithfully represented, requires the inclusion of a stratification of the volume. So, as one might expect, the need for a finer discretization would be interesting. That said, the difference between measured and simulated results decreases rapidly to become practically zero as it approaches to the steady state. This latter is established very slowly by conducto-convective heat exchange with the external environment which remains poorly insulated. Concordance between measurements and simulation results proves the validity of the selected heat transfer coefficients.

Given the temporal evolution of the liquid temperature, the transient thermo hydraulic model of TP-R seems to estimate well the thermal dynamics with identical slopes between model and measures.

b) Evolution of liquid and steam pressure

The temporal evolution of the liquid pressure plotted in figures 11 and 12 is now examined. Once again, the bench instrumentation does not give access to the vapor pressure. The calculated and measured values agree well during steady states. As for the transitional phase, the model generally predicts a monotonic increase in two parts, joining so the experimental data. The slopes during the heating phase seem to be well estimated by the model. However a slight overestimation of pressure during descent phases is observed. The reason is contained in the assumption of thermodynamic equilibrium of the steam. Actually, this assumption leads to a vapor pressure always function of density, whereas this pressure is rigorously depending on the density but also on the temperature. More experimental tests with different power level applied to the heating bloc would measure the validity of this hypothesis.

We should note that the bond graph approach adopted in these work and even making its particularity allows with great flexibility to apply the conservation laws on the steam volume and deduce the temperature and pressure without using the hypothesis of saturation state, which, according to the two validation tests, seems to be not too restrictive.

c) Vapor pressure

The transient model seems to predict well the temporal evolution of the liquid pressure. This shows that:  Since the liquid pressure is calculated by simple application of hydrostatic law, it is indeed pressure vapor which is indirectly validated by the tests. And through this well estimated steam pressure, all modeled phenomena (evaporation, condensation and compressionexpansion steam) are finally well modeled.

 The height of the liquid intervening in the hydrostatic law as plotted in Figure 13, is also implicitly validated. It turns out that the model is able to predict with good accuracy the dynamics of thermo hydraulic behavior of the TP-R, except for a slight overestimation of pressure. However, analyzes raise two points, which worth to be recalled here: the level of discretization and saturation hypothesis both having a tangible impact on the observed differences in pressure.

The model owes its originality first to the bond graph approach, and various thermo hydraulic phenomena processed and modeled without any recalibration with experience. The literature review presents clearly that no similar modeling work was practiced. Several authors argue that the modeling of TP-R integrated into the cooling loops lack of finesse in the way they are modeled. Also, remember that the developed model can be used as a basis for the development of other more accurate solutions while its structure remains the same. Indeed, as previously reported, the bond graph is structural and it is possible to enrich the model taking into account other phenomena without any modification of the basic model. For example, it would be possible to model other heat fluxes that have not been modeled, or take into account the presence of non-condensable gas in the TP-R, or refine the discretization of the liquid and the steam volumes or the TP-R walls volume, as it may be possible to model the convective cells with more precision...

NOMENCLATURE

T T T TT                                                                               2 329, 7 0.1026 exp 27, 77 iq T                        A.
T T T                                                         A. 2
Specific heat of liquid in

T T T                                                       A. 3
Specific heat of the vapor in

                        A. 5
Inter-facial tension

    2 TP R film dV L R y dx          B. 1

Inventory of forces applied to the volume :

dV  Gravity force applied to the condensate film :

    2 g liq liq liq TP R film F m g dV g R y dx g                   B. 2
 Force corresponding to the drained steam:

    2 vap vap vap vap TP R film F m g dV g R y dx g                   B. 3
 Force due to parietal friction : This force is due to the friction of the condensate against the inner surface  The total geometric volume of TP-R is the sum of both volumes: liquid and vapor. We have:

                                                              B.
                                                      C.
                                                                     2 2
1, 141 955, 8 exp 2, 594

vap P                            C. 2

Figure 1 :

 1 Figure 1 : Overall architecture of a PTPFL

Figure 2 :

 2 Figure 2 : representation of evaporation and condensation phenomena.

  , called film condensation, which could coexist with the evaporation phenomenon, leads to the formation of a continuous liquid film of width film  located between the steam and the wall as shown in Figure 2. The width of the film film  by natural convection to the wall. A certain quantity long Q is propagated by conduction along the material constituting the TP-R. This heat flow long Q increases the temperature of the upper wall sup _ int wall T which is in contact with the vapor, and consequently intervenes in the condensation phenomena taking place in this part of the TP-R. Finally, other portions of heat flow noted: convection from the wall (lower and upper parts) to the outside of the TP-R. The Figure 3 summarizes the distribution of the flows, above mentioned.

Figure 3 :

 3 Figure 3 : Distribution of the various heat flows within the TP-R.

  of the wall in contact with the liquid : _ inf wall V . 4. Volume of the wall in contact with the steam : _ sup wall V . 5. Volume of the heating cartridge wall: _ wall cart V .

  the temperature of the lower TP-R wall : inf () wall Tt ,  the temperature of the upper TP-R wall : sup () wall Tt ,  the temperature of the cartridge : () cart Tt ,  the pressure of the vapor : () vap Pt ,  the temperature of the vapor: () vap Tt , The mentioned unknowns are calculated inside C elements, the resolution of integral equations is performed by Runge-Kutta solver integrated in 20-sim [Site 2], a step of 0.01 has been chosen. (20-sim is a modeling and simulation program for mechatronic systems). The bond graph methodology leads us to represent the calculation formalism as follows:

Figure 4 :

 4 Figure 4 : Dynamic pseudo-bond graph model of TP-R.

  height of steam in the TP-R, its expression is obtained by equation (56).  The liquid mass _ liq acc m Equation of mass conservation The mass storage in the liquid volume liq V is modeled by the 2 ports element liq C , as shown in Figure 5.

Figure 5 :

 5 Figure 5 : Bond graph model of the liquid volume.

  The vapor mass stored inside the volume vap V is modeled using the bond graph element vap C with the same developments shown in section (2.3.b).  The pressure of the vapor () vap Pt The vapor volume is saturated which allows to write the vapor pressure vap P as function of steam density vap  . The relationship between the two variables is obtained using thermodynamic tables provided by NIST [site1]. An interpolation function is then developed and valid for [0.0049; 0

  and are crucial to calculate the unknowns of the problem. The thermal convective coefficients are the most complicated parameters, they are calculated using specific correlations extracted from the open literature and reported below. a) Heat flow from the cartridge: . / cart liq H This term is computed in the bond graph element __ Wall ext cart R presented in figure 4.

Figure 6 :

 6 Figure 6 : Nukiyama curve specific to water [DEL90]. The convection coefficient conv h is calculated using Churchil and Chu correlation reported by J-M Delhaye [DEL90] and valid for: 12 5 10 10   

  very quickly, as it is visible in Figure6. It is manifested in reality by a consequent increase in the wall temperature of the heating cartridge which can easily exceed its melting temperature (1000 ° C) and therefore a degraded cartridge.

Figure 7 :

 7 Figure 7 : boiling crisis.

H

  flow exchanged between the liquid and the wall:This term is computed in the bond graph element _ int_ inf Wall R presented in figure4. Heat losses transferred from the liquid to the outside of the TP-R, are the consequence of three modes of heat transfer: Natural convection between liquid and the inner wallThe heat transfer coefficient is given by: The number Pr is given by equation (27).

H

  This term is computed in the bond graph element _ int_ sup Wall R presented in figure 4. The enthalpy flow rate received by the liquid from the condensate film is: The Annex C shows how to determine the analytical expression of the Mass flow of condensation cond m . Its formula is given by equation (52). Expressions of other quantities involved in the condensation phenomenon such as film width equation (53), and the flow velocity cond v of condensate film are also established in the Annex C. The term of specific heat , p liq c is calculated based on the temperature of the condensate film vap T according to the relationship (A. 3).

H

  This term is computed in the bond graph element __ Inter liq vap R presented in figure4. At the evaporation interface, the vapor bubbles leave the liquid to go into the vapor space. These bubbles carry with them some enthalpy flow (quantity of heat) whose expression is: by equation (A. 3). The term evap m is given equation (58).e) Longitudinal heat flow propagated by conduction along the wall:long Q This term is computed in the bond graph element Wall R presented in figure 4. TP-R is a cylinder of an outer diameter: _ TP R ext D 

47 )H

 47 It comes, according to the Fourier conduction law: flow exchanged between the steam and the wall of the TP-R:This term is computed in the bond graph element _ int_ sup Wall R presented in figure 4. The total specific heat * v L transferred by the steam to the TP-R wall is the sum of two contributions: the specific heat of condensation cond H  added to the specific heat due to subcooling of the condensate  

  equations (A. 1), (A. 5). And (50).

Figure 8 :

 8 Figure 8 : TP-R instrumentation.

Figure 9 :

 9 Figure 9 : Time evolution of liquid and vapor temperature of (Test 1).

Figure 10 :

 10 Figure 10: Time evolution of liquid and vapor temperature (Test 2).

Figure 11 :

 11 Figure 11: Time evolution of the pressure of liquid and vapor (Test 1).

Figure 12 :

 12 Figure 12: Time evolution of the pressure of liquid and vapor (Test 2).

Figure 13 :/

 13 Figure 13: Time evolution of the liquid height (left: test 1, right: test 2).

..

  This section has as purpose to establish the analytical expression of the Mass flow of condensation cond m Other parameters used in condensation calculation such as film thickness and condensate film velocity   , film cond v  are also highlighted. A hypothesis allowing the following developments assumes that the condensate flow is laminar 2100 Re  . Figure B.1 represents a condensate film formed on a vertical wall. All notations used are displayed on it. To begin, let's consider the infinitesimal volume constituting a portion of the condensate film:

Figure

  Figure B.1: Schema of the condensation process.

Table 1 .

 1

	Author	steady model	Unsteady model
		analytical	Numerical	analytical	Numerical
		solution	solution	solution	solution
	Furukawa [FUR06]	
	Dolgirev [DGMK78]	
	Ku [KKM87]			
	Kaya et Hoang	
	[KH99]
	Kaya [KPGT07]				
	Chuang [Chu03]	
	Hamdan [HGH03]	
	Pouzet [PJP04]				
	Launay[LPDJ07]				

Table 1 : classification of TP-R modeling works. b) Results of the state-of-the-art

 1 First, it turns out that steady models are predominant with analytical solutions. The state-ofthe-art reveals that few numerical models are developed for simulation in steady state. In fact, numerical tools remain reserved for unsteady studies (transient phenomena, instability, thermal cycling ...) where important thermo hydraulic coupling must be taken into account. Also, the late appearance of numerical models is mainly due to significant advances in the field of the computing science.

The new model proposed in this article is dynamical with numerical solutions; it differs from existing models by the large number of phenomena modeled as well as the minimum number of simplifying hypotheses. The following phenomena are treated in the proposed model but not in other models:  Evaporation at the liquid / vapor interface.  Condensation on walls (Nusselt theory).  Multiple heat exchange.  Various configurations of flow (cartridge / liquid).  Longitudinal conduction.  Exchanges with the outside.

temperature of the walls

	d) Volume	_ Wall cart
		Wall
			H	inf wall	_	acc		(	H	/ liq wall	_ int	inf	) ( 	H	/ cart liq		H	inf air wall ext / _	)	(12)
	The enthalpy storage in the volume	wall V	_ inf		is modeled by the element	wall C	_ inf	:
					H	inf wall	_	acc	() t			H	inf wall	_	acc	dt H  	inf wall	,0	(13)
																t
	The constitutive law of the element		wall C	_ inf	is then:
								inf wall Tt ()		inf () _ wall inf wall Ht p wall , () acc m t c 	(14)
	c) Volume	Wall	_ sup
																			wall C	_ sup	is similar to the that one of	wall C	_ inf	.

V  The inf () wall Tt The thermal junction 0 t allows writing the following enthalpy flow balance: V  The temperature of the wall sup () wall Tt The formalism related describing the element V  The

temperature of the cartridge

						() Tt
						cart
	The thermal junction 0	t allows to write the following enthalpy flow balance:
				H	cart acc __ ext cart P H 	(15)
	where P the thermal power provided by the cartridge. The enthalpy storage in the volume
	_ wall cart V	is modeled by the element		wall cart _ C	:
			H	_ cart acc	() t			H	_ cart acc	dt H  	cart	,0	(16)
									t
	The constitutive law of the element	wall cart _ C	is then:
				() Tt cart		_ () cart acc cart p cart , () Ht m t c 	(17)
	e) Volume

  is calculated using the correlation of Rohsenow [ROH85]:

		, wall liq c		    0.33 liq p liq , liq v liq liq vap c q LL , () wall cart sat sf v T T C g                 	s	(28)
	Rohsenow suggests the following values:	1 s  for water. As for the coefficient	C , the value
						sf
	C 	0.013	is recommended.
	sf

  1

	Density of vapor in	3 kg m : /
	vap	2, 883 exp	493, 3 37, 05 vap	2	2, 49 exp	vap	481, 7 53, 04	2	2, 45 exp	vap	470, 2 79, 93	2

  /

				J kg K  :
	c	, p liq	4709 exp	liq	583, 6 408, 7	2	9669 exp	liq	48, 77 220	2	493, 9 exp	liq	311, 4 109, 3	2

  /

				J kg K  :
	c	, p vap	6     0,1 P	2, 2	5   P	17, 7	4   P	70, 7	3   P	154	2   P	267	P  	1912, 3	A. 4
	Dynamic viscosity of the liquid in Pa s  :
			liq	0, 00427 0, 005535 cos(0, 0164	) 0, 001837 sin(0, 0164 TT liq liq	)
			0, 001649 cos(2 0, 0164		) 0, 001581 sin(2 0, 0164 TT liq liq	)
			0.0001286 cos(3 0, 0164	) 0, 000389 sin(3 0, 0164 TT liq liq	)

11

  Now, thanks to equations B. 10 and B. 11 we can rewrite the equality:Then, an integration of this equation with the boundary condition

						film	 4 liq liq vap wall  cond liq liq _ int x T gH        sup 1/4 vap vap T               	B. 14
										 	mH  	B. 12
											cond	cond
	Under the form:
		    2 	TP R R 		dx			  sup _ int vap liq vap liq film liq  TT wall     2 film g              	d    H 	cond	B. 13
												h leads to the expression
												ext
	of the condensate thickness:

  The mass of the liquid accumulated in the TP-R: , is calculated in the model. The density liq  is calculated from equation A. 1.The viscosity liq  is given by the equation (A. 5).

								TP R V   liq V	vap V	B. 15
	Then:
	vap V	( ) t	 22 ( ) ( ) VE vap TP R liq TP R R x t V V t R          		H	TP R 		_ liq acc liq mt ()      	B. 16
	And:
				() xt vap					 2 TP R TP R R  RH 2 TP R      _ () liq acc liq mt     	B. 17
	ANNEX C
	' hP ( ) 263,5 exp vap	0.2626 0,1546 vap P	2		92,88 exp	0,104 0,08743 P vap	2	34, 29 exp	P vap 0,05121 0,04696	2

_ ()

liq acc

mt

  1

			2			2			2
	" h P ( ) 2686 exp	vap P	5, 743	191, 4 exp	vap P	0, 06863	79, 63 exp	vap P	0, 03843
	vap
		5, 795		0, 6253			0, 2367
			2
	P	0, 1873		P	1, 844
	vap			vap
	464, 5 exp		0, 115 exp
		1, 363		0, 001972

ACKNOWLEDGMENT

The current research work is part of the collaborative project FUI THERMOFLUIDE-RT labeled by the competitively pole ASTech and involving three major groups (Zodiac DS, Safran Hispano, and MBDA), four SMEs (Atmostat Alcen, ADR, AER and ControlSys) and five research laboratories (CRIStAL Ecole Centrale de Lille, LML Arts et Métiers Paris Tech, LEGI Grenoble, LMT ENS Cachan, CEA-Liten Grenoble).

The authors gratefully acknowledge Mr J. Duval from Atmostat for the multiple fruitful scientific discussions.


Simon Boulier

Pierre-Marie Pédrot

Nicolas Tabareau

The Next 700 Syntactical Models of Type Theory

Keywords: F, 4, 1 [MATHEMATI-CAL LOGIC AND FORMAL LANGUAGES]: Mathematical Logic Dependent type theory, Program translation

A family of syntactic models for the calculus of construction with universes (CC ω ) is described, all of them preserving conversion of the calculus definitionally, and thus giving rise directly to a program transformation of CC ω into itself. Those models are based on the remark that negative type constructors (e.g., dependent product, coinductive types or universes) are underspecified in type theory-which leaves some freedom on extra intensional specifications. The model construction can be seen as a compilation phase from a complex type theory into a simpler type theory. Such models can be used to derive (the negative part of) independence results with respect to CC ω , such as functional extensionality, propositional extensionality, univalence or the fact that bisimulation on a coinductive type may not coincide with equality. They can also be used to add new principles to the theory, which we illustrate by defining a version of CC ω with ad-hoc polymorphism that shows in particular that parametricity is not an implicit requirement of type theory. The correctness of some of the models/program transformations have been checked in the COQ proof assistant and have been instrumented as a COQ plugin.

Introduction

"Can we prove that ∀x. f x = g x → f = g ?", "What is the difference between P ↔ Q and P = Q, when P and Q are two propositions?", "Can we prove that a term of type ∀A. A → A is necessarily the identity function?". Those simple questions are frequently asked to someone who starts teaching the use of a theorem prover based on type theory such as COQ (The COQ Development Team 2015) or AGDA (The AGDA Development Team 2015). However, the definitive answer to those questions is far from being simple as it involves proving the consistency of a type theory augmented with some logical principles or their negation.

Traditionally, given a type theory described as a syntactic object, there are two ways to justify it.

1. The most standard one, coming all the way back from model theory, consists in building a model of it, usually into set theory or a given categorical structure. This amounts formally to translating the syntax into some well-behaved quotient. See e.g. [START_REF] Werner | Sets in types, types in sets[END_REF].

2. The most syntactical one consists in showing some good properties of the syntax, usually strong normalization and subject reduction, so as to derive the desired properties on the type theory.

Each approach suffers from its own set of defects. Models of dependent type theory have been widely studied from a set theoretic point of view (see [START_REF] Hoffman | Syntax and semantics of dependent types[END_REF]) for a general overview), giving rise to several families of models, e.g., categories with families [START_REF] Dybjer | Internal type theory[END_REF], comprehension categories [START_REF] Jacobs | Comprehension categories and the semantics of type dependency[END_REF], . . . But all those models of a type theory are built into some other fundational theory, putting back the burden on the consistency on the latter. This is unavoidable, because of the incompleteness theorem, and may be actually seen as an advantage when targeting such a stresstested theory as set theory. Nonetheless, the discrepancy between the source theory and the target theory can be at the root of subtle but very important mismatches. This is typically seen when considering the decidability of conversion which may hold in the source theory, but is lost as soon as objects are interpreted semantically.

Going the syntactical way is not without issues either, as the proofs are often very tedious, not modular, and keep repeating themselves between close flavours of type theory.

In this paper, we advocate for a third alternative approach, based on a proof-as-program interpretation of type theory, which can somehow be seen as a reconciliation of the two aforementioned kinds of justification.

"To justify a complex type theory, it suffices to compile it into a simpler-already justified-type theory." Essentially, we follow the model approach, but instead of targeting an alien system, we use type theory itself and can thus rely on the consistency of it, proved in a syntactical manner. Furthermore, contrarily to recent models of type theory into itself [START_REF] Chapman | Type theory should eat itself[END_REF][START_REF] Altenkirch | Type theory in type theory using quotient inductive types[END_REF], we do not describe the source theory as a deep embedding in the target one, but rather use a shallow embedding where all source proofs are translated into the target system in a way that preserves most of the structure. This is no more than the dependently typed counterpart of more standard logical translations seen as program translations, e.g. Lafont-Streicher-Reus CPS [START_REF] Lafont | Continuation semantics or expressing implication by negation[END_REF] is the programming language equivalent of some variant of Gödel's double-negation translation. This way, several properties from the target theory are inherited for free, as long as the program transformation preserves conversion of the calculus definitionally and that the empty type ⊥ (encoded here as ΠA : i . A) is translated into some type equivalent to ⊥. This provides a very simple notion of model of type theory, accessible to a broader audience than specialists of category theory and set theory, which can be used to quickly answer if an axiom is derivable.

As said, such translations can not be used directly to prove the consistency of the type theory under consideration, and rely on the consistency of the base type theory itself. But they can rather be used to study some properties of type theory enriched with new principles. This approach is in accordance with the recent work on forcing in type theory [START_REF] Jaber | Extending Type Theory with Forcing[END_REF][START_REF] Jaber | The Definitional Side of the Forcing[END_REF] and parametricity in type theory [START_REF] Bernardy | Parametricity and dependent types[END_REF][START_REF] Bernardy | A computational interpretation of parametricity[END_REF], which can both be seen as particular cases of the general picture described in this paper.

We provide several translations in this paper. They are based on the remark that negative type constructors (e.g., dependent product, coinductive types or universes) are underspecified in type theory-which leaves a lot of freedom on extra intensional specifications. Such translations can be used to derive a new type theory where (the negative part of) independence results can be proven, such as functional extensionality, propositional extensionality, univalence or the fact that bisimulation on a coinductive type may not coincide with equality (that will be called here "stream extensionality").

It has to be noticed that obtaining similar results using set-theoretic models is very tedious. Indeed, although most available models negate univalence, finding a model that negates functional extensionality or propositional extensionality is much more difficult as those principles are hardcoded in set theory. It becomes even harder when it comes to models integrating coinductive types, as such model are based upon the notion of final coalgebra and analysing the connection between bisimilulation and equality in this setting is a very complex task.

Type-theoretic translations can also be used to add new principles to the theory, which we illustrate by defining a version of a type theory with ad-hoc polymorphism (i.e., enriched with the (quote) operator of Lisp) that shows in particular that parametricity is not an implicit requirement of type theory.

The systems we study are built upon CC ω , a type theory featuring only dependent products and a denumarable hierarchy of universes i .

Contributions. There are a handful of program translations in type theory (starting from the subset model of [START_REF] Hofmann | Extensional constructs in intensional type theory[END_REF]), but they are usually not presented as such. This is why we believe that giving a proper account of them is worthwhile, as it permits to exhibit the nice properties of those models, most notably the preservation of computation. We also hope to popularize such a way of building models.

In this paper, we provide the following contributions, which are summarized in Figure 1: • we provide a general approach to defining translations of CC ω into itself by adding more intensional properties to negative types

• we apply it to dependent products to show formally that functional extensionality is not derivable in intensional type theory

• we apply it to coinductive types to show that bisimilarity of streams does not imply in general equality of streams

• we apply it to the universe, by using a presentation à la Tarski, to show that univalence and even propositional extensionality are not derivable in CC ω

• finally, we introduce a more complex interpretation of universes using induction-recursion to equip CC ω with ad-hoc polymorphism and a quote operator Coq Formalization. The correctness of the first three program translations have been checked in the COQ proof assistant and have been instrumented as a COQ plugin. They have been developed using the 8.5 release of COQ (The COQ Development Team 2015) and are available at:

https://github.com/CoqHott/Program-translations-CC-omega

Overview

The systems we study in this paper are built upon CC ω , a type theory featuring only dependent products, also known as Π-types. It features a denumerable hierarchy of universes i , and is a close relative to Luo's ECC [START_REF] Luo | ECC, an extended calculus of constructions[END_REF]). Definition 1 (Typing system). We define two statements mutually recursively as usual. The statement Γ means that the environment Γ is well formed, while Γ M : A means that the term M has type A in environment Γ. The typing rules are given in Figure 2. stands for any i or the impredicative universe * when it is considered.

Before exposing specific translations between type theories, we sketch the general schema followed by those translations. Given two type theories, the source theory S and the target theory T , we require that any term t in S is translated into a term [t] in T by induction over the syntax of t, and that there is an internal operation ι which coerces a translated type into a type of the target type theory. We write [ [A]] for ι [A]. Note that the induced type may live in a bigger universe, we will use this fact in Section 5.2. The context is then translated pointwise as:

[[•]] := • [[Γ, x : A]] := [[Γ]], x : [[A]]
The expected theorem is typing soundness which states that [ [Γ]] [M ] : [ [A]] whenever Γ M : A. This requires in particular to show a form of computational soundness which says that [M ] ≡ [N ] whenever M ≡ N in order to interpret the conversion rule transparently as another conversion. Another expected property of the translation is consistency preservation, saying that the translation of ΠX : i . X is not inhabited. Typing soundness together with consistency preservation ensures consistency of the source theory provided consistency of the target theory.

We argue that this approach is strictly sharper than the various notions of models from the literature. First, the translation is only defined by induction on raw syntax, i.e. it does not depend on any typing assumption and is purely local. Furthermore, preservation of conversion gives a first-class treatment of computation even in an untyped setting. Finally, the target is pure type theory, so that every assumption needed to make the soundness proofs go through has to be internal, meaning that one cannot rely on pushing back sideconditions in the metatheory. We call this approach monistic, in the sense that it only requires type theory as foundations. Although a few instances of models of type theory from the literature can be described in this formalism, most of them cannot, and even those which can are typically not presented this way and rely on an intermediate structure such as categories with families or sets. Examples of models which are syntactical but not program translations include the setoid models of [START_REF] Hofmann | Extensional constructs in intensional type theory[END_REF] and [START_REF] Altenkirch | Extensional equality in intensional type theory[END_REF]. Amongst the few members of our class of models, one can cite the subset type (Paulin-Mohring 1989) and parametricity translations [START_REF] Bernardy | Realizability and Parametricity in Pure Type Systems[END_REF], which are quite similar, as well as the call-by-name forcing translation [START_REF] Jaber | The Definitional Side of the Forcing[END_REF].

The source theory S may contain more type constructors or logical properties than T as long as there is a term in T corresponding to the translation of those new type constructors or logical properties. In practice, S is often T + axiom and the translation ensures that the axiom can be assumed consistently. In this case, we also have a trivial translation from T to T + axiom (the injection) and hence the two theories are equiconsistent. Computational soundness can sometimes be refined so that we can deduce strong normalization for S from strong normalization for T , although we will not describe this here. This is done by analyzing the preservation of reduction steps rather than mere conversion.

In all the translations presented in this paper, we use the fact that inhabitants of negative types can only be partially observed from the outside. For instance, dependent functions can only be observed using application. In the same way, types can only be observed on a right-hand side of a typing judgment, which means that the translation only depends on [ [A]] and is oblivious to any additional data contained in [A].

Figure 1 summarizes how this general scheme can be applied to various extensions of CC ω to give a computational meaning to new principles available in those extensions. Those translations are presented in this paper, but for parametricity (already described in (Bernardy and Moulin

Γ M : B Γ A : Γ A ≡ B Γ M : A (λx : A. M ) N ≡ M {x := N } (congruence rules ommitted) Figure 2. Typing rules of CC ω
pre-order of natural numbers. Those translations can be composed to add different principles together.

Extensions. Depending on the translation, we will use various extensions of the base CC ω system, and we will refer to them explicitely when needed. Those extensions are summarized in Figure 3. They feature an impredicative sort * , as it exists in COQ, that will be used to distinguish between propositional extensionality and univalence. To reason about equality in CC ω , we use Martin-Löf identity type, that is typed in i (but it could be typed in * as in COQ). We may need booleans and negative pairs, also known as Σ-types, with projections 1 and, in one case, surjective pairing.

Plan of the paper. In Section 3, we give a first translation that acts on dependent products in order to realize the negation of functional extensionality. This shows for instance that this principle is not provable in CC ω . In Section 4, we show that a similar translation can be done on streams in order to negate the principle of stream extensionality. In Section 5, we provide two translations, one that negates univalence and even propositional extensionality and one that introduces a notion of ad-hoc polymorhism in the form of a (quote) operator à la Lisp. In Section 6, we show how some translations have been formalized in the COQ proof assistant and describe the COQ plugins that implement those translations.

Intensional Functions

In this section, we present a translation that augments every dependent function with a boolean value that cannot be seen externally as the only way to observe a function is by applying it, which forgets about the boolean value. In this translation, every function coming from a translated term of CC ω will be equipped with the value true.

1 We do not use a more general form of dependent elimination to simplify the theoretical development in this paper.

Definition 2. The intensional function translation [•] f from CC ω to CC ω + Σ + B is defined by induction on terms as follows.

[

i] f := i [x] f := x [λx : A. M ] f := (λx : [[A]] f . [M ] f , true) [M N ] f := π1 [M ] f [N ] f [Πx : A. B] f := (Πx : [[A]] f . [[B]] f ) × B [[A]] f := [A] f
Note that [ [A]] f := [A] f , which means that for this translation, ι f is the identity function, which is possible because

[ i ] f := i .
Proposition 3 (Substitution lemma). For all terms M , N and any variable x we have

[M {x := N }] f ≡ [M ] f {x := [N ] f } Proof. By induction on M .
Using the substitution lemma, it is not difficult to derive the two main properties of the translation.

Theorem 4 (Computational soundness).

If M ≡ N then [M ] f ≡ [N ] f .
Proof. The only non-trivial case is the β-reduction rule, which is proved by the following rewriting steps. This translation can account for various extensions of CC ω in a straightforward fashion. For instance, we can interpret inductive datatypes functorially, even though we will not describe it here. In the end of this section, we assume we have at our disposal equality.

[(λx : A. M ) N ] f := π1 ((λx : [[A]] f . [M ] f ), true) [N ] f ≡ (λx : [[A]] f . [M ] f ) [N ] f ≡ [M ] f {x := [N ] f } ≡ [M {x := N }] f Γ e : t =A
Theorem 6 (Consistency preservation). The translation preserves consistency.

Proof. Indeed, we have

[[ΠA : i. A]] f := (ΠA : i. A) × B
which is inhabited if and only if ΠA : i . A is.

While being quite simple, this syntactical model already implements strictly more than just CC ω . Thanks to the additional boolean worn by functions, it becomes possible to discriminate between two functions which are extensionally equal, thus negating functional extensionality. For the rest of this section we add identity types (Figure 3) in source and target theories. The translation extends directly by functoriality.

[stream A] s := stream [[A]] s × B [hd M ] s := hd (π1 [M ] s ) [tl M ] s := (tl (π1 [M ] s ), π2 [M ] s ) [stream_corec S M0 M1 N ] s := (stream_corec [S] s [M0] s [M1] s [N ] s , true) [bisim A M N ] s := bisim [[A]] s (π1 [M ] s ) (π1 [N ] s ) [hdb M ] s := hdb [M ] s [tlb M ] s := tlb [M ] s [bisim_corec S M0 M1 P0 P1 N ] s := bisim_corec (λs0 s1. [S] s (s0, (π2 [P0] s )) (s1, (π2 [P1] s ))) (λs0 s1 s. [M0] s (s0, (π2 [P0] s )) (s1, (π2 [P1] s )) s) (λs0 s1 s. [M1] s (s0, (π2 [P0] s )) (s1, (π2 [P1] s )) s) (π1 [P0] s ) (π1 [P1] s ) [N ] s [. . . ] s := . . . [[A]] s := [A] s
Theorem 7. We define functional extensionality funext as follows.

funext := Π(A : ) (B : ) (f g : A → B).

(Πx : A. f x =B g x) → f =A→B g
Then there is, in the target system, a closed proof of

[[funext → ⊥]] f .
Proof. It is sufficient to instantiate in the premise A and B by some arbitrary type X and f and g respectively by (λx : X. x, true) and (λx : X. x, false). This immediately leads to a proof that true = false by injection and thus a contradiction.

Almost every model of CC ω , if not all, validates funext, so it is consistent with CC ω . The previous theorem shows that it is not provable in CC ω .

Corollary 8. funext is independent from CC ω .

It is possible to define a similar translation by adding the boolean value "inside" the function [Πx :

A. B] f := Πx : [[A]] f . [[B]] f × B.
This translation is very similar so we do not present it in detail.

Intensional Coinductive Types

We now enrich our source theory with coinductive datatypes, and by using a translation similar to the one of intensional functions, we obtain in a straightforward way a variant for intensional streams. Using intensional streams, it is possible to prove that stream extensionality (the fact that bisimilarity coincides with equality for streams) is not provable in CC ω .

Streams. We assume that our source and target theory are equipped with a type of streams and a relation of bisimilarity, defined in Figure 5. Given a stream M , it is possible to get its first element (or head) by using the destructor hd M and to get its tail by using the destructor tl M . The only way to create a stream is by coinduction2 using the constructor stream_corec which produces, for any type S, a map from S to stream A given a map S → A and a map S → S. Bisimilarity of streams is defined similarly.

The translation for intensional streams works by adding a boolean value to every stream, throwing it away when accessing the head, and threading it when accessing the tail.

Definition 9. The intensional stream translation [•] s from CC ω + stream into CC ω + Σ + B + stream is defined by induction on terms as defined in Figure 4, where unspecified cases are defined by commutation of the translation with the corresponding syntax constructor.

The properties satisfied by [•] s are the same as for intensional functions, the proof arguments being similar.

Theorem 10 (Typing soundness). Assuming definitional surjective pairing in the target, if Γ M : A then [ [Γ]] s [M ] s : [ [A]] s .

Proof. Essentially the same as for the functional case. Conversion is once again interpreted as conversion, as the substitution lemma is trivial. We only need surjective pairing in order to show that [N ] s is well-typed in the interpretation of bisim_corec, otherwise all rules are straightforward.

Remark 11. The requirement of surjective pairing can be lifted by defining a new dedicated coinductive type in the target system. We choose instead to reuse the same notion of bisimilarity for the sake of conceptual simplicity at the expense of a stronger requirement on the target system.

Even more directly than for dependent functions, falsity is translated into itself because the translation does not act on dependent products, so that we can derive consistency preservation directly.

Theorem 12 (Consistency preservation). The translation preserves consistency.

As coinductive types are negatives types, the only way to observe them is by using their destructors, which for the case of streams amounts to observing only the head and the tail of a stream (coinductively). Thus, intensional streams allow to

Γ tl M : stream A Γ M : bisim A N1 N2 Γ hdb M : hd N1 =A hd N2 Γ M : bisim A N1 N2 Γ tlb M : bisim A (tl N1) (tl N2) hd (stream_corec S M0 M1 N ) ≡ M0 N tl (stream_corec S M0 M1 N ) ≡ stream_corec S M0 M1 (M1 N ) hdb (bisim_corec S M0 M1 P0 P1 N ) ≡ M0 P0 P1 N tlb (bisim_corec S M0 M1 P0 P1 N ) ≡ bisim_corec S M0 M1 (tl P0) (tl P1) (M1 P0 P1 N ) Figure 5.
Coinductive types negate stream extensionality by comparing two streams that share the same elements, but differ on the additional boolean value. As previous, the translation extends to identity types and we have:

Theorem 13. We define stream extensionality streamext as follows.

streamext := Π(A : ) (s 1 s 2 : stream A). bisim A s 1 s 2 → s 1 = stream A s 2
Then there is in the target system a closed proof of

[[streamext → ⊥]] s .
Proof. Once again, as in the functional case, intensional equality observes the boolean in the translated streams but bisimilarity does not.

Intensional Types

In this section, we exploit the underspecification of types in CC ω to give more content to types. Our first translation builds upon the • × B trick we used in the previous sections, but our second translation is much more subtle as it allows to implement ad-hoc polymorphism in vanilla type theory.

Ad-hoc intensional types

We define here a translation giving a very naive intensional content to types. Just as we did in the function case, we enrich every type with a boolean which is not observable in the source theory, except for intensional equality.

Definition 14. The ad-hoc intensional type translation [•] t from CC ω to CC ω + Σ + B is defined by induction on terms as follows.

[ i] t := ( i × B, true)

[x] t := x [λx : A. M ] t := λx : [[A]] t . [M ] t [M N ] t := [M ] t [N ] t [Πx : A. B] t := (Πx : [[A]] t . [[B]] t , true) [[A]] t := π1 [A] t
As in previous sections, the translation verifies the substitution lemma and computational soundness, from which we derive:

Theorem 15 (Typing soundness). If Γ M : A then [[Γ]] t [M ] t : [[A]] t .
Proof. By induction on the typing derivation of Γ M : A. The only interesting cases are the two rules for type constructors. 1. Case i : j . Direct from the fact that

( i × B, true) : j × B
2. Case Πx : A. B : j . Direct from the fact that

(Πx : [[A]] t . [[B]] t , true) : i × B
Theorem 16 (Consistency preservation). The translation preserves consistency.

Proof. This comes immediately from the fact that

[[ΠA : i . A]] t := ΠA : i × B. π 1 A
which is inhabited if and only if ΠA : i . A is Proposition 17. The above translation can easily accomodate the presence of an impredicative universe * as long as there is one in the target system, by defining

[ * ] t := ( * × B, true).
The rules for an impredicative universe from Figure 3 are valid with this interpretation.

More generally, the translation can be extended to any type former Φ which is not a universe by defining

[Φ (M 1 , . . . , M n )] t := (Φ ([M 1 ] t , . . . , [M n ] t ), true).
In the remainder of this section, we assume that we have an equality and an empty type and their translations at hand. Theorem 18. We define propositional extensionality as:

propext := Π(A B : * ). (A → B) → (B → A) → A = * B.
There is in the target system a proof of

[[propext → ⊥]] t .
Proof. Just as in the functional extensionality proof, it is sufficient to take A and B to be the same underlying proposition X, but with a different boolean.

Using the validity of propositional extensionality in the set model [START_REF] Werner | Sets in types, types in sets[END_REF], we get the independence of propositional extensionality with CC ω .

In the same way, it is possible that the negation of univalence holds in the source theory. Using the validity of univalence in the simplicial model of [START_REF] Kapulkin | The simplicial model of univalent foundations[END_REF], we conclude that univalence is independent from CC ω .

Ad-hoc polymorphism

In this section, we push the concept of type intensionality into its utmost consequencies, namely by showing that there exists a syntactic model of type theory interpreting a quoting operator on types. Such an operator allows to do case-analysis on the normal form of any type in the theory, which proves that ad-hoc polymorphism is actually compatible with usual type theory. Although this result looks surprising, the model is actually quite straightfoward to obtain as soon as the target theory is expressive enough.

We will assume here that our target theory features induction-recursion, and we will use it to define the type of codes (as in [START_REF] Dybjer | A general formulation of simultaneous inductiverecursive definitions in type theory[END_REF]).

Definition 19 (Codes). We define a family of inductiverecursive definitions TYPE i and Elt i where i ranges over N as follows, using a suggestive syntax. . . .

Inductive TYPEi+1 : i+2 := | Ui : TYPEi+1 | Π 0 i+1 : ΠA : TYPE0. (Elt0 A → TYPEi+1) → TYPEi+1 | . . . : . . . | Π i+1 i+1 : ΠA : TYPEi+1. (Elti+1 A → TYPEi+1) → TYPEi+1 with Elti+1 : TYPEi+1 → i+1 := fun | Ui ⇒ TYPEi | Π 0 i+1 A B ⇒ Πx : Elt0 A. Elti+1 (B x) | . . . ⇒ . . . | Π i+1 i+1 A B ⇒ Πx : Elti+1 A. Elti+1 (B x)
The typing and reduction rules generated by these definitions are formally given in Figure 6. These inductiverecursive types respect the usual positivity conditions and thus do not endanger the consistency of the target system.

There are several points to discuss about codes. First, the definition of codes makes a closed-world assumption on the type constructors from the source theory. Furthermore, as codes reflect faithfully the various operations at our disposal in the source theory, we actually need to hardwire the universe hierarchy in the inductive-recursive definitions by externally quantifying over the index i ∈ N. In order not to make the translation even more complex as it is, we simplify a bit the authorized type formers to prevent a combinatorial explosion. Most notably, the codes for product must be duplicated as many times as there are valid combinations of sorts for it.

It is interesting to remark that the resulting model suffers from an expressivity limitation directly linked to the inductive-recursive construction, that is, it cannot interpret an impredicative universe. This would obviously entail a non-wellfounded loop in the definition of codes, because * : 0 but all quantifications targetting * would have to refer to every TYPE i defined afterwards.

In order to define the translation, we need to know the universe level at which a term is being typed at each inductive step. Therefore, we will use as a source system CC ι ω , a variant of CC ω which is slightly less expressive but well stratified, defined in Figure 7. It would probably be possible to adapt the translation to the full-blown CC ω system, at the cost of a more involved translation. Essentially, the main difference is that we annotate both the sequent and the variables from the context with the level of their expected sort. We will omit the indices when they are uniquely defined from the context.

Proposition 20. CC ι ω is a subsystem of CC ω . Γ M :i B Γ A :i+1 i A ≡ B Γ M :i A (λx :i A. M ) i N ≡ M {x := N } (congruence rules ommitted) Figure 7. Typing rules of CC ι ω
Contrarily to previous translations, this translation needs to be indexed by the universe level. This is because the code for dependent products is not polymorphic in the universe level, which must thus be inserted explicitly during the translation. Therefore, the index is here to keep track of the current universe level.

Definition 21. The ad-hoc polymorphism translation [•] T i∈N from CC ι ω to CC ω + TYPE i∈N is defined by induction on terms as follows.

In general, Π j i may not be defined so that we arbitrarily fix Π j i := Π 0 i whenever i < j. Note that the context translation is not indexed, as the corresponding level is hardcoded in each variable from the context.

Proposition 22 (Substitution lemma). For all terms M , N and any variable x s.t. Γ, x : i A, ∆ M : j B, we have

[M {x := N }] Tj ≡ [M ] Tj {x := [N ] Ti }
Proof. By induction on the typing derivation of M . Actually, we need a much weaker condition than typing on M for the theorem to hold, which amounts to checking that variables are used at the correct universe level in the axiom case.

Theorem 23 (Typing soundness).

If Γ M : i A then [[Γ]] T [M ] Ti : [[A]] Ti .
Proof. By induction on the typing derivation of M . Conversion is interpreted by conversion itself, thanks to the substitution lemma, and the other rules are staightforward.

Remark 24. When the source theory only features Π-types and universes, it is not clear whether the translation preserves consistency. Indeed, we have

[[ΠA : i i . A]] Ti ≡ ΠA : TYPE i . Elt i A
but then there is no obvious closed code A made out of Π-types and universes to give to a term of the above type in order to recover an inconsistency. For instance, trying to feed it with the code of the impredicative encoding of falsity simply gives back the same type. This phenomenon does not occur as soon as the source theory features an empty type ⊥, reflected in the codes as F i s.t. Elt i F i ≡ ⊥. In this case, we can instantiate a proof of the above type with F i and we obtain immediately a proof of the empty type.

Theorem 25 (Consistency preservation). If the source theory features an empty type ⊥, the ad-hoc polymorphic translation preserves consistency.

We now turn to show that this translation allows to fully observe the normal form of types by doing case analysis on any term A : i . We define formally what we mean by this under the notion of type quoting below.

Definition 26 (Type quoting). A type quoting operator is given in CC ι ω by the data described in Figure 8.

Theorem 27 (Type Quote). The [•] Ti translation gives a computational content to type quoting.

Proof. As all types are represented by codes, the various quote operators are simply defined in terms of the TYPE_rec operators.

[quote i P M ] Ti+1 := TYPE_rec i (λA :

TYPE i . Elt i ([P ] Ti+2 A)) [ M ] Ti+1
Preservation of typing and reduction is straightfoward, as everything has been done to obtain this property.

The type operator can be used to define non-parametric functions. For example, it becomes possible to prove Σf : (ΠA : . A → A). f = ΠA: . A→A id → ⊥ by simply passing a function that is the negation on B and the identity on other types. This shows that parametricity is not built-in in CC ω .

Formalization and Instrumentation

This section presents the framework for the COQ formalization of some of the translations. We then describe the instrumentation of such translations as a COQ plugin.

Deep Embedding using De Bruijn Indices

We rely on the formalization of Pure Type Systems (PTS) given by Siles and Herbelin [START_REF] Siles | Pure type systems conversion is always typable[END_REF]. It consists in first defining untyped terms and then defining the conversion and typing rules. Note that we could have also used another approach based on induction-recursion that defines directly well-typed terms as in the recent work of Altenkirch and Kaposi [START_REF] Altenkirch | Type theory in type theory using quotient inductive types[END_REF]. However, it appears that this approach is a bit too rigid as it forbids to use an untyped term during the translation, making the translation very difficult to define in practice.

Terms are defined by an inductive type, where variables are represented using De Bruijn indices and Sorts is an inductive type representing the sorts (either i or i and * ). The substitution of the n-th De Bruijn variable by N in M is defined by recursion on M. We write it M [n → N]. Conversion in the calculus, written M ≡ N, is defined as the reflexive, symmetric and transitive closure of the beta reduction, defined as an inductive family. The type system is defined by mutual induction with the well-formedness of contexts as In the additional materials accompanying this paper3 , we have formalized the intensional functions translation, the intensional streams translation4 and ad-hoc intensional types translation. In each case, computational soundness, typing soundness and consistency preservation have been checked.

Instrumentation as a COQ Plugin

It is quite commonly agreed upon that type theory can be difficult to work with formally, which is why proof assistants were implemented in the first place. In particular, it is not very convenient to prove new logical or computational principles directly through the paper translation, let alone in the deep embedding formalization. Luckily, our translations rely on a rather generic target theory, so that we can use the one underlying the COQ proof assistant. This is where plugins shine in. A COQ plugin is simply a program that, given a COQ proof term M , produces the translation [M ] as another COQ term. This is a shallow embedding, and this process is orthogonal to the COQ formalization which uses deep embedding instead. Typically, the fact that [M ] is still well-typed relies on the soudness theorem that lives in the metatheory rather than in the object theory.

While there is no real point in implementing model translations in any formal foundations such as e.g. set theory, here, the fact that we have an actual proof assistant at hand makes the plugin quite useful. It allows to give the impression to the user that she is working transparently in the source theory, while it turns out everything is translated into the target theory on the fly. In particular, typechecking remains decidable by construction, and one can take advantage of all of the facilities provided by the host language. This effectively prevents the necessity to reimplement a standalone proof assistant for the source theory.

Writing a plugin can be cumbersome, for two unrelated reasons. One has to know the internals of the COQ system, which strongly restricts the amount of people able to do it. Furthermore, a distinct term-translating program must be written for every translation one wishes to internalize, which implies that each translation requires a distinct plugin. For instance, the forcing plugin described in [START_REF] Jaber | The Definitional Side of the Forcing[END_REF]) is quite different from the ones we implemented for this paper. As of today, there is no such thing as a meta-plugin that would allow to quickly prototype a term translation in COQ. Remark 28. The type theory implemented by COQ and the various extensions of CC ω are slightly different, leading to small discrepancies between the previously described translations and their actual instrumentation as a plugin. First, parameters do not appear in dependent pairs from the PTS presentation, while they do in COQ. Second, and more importantly, the management of universes in COQ is more complex as it deals with universe variables and a graph of constraints.

In the remaining of this section, we describe the commands provided by a plugin. First, any COQ term also pertaining to the source theory can be translated into the target theory automatically. Assuming some constant c : A, the plugin command Translate c.

produces a new constant c f : [ [A]] that is added to the current environment and whose body is the translation of the body of c.

Moreover, it is possible to add new symbols to the system through a translation. To do so, it is sufficient to provide for any such symbol p : A its translation p • : [ [A]]. This is reflected in the COQ plugin by the command Theoretically, this amounts to considering a typing relation t in the translation layer defined by extending CIC with the axiom Γ t p : A. We easily get that if Γ t M : B then [ [Γ]] [M ] : [[B]] using the typing correctness of the translation, which justifies the abovementioned equiconsistency result.

In practice, the plugin can thus be used to inhabit new axioms. For instance, for the case of the intensional functions translation, we can add the negation of functional extensionality in the translation layer by providing a term

Future Work

As a first step, we wish to improve the plugins which are only prototypes for the moment. This requires generalizing the program transformations presented in this paper to the entire language of COQ-defining it on all inductive types, coinductive types and records. This way, it will be possible to work on the translation layer without restriction and still benefit from the new logical or computional principles available in this layer.

Regarding the type quote operator, an instrumentation as a COQ plugin would require to define induction-recursion in COQ. This is the subject of on-going work and has already been implemented in an experimental branch of COQ 8.5 developed by Matthieu Sozeau (https://github. com/mattam82/coq/tree/IR). However, the extension of the syntactic guard condition from inductive to inductiverecursive definitions is still the subject of ongoing research.

Another possible line of work would be on the development of a generic COQ plugin that allows users to define their own compilation phase with a minimum effort-e.g., by defining only the translation on untyped terms in the deep embedding-and generate automatically the associated plugin for this transformation. This way, it will be possible to experiment the frontier of what is provable in type theory at a low cost investment.

But the most important is the development of more translations in order to realize axioms and logic principles. For instance, we wonder if it is possible to find a presentation of the setoid model as a program translation.

Figure 1 .

 1 Figure 1. Different Translations of CC ω

Figure 3 .

 3 Figure 3. Extensions to CC ω

Figure 4 .

 4 Figure 4. Definition of the intensional stream translation

  TYPE0. (Elt0 A → TYPE0) → TYPE0 with Elt0 : TYPE0 → 0 := fun | Π 0 0 A B ⇒ Πx : Elt0 A. Elt0 (B x)

  Inductive Term : Set := | Var : N → Term | Sort : Sorts → Term | Π : Term → Term → Term | λ : Term → Term → Term | App : Term → Term → Term | Eq : ∀ (A t1 t2 : Term), Term | refl : Term → Term | J : ∀ (A P t1 u t2 p : Term), Term.

  Implement p : A. which opens a new goal of type [[A]]. When it is solved, the resulting term p • is used to automatically extend the translation with a term p : A by defining [p] := p • .

  Implement neg_fun_ext :(∀ A B, (f g : A → B), (∀ x, f x = g x) → f = g) → False.Such a plugin has been defined for the intensional functions translation, the intensional streams translation and adhoc intensional types translation. Code and examples come with this article.

2012)) and for functional reactive programming and forcing which have already been described in[START_REF] Jaber | Extending Type Theory with Forcing[END_REF][START_REF] Jaber | The Definitional Side of the Forcing[END_REF]-the former being a particular case of the latter because stream A N → A corresponds to forcing on the Γ, ∆ ::= • | Γ, x : A A, B, M, N ::= i | x | M N | λx : A. M | Πx : A. B Γ i < j Γ i : j Γ A : i Γ, x : A B : j Γ Πx : A. B : max(i,j) Γ, x : A M : B Γ Πx : A. B : Γ λx : A. M : Πx : A. B Γ M : Πx : A. B Γ N : A Γ M N : B{x := N } Γ M : B Γ A : Γ, x : A M : B • Γ A : Γ, x : A Γ A : Γ, x : A x : A

Theorem 5 (Typing soundness). If Γ M : A then [[Γ]] f[M ] f : [[A]] f . Impredicative Universe A, B, M, N ::= . . . | * Γ Γ * : i Γ A : Γ, x : A B : * Γ Πx : A. B : * Negative Pairs A, B, M, N ::= . . . | Σx : A. B | π1 M | π2 M | (M, N ) Γ A : i Γ, x : A B : j Γ Σx : A. B : max(i,j) Γ M : A Γ N : B{x := M } Γ (M, N ) : Σx : A. B Γ M : Σx : A. B Γ π1 M : A Γ M : Σx : A. B Γ π2 M : B{x := π1 M } π1 (M, N ) ≡ M π2 (M, N ) ≡ N (π1 M , π2 M ) ≡ M Booleans A, B, M, N ::= . . . | B | true | false | if M ret P then N1 else N2 Γ M : B Γ P : B → i Γ N1 : P true Γ N2 : P false Γ if M ret P then N1 else N2 : P M Γ Γ B : i Γ Γ true : B Γ Γ false : B if true ret P then N1 else N2 ≡ N1 if false ret P then N1 else N2 ≡ N2 Equality A, B, M, N ::= . . . | reflx | x =A y | J(P, e, t)Γ Γ A : i Γ t, t : A Γ t =A t : i Γ t : A Γ reflt : t =A t

Coinductive types are defined categorically as terminal coalgebras, so their universal property can be used to construct maps going into them. This corresponds to the coinduction principle.A, B, M, N::= . . . | stream A | hd M | tl M | stream_corec S M0 M1 N | bisim A M N | hdb M | tlb M | bisim_corec S M0 M1 P0 P1 N Γ S : i Γ M0 : S → A Γ M1 : S → S Γ N : S Γ stream_corec S M0 M1 N : stream A Γ S : stream A → stream A → i Γ M0 : T0 Γ M1 : T1 Γ N : S P0 P1 Γ bisim_corec S M0 M1 P0 P1 N : bisim A P0 P1where T0 := Π(s0 s1 : stream A). S s0 s1 → hd s0 =A hd s1 T1 := Π(s0 s1 : stream A). S s0 s1 → S (tl s0) (tl s1)Γ A : i Γ stream A : i Γ A : i Γ M : stream A Γ N : stream A Γ bisim A M N : i Γ M : stream A Γ hd M : A Γ M : stream A

Proof. It is indeed sufficient to erase all level annotations on colons to translate a well-typed CC ι ω term into a well-typed CC ω term.A, B, M, N ::= . . . | TYPEi | Elti | Ui | Π j i | TYPE_rec i Γ Γ TYPEi : i+1 Γ Γ Elti : TYPEi → i Γ Γ Ui : TYPEi+1 Γ j ≤ i Γ Π j

i+1 A B) ≡ pΠ i+1 A B (TYPE_rec i+1 P pU pΠ 0 . . . pΠ i+1 A) (λx : Elti+1 A. TYPE_rec i+1 P pU pΠ 0 . . . pΠ i+1 (B x)) Figure 6. Codes Γ, ∆ ::= • | Γ, x :i A A, B, M, N ::= i | x | Mi N | λx :i A. M | Πx :i A. B Γ Γ i :i+2 i+1 Γ A :j+1 j Γ, x :j A B :i+1 i j ≤ i Γ Πx :j A. B :i+1 i Γ, :i A M :j B Γ Πx :j A. B :i+1 i Γ λx :j A. M :i Πx :j A. B Γ M :i Πx :j A. B Γ N :j A Γ Mj N :i B{x := N } Γ M :j B Γ A :i+1 i Γ, x :i A M :j B • Γ A :i+1 i Γ, x :i A Γ A :i+1 i Γ, x :i A x :i A

Inductive wf : Env → Prop := | wf_nil : nil | wf_cons : ∀ Γ A s, Γ A : Sort s → A::Γ where "Γ " := (wf Γ) with typ : Env → Term → Term → Prop := | cVar : ∀ Γ A v, Γ v → A ↓ v ⊂ Γ → Γ Var v : A

https://github.com/CoqHott/Program-translations-CC-omega

Some bureaucratic lemmas about lifting of De Bruijn indices have been admitted for the type system extended with streams. See Readme.md.

where PΠ i := Π(A : TYPEi) (B :

where The typing soundness of the translation amounts to prove the following theorem by mutual induction.