• Nenhum resultado encontrado

2 Idea of the translation

N/A
N/A
Protected

Academic year: 2023

Share "2 Idea of the translation"

Copied!
6
0
0

Texto

(1)

A Restricted Version of Reflection Compatible with Homotopy Type Theory

Théo Winterhalter,

supervised by Andrej Bauer and Matthieu Sozeau 11 September, 2017

Abstract

In this report, I present my work over the year on the relation between the different notion of equalities, particularly in the setting of homotpy type theory. We present a new notion of restricted reflection that is compatible with that setting, while still providing useful applications.

Acknowledgements

Although I do not mention them in the header, I would like to mention Philip Haselwarter and Nicolas Tabareau that also worked with me on this topic.

Introduction

When one wants to make sure their mathematical developements actually hold formally, they can rely on the power of proof assistants such as Coq [?] and Agda [?]. These allow users to write their proofs in a manner that isunderstood by the computer so that the machine can actually check if the statements written down make sense. As useful as it might be, these tools can sometimes be annoying to use as they force the user to go into extreme details.

The job of the people working on these tools is—in part—to make them easier to use and ever stronger. One such way is to allow an intuitive use of the notion of equality that is often required in mathematical reasonings. This is however not a trivial problem, and many notions of equalities have been (and still are being) investigated in type theory (the core foundation of the main proof assistants).

Another part of this work is to make sure that the type theories we use actually make sense (e.g. are consistent). This can in turn be proven using the very tools

(2)

we develop. Part of my focus during this internship has been dedicated to the developpement of tools in the Coq proof assistant to prove meta-theorems of type theory. They are already available on github [?].

Our main contribution is still a new formulation of the reflection rule that is used to bridge the gap between the two main notion of equality in type theory that is compatible with the now famous Homotopy Type Theory (HoTT) and its Univalence axiom.

1 Source theory

The source type theory comes with a peculiar rule for reflection that brings a change in the usual conversion relation. Our reflection rule is stated as follows:

Γ`e:IdBool(b1, b2)

∆`b1Γb2 :Bool (Γ⊆∆)

While conversion is now:

Γ`t:A Γ`A≡ΓB Γ`t:B

The idea is that we can only use reflection on equality that already made sense in the context used for the conversion. This allows us to do a transport on that very equality at top-level.

2 Idea of the translation

For the translation, we assume we are only eliminating one application of the reflection rule involvinge:IdBool(b1, b2). This means we can define the following notions, only by mentionning thesee, b1 andb2.

2.1 Transports

In Oury’s work, definitional equality gets translated to propositional equality but this alone implies the need of UIP. Instead, we refine this idea to havetransports overe(the global equality). This means the only definitional equalities involved are on booleans that verify UIP.

Definition 1 (Transports). We define mutually transports between contexts, be- tween types, and between terms.

(3)

• For contextsΓ1andΓ2we defineγ : Γ1 =⇒Γ2as pointwise=⇒on the types that compose the two contexts (it means that they must be of the same length).

• We defineΓ` τ :A =⇒ Bas two predicatesC1 andC2over two booleans and an equality between them, such thatΓ ` C1[b1, b2, e] ≡? A andΓ ` C2[b1, b2, e]≡?B and for allb,Γ`C1[b, b,reflb]≡?C2[b, b,reflb].

• We defineΓ ` ρ : u =⇒ v : Aas two term-predicatest1 andt2 such that Γ ` t1[b1, b2, e] ≡? u : A and Γ ` t2[b1, b2, e] ≡? v : A and for all b, Γ ` t1[b, b,reflb ] ≡? t2[b, b,reflb ] : A. Should it be Aeverywhere? Or shouldAdepend on the equality as well?

From any meta-transport, we can deduce a real one as the action using the J eliminator one(on terms, it is "only" under some predicateP, while on contexts, it comes from application of the respective transports on types through substitu- tions).

2.2 Relations for the translation

Before defining our translation, we define a relation between the expressions of the source type theory and those of the target stating that they have the same shape modulo the application ofmeta-transports. We writet / t0 whent0 (target) has the same shape ast(source).

Following this definition, we also definet1 ./ t2 between two expressions of the source to state that there is sometin the source such thatt / t1 andt / t2, but this is merely implied by it and rather defined inductively (so that it’s easier to work with).

Note: These relations are purely syntactic!

Now, we want to relate the notion of shape and the notion of meta-transport.

This is the purpose of the following lemma that we believe is crucial to the main theorem as it allows to prove coherence between translations.

Lemma 2(Coherence of translation).

• IfΓ1ctxandΓ2 ctxandΓ1 ./Γ2, then there existsγ : Γ1=⇒Γ2.

• Ifγ : Γ1 =⇒ Γ2and Γ1 ` A1 typeandΓ2 ` A2 typeandA1 ./ A2 then there existsΓ2`τ :γ.A1=⇒A2.

• Ifγ : Γ1 =⇒Γ2andΓ1 `u1:A1andΓ2`u2 :A2andu1 ./ u2then there existsΓ2 `τ :γ.A1 =⇒A2andΓ2 `ρ:τ.γ.u1 =⇒u2 :A2.

Proof. We focus on a few specific cases:

(4)

• CaseΠ:γ : Γ1=⇒Γ2 andΓ1`Q

A1B1typeandΓ2 `Q

A2B2 typeand A1 ./ A2 B1./ B2

Q

A1B1./Q

A2B2

By inversion we haveΓ1 ` A1 type,Γ2 ` A2 type,Γ1, A1 `B1typeand Γ2, A2 ` B2 type. So, by IH we have Γ2 ` τ1 : γ.A1 =⇒ A2, and thus γ, τA: Γ1, A1 =⇒Γ2, A2.

By definition we have the corresponding predicatesC1andC2forAs and D1andD2forBs. We deduceP1 :=γ.(Q

γ−1.C1(γ, τA)−1.D1)that works forγ.(Q

A1B1), andP2 :=Q

C2D2(noting that evenγ andτAdo depend on[b1, b2, e], it is crucial to remark that the action of a meta-transport dis- appears wheneis eliminated).

• Case application: γ : Γ1 =⇒ Γ2 andΓ1 ` u1@A1.B1 v1 : T1 andΓ2 ` u2@A2.B2 v2:T2and

u1./ u2 A1 ./ A2 B1 ./ B2 v1 ./ v2 u1@A1.B1 v1./ u2@A2.B2 v2

By inversion we haveΓi ` Ai typeandΓi, Ai ` Bi type andΓi ` ui : Q

AiBiandΓi `vi :Ai andΓi `Bi[vi]≡?Ti.

By IH we haveΓ2 ` τA :A1 =⇒ A2and thusγ, τA : Γ1, A1 =⇒ Γ2, A2, so by IH,Γ2, A2B:γ, τA.B1 =⇒B2.

By IH we get as wellΓ2 ` τπ : γ.(Q

A1B1) =⇒ Q

A2B2 together with Γ2uπ.γ.u1=⇒u2:Q

A2B2.

Likewise,Γ2A0 :γ.A1=⇒A2andΓ2vA0 .γ.v1 =⇒v2:A2. We first wantΓ2 `_:γ.B1[v1] =⇒B2[v2].

We haveΓ2 ` _ : B2A0.γ.v1] =⇒ B2[v2]fromρv, so we needΓ2 ` _ : γ.B1[v1] =⇒B2A0.γ.v1].

AdapatingτB, we getΓ2 ` _ : γ.B1[v1] =⇒ B2A.γ.v1], meaning there remains Γ2 ` _ : γ.B2A.γ.v1] =⇒ B2A0.γ.v1]which should simply hold.

The whole conclusion should follow similarly.

• Case context transport on types:γ : Γ1 =⇒Γ2andΓi `Aitypeand A1./ A2

A1 ./ δ.A2

(5)

Althoughδ isn’t technically a term and thus cannot be given a "type" di- rectly from inversion of typing, we argue that the required information can be recovered from the inversion of the substitutions withJinvolved.

This means we still get ∆ ` A2 type and δ : ∆ =⇒ Γ2. From this we get δ−1 ◦ γ : Γ1 =⇒ ∆. Then, by induction hypothesis we have

∆`τ : (δ−1◦γ).A1 =⇒A2. Now, we expect some∆`_:γ.A1 =⇒δ.A2 instead.

Composing on both sides byδshould be harmless, andδ◦δ−1should cancel each other.

• TODO

Note that the variable case is the one responsible for the need ofγ : Γ1 =⇒Γ2. What about UIP and funext?? When do we need them?

We will actually use the following corollary (the lemma was stated as such in order for the proof to go through).

Corollary 3(Coherence).

• IfΓ1ctxandΓ2 ctxandΓ1 ./Γ2, then there existsγ : Γ1=⇒Γ2.

• IfΓ ` A1 typeand Γ ` A2 type andA1 ./ A2 then there existsΓ ` τ : A1 =⇒A2.

• IfΓ`u1 :AandΓ`u2 :Aandu1 ./ u2 then there existsΓ`ρ:u1 =⇒ u2 :A.

Proof. The proof basically requires the meta-transport relation to be reflexive which it is trivially. In the term case, we also need to know that anyΓ ` τ : A =⇒ A has an action that amounts to the identity, this is the case by axiom K.

2.3 Translation

Here we mainly lay out the idea of the theorem we want to prove, but first we need to define the notion of translation of a judgment.

Definition 4(Translation). We define the relation Γ0 ` J0 ∈ JΓ ` JKon judg- ments of the target, and judgments of the source as roughlyΓ/Γ0andJ /J0and Γ0 ` J0. This however does not apply to equality judgments. For those we instead produce a meta-transport.

(6)

Remember thatJ / J0andJ / J00impliesJ0 ./ J00, meaning that two translations of the same term fall under lemma 3.

Lemma 5. For any typeT, we can always choose a translation that has the same head constructor asT.

Proof. Assume we haveΓ0 `t0 :T0 ∈JΓ`t:TK. By definition we haveT / T0 meaning thatT0 is someT00with the same head constructor asT decorated by meta-transports.

As in corollary 3, we get a transport that we apply to t0 to get some Γ00 ` t00 :T00 ∈JΓ `t :TK. (Note that we generally get a differentΓ00fromΓ0 in the process.)

Theorem 6(Translation).

• IfΓctxthen, there existsΓ0ctx∈JΓctxK.

• IfΓ`Atypethen, there existsΓ0`A0 type∈JΓ`AtypeK.

• IfΓ`u:Athen, there existsΓ0 `u0 :A0 ∈JΓ`u:AK.

• What about substitutions, should they be explicit?

• IfΓ≡∆then, there existsΓ0ctx∈JΓctxKand∆0ctx∈J∆ctxKas well as γ : Γ0 =⇒∆0.

• IfΓ ` A ≡? B then, there existsΓ0 ` A0 type ∈ JΓ ` AtypeKand Γ0 ` B0type∈JΓ`B typeK(with the sameΓ0) as well asΓ0 `τ :A0 =⇒B0.

• IfΓ`u≡?v:Athen, there existsΓ0 `u0 :A0 ∈JΓ`u:AKandΓ0 `v0 : A0 ∈JΓ`v:AK(with sameΓ0andA0) as well asΓ0 `ρ:u0 =⇒v0 :A0. Proof. TODO

Referências

Documentos relacionados

MINISTERIO DA EDucAçAo SECRETARIA DE EDucAçAo PROFISSIONAL E TECNOLOGICA INSTITUTO FEDERAL DE EDUcAçAO, CIENCIA E TECNOLOGIA DE RORAIMA REGIMENTO INTERNO DO COMITE GESTOR DE