9

I'm attempting to do that as follows:

λ (A : *) ->
λ (B : (A -> *)) ->
λ (t : (∀ (r : *) -> (∀ (x : a) -> (B x) -> r)) -> r) ->
(t (B (t A (λ (x : A) -> λ (y : (B x)) -> x)))
    (λ (x : A) -> λ (y : (B x)) -> y))

Notice that, since the value returned by that function depends on a value inside the sigma itself, I need to extract that value. This code doesn't check, because, I believe, it fails to unify the type extracted from Sigma with the type inside it.

Is there any workaround?

MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
  • 1
    I'd guess it is impossible to do that without dependent elimination. Church encodings in CoC only allow for non-dependent elimination, IIRC. Inductive types (as in CiC) of course do allow that. (Perhaps Self types also allow for a better encoding, featuring dependent elimination) – chi May 13 '17 at 21:33
  • @chi ... damn. But how would those help? I've been thinking a lot about this and I'm out of creativity. – MaiaVictor May 13 '17 at 21:34
  • 1
    In dependent elimination, the "return" type `r` is not a type `*`, but a type family `r :: (x:a) -> B x -> *` allowing for the second projection to have the type you want. Check e.g. the HoTT book at pages 31-32 for some discussion on Sigma types, and dependent vs non dependent elimination. – chi May 14 '17 at 08:06
  • I really need to read the HoTT book, @chi. Do you, in particular, have anything else to suggest me to read when I have some free time? Given that you know more or less the things I ask. – MaiaVictor May 14 '17 at 19:34
  • I wish there were a few comprehensive books/papers to summarize the main results of type theory -- the literature is too sparse :-( Anyway, I personally enjoyed the Martin-Lof ITT [notes](https://intuitionistic.files.wordpress.com/2010/07/martin-lof-tt.pdf) and the HoTT book. Also, [Robert Harper's videos](https://www.youtube.com/playlist?list=PLGCr8P_YncjXRzdGq2SjKv5F2J8HUFeqN) are nice. The Barendregt Typed Lambda Calculi book is also useful. – chi May 14 '17 at 20:40
  • @chi that is a serious problem! I can't wait for the killer DApp that makes to scientific knowledge what Youtube did to creative content. Wikipedia is more of an archive. An universal way to talk communicate maths as a whole, something easy to pick and share. Papers suck. Seriously, they such too much. It takes weeks to digest a paper that ultimately could be explained in a few sentences once "decrypted". (Sighs.) Thanks for the recommendations. – MaiaVictor May 14 '17 at 22:38
  • In theory, that's what survey papers are for: you take results from many papers and summarize the key points from each. In practice, there's too much material. Even books do not tell the whole tale. And, yes, sometimes you need to spend way too much time in technical details just to get the general idea. I am fine with needing a long time to digest some result, not so when I need a long time only to see if paper P is what I was looking for (especially when asking some expert on SE is faster :-( ... ) – chi May 15 '17 at 13:33
  • @chi *sighs* can I ask just one more question, promise? The reason I'm looking for those things is that I need a simple core that is expressive enough to prove a lot of things. Reason is, I'd compile it to JS and EVM (Ethereum) and, with this, be able to explore and learn the concept of proving things about my real-life programs. Existing langs (coq/idris/agda) doesn't work because they don't compile to those targets satisfactorily. CoC itself doesn't because it isn't expressive enough (induction, etc.). What would you do? I don't need a TT PHD right now. A core I can program is all I need! – MaiaVictor May 15 '17 at 16:16
  • I can not really recommend a specific framework. Either you try to compile CiC, or use CoC+extra axioms for dependent elimination (or some variant of Martin-Löf's ITT ... ?). Maybe you should try asking on CS or TCS, were more expert people can provide insights. – chi May 15 '17 at 16:31

0 Answers0