Raphaël Chiappini
email: raphael.chiappini@u-bordeaux.fr.

Bertrand Groslambert
email: bertrand.groslambert@skema.edu.

Olivier Bruno
email: bruno@gredeg.cnrs.fr.

Bordeaux Economics Working Papers series Liquidity matters when measuring bank output

Keywords: bank output, liquidity premium, risk premium, ARDL, local projections. JEL: E01, E44 bank output, liquidity premium, risk premium, ARDL, local projections JEL Classification: E01, E44

We develop a new method for calculating bank output that addresses the flaws of the current approach of the System of National Accounts. We implement a simple model-free method that removes the "pure" credit risk premium from the production of banks while keeping the liquidity provision as part of the total bank output. Using both local projections and autoregressive distributed lag models, we show that our method produces bank output estimates that are consistent with the evolution of the economic activity and that remain always positive including during periods of financial stress. This method satisfies the four conditions set by the Inter-Secretariat Working Group on National Accounts. Furthermore, our method reveals that the banking output of the eurozone is overestimated by approximately 40 percent over the period 2003-2017.

Introduction

The financial sector has a central place in both developing and developed economies. The share of finance in Gross Domestic Product (GDP) has experienced a continuous growth over the past 60 years as depicted in [START_REF] Philippon | An International Look at the Growth of Modern Finance[END_REF]. For instance, the share of the financial sector in the United States' GDP has risen from less than 4% in 1970 to around 7% in 2005. A similar trend can be observed for the United Kingdom (4% to 7,5%), Canada (4% to 6%) and Japan (5% to 6%). In the European Union, the increase is less pronounced, as we can observe an increase of 3 percentage points for Belgium, 1,5 percentage points for Germany and only 1 percentage point for France during the same period. Among the financial sector, the role of financial intermediaries is important in promoting economic growth [START_REF] Rajan | Financial Dependence and Growth[END_REF]. Indeed, they pool funds, produce information, transfer resources and share risks which directly benefits to both lenders and borrowers [START_REF] Philippon | Has the US finance industry become less efficient? On the theory and measurement of financial intermediation[END_REF]. These services are compensated as they create value added.

Nevertheless, measuring this valued added remains a huge challenge [START_REF] Sakuma | A Note on FISIM[END_REF][START_REF] Hagino | Treatment of risk in the estimation of FISIM[END_REF]. Indeed, the remuneration for these financial intermediation services are not directly charged to the customers. Instead, they come from the spread between interest rates receivable on financial assets and interest rates payable on financial liabilities. They are known in national accounting under the acronym FISIM (financial intermediation services indirectly measured). The problem revolves around the estimation of the reference rate used to estimate the spreads on loans and deposits. During the financial crisis, the production of FISIM as measured by the method of the 2008 System of National Accounts (SNA) grew substantially [START_REF] Akritidis | Financial intermediation services indirectly measured (FISM) in the UK revisited[END_REF]. For instance, the banking value added estimated by the 2008 SNA has increased by 21% in Germany and 63% in France between 2007 and 2010 1 . This estimation has been considered implausible by most national accountants [START_REF] Davies | The measurement of financial services in the national accounts and the financial crisis[END_REF], and made this issue even more acute. Since then, an intense debate has flourished to provide a more accurate method to estimate bank output [START_REF] Zieschang | FISIM Accounting. CEPA Working Papers Series WP012016[END_REF]. With no clear consensus emerging, the Task Force of the Inter-Secretariat Working Group on National Accounts (ISWGNA, 2013, p. 5) recommended 1 According to Eurostat data.

that: "research continues in this area [...] to develop methods and data that can support estimation in the future".

On one side of the debate, scholars such as [START_REF] Diewert | Problems with the measurement of banking services in a national accounting framework[END_REF], [START_REF] Diewert | The treatment of financial transactions in the SNA: A user cost approach[END_REF], [START_REF] Zieschang | FISIM Accounting. CEPA Working Papers Series WP012016[END_REF] and Fixler and Zieschang (2019) favour a reference rate specific to each bank and based on the bank's cost of capital. Using this type of reference rates implies that the value added of banks contains some elements of risk remuneration. However, critics of this approach contend that compensation for assuming credit default risk should not be part of the banks' value added. On the other side, [START_REF] Wang | A General Equilibrium Asset-Pricing Approach to the Measurement of Nominal and Real Bank Output[END_REF], [START_REF] Basu | The value of risk: measuring the service output of US commercial banks[END_REF] and [START_REF] Colangelo | Bank output measurement in the euro area: a modified approach[END_REF] advocate using a series of reference rates specific to the risk and maturity of each type of deposit and loan instruments. This alternative approach has the merit of removing the credit risk-related remuneration from the banking output but has the disadvantage of eliminating all liquidity-related services from the SNA account, which goes against the consensus reached by the community [START_REF] Iswgna | Task Force on FISIM[END_REF].

Borrowing from both sides of the debate, we introduce a new method that excludes the compensation for bearing credit risk in the spirit of [START_REF] Wang | A General Equilibrium Asset-Pricing Approach to the Measurement of Nominal and Real Bank Output[END_REF] and [START_REF] Colangelo | Bank output measurement in the euro area: a modified approach[END_REF], but also includes the liquidity transformation services as advocated by Fixler and Zieschang (2019) and recommended by the United Nations Statistics Division (2014).

The impact of illiquidity on the price of bonds and on credit spread is well documented. For example, using several alternative liquidity measures proposed in the literature, [START_REF] Friewald | Illiquidity or credit deterioration: A study of liquidity in the US corporate bond market during financial crises[END_REF] found that liquidity proxies account for approximately 14 percent of the explained time-series variation of the yield spread changes over time for individual bonds. These results, which [START_REF] Bao | The illiquidity of corporate bonds[END_REF] confirm, underline that in times of financial stress, liquidity effects are the dominant driver of credit spread and take over the credit risk component. On the contrary, quantitative easing measures have reduced the liquidity premia and indirectly credit risk after the financial crisis as depicted by [START_REF] Wong | Liquidity and credit risks in the UK's financial crisis: how 'quantitative easing' changed the relationship[END_REF] for the U.K. However, these liquidity effects on the value of credit spread do not reflect the fundamental level of credit risk. They are due to financial market microstructure or to portfolio reallocation during period of stress.

In this paper, we propose a new way to measure bank output based on a simple model-free method that removes the "pure" credit risk premium from the production of banks while keeping the liquidity provision as part of the total bank output. We use the spread between the yields of Kreditanstalt für Wiederaufbau (KfW) governmentguaranteed agency bonds and German government bonds to estimate the liquidity premium over the term structure in the euro area. Then, we compute the adjusted liquidityfree reference rate for each maturity, and we use this new reference rate to estimate banking output of the eurozone during the period 2003-2017. We assess the performance of our method using the four criteria established by the ISWGNA (2013) (p. 20, §49) for producing reasonable reference rates and sensible FISIM:

1. Strong connection to underlying economic conditions as measured by volatility.

2. No sustained periods of negative FISIM.

3. Sensible changes in FISIM near economic turning points.

Data is observable.

We compare the new method with (1) the current 2008 SNA and (2) the full risk premia-excluded method (based on [START_REF] Colangelo | Bank output measurement in the euro area: a modified approach[END_REF]'s method) and find that it is the only one that satisfies all four ISWGNA criteria. Indeed, using both local projections (LP) and autoregressive distributed lag (ARDL) models, we show that our method and the full risk premia-excluded method fulfil the first and third criteria, contrary to the current 2008 SNA method. On the second criteria, only our method and the current 2008 SNA method do not generate sustained periods of negative FISIM. Finally, regarding the fourth criteria, we show that we can find data to replicate the new method at the international level in Japan, the United Kingdom and the United States.

The main contribution of this paper is to provide a method that remains within the framework of the 2008 SNA, and that produces coherent and stable banking output even during periods of financial stress, including during times of volatile movements in reference rates and when liquidity markets are dysfunctional. The method eliminates the occurrence of negative outputs and generates reliable output estimates. It improves the consistency of the current 2008 SNA, without requiring any drastic change in its architecture. Furthermore, the method relies on an opportunity cost approach to funds following the ISWGNA recommendations. It allows keeping the term premium and the remuneration linked to liquidity services and satisfies the four ISWGNA criteria. Putting the new method to work, we also show that the banking output estimate in the eurozone, over the period 2003-2017, is, on average, 46 percent lower than the current method predicts and 22 percent higher than the approach that adjusts for default risk premium only states.

Therefore, this research adds to the literature on the measurement of the financial intermediation services starting with [START_REF] Fixler | Measuring financial service output and prices in commercial banking[END_REF] and [START_REF] Fixler | The productivity of the banking sector: Integrating financial and production approaches to measuring financial service output[END_REF] and followed by [START_REF] Basu | The value of risk: measuring the service output of US commercial banks[END_REF] and [START_REF] Inklaar | Real output of bank services: what counts is what banks do, not what they own[END_REF]. This study also relates to the stream of research examining the size and efficiency of the banking industry including [START_REF] Greenwood | The growth of finance[END_REF], [START_REF] Philippon | Has the US finance industry become less efficient? On the theory and measurement of financial intermediation[END_REF] and [START_REF] Bazot | Financial consumption and the cost of finance: Measuring financial efficiency in Europe (1950-2007)[END_REF].

The remainder of the paper is organized as follows: Section 2 presents the database and the new method we propose to estimate bank output. Section 3 describes our main results, and Section 4 concludes.

Data and Methodology

The current 2008 SNA method uses a single reference rate, r f , which is determined according national circumstances, usually an interbank rate. Then, it computes the total indirectly measured banking output (FISIM) as the sum between the FISIM on deposits and the FISIM on loans. FISIM on deposits are calculated as the difference between the reference rate, r f , and the rate actually paid to depositors, r D , multiplied by the amount of deposits. FISIM on loans are given by the difference between the rate paid to banks by borrowers, r L , and the reference rate, r f , multiplied by the amounts of loans.

F ISIM = (r f -r D ) × Deposits + (r L -r f ) × Loans (1)
We basically follow the same approach as the 2008 SNA except that we chose different reference rates in lieu of a single r f . We use the data provided by the ECB Statistical Data Warehouse for series on loans and deposits.

Deposits

ISWGNA (2013) concluded that liquidity transformation services are part of the banking output, and it found that the current method for computing FISIM on deposits is correct and does not require any changes. Consequently, we follow the 2008 SNA and keep a single reference rate that reflects the average of short-term interbank lending rates (Euribor).

To determine the FISIM on deposits, we need the outstanding amounts and outstanding amount rates for each of the sectors, categories and maturities of deposits as described in Table 1.

Loans -Credit Risk

Considering risk-bearing as a non-productive activity, we aim to remove any risk remuneration from the banking output. In a first step, we calculate a series of reference rates, including the risk of default and any term premium in the spirit of [START_REF] Wang | A General Equilibrium Asset-Pricing Approach to the Measurement of Nominal and Real Bank Output[END_REF], [START_REF] Basu | The value of risk: measuring the service output of US commercial banks[END_REF] and [START_REF] Colangelo | Bank output measurement in the euro area: a modified approach[END_REF]. We do so for each institutional sector, each type of loan and each maturity. Using the European Central Bank (ECB) database enables us to categorize the statistical series presented in Table 2. For each type of loan, we need the quantity and the price of the financial intermediation services.

The quantity of financial intermediation generated by banks over the duration of loans depends on the nature of the financial services provided. Some services, such as screening, are performed only once at the initiation of the deal; other services occur regularly until termination of the contract. This suggests using the outstanding amounts of loans and deposits rather than the amounts of new business as a measure of quantity of loans. We retain the former approach, which also corresponds to the 2008 SNA method.

The price of the financial intermediation services is represented by the margins on loans, which corresponds to the spreads between some reference rates and the actual interest rates on loans. For the actual interest rate, it is necessary to choose between "new business" rates and "outstanding amount" rates. Because the spread between the reference rate and the actual interest rate applies to the stock of loans in the relevant instrument category, the SNA proposes using the outstanding amount rates. We follow this recommendation.

For each type of loan, a corresponding reference rate is selected from the same systematic risk and maturity profiles. Then we need to find a corresponding bond index for which systematic risk is as close as possible to each type of bonds. For non-financial corporations, we use the iBoxx € non-financials. This index comprises 1000 firms and is split by maturities 1 to 3 years, 3 to 5 years, 5 to 7 years, 7 to 10 years and more than 10 years. For households and NPISH, there are no such comparable bond indices, because they do not raise money directly from the markets. However, we can estimate their risk by assessing the covered bond rates. The latter are issued by financial institutions and backed by mortgage loans to pay interests on the covered bonds. The interests paid by households are passed on to the covered bond investors. The iBoxx € Covered tracks the evolution of this market. It comprises approximately 700 bonds split along the maturities 1 to 3 years, 3 to 5 years, 5 to 7 years, 7 to 10 years and more than 10 years. We retain this index for measuring the households and NPISH systematic risk. This gives us for each type of loan i of maturity t a market reference rate r M it based on the yields on market securities with the same systematic risk. In opposition to the single reference rate currently used in the 2008 SNA, this rate reflects the credit default risk and allows removing the remuneration related to the credit risk premium from the banking output, as recommended by the Task Force of the ISWGNA (2013, p. 22, §60).

r M it =      Corporate bond index it if non -f inancial corporations Covered bond index it if households N P ISH

Loans -Liquidity Risk

In a second step, we estimate the liquidity risk premium, which we subtract from the reference rates r M it calculated previously. The liquidity risk reflects the potential difficulty that may be encountered when buying or selling an asset due to the deterioration of trading conditions. This risk has been studied by [START_REF] Brunnermeier | Deciphering the liquidity and credit crunch 2007-2008[END_REF] and [START_REF] Acharya | A model of liquidity hoarding and term premia in inter-bank markets[END_REF], and its importance was highlighted during the financial crisis [START_REF] Gianfelice | A liquidity risk index as a regulatory tool for systemically important banks? An empirical assessment across two financial crises[END_REF]. The ISWGNA (2013) concluded that the liquidity transformation services should be part of the banking output therefore, the reference rate must be free of any liquidity risk and we need to adjust the market reference rate by removing the liquidity premium. To do so, in the spirit of [START_REF] Amihud | Liquidity, maturity, and the yields on US Treasury securities[END_REF] and [START_REF] Warga | Bond returns, liquidity, and missing data[END_REF], we follow the literature that decomposes yields into liquidity and credit risk and computes the liquidity premium as the spread between bonds with the same credit quality but with different liquidity.

We implement a model-free measure of market liquidity, directly calculated from asset prices, and borrow the methodology from [START_REF] Longstaff | The Flight-to-Liquidity Premium in US Treasury Bond Prices[END_REF]. Longstaff extracts the yield differential between U.S. Treasury bonds and same maturity bonds issued by RefCorp (Resolution Funding Corporation), which is a U.S. government agency, guaranteed by the U.S. Treasury. [START_REF] Ejsing | Liquidity and credit premia in the yields of highly-rated sovereign bonds[END_REF] and Schwarz (2019) adopted a similar approach for the euro area, and this is the path that we follow. More specifically, we examine the yields of highly liquid German government bonds and some less liquid German governmentguaranteed agency bonds, namely the KfW agency bonds. KfW bonds are fully and explicitly guaranteed by the government and have the same credit risk as the German government bonds, they also have the same tax treatment.

Schestag et al. ( 2016) evaluated a comprehensive list of measures of liquidity and found that most of them perform well. [START_REF] Monfort | Decomposing euro-area sovereign spreads: credit and liquidity risks[END_REF] proposed an alternative method to that of [START_REF] Longstaff | The Flight-to-Liquidity Premium in US Treasury Bond Prices[END_REF] From these baskets, we create generic historical series of 1-year up to 15-year maturity.

As the maturities do not match perfectly, we need to interpolate the yield curves, and we use the [START_REF] Svensson | Estimating and interpreting forward interest rates: Sweden 1992[END_REF] method for recovering monthly yield curves of each issuer. Then we subtract the yields on KfW bonds from the yields on German government bonds with corresponding maturities and find the liquidity premium for each maturity t ranging from 1 year to 15 years.

Liquidity premium t = Y ield Agency t -Y ield governement t (2)
Next, we compute the adjusted liquidity-free reference rate:

r M * it = r M it -Liquidity P remium t (3)
We calculate the liquidity premium as the spread between bond yields of the same credit quality but of different liquidity. [START_REF] Schwarz | Mind the gap: Disentangling credit and liquidity in risk spreads[END_REF] and [START_REF] Monfort | Decomposing euro-area sovereign spreads: credit and liquidity risks[END_REF] established the existence of a commonality in market liquidity in the cross-section of countries, implying that the KfW liquidity premium carries European-wide liquidity-pricing effects. For example, Figure 1 From that date, it rises again but remains well below the level reached during the subprime and euro crisis, and fluctuates around 0.2 percent. In Figure 2, we take the spread between the 6-year French and German government bonds as a crude measure of the financial crisis intensity, and find a strong correlation between the evolution of the liquidity premium and the crisis intensity. Our measure of liquidity premium reflects the flight to quality that occurs in times of crisis when investors prefer to hold highly liquid securities and widen the spread between assets of same credit quality.

Empirical methods to investigate the link between FISIM and macroeconomic conditions

To test the relevance of the different methods with regard to the first and third ISWGNA criteria, we adopt two different tests.

On the short run. First, we investigate the short-run relationship between estimated FISIM and economic cycle of the euro area, proxied by its Gross Domestic Product (GDP)

or the Economic Sentiment Index (ESI) of the area. For that, we rely on the general method proposed by [START_REF] Jordà | Estimation and Inference of Impulse Responses by Local Projections[END_REF] and [START_REF] Jordà | Simultaneous Confidence Regions for Impulse Responses[END_REF] to estimate impulse response functions (IRF) from local projections. Indeed, this method is robust to the misspecification representation of the data generating process (DGP), which is not represented by a VAR.

This method does not impose any underlying dynamics on the variables in the system, contrary to VAR models. In its basic form, local projection consists of a sequence of regressions of the endogenous variable shifted several steps ahead. As a result, the approach consists in estimating the following equation:

∆ h Y t+h = β h EC t + ϵ h t (4)
where ∆ h Y t+h = Y t+h -Y t-1 and corresponds to the log change in the FISIM estimated from base quarter t up to quarter t + h, using the different methods3 , and EC t is the measure of the euro area economic cycle (euro area GDP or euro area ESI) at time t.

Each step of the accumulated IRF is obtained from a different equation and directly corresponds to the estimates of β h .

On the long-run. In a second step, we run a cointegration analysis to test the longterm relationship between the computed FISIM and the economic cycle (first criterion) but also the adjustment speed towards this equilibrium relationship in the short run (third criterion). For this purpose, we employ the ARDL bounds testing procedure developed by [START_REF] Pesaran | An Autoregressive Distributed Lag Modeling Approach to Cointegration Analysis[END_REF] and [START_REF] Pesaran | Bounds testing approaches to the analysis of level relationships[END_REF]. We prefer this method to standard cointegration tests such as those of [START_REF] Johansen | Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models[END_REF] or [START_REF] Engle | Co-integration and error correction: representation, estimation, and testing[END_REF] for several reasons.

First, one important feature of the bound testing procedure proposed by [START_REF] Pesaran | Bounds testing approaches to the analysis of level relationships[END_REF] is that it can be applied to a set of regressors that are a mixture of I(0) and I(1) variables. However, [START_REF] Cheung | Finite-sample sizes of Johansen's likelihood ratio tests for cointegration[END_REF] put forth evidence that standard unit root tests suffer from size distortion and low power in the case of small samples, as is the case in our analysis. Second, the bound testing procedure is robust in case of small samples whereas others could be biased in this case. Finally, as [START_REF] Narayan | The saving and investment nexus for China: evidence from cointegration tests[END_REF] suggests, the method provides robust t-statistics and, thus, unbiased long-term estimates even if one or more regressors are potentially endogenous.

Following [START_REF] Pesaran | Bounds testing approaches to the analysis of level relationships[END_REF], we estimate the conditional error correction model presented in Equation 5to obtain the bound tests:

∆Y t = µ + δY t-1 + k i=1 γ i ∆Y t-i + θEC t-1 + l j=1 τ i ∆EC t-j + ϵ t , (5)
where Y t is the logarithm of FISIM estimated using the different methods proposed the F-statistic is lower than the lower bound, the null hypothesis cannot be rejected and there is no long-term relationship between the two studied variables. The reverse is true if the F-statistic is higher than the upper bound. However, the test is inconclusive if the F-statistic falls between the two bounds. In this case, standard unit root tests have to be computed.

Results

Estimated FISIM

We compute FISIM under respectively (1) the current regulation, (2) the default risk adjusted, and ( 3) the default and liquidity risk adjusted for the eurozone. Table 4 presents these results split by sector and averaged over the period 2003-2017. As expected, FISIM adjusted for default risk and FISIM adjusted for default and liquidity risk are much lower than those obtained by the current method, especially from 2008 to 2015, which is consistent with the economic intuition. The method we propose (column 3) reduces the banking output estimate of the eurozone by a significant 46 percent compared with the current regulation (column 1). This reduction is more pronounced for the non-financial corporation sector with 52 percent than for the household sector with 42 percent. Our method generates on average 22 percent more than the approach that adjusts for default risk premium only (column 2). 4 Figure 5 shows the quarterly production of FISIM under these different approaches.

The difference between the banking output under the current regulation and the riskadjusted methods varies over time. It was at its maximum during the subprime crisis and the euro crisis. The current method leads to paradoxical results because FISIM dramatically increased during the financial crisis of 2008 and the eurozone crisis of 2012.

Thereafter FISIM initiated a declining trend with low volatility. Conversely, the riskadjusted methods resulted in a sharp decline of the banking output in the first quarter of 2009, and again at the end of 2010 and the beginning of 2011. Since then, they have 4 Colangelo and Inklaar (2012) use a slightly different method that adjusts for both default risk and term premium. The results adjusted for default risk premium (column 2) are in line with theirs.

gradually recovered and have been fluctuating at the pre-crisis levels since 2014. At first glance, the risk-adjusted methods present a picture more consistent with the evolution of the business cycle.

Then, we examine separately the FISIM on loans and the FISIM on deposits. We find that except in 2011, the FISIM on deposits have been negative every quarter since 2009 (Figure 4). This result is related to the emergence of negative interest margins on deposits when the reference rate falls below the interest rates on deposits (see Figures A.1 and A.2 in the Appendix). This confirms the view of [START_REF] Ravets | New York: Meeting of the Task Force on Financial Intermediation Services Indirectly Measured (FISIM)[END_REF] and [START_REF] Groslambert | Desperately seeking cash: Evidence from bank output measurement[END_REF], who found that negative output on deposits is not only due to the near-zero interest rate policy but also explained by the changing behavior of banks towards deposits. Deposits have become an important liquidity resource for banks, and consequently, banks are ready to pay for them.

For FISIM on loans (Figure 5), we find roughly the same patterns as for total FISIM.

The current method exhibits a threefold increase in banking output at the time of the

Performance of the different methods

In this section, we compare the respective merits of each method by using the four criteria established by the ISWGNA (2013) for producing reasonable reference rates and sensible FISIM estimates which are described in the 1.

Connection with underlying economic conditions and sensible changes near turning points

Short run analysis. First, we test the time series properties of our different variables using both the Augmented Dickey-Fuller (ADF) test and the stationarity test developed by [START_REF] Kwiatkowski | Testing the null hypothesis of stationarity against the alternative of a unit root: How sure are we that economic time series have a unit root?[END_REF]. Table A.1. in the Appendix reports the results of the unit root tests. All variables seems to be I(0) or I(1). Figures 6 and7 displays impulse responses of estimated FISIM to one standard deviation innovations of the explanatory variables (ESI or current GDP) in a 95% marginal confidence band using the LP method.

Note that estimation of impluse response coefficients can lead to wider marginal error bands in case of serial correlation. The use of conditional error bands allows to remove the variability caused by serial correlation.

Figures 6 reveals that a positive shock on euro area GDP has a significant negative impact on FISIM estimated using the current method, which seems counterintuitive. When FISM are computed using the full risk premia-excluded method and the credit risk premia only-excluded method, results are different. Indeed, Figure 6 shows that a one standard deviation innovations of euro area entails an increase of FISIM. FISIM estimated using the full risk premia-excluded method increase by 0.28 percentage points, while FISIM computed using the credit risk premia only-excluded method increase by 0.6 percentage points two quarters following the shock. These results put forth the evidence that FISIM computed using the current method seems to be disconnected from macroeconomic conditions on the short-run, while FISIM estimated using the two other methods are not.

Figure 7 confirms this conclusion by using the ESI rather than the euro area GDP to proxy for macroeconomic conditions.

Long run analysis. The Schwartz information criterion is used to select the optimal number of lags for the estimation of the ARDL models. We also correct standard errors for autocorrelation and heteroscedasticity using the Newey-West transformation. Table 5 summarizes results of the bound tests and presents the long-term relationship between the estimated FISIM and the eurozone's GDP, as long as the error correction term is based on the estimation of the ARDL models. Table 5 also displays autocorrelation and heteroscedasticity tests to check the accuracy of estimations. Note that ARDL models are estimated without an intercept and a trend, as both intercept and trend are not significant at the 5 percent level.

Column (1) of Table 5 depicts the current method for the computation of FISIM, column (2) provides the results for the full risk premia-excluded method and column [START_REF] Monfort | Decomposing euro-area sovereign spreads: credit and liquidity risks[END_REF] presents the results for the credit risk premia only-excluded method. The results indicate that the null hypothesis of no cointegration between FISIM estimated by the current SNA method and the euro's area current GDP cannot be rejected at the 5 percent level. Therefore, the current method fails to satisfy the requirements provided by the ISWGNA. By contrast, FISIM adjusted for credit risk and liquidity premia and for credit risk premium only are related to eurozone's economic cycle, as the null hypothesis of no cointegration with the eurozone's GDP is rejected at the 1 percent level. Consequently, the first criterion proposed by the ISWGNA ( 2013) is only fulfilled by these two methods.

Then, we evaluate the third criterion proposed by the ISWGNA, which means that FISIM exhibit sensible changes near economic turning points, using the adjustment speed estimated in the error correction model. The results in Table 5 show that the coefficient associated with the error correction term is significant at the 1 percent level only in the last two estimations. This indicates that deviations from the long-term relationship are eliminated more quickly in the case of the method adjusted for default risk premium only and in the case of the method adjusted for both default risk and liquidity premium.

Therefore, the volatility of FISIM from factors not connected with the economic cycle is much lower with the latter two methods. As a consequence, the method adjusted for default risk premium only and the method adjusted for both default risk and liquidity premium are more in line with the third criterion proposed by the ISWGNA (2013), contrary to the current method. Note that we observe a strong difference between the adjustment speed estimated for the method adjusted for the default risk only and the one estimated for the method adjusted for both risk and liquidity premia. At first glance, we could conclude that the method adjusted for the default risk only produces better results because the adjustment speed towards long-term equilibrium is higher. However, we find that the discrepancy in adjustment speed between the two methods is only linked to the logarithmic transformation applied to the method adjusted for default risk, as it entails negative values. 5 Indeed, if we apply the same transformation to the method adjusted for both liquidity and default risk premia, we obtain a similar coefficient for the adjustment speed as shown in Table A.2. of the Appendix.

To test the robustness of our results, we also conduct the ARDL cointegration testing procedure of [START_REF] Pesaran | Bounds testing approaches to the analysis of level relationships[END_REF] on the ESI of this area. Table 6 reports the results and confirms our previous conclusions In summary, our results provide evidence that the method adjusted for the default risk premium and the method adjusted for both the default risk and liquidity premia outperform the current method in terms of the first and third criteria proposed by the ISWGNA (2013). They are more connected with the economic cycle and minimize the part of volatility due to factors not related to this economic cycle. It is important to note that our results are robust to the use of another method to measure the liquidity premium. Indeed, if we rely on the spread between the iBoxx euro non-financial corporate bond index and its subset, the iBoxx euro liquid non-financial corporate bond index, we obtain very similar results, as shown in Table A.3. of the Appendix.

5 See footnote 4 for a presentation of the applied transformation.

No sustained periods of negative FISIM

The ISWGNA debated the notion of negative FISIM and their theoretical meaning (Ahmad, 2012) and concluded that negative FISIM was not conceptually possible and recommended that any method for computing FISIM should not produce sustained periods of negative FISIM. Table 7 gives the number of occurrences of negative quarterly FISIM in the period 2003-2017. The current regulation method does not generate any quarter of total negative FISIM (column 1). Conversely, the method adjusted for the default risk premium generates three quarters of negative total output in the first half of 2009 and the first quarter of 2011. This comes from the overestimation of the reference rate during a period of financial stress, which dramatically decreases the FISIM on loans. The method generates five quarters of negative FISIM on loans in the last quarter of 2008, the two first quarters of 2009 and in the first two quarters of 2011 (column 2). The method adjusting for default risk and liquidity premium corrects this flaw and does not generate any negative quarterly output, contrary to the default risk only method.

The current regulation method and the method adjusted for risk and liquidity premia comply with the second criteria of the ISWGNA. This is not the case for the method adjusted for default risk premium only. This raises issues of consistency of this method during periods of financial stress because it is difficult to explain a sustained negative output on loans.

Observable data

Compared with the current regulation, the new proposed methods require additional data to compute the default risk premium and the liquidity risk premium. For the default risk, it is necessary to find a non-financial corporate bond index and a covered bond index.

These types of data are easily accessible through third party vendors such as Markit Iboxx, Bank of America Merrill Lynch or Bloomberg Barclays. For the liquidity risk, one needs to have both liquid and non-liquid credit riskless bond issuers with a sufficient number of bonds in all maturity segments. In the eurozone, KfW bonds are good candidates [START_REF] Monfort | Decomposing euro-area sovereign spreads: credit and liquidity risks[END_REF][START_REF] Schwarz | Mind the gap: Disentangling credit and liquidity in risk spreads[END_REF]. For the United States, one can use RefCorp bonds as shown by [START_REF] Longstaff | The Flight-to-Liquidity Premium in US Treasury Bond Prices[END_REF]. [START_REF] Hattori | J-liquidity measure: The term structure of the liquidity premium in Japan[END_REF] developed a similar approach with Japanese government-guaranteed bonds. In the United Kingdom, one can use the bonds issued by the Network Rail Infrastructure Finance PLC, which benefits from the British government guarantee in full and carries the same credit ratings as the UK sovereign. Thus, we can estimate the liquidity risk premium across a large number of countries directly from asset prices without relying on a specific model. Consequently, we can conclude that data are observable, and the method we propose to correct for credit risk and liquidity premium can be easily implemented in the countries that have a large banking sector.

Conclusion

Following the recommendation of the group of experts on FISIM (ISWGNA, 2013), we aimed to develop a method for calculating banking output that excludes the credit risk premium. Our approach differs from [START_REF] Colangelo | Bank output measurement in the euro area: a modified approach[END_REF]'s as it removes the liquidity risk premium that may greatly affect the evolution of interest rates in times of financial crisis. The method that we propose corrects the problems raised by both the current SNA method and by the full risk premia-excluded method. First, our method generates less volatile banking output than that obtained with the alternative methods.

Our results are more in accordance with the changes in the economic cycle between 2003 and 2017. Second, while taking into account the credit risk, our method does not lead to negative banking output, even during periods of financial stress. This indicates that the liquidity premium plays a major role in the rise of credit spread during the subprime and the eurozone crises, when the two other methods led to diverging results. Third, the method proposed herein relies on data available for most developed economies and therefore can be applicable for Japan, the United Kingdom, and the United States. Finally, we show that the current SNA method overestimates banking output, while the full risk premia-excluded method underestimates it. Not only is measuring precisely financial intermediation services important for national accounting, but it is also a sensitive question for the research on the productivity of the banking industry [START_REF] Philippon | Has the US finance industry become less efficient? On the theory and measurement of financial intermediation[END_REF] and the study of possible rent-seeking activity [START_REF] Greenwood | The growth of finance[END_REF][START_REF] Zingales | Presidential address: Does finance benefit society?[END_REF]. Note: The FISIM on deposits are calculated in the same way as for the three methods.

  shows the liquidity premium extracted from the 6-year German government bonds and the 6-year KfW bonds. Until the second quarter of 2007, the liquidity premium is less than 0.1 percent. Then, it gradually increases and reaches a maximum of almost 1 percent at the height of the subprime crisis in the fourth quarter of 2008. It recedes rapidly until the first quarter of 2010 and then increases again rapidly with the onset of the euro crisis. It reaches a second peak at 0.84 percent in the fourth quarter of 2011 corresponding to the most acute time of the euro crisis. Then, after the arrival of Mario Draghi as head of the European Central Bank and the resulting change in its policy, the liquidity premium decreases almost continuously and reaches a pre-crisis level from mid-2014 to mid-2015.

  herein at time t. EC t is the measure of the euro area economic cycle (euro area GDP or euro area ESI) at time t. k and l are the lags of the ARDL model selected according the Schwartz information criterion and ϵ t are the errors of the model assumed to be independent and identically distributed. The bound test, testing the null hypothesis of no cointegration, developed by Pesaran et al. (2001) is based on an F-test statistics, as follows: H 0 : δ = θ = 0 (6) Pesaran et al. (2001) provided two sets of critical values for their bound test. The first set is computed assuming that all variables in the ARDL model are stationary. For the second set, all variables of the ARDL model are supposed to be I(1). These two sets of critical values provide bounds for all regressors. The decision procedure is as follows: if

  crisis and then stabilize around 300 billion euros per quarter. Because the growth rate of the outstanding amount of loans has been flat since 2009, these variations are mostly explained by the evolution of the interest rate margin. This huge increase was caused by the plummeting of the 2008 SNA reference rate due to an accommodating monetary policy by the ECB from 2008 (see Figures A.3 to A.6 in the Appendix). Both alternative methods show a very different evolution of the banking output. They dropped during the subprime crisis and again during the eurozone crisis but then recovered dramatically from a low in the first quarter of 2011 until 2014. Since then, they have fluctuated around 200 billion euros at about 25 percent less that the current method.

Figure 1 :

 1 Figure 1: Liquidity premium KfW 6-year

Figure 2 :

 2 Figure 2: Financial crisis intensity and liquidity premium

Figure 3 :

 3 Figure 3: Quarterly FISIM under various methods

Figure 4 :

 4 Figure 4: FISIM on deposits (million euros).

Figure 5 :

 5 Figure 5: FISIM on loans (million euros).

Figure 6 :

 6 Figure 6: FISIM local projection responses to a positive current GDP shock

  , which does not directly consider the German government bonds but subtracts German CDS from maturity-matched German bonds to neutralize any credit risk premium. However, taking into account the ISWGNA (2013)'s concern about the feasibility of new methods, we prefer the simplicity of the Longstaff

(2004) model-free approach, which relies only on the assumptions that both issuers share exactly the same credit risk. We recover daily prices from Bloomberg from January 1st, 2003 to Dec 31st, 2017. We select fixed annual coupon, euro-denominated, bullet KfW bonds comparable to the German government bonds. Our dataset consists of 124 KfW bonds maturing between 2003 and 2037 and 204 German government bonds maturing between 2003 and 2048. Table

3

provides the summary statistics of the dataset.

Table 1 :

 1 Characteristics of deposits

	Deposits
	Sector	Category	Maturity
		Overnight	-
	Non-financial corporations (S11)		Less than two
		With agreed maturity	years
			More than two
			years
		Overnight	-
	Households and NPISH (S14+S15)		Less than two
		With agreed maturity	years
			More than two
			years
		Redeemable at notice	Less than three months

Table 3 :

 3 Summary statistics for KfW bonds and German government bonds

		German
	KfW	government
		bonds

Table 4 :

 4 Imputed banking sector output (FISIM) in eurozone by sector, current regulation, and modified approaches (average January 2003-December 2017, million euros)

		(1)	(2)	(3)
				Adjusted for
		Current	Adjusted for	default risk
		regulation 2008	default risk	premium and
		SNA	premium only	liquidity
				premium
	Total	234,251	103,36	125,911
	Non-financial corporations	91,21	33,769	43,604
	Households	143,04	69,591	82,308

Table 5 :

 5 Results of bound tests with current eurozone's GDP (case no intercept)

		(1)	(2)	(3)
		Current regulation 2008 SNA	Adjusted for default risk premium only	Adjusted for default risk premium and liquidity premium
	Model	ARDL (4,4) ARDL (1,2) ARDL (1,2)
	Cointegrating vector	0.858***	0.720***	0.755***
		(0.010)	(0.020)	(0.013)
	ECT t-1	-0.043	-0.969***	-0.461***
		(0.026)	(0.154)	(0.098)
	Diagnostic tests
	QLB (1)	1.588	0.003	0.001
	QLB (5)	4.063	1.944	0.987
	QLB (10)	6.602	5.578	16.764*
	ARCH-LM test	0.091	0.011	0.300
	Bound tests
	F-statistics	2.186	60.684	15.114
	I(0) critical value (5%)	3.15	3.15	3.15
	I(1) critical value (5%)	4.11	4.11	4.11
	I(0) critical value (1%)	4.81	4.81	4.81
	I(1) critical value (1%)	6.02	6.02	6.02

Note: Number in parentheses are standard errors. The model includes no intercept and no trend (Case I). Critical values for bound test come from Pesaran et al. (2001). ECTt-1 represents the coefficient associated with the adjustment speed in the error correction model. QLB represents the Ljung-Box statistic. ARCH-LM represents the ARCH-LM statistic to test for heteroscedasticity. Significance level: *** p < 0.01, ** p < 0.05, * p < 0.1.

Table 6 :

 6 Results of Bound tests for eurozone's ESI (Case no intercept) Note: Number in parentheses are standard errors. The model includes no intercept and no trend (Case I). Critical values for bound test come from Pesaran et al. (2001). ECTt-1 represents the coefficient associated with the adjustment speed in the error correction model. QLB represents the Ljung-Box statistic. ARCH-LM represents the ARCH-LM statistic to test for heteroscedasticity. Significance level: *** p < 0.01, ** p < 0.05, * p < 0.1.

		(1)	(2)	(3)
		Current regulation 2008 SNA	Adjusted for default risk premium only	Adjusted for default risk premium and liquidity premium
	Model	ARDL (4,1) ARDL (1,2) ARDL (1,2)
	Cointegrating vector	2.679***	2.519***	2.526***
		(0.033)	(0.042)	(0.029)
	ECT t-1	0.014	-0.924***	-0.458***
		(0.013)	(0.214)	(0.107)
	Diagnostic tests
	QLB (1)	0.110	0.130	0.041
	QLB (5)	4.355	6.686	1.286
	QLB (10)	7.075	9.054	10.225
	ARCH-LM test	0.417	6.141	0.195
	Bound tests
	F-statistics	0.923	29.037	8.165
	I(0) critical value (5%)	3.15	3.15	3.15
	I(1) critical value (5%)	4.11	4.11	4.11
	I(0) critical value (1%)	4.81	4.81	4.81
	I(1) critical value (1%)	6.02	6.02	6.02

Table 7 :

 7 Number of negative quarters of banking output on loans from Q1-2003 to Q4-2017

		(1)	(2)	(3)
				Adjusted for
		Current	Adjusted for	default risk
		regulation	default risk	premium and
		2008 SNA	premium only	liquidity
				premium
	Total FISIM	0	3	0
	FISIM on loans	0	5	0
	FISIM on deposits*	32	32	32

  Table A.2: Results of bound tests using transformation for FISIM (liquidity and risk adjusted)Note: Number in parentheses are standard errors. The model includes no intercept and no trend (Case I). Critical values for bound test are taken from Pesaran et al. (2001). ECTt-1 represents the coefficient associated with the adjustment speed in the error correction model. QLB represents the Ljung-Box statistic. ARCH-LM represents the ARCH-LM statistic to test for heteroscedasticity. Significance level: *** p < 0.01, ** p < 0.05, * p < 0.1.

		With
		current	With ESI
		GDP
	Model	ARDL (1,2) ARDL (1,2)
	Cointegrating vector	0.715***	2.474***
		(0.021)	(0.046)
	ECT t-1	-0.920***	-0.934***
		(0.145)	(0.198)
	Diagnostic tests
	QLB (1)	0.013	0.123
	QLB (5)	0.920	5.184
	QLB (10)	10.576	13.225
	ARCH-LM test	0.000	0.053
	Bound tests
	F-statistics	47.403	28.027
	I(0) critical value (5%)	3.15	3.15
	I(1) critical value (5%)	4.11	4.11
	I(0) critical value (1%)	4.81	4.81
	I(1) critical value (1%)	6.02	6.02

  Table A.3: Results of bound tests using the iBoxx euro liquid non-financial corporate bond index to measure the liquidity premium Note: Number in parentheses are standard errors. The model includes no intercept and no trend (Case I). Critical values for bound test are taken from Pesaran et al. (2001). ECTt-1 represents the coefficient associated with the adjustment speed in the error correction model. QLB represents the Ljung-Box statistic. ARCH-LM represents the ARCH-LM statistic to test for heteroscedasticity. Significance level: *** p < 0.01, ** p < 0.05, * p < 0.1.

		With
		current	With ESI
		GDP
	Model	ARDL (1,2) ARDL (1,0)
	Cointegrating vector	0.755***	2.533***
		(0.014)	(0.029)
	ECT t-1	-0.323***	-0.320***
		(0.103)	(0.103)
	Diagnostic tests
	QLB (1)	0.534	0.641
	QLB (5)	4.772	4.698
	QLB (10)	18.032*	18.278*
	ARCH-LM test	3.409*	7.425***
	Bound tests
	F-statistics	10.495	7.309
	I(0) critical value (5%)	3.15	3.15
	I(1) critical value (5%)	4.11	4.11
	I(0) critical value (1%)	4.81	4.81
	I(1) critical value (1%)	6.02	6.02

See http://sdw.ecb.europa.eu/.

The three methods are: the current method developed by the 2008 SNA, the method adjusted for the credit risk premium, and the method adjusted for both credit risk and liquidity premium. As the method adjusted for the risk premium provides negative FISIM, we compute the logarithm of this variable using the following transformation: ln(Y t -M in(Y t ) + 1).

Appendix

List of Figures


Dominique Duval

Jean-Claude Reynaud

About raising and handling exceptions

Keywords: semantics of exceptions, case distinction, extensive sums, diagrammatic logic

This paper presents a unified framework for dealing with a deduction system and a denotational semantics of exceptions. It is based on the fact that handling exceptions can be seen as a kind of generalized case distinction. This point of view on exceptions has been introduced in 2004, it is based on the notion of diagrammatic logic, which assumes some familiarity with category theory. Extensive sums of types can be used for dealing with case distinctions. The aim of this new paper is to focus on the role of a generalized extensivity property for dealing with exceptions. Moreover, the presentation of this paper makes only a restricted use of category theory.

Introduction

This paper presents a unified framework for dealing with a deduction system and a denotational semantics of exceptions. It is based on the fact that handling exceptions can be seen as a kind of generalized case distinction. This point of view on exceptions has been introduced in [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF], and a short presentation can be found in [START_REF] Duval | Diagrammatic logic and exceptions: an introduction[END_REF]. In both these papers, some familiarity with category theory (adjunction, sketches,. . . ) is assumed. One aim of this new paper to present the main ideas of [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF] in an elementary way, with a restricted use of category theory.

Usual case distinction can be presented in a distributive logic, which means that products and sums of types are allowed, and that the product is distributive over the sum. Products and sums of types can be interpreted as cartesian products and disjoint unions of sets, respectively, so that the distributivity property does hold on sets. It follows from [START_REF] Carboni | Introduction to extensive and distributive categories[END_REF] that case distinction can also be presented in a weaker extensive logic, where sums of types are allowed, and the inverse image of a sum by a function is still a sum. In this paper, exceptions are formalized in a kind of generalized extensive logic; in [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF], this framework is enriched for dealing also with product types. Exceptions are studied in many different frameworks, for instance in [START_REF] Gogolla | Algebraic and operational semantics of exceptions and errors[END_REF][START_REF] Bernot | Abstract data types with exception handling: an initial approach based on a distinction between exceptions and errors[END_REF][START_REF] Schobbens | Exceptions for algebraic specifications[END_REF][START_REF] Benton | Monads and Effects[END_REF][START_REF] Laird | Exceptions, continuations and macro-expressiveness[END_REF][START_REF] Plotkin | Algebraic Operations and Generic Effects[END_REF][START_REF] Walter | Mossakowski Parametrized Exceptions[END_REF]. But, to our knowledge, the emphasize on the use of the extensivity property for dealing with exceptions, is new.

A puzzling issue about exceptions is the apparent discrepancy between the deduction system of a language with exceptions and its set-valued interpretation. Indeed, the type of exceptions is implicit in the language, while its interpretation requires an explicit set of exceptions. A major step towards a solution is the use of monads in [START_REF] Moggi | Notions of computation and monads[END_REF], in the framework of typed lambda-calculus: the functions are classified, on the one hand the values are not allowed to raise any exception, on the other hand the computations may raise an exception. So, if the types X and Y are interpreted in a set-valued model as the sets A and B, then a function f : X → Y is interpreted either as a map ϕ : A → B if f is a value, or as a map ϕ : A → B + E, where E is the set of exceptional values, if f is a computation. But this approach fails to formalize in a satisfactory way the handling of exceptions in the framework of typed lambda-calculus [START_REF] Plotkin | Semantics for algebraic operations[END_REF]. Our approach succeeds in formalizing the handling of exceptions, but the extensive logic is fairly different from typed lambda-calculus. Although we do not use monads explicitly, we do distinguish values from computations. 1 Actually, three different extensive logics are presented in this paper. The basic extensive logic is described in section 3: there are sums of types, and the inverse image of a sum by a function is a sum. This basic logic does not deal with exceptions. In the next sections, it is modified in two different ways, in order to include a treatment of exceptions. The decorated logic with exceptions, or simply decorated logic, is described in section 4. Then the logic with explicit exceptions, or simply explicit logic, is presented in section 5. Each of both logics for exceptions has its own deduction system and denotational semantics, however the interest of the first one relies primarily in its deduction system, while the denotational semantics of the second one is easier to grasp. A link between these logics is established, so that the deduction system of the decorated logic is sound with respect to the models in the sense of the explicit logic. This solves the problem of the apparent discrepancy between the deduction system of a language with exceptions and its set-valued interpretation.

So, this point of view on exceptions requires a framework for dealing with several logics and the links between them. Such a framework is provided by diagrammatic logics [START_REF] Duval | Diagrammatic specifications[END_REF][START_REF] Duval | Diagrammatic specifications[END_REF]. This work does rely on the theory of diagrammatic logics, mainly for the definition of the decorated logic and for the link between the decorated logic and the explicit logic, as explained in [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF][START_REF] Duval | Diagrammatic logic and exceptions: an introduction[END_REF]. However, in this paper, the role of diagrammatic logic is hidden, and the few required notions about categories are reminded. Actually, we do not need much more than the definition of a category, which is quite simple: it is a directed graph where the arrows can be composed as soon as they are consecutive. Proofs can be found in [START_REF] Duval | Diagrammatic logic and exceptions: an introduction[END_REF].

A diagrammatic logic is well known as soon as its specifications and theories are carefully described. Roughly speaking, a specification is a family of axioms, and a theory is a family of theorems that is closed under deduction. The deduction rules of the given diagrammatic logic are used for generating a theory from a specification, which means, for deriving theorems from axioms. The models of a specification are then defined automatically, in a sound way: every theorem that can be proved from a specification is satisfied in every model of the specification, or equivalently, every model of the specification can be extended to a model of the generated theory.

About graphs

In the three logics that will be described, the specifications and theories are some kind of generalized graphs and categories, respectively. In this preliminary section, we introduce some basic facts about graphs and categories, that will be used in the next sections.

Definition 2.1 (graph).

A (directed multi-)graph is made of points and arrows, that are called respectively types X, Y ,. . . and (univariate) functions f : X → Y ,. . . A category is a graph where functions can be composed, with the usual properties of composition, as follows.

Definition 2.2 (category).

A category is a graph where each type has an identity function id X : X → X, each pair of consecutive functions f : X → Y and g : Y → Z has a composed function g . f : X → Z, and the unitarity and associativity axioms hold (as soon as it makes sense):

f . id X = f , id Y . f = f , (h . g) . f = h . (g . f ) .
As usual, thanks to associativity, parentheses are generally dropped.

Clearly, each graph generates a category, by adding all the missing identities and composed functions, and by identifying some functions according to the axioms. Generating a category from a graph is similar to generating all the programs from a grammar of a given language, or generating all the theorems about groups (say) from a set of axioms for groups. This is pretty interesting, but far too large: we are usually quite happy with some programs and some theorems. . . More is said about this remark in the "decomposition theorem" of [START_REF] Duval | Diagrammatic specifications[END_REF][START_REF] Duval | Diagrammatic specifications[END_REF]. About graphs and categories, this remark is the motivation for defining something "between" both, as follows.

Definition 2.3 (compositive graph).

A compositive graph is a graph where each type may have a (potential) identity function id X : X → X and each pair of consecutive functions f : X → Y and g : Y → Z may have a (potential) composed function g . f : X → Z.

The unitarity and associativity axioms are not mentioned: as any equalities, some of them may hold, but this is not mandatory. Typically, a compositive graph may describe a step between a graph and its generated category, when some identities and composed functions have been generated.

The compositive graphs and the categories form the specifications and theories, respectively, of a (very simple) diagrammatic logic. The rules of this logic are the identity and composition rules, as well as the rules that correspond to the axioms for categories:

X id X : X → X (id) f : X → Y g : Y → Z g . f : X → Z (comp) f : X → Y f . id X = f : X → Y (unit X ) f : X → Y id Y . f = f : X → Y (unit Y ) f : X → Y g : Y → Z h : Z → T (h . g) . f = h . (g . f ) : X → T (assoc)
The fact that types and functions can be considered as symbols that stand for sets and maps, respectively, is catched by the following notion of model. In this paper, only set-valued models are considered; a more general definition of models can be found in [START_REF] Duval | Diagrammatic specifications[END_REF][START_REF] Duval | Diagrammatic specifications[END_REF]. For clarity, we speak about maps (rather than functions) between sets.

Definition 2.4 (model of a compositive graph). A (set-valued) model M of a compositive graph interprets each type X as a set M (X) and each function f : X → Y as a map M (f ) : M (X) → M (Y ), in such a way that identity functions are interpreted as identity maps and composed functions as composed maps: M (id X ) = id M(X) and M (g . f ) = M (g) . M (f ).

Example 2.5 (natural numbers). Let us consider the graph made of two types Unit and Nat and two functions z : Unit → Nat and s : Nat → Nat:

Unit z / / Nat s h h
The generated category contains the functions id Unit , id Nat , as well as s k : Nat → Nat and s k . z : Unit → Nat for every k ∈ N. By adding to the initial graph some of these functions, we get a compositive graph.

The model of naturals of all these graphs interprets Unit as a singleton { * }, Nat as the set N of naturals, z as the constant map * → 0, which is identified to the element 0 ∈ N, and s as the successor map succ : N → N. Then the function s k . z is interpreted as the constant map * → k, identified to k ∈ N.

There is still a technical point to discuss about compositive graphs and categories. Equality between functions is often too crude for dealing with computational issues: for a compiler, functions like f . id X and f are distinct, even though they become identified in all models. This is a reason for introducing equations f ≡ g as potential equalities in compositive graphs: if f ≡ g, then M (f ) = M (g) in every model M . So, from now on, every compositive graph may have equations.

It follows that the categories also have to be modified. An equiv-category looks like a category, except for two points. First, it is equipped with equations which form a congruence, which means, an equivalence relation compatible with composition. Second, it satisfies the unitarity and associativity axioms only up to congruence. For simplicity, and because this will not cause any trouble in this paper, we still call it a category.

So, this diagrammatic logic is a kind of equational logic, where all functions have arity 1.

A basic logic

In order to focus on the issue of exceptions, we have chosen a basic logic that deals with case distinctions. As in section 2, all its functions have arity 1, since no product of types is provided; multivariate functions are considered in [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF]. In order to deal with case distinctions, some sums of types are needed, and they must satisfy a property called extensivity, after [START_REF] Carboni | Introduction to extensive and distributive categories[END_REF]. Note that in [START_REF] Carboni | Introduction to extensive and distributive categories[END_REF] the word "extensivity" is used only for categories, while here it is used for sums. The specifications and theories of the basic logic are described below.

Definition 3.1 (basic specification).

A basic specification Σ is a compositive graph such that some finite lists of types Y 1 , . . . , Y n have a (potential) sum, made of a vertex type Y 1 + . . . + Y n and coprojection functions j i :

Y i → Y 1 + . . . + Y n , for i ∈ {1, . . . , n}.
Definition 3.2 (models of a basic specification). A (set-valued) model of a basic specification is a model of the underlying compositive graph that interprets potential sums as disjoint unions.

The properties of sums in a basic theory are stated now. The first one (existence and unicity of matches) is the usual defining property of sums in a category, but only up to congrunce. The second property (extensivity of sums) will allow to define case distinction.

Definition 3.3 (sums and matches).

A sum is a potential sum that satisfies the following property. If f i : Y i → Z, for i ∈ {1, . . . , n}, are functions, then there is a match

[j 1 ⇒ f 1 | . . . | j n ⇒ f n ] or [f 1 | . . . | f n ] : Y 1 + . . . + Y n → Z, i.e., a function such that [f 1 | . . . | f n ] . j i ≡ f i for i ∈ {1, . . . , n}, and if f : Y 1 + . . . + Y n → Z is a function such that f . j i ≡ f i for i ∈ {1, . . . , n} then f ≡ [f 1 | . . . | f n ].
The existence of matches can be illustrated as follows, when n = 2, with dotted arrows for representing the coprojections:

Y 1 j1 v v f1 ) ) S S S S S S S S S S S S ≡ Y 1 + Y 2 [f1|f2] / / Z Y 2 j2 h h f2 5 5 k k k k k k k k k k k k ≡ When n = 0, a sum "of no type" is called an initial type, denoted 0; it satisfies the following property. If Z is a type, then there is a function [ ] Z : 0 → Z such that, if f : 0 → Z is a function, then f ≡ [ ] Z .
The existence of empty matches can be illustrated as follows:

Y = Y 1 + . . . + Y n by the function u is a sum X = u -1 (Y 1 )+ . . .+ u -1 (Y n ), with coprojections u -1 (j 1 ), . . . , u -1 (j n ), together with restriction functions u i : u -1 (Y i ) → Y i such that, for i ∈ {1, . . . , n}: j i . u i ≡ u . u -1 (j i ) .
Here is an illustration when n = 2.

u -1 (Y 1 ) u -1 (j1) w w u1 / / ≡ Y 1 j1 z z X u / / Y u -1 (Y 2 ) u -1 (j2) g g u2 / / ≡ Y 2 j2 d d Definition 3.5 (extensivity). A sum Y = Y 1 + . . . + Y n is extensive if, for every function u : X → Y
there is an inverse image of the sum Y = Y 1 + . . . + Y n by the function u, and it is unique (the unicity of inverse images, here and in the sequel, is only up to some equivalence).

Definition 3.6 (basic theories).

A basic theory Θ is a basic specification such that its underlying graph is a category, and all its potential sums of types are extensive sums.

The category of sets can be seen as a basic theory, with the equality for congruence. It is not assumed here that all sums of types do exist in a basic theory, although this property could be added. Now, case distinction in any basic theory is easily defined, thanks to the properties of sums.

Definition 3.7 (cases). Let Y = Y 1 + . . . + Y n be a sum, u : X → Y a function, and let X = u -1 (Y 1 ) + . . . + u -1 (Y n ) be the inverse image. Let f i : u -1 (Y i ) → Z be functions, for i ∈ {1, . . . , n}.
The case distinction function (or simply the case function) that acts as f i on u -1 (Y i ), for all i, is:

case u of [ j i ⇒ f i ] 1≤i≤n = [ u -1 (j i ) ⇒ f i ] 1≤i≤n : X → Z . u -1 (Y 1 ) u -1 (j1) w w f1 * * T T T T T T T T T T T T ≡ X case u of[j1⇒f1|j2⇒f2] / / Z u -1 (Y 2 ) u -1 (j2)
g g f2 4 4 j j j j j j j j j j j j ≡ This means that the case function is characterized by the equations:

(case u of [ j i ⇒ f i ] 1≤i≤n ) . (u -1 (j i )) ≡ f i , for 1 ≤ i ≤ n .
Clearly, when u = id Y : Y → Y , then the case function is congruent to a match:

(case id Y of [ j i ⇒ f i ] 1≤i≤n ) ≡ [ j i ⇒ f i ] 1≤i≤n : Y → Z .
The basic specifications and the basic theories form a diagrammatic logic, in this paper it is called the basic logic. The rules of this logic are the identity and composition rules, as in section 2, together with the rules for the existence and unicity of matches and for the extensivity of sums. Remark 3.8 (booleans). In order to recover a type of booleans, a sum Bool = F + T can be used. Then a function with values in Bool is called a predicate. The inverse image of the sum Bool = F + T by a predicate p : X → Bool is also a sum, say X = X b + X b , because of the extensivity property. In the basic theory of sets, it can be assumed that the types F and T are interpreted as singletons, so that Bool is interpreted as the usual set of booleans. Then, in every model M , the sets M (X b ) and M (X b ) are the parts of M (X) where the map M (b) is true and false, respectively. Example 3.9 (the basic specification Σ nat ). The graph in example 2.5 can be considered as a basic specification, with no equation and no sum. The rules of the basic logic can be used for deriving, for instance, the functions [s ⇒ s . s | z ⇒ z] : Nat → Nat, and (the subscript Nat is omitted):

p = case id of [ s ⇒ id | z ⇒ z ] ≡ [ s ⇒ id | z ⇒ z ] : Nat → Nat .
From its definition, the function p satisfies the equations p . z ≡ z and p . s ≡ id. As in example 2.5, we are interested in the model of naturals of Σ nat , called M nat . In this model, the function p must be interpreted as the predecessor map pred : N → N such that pred(n) = n -1 for each positive n and pred(0) = 0.

A decorated logic for exceptions 4.1 Three keywords for exceptions

We use the keywords raise for raising exceptions and handle for handling them, as in Standard ML.

The predecessor map pred : N → N from example 3.9 can also be formalised in the following way, if some mechanism for exceptions is available:

First, an exception e is created:

Exception e

Then, a function p ′ : N → N is generated, such that p ′ (z) raises the exception e:

p ′ (x) = case x of [ s(y) ⇒ y | z ⇒ raise e ]
Finally, a function p ′′ : N → N is generated, that calls p ′ and handles the exception e:

p ′′ (x) = p ′ (x) handle [ e ⇒ z ]
The basic logic is now modified, in order to be able to deal with the mechanism of exceptions, with its three keywords: Exception , raise , handle .

For this purpose, we use a kind of logic where the functions are decorated : each function is associated to a symbol, which is called its decoration, and which appears as a superscript. The decorations are "v" for value and "c" for computation, they are borrowed from the monads approach [START_REF] Moggi | Notions of computation and monads[END_REF]. What is new here, is that the rules of the logic are also decorated, as will be explained below. In particular, various decorations of the extensivity property will give rise to various kinds of case distinctions, which in turn will be used for formalizing the treatment of exceptions. We claim that expressions of the form:

raise e or f handle g , can be considered as decorated functions; the keywords "raise" and "handle" are constructors for new decorated functions, very much like "[. . .]" and "case" are constructors for new basic functions. Moreover, the decoration of every function can be easily derived from the use of the keyword "Exception" and from the rules of the decorated logic, as follows: every exception is a computation, and every function involving a computation is a computation.

One issue with the decorated logic is that it does not have set-valued models in such a simple way as the basic logic in section 3 or the explicit logic in section 5, which blurs the intuition about this logic. In section 5, the decorated logic will be mapped to the explicit logic, and a set-valued interpretation will then be recovered.

Example 4.1 (the decorated specification Σ nat,deco ). In the next examples, a decorated specification Σ nat,deco is built progressively, so that a predecessor decorated function p is defined in example 4.2 without using exceptions, then a predecessor decorated function p ′′ is defined in example 4.2 with the help of exceptions, and finally (also in example 4.2) it is proved, in the decorated logic, that p ′′ is congruent to p.

The decoration "v" for "value"

The functions that have nothing to do with the exceptions are called values; they are decorated with the symbol v, i.e., the notation f v means that the function f is a value. An equation between values is called a value equation, i.e., the notation f ≡ v g means that f v ≡ g v is an equation between values.

The identities are values, and the composition of values is a value. The value equations generate a congruence. The sums of types behave as in the basic logic, with values instead of arbitrary functions: the coprojections are values, a match of values is a value, and the extensivity property holds for values, so that cases over values give rise to values. These sums, matches and cases are denoted as in the basic logic, in particular the initial type for values is denoted 0. For the case construction, this means that a case like "case u of [ j i ⇒ f i ] i ", where u and the f i 's are values, is the value:

(case u v of [ j v i ⇒ f v i ] 1≤i≤n ) v = (case u of [ j i ⇒ f i ] 1≤i≤n ) v = [ u -1 (j i ) ⇒ f i ] 1≤i≤n v .
So, one rule of the decorated logic is the extensivity rule for values, which says that every sum has a unique inverse image by every value. For binary sums, this rule can be illustrated as follows.

u -1 (Y 1 ) (u -1 (j1)) v w w u v 1 / / ≡ Y 1 j v 1 z z X u v / / Y u -1 (Y 2 ) (u -1 (j2)) v g g u v 2 / / ≡ Y 2 j v 2 d d
Example 4.2 (the value part of Σ nat,deco ). In our example, the value part of the decorated specification Σ nat,deco is a copy of the basic specification Σ nat from example 3.9. Hence, Σ nat,deco has two types Unit and Nat, two values z v : Unit → Nat and s v : Nat → Nat, and no value equation. It generates a value:

p v = (case id of [ s ⇒ id | z ⇒ z ]) v ≡ [ s ⇒ id | z ⇒ z ] v : Nat → Nat
so that p . s ≡ v id and p . z ≡ v z.

The decoration "c" for "computation"

All the functions that may raise exceptions are called computations; they are decorated with the symbol c, as well as the equations between them. Since computations may (and not must ) raise exceptions, each value f v may be coerced into a computation f c , and similarly each value equation may be coerced into a computation equation. The composition of computations yields a computation, and the computation equations generate a congruence. In the composed computation (g . f ) c = g c . f c , it is expected that any exception which is raised by f c is propagated by g c : this is proved in theorem 4.5.

A match of computations is a computation, in a straightforward way. When n = 0, this means that the initial type for values is also initial for computations: for every type X, there is a unique value [ ] v X : 0 → X, and its coercion as a computation [ ] c X is the unique computation [ ] c X : 0 → X. Since a match of computations is a computation, a case like "case u of [ j i ⇒ f i ] i " is defined when the f i 's are computations and u is a value; the same notation "case" is used for this construction:

(case u v of [ j v i ⇒ f c i ] 1≤i≤n ) c = (case u of [ j i ⇒ f i ] 1≤i≤n ) c = [ u -1 (j i ) ⇒ f i ] 1≤i≤n c .
But there is no such definition when u is a computation; indeed, if u raises an exception, there is no canonical way to decide which Y i the exception "comes from". However, in section 4.6 a special situation is described, where some kind of "case u c of . . ." can be defined, when u is a computation.

The keyword Exception

In a decorated specification, the values are generated from some elementary values, which are the operation symbols of a signature, and the computations are generated from some elementary computations, which are the exceptions. Recall that a computation f c : X → Y in a decorated specification may raise an exception instead of returning a result of type Y . Following this idea, we consider that a declaration "Exception e of P ", for any type P , adds to the decorated specification a computation e c : P → 0: indeed, such a computation cannot return a result of type 0, since 0 stands for the empty set, hence it has to raise an exception.

P e c
/ / 0 In this paper, for simplicity, it is assumed that all the exceptions in a decorated specification are given once and for all. The exceptions form the coprojections of a new kind of sum in the decorated specification; this exceptional sum is studied in section 4.7.

Example 4.3 (the exception of Σ nat,deco ). In the decorated specification Σ nat,deco , the declaration "Exception e" adds a computation e c : Unit → 0, from which other computations will be derived in example 4.6.

The keyword raise

Recall that 0 is an initial type for values and for computations. We claim that when a function f : X → Y raises an exception e, this means that the exception e can be viewed as an expression of type Y . This is expressed in the following definition.

Definition 4.4 (the keyword raise). The keyword raise is the polymorphic value:

raise Y v = [ ] Y v : 0 -→ Y .
In a decorated specification Σ, let e c : P → 0 be an exception and Y a type. To raise the exception e c in the type Y is to build the composition:

(raise Y . e) c : P -→ Y .

The following result proves that the exceptions propagate, as required; it is a consequence of the unicity of the empty sum.

Theorem 4.5 (propagation of exceptions). For every computations f c : X → 0 and g c : Y → Z (typically, when f c is an exception):

g . raise Y . f ≡ c raise Z . f .
Example 4.6 (raising an exception in Σ nat,deco ). In the decorated specification Σ nat,deco , the computation p ′ is defined as follows:

p ′ c = ( case id of [ s ⇒ id | z ⇒ raise . e ] ) c ≡ [ s ⇒ id | z ⇒ raise . e ] c : Nat → Nat
It follows from theorem 4.5 that, for every computation g c : Nat → Nat, the computation (g . p ′ . z) c raises the exception e.

The case construction over a computation

The case construction over a computation, which is described now, can be used only inside a handle construction (section 4.8). Such a construction occurs only with respect to a sum of the form Y + 0, for any type Y . It is easy to prove that the vertex of this sum is isomorphic to Y , with the coprojections raise Y and id Y (the subscript Y is often omitted): indeed, the proof involves only values, it is similar to the usual proof in the basic logic. This sum Y = Y + 0 may be used as the other sums, for building matches of values and matches of computations, and also for building inverse images of values, but this has little interest: the inverse image of the sum Y = Y + 0 by a value u v : X → Y is simply the sum X = X + 0. The interesting property of the sum Y = Y + 0 is that there is a special rule for it: this sum has an inverse image by every computation u c : X → Y . Indeed, if u raises an exception, then we decide that this exception "comes from" the 0 part of the sum Y = Y + 0. More precisely, this inverse image is defined below.

Definition 4.7 (the inverse image of a sum by a computation). Let u c : X → Y be a computation.

An inverse image of the sum Y = Y + 0 by the computation u is a sum X = X u,1 + X u,0 , with value coprojections j v u,1 : X u,1 → X and j v u,0 : X u,0 → X, and with a value u v 1 : X u,1 → Y and a computation u c 0 : X u,0 → 0 such that:

u . j u,1 ≡ c u 1 and u . j u,0 ≡ c raise Y . u 0 . X u,1 j v u,1 x x u v 1 / / ≡ c Y id v z z X u c / / Y X u,0 j v u,0 f f u c 0 / / ≡ c 0 raise v d d
Some properties of this inverse image are stated now, their proof is easy. The second one shows that there is no ambiguity in our definition: when a computation u c comes, by coercion, from a value u v , then the inverse image of Y = Y + 0 by the computation u is the same as the inverse image of Y = Y + 0 by the value u. The last property proves the "back-propagation" of the raising of exceptions, with respect to values: if u ′ . u raises an exception, and if u is a value, then u ′ raises the same exception. Proposition 4.8 (properties of the inverse image of a sum by a computation). The rule of extensivity for computations states that in a decorated theory, for every type Y the sum Y = Y + 0 is extensive for computations.

• Let u c , u ′ c : X → Y be two computations such that u ≡ c u ′ , then u -1 (Y + 0) = u ′ -1 (Y + 0) . • Let u v : X → Y be a value, then (u v ) -1 (Y + 0) = X + 0 . • Let u c : X → Y be a computation and u ′ v : Y → Z a value, then (u ′ v . u) -1 (Z + 0) = u -1 (Y + 0) . • Let u c : X → Y be a computation such that u ≡ c raise Y . f for some computation f c , then (u v ) -1 (Y + 0) = 0 + X . • Let u c : X → Y be a computation and u ′ v : Y → Z a value, such that u ′ . u ≡ c raise Z . f for some computation f c , then u ≡ c raise Y . f .
• For every computation u c = raise Y . u ′ : X → Y where u ′ c : X → 0:

u handle [e i ⇒ f i ] i∈I ≡ c case e u ′ of [ e i ⇒ f i ] i∈I .
If in addition u ′ = e j . u ′′ : X → Y for some j ∈ {1, . . . , k} and some value u ′′ v : X → P , then:

u handle [e i ⇒ f i ] i∈I ≡ c f j if j ∈ I , u handle [e i ⇒ f i ] i∈I ≡ c u otherwise .
Example 4.18 (handling an exception in Σ nat,deco ). From example 4.2, p v is the value:

p v = case id of [ s ⇒ id | z ⇒ z ] ≡ [ s ⇒ id | z ⇒ z ] : Nat → Nat .
On the other hand, from example 4.6, p ′ c is the computation:

p ′ c = case id of [ s ⇒ id | z ⇒ raise . e ] ≡ [ s ⇒ id | z ⇒ raise . e ] : Nat → Nat .
Now, let:

p ′′ c = p ′ handle [ e ⇒ z ] : Nat → Nat ,
As an example of a proof in the decorated logic, let us prove that p ′′ ≡ c p.

It follows from the definition of p ′ c that:

Nat s v w w id v / / ≡ c Nat id v x x Nat p ′ c / / Nat Unit z v g g e c / / ≡ c 0 raise v f f
Hence, the inverse image of the sum Nat = Nat + 0 by the computation p ′ is Nat = Nat + Unit, with coprojections s and z, and with p ′

p ′′ c = p ′ handle [ e ⇒ z ] ≡ c case c p ′ of [ id ⇒ id | raise ⇒ w ] ≡ c [ s ⇒ id | z ⇒ w ] : Nat → Nat ,
where, as in example 4.15:

w c = case e e of [ e ⇒ z ] ≡ c z : Unit → Nat .
It follows that:

p ′′ ≡ c [ s ⇒ id | z ⇒ z ] : Nat → Nat .
Finally, from the unicity of matches, we conclude that:

p ′′ ≡ c p .
Since p is a value, it follows that the computation p ′′ , actually, never raises an exception.

Undecoration

Definition 4.19 (undecoration). The undecoration of a decorated specification Σ deco is the basic specification Σ basic that is obtained simply by forgetting the decorations.

In the framework of diagrammatic logics, it is easy to check that the undecoration is a morphism from the decorated logic to the basic logic.

By undecoration, every value f v : X → Y or computation f c : X → Y in Σ deco gives rise to a function f : X → Y in Σ basic . Decorated sums and cases in Σ deco , give rise to ordinary sums and cases in Σ basic .

The sum X = X u,1 + X u,0 gives rise to the sum X = X + 0, and the exceptional sum to a sum with vertex 0. Hence, the undecoration allows to get a simplified view on the functions and equations, by forgetting all the decorations. It allows to get a simplified view on the proofs, since the image of a proof in the decorated logic is a proof in the basic logic. This can be stated as: "A proof in Σ deco is a proof in Σ basic which can be decorated". This yields a two-step method for checking a proof in the decorated logic: first, the proof without its decorations must be valid in the basic logic, then it must be feasible to add the decorations in a way that is valid in the decorated logic. However, this simplified view "does not preserve the meaning": for instance, when Unit is interpreted as a singleton, a constant exception e c : Unit → 0 in Σ deco gives rise in Σ basic to a function e : Unit → 0, which has no set-valued interpretation. In section 5, the expansion of a decorated specification is defined; it is more subtle than the undecoration, and it "does preserve the meaning".

Example 4.20 (the undecoration of Σ nat,deco ). By undecorating Σ nat,deco , we get a basic specification Σ nat,basic , with a function e : Unit → 0, so that this basic specification has no set-valued model where Unit is interpreted as a singleton. The computation p ′′ c in Σ nat,deco , that involves the three kinds of decorated cases, gives rise in Σ nat,basic to a function that involves three times the basic case distinction.

A logic with explicit exceptions 5.1 Expansion

The exceptions are now considered in an explicit way, which means that there is a type of exceptions E which formalizes the set of exceptions, and that E appears in the type of a function, as soon as this function may raise an exception. This corresponds to the explicit logic, which has no decorations. It is an enrichment of the basic logic with a distinguished type E. Definition 5.1 (explicit specification). An explicit specification is a basic specification together with a distinguished type E. Definition 5.2 (expansion). The expansion of a decorated specification Σ deco is the explicit specification Σ expl obtained by adding the distinguished type E, keeping each value f v : X → Y as a function f : X → Y , and replacing each computation

f c : X → Y by a function f : X → Y + E.
In the framework of diagrammatic logics, it is easy to check that the expansion is a morphism from the decorated logic to the explicit logic.

So, every non-exceptional sum

n i=1 (j v i : Y i → Y ) in Σ deco gets expanded as a sum n i=1 (j i : Y i → Y ) in Σ expl .
The initial type 0 in Σ deco gets expanded as the initial type 0 in Σ expl , and the value raise v Y = [ ] v : 0 → Y gets expanded as [ ] : 0 → Y , for each type Y . In this way, the properties of sums of values in the decorated logic get satisfied by their images in the explicit logic. This includes the existence and unicity of the inverse image of any value u v , which gets expanded as the inverse image of the function u. This also includes the property that there are matches of computations; indeed let (f c i : Y i → Z) 1≤i≤n be computations in Σ deco , they get expanded as functions (f i :

Y i → Z + E) 1≤i≤n , and the computation [f 1 | . . . | f n ] c : Y → Z gets expanded as the function [f 1 | . . . | f n ] : Y → Z + E.
For the cases over computations, let u c : X → Y be a computation in Σ deco , then the expansion of the inverse image of the sum Y = Y + 0 by the computation u c is the inverse image of the sum Y + E by the function u : X → Y + E in Σ expl .

For the exceptional cases, the exceptions e c i : P i → 0 get expanded as e i : P i → E. So, the expansion of the exceptional sum is the sum E = k i=1 P i , with coprojections the e i 's, and the expansion of an inverse image of the exceptional sum is an inverse image of this sum.

Since the raising and handling of exceptions have been defined in terms of these decorated case constructions, they get expanded accordingly.

Example 5.3 (the expansion of Σ nat,deco ). Let Σ nat,expl be the expansion of Σ nat,deco : it is made of a copy of Σ nat from example 3.9, together with e : Unit → E, which has to be a sum, which means that e has to be invertible.

Models

Let Σ deco be a decorated specification, and Σ expl the explicit specification obtained by expanding Σ deco . Let E be a fixed set, called the set of exceptions. A (set-valued) model of Σ expl with set of exceptions E is defined as a (set-valued) model (in the basic sense) such that the interpretation of the distinguished type E is the set E. So, the exceptions e c i : P i → 0 in Σ deco , that are expanded as e i : P i → E in Σ expl , are interpreted as maps M (e i ) : M (P i ) → E. It follows that E must be the disjoint union of the M (P i )'s.

It follows, as required, that the models of the expanded specifications provide a denotational semantics for the decorated logic.

Theorem 5.4 (soundness). The deduction system of the decorated logic is sound with respect to the explicit denotational semantics. This means that every equation of Σ deco (either between values or between computations) is interpreted as an equality in every model of Σ expl . A proof of this result can be found in [START_REF] Duval | Diagrammatic logic and effects: the example of exceptions[END_REF], it relies upon the fact that the decorated and the explicit logics can be formalized as diagrammatic logics, and that the expansion is a morphism between them.

Example 5.5 (the expansion of Σ nat,deco ). Let E = {ε}. Then Σ nat,expl has a model M nat,expl that interprets Unit, Nat, z, and s as { * }, N, 0 and succ, respectively, and e : Unit → E as ε : { * } → E. In this model, the computation (raise Nat . e) c and the value z v are interpreted respectively as ε and 0. The value p v is interpreted as the predecessor map pred : N → N, such that pred(n) = n -1 for n > 0 and pred(0) = 0. The computation p ′ c is interpreted as the map pred ′ : N → N+ E, such that pred ′ (n) = n-1 for n > 0 and pred ′ (0) = ε. And the computation p ′′ c is interpreted as the map pred ′′ : N → N + E, such that (like pred) pred ′′ (n) = n -1 for n > 0 and pred ′′ (0) = 0.

Conclusion

Two logics for dealing with exceptions are presented in this paper. The decorated logic provides a deduction system, and the explicit logic provides a denotational semantics. The expansion, from the decorated logic to the explicit logic, ensures soundness.

Perspectives include the comparison of this approach with other formalizations. Another direction for future research is to use a similar approach, via morphisms of diagrammatic logics, in order to study other computational effects; in particular, the combination of various effects should run smoothly in our diagrammatic framework.

  Definition 3.4 (the inverse image of a sum by a function). Let Y = Y 1 + . . . + Y n be a sum, with coprojections j 1 , . . . , j n , and let u : X → Y be a function. An inverse image of the sum

Definition 4 . 9 (

 49 extensivity for computations). A sum Y = Y + 0 is extensive for computations if, for every computation u c : X → Y there is an inverse image of the sum Y = Y + 0 by the computation u, and it is unique.

1 v

 1 = id and p ′ 0 c = e. Thus:

Definition 4.10 (cases over computations). Let u c : X → Y be a computation, and f c 1 : X u,1 → Z and f c 0 : X u,0 → Z two computations. Then the computation "case c u of [ id ⇒ f 1 | raise ⇒ f 0 ]", which is called a case over computation construction, is defined as:

This means that the case over computation function is characterized by the equations:

The exceptional case construction

Let us come back to the declarations of exceptions. The exception declarations "Exception e i of P i ", for 1 ≤ i ≤ k, add to the decorated specification a sum of a new kind, called the exceptional sum, which allows to test which one among the e i 's is some given exception. From now on, let:

be the exceptions in some given decorated specification.

Definition 4.11 (the exceptional sum). The exceptional sum 0 = k i=1 P i has vertex 0 and coprojections the computations e c i 's for 1 ≤ i ≤ k.

The exceptional sum is quite special: its coprojections are computations, instead of values, and it is used only inside a handle construction (section 4.8). The exceptional sum enjoys a decorated version of only one among the properties of sums, namely the extensivity, as follows.

Definition 4.12 (the inverse image of the exceptional sum by a computation). Let u c : X → 0 be a computation. An inverse image of the exceptional sum by u c is a sum X = k i=1 u -1 (P i ), with values coprojections (u -1 (e i ) v , together with values u v i : u -1 (P i ) → P i such that for each i:

u . (u -1 (e i )) ≡ c e i . u i .

u -1 (P 1 ) The rule of extensivity for exceptions states that in a decorated theory, the exceptional sum is extensive. Now the exceptional case construction can be defined, as another decorated version of the basic case construction.

Definition 4.14 (exceptional cases). Let u c : X → 0 be a computation, I a subset of {1, . . . , k}, and for each i ∈ I let f c i be a computation:

For each i ∈ I, let f c i be the default computation:

Then the computation "case e u of [ e i ⇒ f i ] i∈I ", which is called an exceptional case construction, is defined as:

This means that the computation "case e u of [ e i ⇒ f i ] i∈I " is characterized by the equations:

Example 4.15 (an exceptional case in Σ nat,deco ). In the decorated specification Σ nat,deco , there is only one exception e 1 = e, so that k = 1 and P 1 = Unit, in the exceptional sum. We may consider the computations u c = e c : Unit → 0 and:

Then clearly u -1 (e) = id Unit , so that w c ≡ c z : Unit → Nat.

The keyword handle

The keyword "handle" has two arguments: for instance, in the function "p ′ handle [ e ⇒ z ]", the arguments of handle are p ′ and [ e ⇒ z ]. There are two nested kinds of cases in a handling expression "f handle g". The first one tests whether f raises an exception, and when this is true, the second one tests which is the raised exception. The first one is a case distinction over a computation, as in section 4.6, and the second one is an exceptional case distinction, as in section 4.7. Now, the handling construction is easily defined from these two kinds of cases.

Definition 4.16 (the keyword handle). Let u c : X → Y be a computation, and let X = X u,1 + X u,0 be the inverse image of the sum Y = Y + 0 by the computation u c , together with the restrictions u v 1 : X u,1 → Y and u c 0 : X u,0 → 0. Let X u,0 = k i=1 u -1 0 (P i ) be the inverse image of the exceptional sum by the computation u c 0 . Let I be a subset of {1, . . . , k} and for each i in I, let f c i : u -1 0 (P i ) → Y be a computation. To handle an exception arising from u c according to the match [ e i ⇒ f i ] i∈I is to build the computation:

where f is the computation:

The following result proves that the exceptions are handled as required; it can be compared to the rules for "handle" in the definition of SML [START_REF] Milner | The definition of Standard ML[END_REF]. Theorem 4.17 (properties of the handling of exceptions).

• Let u 1 ≡ c u 2 : X → Y , then (with the above notations):

• For every value u v : X → Y :

u handle [e i ⇒ f i ] i∈I ≡ c u .