<html><head><base href="x-msg://283/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Chung,<div><br></div><div>congratulations! I didn't know about this problem and I think it is a serious issue indeed. Maybe it is a known issue? Nisse? Ulf?</div><div><br></div><div>Surely, type constructors should not be injective in general. A definition of the form</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>data I : (Set -&gt; Set) -&gt; Set where&nbsp;</div><div><br></div><div>should be expandable by an annonymous declaration&nbsp;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>I : (Set -&gt; Set) -&gt; Set</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>I F = data {}</div><div><br></div><div>in an analogous way a named function definition can be expanded by definition and a lambda abstraction (e.g. this is the approach in PiSigma a proposed core language for dependently typed programming).</div><div><br></div><div>Clearly I is just a constant function and hence not injective.&nbsp;</div><div><br></div><div>I suspect that the idea that type constructors should be injective arises from the goal to imitate polymorphic programming ala Haskell where the type checker exploits the "fact" that all type formers are injective. This is reflected in a rule in Haskell's core language Fc which I find semantically unacceptable but which seems to be pragmatically necessary.</div><div><br></div><div>How can we fix this? I suspect that it would be pragmatically unacceptable to give up in general that type constructors are injective because this would make type inference much less powerful.&nbsp;</div><div><br></div><div>First of all, clearly it is not essential that I is empty, your proof goes through with</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>data I : (Set -&gt; Set) -&gt; Set where&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;&nbsp;&nbsp;inI : I (¥ë x ¡æ x)</div><div><br></div>&nbsp;without any problems. Interestingly, the proof still goes through if we turn the first argument into a parameter<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  data I (F : Set -&gt; Set) : Set&nbsp;where&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;&nbsp;&nbsp;inI : I F</div><div><br></div><div>I find this interesting because now I seems to be injective because F is now an implicit parameter of inI. &nbsp;However, if we try to translate this into an anonymous definition we end up destroying injectivity. Hence the mistaken assumption that all type constructors are injective seems to be the root of the problem.</div><div><br></div><div>The only fix I can see is that Agda should check wether a type constructor is actually injective and only then use this fact during unification. We may want to go further and allow the user to prove that a function is injective (I suggested this before) which would enable us to make type inference stronger in many situations. For most type constructors Agda could infer this automatically but certainly not for I and its variants.</div><div><br></div><div>Btw, I think it is correct that your proof needs EM even though I can't think of a simple argument just now. This is related to what Dan has been saying: I conjectured if we assume some sort of continuity we can actually construct a non-trivial solution of a D = D -&gt; D in Type Theory. But since continuity is consistent with core Type Theory we should not be able to refute this.&nbsp;</div><div><br></div><div>Continuity is also inconsistent with EM but it seems a reasonable assumption, while I cannot see any reason to believe that all type constructors should be injective. Also while we may accept that extensions of Type Theory may be anticlassical, we should expect that core Type Theory is consistent with EM. Hence, this is a real issue and it should be fixed.</div><div><br></div><div>Cheers,</div><div>Thorsten</div><div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><br><div><div><br><div><br></div><div><br><div><div>On 6 Jan 2010, at 23:44, Chung Kil Hur wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div bgcolor="#ffffff"><div><font size="2" face="Arial">Hi everyone,</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">I proved the absurdity in Agda assuming the excluded middle.</font></div><div><font size="2" face="Arial">Is it a well-known fact ?</font></div><div><font size="2" face="Arial">It seems that Agda's set theory is weird.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">This comes from the injectivity of inductive type constructors.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">The proof sketch is as follows.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">Define a family of inductive type</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">data I : (Set -&gt; Set) -&gt; Set&nbsp;where</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">with no constructors.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">By injectivity of type constructors, I can show that I : (Set -&gt; Set) -&gt; Set is injective.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">As you may see, there is a size problem with this injectivity.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">So, I just used the cantor's diagonalization to derive absurdity in a&nbsp;classical way.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">Does anyone know whether cantor's diagonalization essentially needs the classical axiom, or can be done intuitionistically ?</font></div><div><font size="2" face="Arial">If the latter is true, then Agda system is inconsistent.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">Please have a look at the Agda code below.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">Any comments are wellcome.</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">Best regards,</font></div><div><font size="2" face="Arial">Chung-Kil Hur</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">============== Agda code ===============</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">module cantor where</font></div><div><font size="2"></font>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data Empty : Set where</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data One : Set where<br>&nbsp;&nbsp;&nbsp; one : One</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data coprod (A : Set1) (B : Set1) : Set1 where<br>&nbsp;&nbsp;&nbsp; inl : ¢£ (a : A) -&gt; coprod A B<br>&nbsp;&nbsp;&nbsp; inr : ¢£ (b : B) -&gt; coprod A B</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; postulate exmid : ¢£ (A : Set1) -&gt; coprod A (A -&gt; Empty)</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data Eq1 {A : Set1} (x : A) : A -&gt; Set1 where<br>&nbsp;&nbsp;&nbsp; refleq1 : Eq1 x x</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; cast : ¢£ { A B } -&gt; Eq1 A B -&gt; A -&gt; B<br>&nbsp; cast refleq1 a = a</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; Eq1cong : ¢£ {f g : Set -&gt; Set} a -&gt; Eq1 f g -&gt; Eq1 (f a) (g a)<br>&nbsp; Eq1cong a refleq1 = refleq1</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; Eq1sym : ¢£ {A : Set1} { x y : A } -&gt; Eq1 x y -&gt; Eq1 y x<br>&nbsp; Eq1sym refleq1 = refleq1</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; Eq1trans : ¢£ {A : Set1} { x y z : A } -&gt; Eq1 x y -&gt; Eq1 y z -&gt; Eq1 x z<br>&nbsp; Eq1trans refleq1 refleq1 = refleq1</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data I : (Set -&gt; Set) -&gt; Set where</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; Iinj : ¢£ { x y : Set -&gt; Set } -&gt; Eq1 (I x) (I y) -&gt; Eq1 x y<span class="Apple-converted-space">&nbsp;</span><br>&nbsp; Iinj refleq1 = refleq1</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data invimageI (a : Set) : Set1 where<br>&nbsp;&nbsp;&nbsp; invelmtI : forall x -&gt; (Eq1 (I x) a) -&gt; invimageI a</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; J : Set -&gt; (Set -&gt; Set)<br>&nbsp; J a with exmid (invimageI a)<br>&nbsp; J a | inl (invelmtI x y) = x<br>&nbsp; J a | inr b = ¥ë x ¡æ Empty</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; data invimageJ (x : Set -&gt; Set) : Set1 where<br>&nbsp;&nbsp;&nbsp; invelmtJ : forall a -&gt; (Eq1 (J a) x) -&gt; invimageJ x</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; IJIeqI : ¢£ x -&gt; Eq1 (I (J (I x))) (I x)<br>&nbsp; IJIeqI x with exmid (invimageI (I x))<br>&nbsp; IJIeqI x | inl (invelmtI x' y) = y<br>&nbsp; IJIeqI x | inr b with b (invelmtI x refleq1)<br>&nbsp; IJIeqI x | inr b | ()</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; J_srj : ¢£ (x : Set -&gt; Set) -&gt; invimageJ x<br>&nbsp; J_srj x = invelmtJ (I x) (Iinj (IJIeqI x))</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; cantor : Set -&gt; Set<br>&nbsp; cantor a with exmid (Eq1 (J a a) Empty)<br>&nbsp; cantor a | inl a' = One<br>&nbsp; cantor a | inr b = Empty</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; OneNeqEmpty : Eq1 One Empty -&gt; Empty<br>&nbsp; OneNeqEmpty p = cast p one</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; cantorone : ¢£ a -&gt; Eq1 (J a a) Empty -&gt; Eq1 (cantor a) One<span class="Apple-converted-space">&nbsp;</span><br>&nbsp; cantorone a p with exmid (Eq1 (J a a) Empty)<br>&nbsp; cantorone a p | inl a' = refleq1<br>&nbsp; cantorone a p | inr b with b p<br>&nbsp; cantorone a p | inr b | ()</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; cantorempty : ¢£ a -&gt; (Eq1 (J a a) Empty -&gt; Empty) -&gt; Eq1 (cantor a) Empty<br>&nbsp; cantorempty a p with exmid (Eq1 (J a a) Empty)<br>&nbsp; cantorempty a p | inl a' with p a'<br>&nbsp; cantorempty a p | inl a' | ()<br>&nbsp; cantorempty a p | inr b = refleq1</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; cantorcase : ¢£ a -&gt; Eq1 cantor (J a) -&gt; Empty<br>&nbsp; cantorcase a pf with exmid (Eq1 (J a a) Empty)<br>&nbsp; cantorcase a pf | inl a' = OneNeqEmpty (Eq1trans (Eq1trans (Eq1sym (cantorone a a')) (Eq1cong a pf)) a')<br>&nbsp; cantorcase a pf | inr b = b (Eq1trans (Eq1sym (Eq1cong a pf)) (cantorempty a b))</font></div><div>&nbsp;</div><div><font size="2" face="Arial">&nbsp; absurd : Empty<br>&nbsp; absurd with (J_srj cantor)<br>&nbsp; absurd | invelmtJ a y = cantorcase a (Eq1sym y)</font></div><div><font size="2" face="Arial"></font>&nbsp;</div><div><font size="2" face="Arial">=====================================</font></div><div>&nbsp;</div><div><font size="2" face="Arial"></font>&nbsp;</div>_______________________________________________<br>Agda mailing list<br><a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br><a href="https://lists.chalmers.se/mailman/listinfo/agda">https://lists.chalmers.se/mailman/listinfo/agda</a><br></div></blockquote></div><br></div></div></div></div></div></body></html>