/home/laney/.irssi/irclogs/Freenode/2010/#agda/September.log

--- Log opened Wed Sep 01 00:00:16 2010
copumpkinedwinb: what's the error when trying to get agda to start?01/09 17:37
edwinbI have defeated it!01/09 17:40
edwinbI found the error in the *ghci* buffer01/09 17:40
edwinbI didn't have libncursesw somewhere visible by emacs01/09 17:40
copumpkin:O01/09 17:40
copumpkinnice01/09 17:40
edwinbI'm not going to pretend I understand why this was a problem, but at least I'm back where I was a couple of months ago now ;)01/09 17:40
edwinbIn the meantime, I've uninstalled MacPorts and found the things I was using there somewhere else, which has made my ghc/libiconv problem go away01/09 17:41
edwinbNow I just need to remember what I was going to do when I started this nonsense [mumble] hours ago...01/09 17:42
Saizanedwinb: "I’d like to give a short talk about the forcing, detagging and collapsing optimisations (as described in my thesis and implemented in Idris) and discuss how these may be implemented in Agda, with the goal of improving the efficiency of the type checker by reducing sharing." <- reducing sharing? to make more terms get garbage collected?01/09 18:00
pigworkerwould that be 'reducing opportunity for loss of sharing'?01/09 18:24
edwinboh, did I say that?01/09 18:58
edwinbApparently I did01/09 18:59
edwinbI was on holiday when I wrote it, I obviously had my brain turned off...01/09 18:59
edwinbit's an experiment I'd quite like to do in Agda anyway - mark as many terms as possible as "you never need to look at this" and see if it has any effect on the efficiency of the type checker01/09 19:01
copumpkinlarrytheliquid: you there?01/09 20:37
applicativelarrytheliquid ping?01/09 20:37
applicativealas01/09 20:38
shaprSo, um, is Agda purely functional?01/09 20:39
* shapr is joking01/09 20:39
lispy1shapr: No, I think Agda is like perl, isn't it?01/09 20:40
* lispy1 also joking01/09 20:40
shapryow!01/09 20:40
copumpkinbe very quiet, everyone in here is thinking very hard!01/09 20:41
copumpkin(that's what agdaers do)01/09 20:41
* lispy1 <3 Agda01/09 20:41
lispy1I don't want you all to think I'm a troll!01/09 20:41
applicativei'm not a troll, i love agda, it's the new version of ada, right?01/09 20:42
applicative@vixen do you like agda01/09 20:42
applicativeill managed channel, clearly01/09 20:43
larrytheliquidhey yes01/09 20:49
larrytheliquidhere now01/09 20:49
larrytheliquidcopumpkin: pong01/09 20:50
lispy1larrytheliquid: I read about lemmachine on your github.  I like the positive write up in the readme about reusing propositions and their similarity to various types of tests.  I can say it re-inspires me to study agda again.01/09 20:50
copumpkinapplicative was telling us you'd gone to agda from ruby and had written something about agda for rubyists. Do you have that still?01/09 20:51
lispy1larrytheliquid: thanks!01/09 20:51
larrytheliquidlispy1: awesome! yeah i came to agda very strangely01/09 20:51
larrytheliquidoriginally i got stuck on some theoretical issues with genetic programming  / inductive programming01/09 20:52
larrytheliquidand eventually admitted that i needed to search for more expressive typesystems01/09 20:52
lispy1larrytheliquid: I've heard that agda has rotten performance at times.  Have you found this to be the case?01/09 20:52
lispy1larrytheliquid: another question:  How does lemmachine compare to Ur?01/09 20:53
larrytheliquidlispy1: it depends, ive gotten it to perform terribly mostly when doing a lot of large conversions that arent builtins or primitives01/09 20:53
larrytheliquidlike large string -> list -> vec -> map to something, etc01/09 20:53
lispy1larrytheliquid: (thisis ur by the way: http://www.impredicative.com/ur/)01/09 20:54
larrytheliquidso any time ive had any performance issues theyve been fairly intuitive to resolve01/09 20:54
copumpkinoh, by the way, has anyone written a strongly typed STLC interpreter in agda? I've played with the NBE approach to it, but was trying to write a simple substitution function with my representation and failed no matter what I tried01/09 20:55
lispy1larrytheliquid: interesting, I wonder too if that could be fixed via some of the tricks that Haskell does01/09 20:55
lispy1fusion, deforestation, etc01/09 20:56
copumpkinstrongly typed meaning you can't construct bad language terms in it (you index your terms by environment and type)01/09 20:56
larrytheliquidcopumpkin: http://video2010.scottishrubyconference.com/show_video/11/101/09 20:56
larrytheliquidcopumpkin: http://github.com/larrytheliquid/scotrubyconf01/09 20:56
copumpkingreat, thanks :)01/09 20:56
larrytheliquidcopumpkin: a lot of the content was simple/basic, fwiw01/09 20:57
larrytheliquidtheres some extra content that got kind of cool at the end of the slides though, that i ran out of time for in the video01/09 20:57
larrytheliquidthe slides have lots of speaker notes though01/09 20:57
larrytheliquidlike getting to use ∃₂01/09 20:58
larrytheliquidlispy1: my goal with lemmachine is to eventually have it share a similar feature set to urweb/opa/ocsigen, but where the framework guarantees are supportable by the host language (agda)01/09 21:00
lispy1larrytheliquid: okay.  I'm not familiar with opa/ocsigen, I think that answers my question01/09 21:00
larrytheliquidright now im working on an http protocol validator to provide a better foundation than lemmachine master has right now01/09 21:01
lispy1larrytheliquid: User programs are extensions of the framework, and as such can reuse its proofs, instead of being written on top of the framework in a different notation.01/09 21:01
larrytheliquidlispy1: yup01/09 21:01
lispy1It sounds interesting, will you publish this work at one of the FP conferences?  Perhaps http://cs.utdallas.edu/padl09/?01/09 21:02
lispy1well, not 09, but PADL in general01/09 21:03
larrytheliquidlispy1: id like very much to submit it for publication somewhere, but right now its still changing too much01/09 21:04
* lispy1 nods01/09 21:04
lispy1Well, this is all very cool.  Good luck!01/09 21:04
larrytheliquidthanks, fwiw the master branch doesnt do anything particularly cool with agda, mostly a non-dependent runtime with propositional equality proofs01/09 21:06
larrytheliquidbut the http 1.0 validation branch has some fun uses of heavily nested dependent types http://github.com/larrytheliquid/Lemmachine/tree/rfc194501/09 21:06
larrytheliquidlots of nested dependent products, where parsing a request method determines the type of response possible, in addition to the response status used, whether a body is possible, which then requires a content-length to match the Vec length of the body, etc01/09 21:09
copumpkinwhy not make your own types instead of nesting sigmas?01/09 21:09
copumpkinor is that what you mean?01/09 21:10
larrytheliquidcopumpkin: going to add a view function with a custom type later01/09 21:10
larrytheliquidcopumpkin: but to be able to use a generic parser it starts as nested sigmas01/09 21:10
copumpkinoh I see01/09 21:10
danbrowncopumpkin: http://acandystore.org/agda/PHOAS.Typed.html01/09 21:22
copumpkindanbrown: thanks, I'll take a look :)01/09 21:22
Saizanimplementing substitution with phoas is kind of cheating :P01/09 21:23
danbrownintrinsically typed, PHOAS, small-step semantics, and even an IO driver01/09 21:23
danbrownSaizan: when substitution isn't the behavior under study, i'm happy to cheat01/09 21:23
copumpkinmine isn't PHOAS though01/09 21:23
copumpkinsubstitution in the representation I'm using has been a nightmare :P01/09 21:24
danbrowni think it often is01/09 21:24
Saizansubstitution is easier if you do it for all the variables at once, apparently01/09 21:24
copumpkinyeah, I almost got it working by doing that01/09 21:25
copumpkinbut it wasn't really what I wanted01/09 21:25
Saizan(it's like (>>=))01/09 21:25
Saizancopumpkin: do you have the code where you got stuck?01/09 21:25
danbrowni'm still bothered that PHOAS isn't quite a monad...01/09 21:26
copumpkinSaizan: sure01/09 21:26
copumpkinjust a sec01/09 21:26
copumpkinSaizan: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29644#a2964401/09 21:32
Saizanwhere is \neg defined?01/09 21:48
copumpkinlarrytheliquid: you should've told them that agda isn't turing-complete :)01/09 21:52
copumpkinSaizan: Relation.Nullary or .Core I think?01/09 21:52
* copumpkin can never remember any of those01/09 21:53
copumpkinor maybe Data.Empty?01/09 21:53
larrytheliquidcopumpkin: i know, i answered that particular question the guy asked poorly01/09 21:54
copumpkinlarrytheliquid: enjoying the talk though, thanks again :)01/09 22:00
larrytheliquidcopumpkin: thx, the ending slides not in the talk are more fun ;)01/09 22:00
larrytheliquidwhich honestly would have been way too confusing for that audience, so its a good thing i didnt get to them01/09 22:01
copumpkinyeah01/09 22:02
* Saizan now remembers the annoying part where you've to mangle all the other variables to fit the new indices01/09 22:16
copumpkinSaizan: you mean in relation to what I pasted?01/09 22:16
Saizanyep01/09 22:16
copumpkinman, larrytheliquid is getting a lot of twitter coverage from the haskell community01/09 22:18
copumpkin:P01/09 22:18
Saizanbtw, Var ctx t ~~ Data.List.Any (_\==_ t) ctx, in case you didn't realize :)01/09 22:18
larrytheliquidcopumpkin: oh wow, thats pretty awesome01/09 22:19
copumpkinSaizan: oh, I was considering something like that, but wanted this to be fairly self-contained01/09 22:19
copumpkinSaizan: does that weird index type I wrote have a simpler presentation?01/09 22:19
Saizancopumpkin: it seems something you could build with Star but i'm not sure if that's "simpler"01/09 22:21
copumpkinah01/09 22:22
Saizansubst : ∀ {σ τ Γ} → Term Γ τ → (v : Var Γ σ) -> let Γ′ = delete Γ v in Term Γ′ σ → Term Γ′ τ <- i was trying to go with a type like this though01/09 22:22
copumpkinSaizan: ah, yeah... I was afraid of something with a function in the type like that as I've had bad experiences with it in the past :)01/09 22:23
copumpkinbesides, that inductive index was fairly simple01/09 22:23
Saizanyeah, it might work better with type inference01/09 22:26
copumpkinit was just helpful to have pattern matching on the index refine the types for me01/09 22:27
copumpkinwhich you wouldn't get with the function in the type01/09 22:27
copumpkinyou'd need a with block01/09 22:27
copumpkinbut maybe it'll work better overall01/09 22:27
Saizani'm in a position where i'd have to mangle the term too01/09 22:34
* Saizan has a dejavu01/09 22:34
copumpkinyeah :/01/09 22:34
copumpkinI had another version of this with Var in Term01/09 22:34
copumpkinwhere I increment the term I'm substituting as I recurse on binders01/09 22:34
copumpkinI don't really like that as much because you can have equivalent terms that have different representations depending on where you put the lift/suc/weaken01/09 22:35
Saizanit'd be easy with a constructor shift :: Term G t -> Term (s :: G) t01/09 22:35
copumpkinis it?01/09 22:36
Saizanah, yeah, weaken would be the right term :)01/09 22:36
copumpkinthat's what I'm talking about01/09 22:36
copumpkinif you move Var into Term01/09 22:36
copumpkinyour suc is basically weaken01/09 22:36
Saizani see01/09 22:36
copumpkinbut then I run into issues with (there x) (var (suc x))01/09 22:36
copumpkin(the binders are easy though, with that form)01/09 22:37
copumpkinbut if you succeed that way I'll take it, at this point :P01/09 22:37
copumpkinit doesn't feel like it should be this hard even with the current representation01/09 22:38
copumpkinI've experimented with a bunch of different forms though and have failed on all of them :P01/09 22:38
Saizanwell, even if you strip out all the types, you still have the problem that these vars are basically de brujin indexes, or something quite similar, so they need to be adjusted when you move them under other lambdas..01/09 22:41
copumpkinyeah01/09 22:41
copumpkinI tried writing a lifting function with the current representation01/09 22:41
copumpkinor weakening, I guess01/09 22:41
* Saizan guesses some of the syntax experts would have more interesting things to say here01/09 22:44
Saizannow the problem is substituting under the weaken constructor, sigh01/09 22:53
copumpkinyeah :P01/09 22:54
* Saizan has newed motivation to finish reading "A fresh look at programming with names and binders"01/09 23:00
copumpkinSaizan: I haven't seen that01/09 23:22
copumpkinlooking now :)01/09 23:23
Mathnerd314I want Haskell, but with dependent types. Agda is closest, right?01/09 23:41
Saizanyep01/09 23:41
Saizancopumpkin: i'd be interesting to figure out whether or not Term is a free monad and of which functor01/09 23:43
copumpkinMathnerd314: it comes at a cost, though!01/09 23:45
copumpkinSaizan: yeah01/09 23:46
Mathnerd314a cost? what sort of cost?01/09 23:46
copumpkinfifty bucks, payable to me over paypal01/09 23:46
Mathnerd314hmm, I've never used paypal :p01/09 23:48
Mathnerd314is it a trustworthy service?01/09 23:50
copumpkin:)01/09 23:52
copumpkinnah, not at all01/09 23:52
copumpkinthe price of using agda is really the lack of much inference, and sometimes having to jump through hoops to convince it your programs terminate01/09 23:53
edwinbAgda's inference seems pretty good to me...01/09 23:53
copumpkinand of course, writing your functions in a way that simplifies proving things about them01/09 23:54
edwinbas long as you have a type at the top level, of course01/09 23:54
copumpkinyeah, it isn't bad01/09 23:54
Mathnerd314copumpkin: so are there cases where Haskell infers a type but Agda doesn't?01/09 23:54
copumpkinwell agda actually forces you to write types for all top-level functions (unless you fool it by writing lambdas for values)01/09 23:55
copumpkinand even if you do fool it, it'll make your resulting value yellow01/09 23:56
Mathnerd314force you to write types? :-( The whole point of using Haskell is to *not* write out those stupid function signatures...01/09 23:57
copumpkinwell the issue is that it's fundamentally impossible with dependent types to give you general type inference01/09 23:57
copumpkinsince your types can contain arbitrary terms, including functions01/09 23:57
edwinbon the other hand, the point of dependent types is to be able to explain precisely what a function is meant to do01/09 23:58
edwinb(one of the points...)01/09 23:58
copumpkinyeah01/09 23:58
edwinbyou can't infer that sort of thing01/09 23:58
copumpkinI don't mind writing top-level function signatures as I tend to write them in haskell too01/09 23:58
edwinband things which are essentially trival, you can infer anyway01/09 23:58
copumpkinand most of the inner stuff can be inferred01/09 23:58
edwinbactually, I sometimes wonder, in a practical language, maybe you want to ignore what's decidable and just assume simple or Hindley Milner types if there's no signature01/09 23:59
edwinbnot that I've thought that through properly01/09 23:59
edwinbI usually start with a type in Haskell then work towards a program01/09 23:59
--- Day changed Thu Sep 02 2010
copumpkinyeah, same02/09 00:00
edwinbAgda (or similar) makes that easy02/09 00:00
copumpkinI've found myself wishing for holes and agsy in haskell recently02/09 00:00
copumpkinand C-c C-r is my new best friend02/09 00:00
edwinbwhat's always fun is when you decorate the type with a bit more detail and the program still typechecks02/09 00:00
copumpkinMathnerd314: hope we didn't put you off! it's still completely addictive, like a puzzle game02/09 00:01
copumpkinI have to pry myself away from agda with a crowbar02/09 00:01
Mathnerd314I'm just wishing Agda was more Haskelly02/09 00:01
copumpkinyou don't get anything for free, sadly :)02/09 00:01
copumpkinthat's why haskell is interesting :) it tries to push the limits of what you can do at the type level while (mostly) retaining decidable inference02/09 00:02
copumpkinso it's walking a fine line along the boundary there02/09 00:02
Mathnerd314but Agda already is undecidable, with termination checking. So why not do more undecidable things? :p02/09 00:03
copumpkinno it isn't02/09 00:03
edwinbI don't think it's undecidable...02/09 00:03
copumpkinagda just isn't turing-complete02/09 00:04
edwinbthing is, though, we're all new at this, and we're still figuring out how to make practical dependently typed languages02/09 00:04
edwinbso input from someone who wants to make it more Haskelly, say, is really valuable02/09 00:04
Mathnerd314I mean that Agda does undecidable things02/09 00:05
copumpkinnope02/09 00:06
Mathnerd314"determines properties that in the general case are undecidable"02/09 00:07
edwinbah, right02/09 00:07
copumpkinthere's a difference between being conservative and rejecting things which might terminate02/09 00:07
copumpkinand deciding the undecidable :P02/09 00:07
edwinbin the general case meaning a Turing complete language02/09 00:07
edwinbTuring completeness is overrated ;)02/09 00:08
copumpkinMathnerd314: haskell's type system makes statements about a turing complete language too ;) Rice said we can't do that02/09 00:08
larrytheliquidturing completely-confusing02/09 00:11
larrytheliquid(i apologize for that in advance, couldnt resist a few hours before works over)02/09 00:12
edwinbI've yet to find a function worth writing that actually relies on Turing Completeness02/09 00:12
copumpkinyeah02/09 00:13
edwinbyou might want to add coinduction for actual programs, say operating systems.02/09 00:14
copumpkinbut productivity checking there also ensures what we consider meaningful behavior in a real system02/09 00:14
copumpkinso I'm not sure why you'd ever want more02/09 00:14
copumpkinunless you really like doing stuff that simply doesn't terminate for the fun of it02/09 00:14
Mathnerd314I'm guessing Agda wouldn't let you try to verify the Collatz conjecture by writing a collatz-calculating function?02/09 00:15
copumpkinyou can write it coinductively02/09 00:15
copumpkinthen you could try to write a proof to give you a List from the generated Colist :)02/09 00:15
copumpkin(which would essentially be a proof of the conjecture)02/09 00:16
copumpkinMathnerd314: you can work with infinite things just fine in agda using coinduction, but there there's a productivity checker that tries to guarantee that your functions always produce a result02/09 00:17
copumpkinfor example, you could write concat on an infinite colist, but you'd need the inner lists to be non-empty02/09 00:17
copumpkinotherwise it has no guarantee that you aren't doing concat ([[1],[2],[3]] ++ repeat [])02/09 00:17
copumpkinor you could write a much more complicated concat on an infinite colist of colists, as long as you can supply a proof that you'll eventually hit a non-empty list at any given point02/09 00:18
Mathnerd314couldn't you optimize to (concat [[1],[2],[3]]) ++ (concat (repeat [])), do loop fusion, and end up happy?02/09 00:19
copumpkinit has no knowledge of the value you're passing in02/09 00:20
copumpkinunless you give it some proofs too02/09 00:20
copumpkinif it just takes a Colist (Colist a)02/09 00:20
copumpkinthat's all it knows, that it has a possibly infinite list of possibly infinite (but also empty) lists02/09 00:20
Saizantype inference works well when the system has principal types (schemes), because otherwise there are cases where you've to decide between multiple incompatible alternatives, and in the cases where your heurstics fail you'll probably get a spurious type error, though i guess with good reporting of the choice points and interactivity it could be a nice system02/09 00:21
SaizanMathnerd314: a Colist has to be able to fully produce arbitrary length prefixes in a finite number of steps02/09 00:24
applicativelarrytheliquid, you awake?02/09 01:11
larrytheliquidapplicative: thats debatable02/09 01:12
applicativeoh hey02/09 01:15
applicativei read some slides you put up for ruby folks about the advantages agda over the usual ruby type correctness controls02/09 01:16
applicativecant find them though I thought I would link them in the reddit.com/r/haskell discussion dons has triggered02/09 01:17
larrytheliquidah cool yeah http://github.com/larrytheliquid/scotrubyconf02/09 01:17
applicativei see, so it was on github, my memory had me hunting the doc directory in the lemmachine source02/09 01:18
larrytheliquidapplicative: the video is here too http://video2010.scottishrubyconference.com/show_video/11/102/09 01:19
applicativelemmachine is very interesting, but i can't praise it properly; i'll get back to you when i learn more agda!02/09 01:19
applicativeoh cool, ill link that too.02/09 01:19
larrytheliquidapplicative: nice, ya as i mentioned earlier the master branch of lemmachine isnt as interesting as the rfc1945 branch (for dependently typed programmers)02/09 01:20
larrytheliquiditll eventually make its way back into master as a lower-level verified core though02/09 01:21
larrytheliquidin other words, master might be easier to read through if youre new to agda, but rfc1945 uses agda more effectively02/09 01:23
applicativei see.02/09 01:24
applicativeas I say, i'm still with the abc's e.g. figuring out how the connection with Hack is made.02/09 01:24
applicativeand that sort of thing02/09 01:25
larrytheliquidapplicative: gotcha02/09 01:25
applicativei'll see if i can compose a couple of worthwhile sentences.02/09 01:26
Saizancopumpkin: not sure if you'd like this but i like that the recursion over term is only in _>>=_ http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29658#a2965802/09 01:53
copumpkinwow :)02/09 01:56
copumpkinthanks :) I'll try to figure out what's going on02/09 01:57
Saizannp, i had that idea before, but instead of implementing it i lost myself trying to use something more general than (\Delta ++), it feels nice to have it written down at last :)02/09 02:01
applicativeah, larrytheliquid is gone.  I posted a few more links in comments to dons' link to the Lemmachine source.  I hope not too incompetently....02/09 02:24
applicativei mean http://www.reddit.com/r/haskell/comments/d8dck/lemmachine_a_web_framework_in_agda/02/09 02:25
* lispy is watching larry's talk now02/09 02:33
lispyHm...I don't see agda listed here: http://shootout.alioth.debian.org/02/09 03:26
lispyI think that would be really interesting...I wonder what it would take to get agda there02/09 03:26
lispyheh, they must get that question a lot02/09 03:29
lispyfrom their FAQ:02/09 03:29
lispyWhy don't you include language X?02/09 03:29
lispyWhy don't you use our measurement scripts and publish measurements for language X?02/09 03:29
copumpkinlispy: he talks a lot about specifying properties but not so much about proving them, which is the hairier part :)02/09 03:29
lispycopumpkin: it's true02/09 03:29
lispycopumpkin: but all the more reason to reuse proofs :)02/09 03:30
Saizannot only compiling agda, but actually running the executable? madness.02/09 03:30
copumpkin*typechecking02/09 03:30
copumpkin:P02/09 03:30
* copumpkin doesn't even know the key binding for compilation02/09 03:30
copumpkinI need an "instance DecTotalOrder a => DecTotalOrder (Maybe a)" :P02/09 03:31
lispyActually, it would be pretty sweet to setup a site like the shootout, but it only allows you to compare esoteric languages02/09 03:31
Saizanhave they released the scripts?02/09 03:33
lispySaizan: indeed02/09 03:33
lispyhttp://shootout.alioth.debian.org/help.php#languagex02/09 03:33
lispySaizan: another idea I had would be to use their scripts to setup a version control shootout.02/09 03:34
lispyalas, the round tuits, I have none02/09 03:34
copumpkinwhat's a good way of representing a binary tree with empty leaves, data in the nodes, and preserving ordering?02/09 03:39
copumpkinI wanted to index the node by the value in it, so I have access to it in the parent02/09 03:39
copumpkinbut then the empty leaves contain nothing and make it ugly02/09 03:39
copumpkinI don't want a Maybe02/09 03:40
djahandarieBy idling in this channel I will suck all knowledge through proximity02/09 04:42
lispycopumpkin: why do you need Maybe?02/09 04:51
lispycopumpkin: (using Haskell syntax) you have something like data Tree a = Leaf | Branch a (Tree a) (Tree a)  ?02/09 04:51
lispycopumpkin: oh!02/09 04:52
lispycopumpkin: I see.  Because Leafs are indexed by their value too, you needed a Nothing there?02/09 04:53
leohello02/09 15:29
copumpkinhi!02/09 15:30
leohi, is my first time here :D. I'm looking for help, i'm learning monads02/09 15:31
leo(of stdlib)02/09 15:31
copumpkinwhat in particular? do you understand the abstract concept? cause there's two dozen people eagerly waiting to explain them in #haskell :)02/09 15:32
copumpkinor is it the agda presentation of them that confuses you?02/09 15:33
leoyes, the adga presentation.02/09 15:34
leoDo you know if there is some Agda library for Monads more simply than sdlib ?02/09 15:34
leoor may be a tutorial of the stdlib presentation02/09 15:35
leo(i'm sorry for my english)02/09 15:35
copumpkinhmm, no, I don't think so. http://web.student.chalmers.se/~stevan/ctfp/html/README.html has various CT structures but no monads yet02/09 15:36
copumpkinand they're also a lot more general than the standard library approach02/09 15:36
copumpkinthere are some other links in there though02/09 15:38
copumpkinthat might point you to simpler monads02/09 15:38
Saizanleo: is the indexing that confuses you? i.e. that return's type is "return : ∀ {i A} → A → M i i A" instead of "∀ {A} → A → M A" ?02/09 15:39
Saizanor the use of record types to group methods?02/09 15:39
leoboth :D I'm reading Indexed.agda now.02/09 15:49
leoin Category/Monad/State.agda02/09 16:04
leoWhat is the equivalent to the haskell State monad ? I mean State s a = State { runState :: s -> (a,s) }02/09 16:04
leo(State s is really the monad)02/09 16:05
Saizannear the bottom there's a State, that's it02/09 16:06
Saizanand StateMonad is the equivalent of haskell's "instance Monad (State s) where .."02/09 16:06
danbrownhelp with rewrite? http://acandystore.org/agda/M.Type.html02/09 16:59
danbrown(sorry for the mess)02/09 17:00
danbrownat the bottom i have a few attempts at defining the (s ⇒ t) clause in the function μt02/09 17:01
danbrowni can force it through with the postulate simp!, but i can't get it through with either of the rewrites simp or simp′02/09 17:01
danbrownwhat i really want is to use the simpler rewrite op∘op=1, but the x it needs to apply to isn't in my scope02/09 17:03
danbrown(that is, the scope of the (s ⇒ t) clause)02/09 17:04
danbrownat a high level what i'm trying to do is model a simple λ-calculus with free type vars and inductive types. i'm using PHOAS to represent binding at both levels (terms are in http://acandystore.org/agda/M.All.Syntax.html), which seems to work fine. the tricky bit is tracking co- and contravariance on type vars so you can ensure that inductive types μα.t are well-formed.02/09 17:33
Saizanheh, if you've to substitute under a lambda you're screwed :)02/09 17:37
danbrownwhy so? λ̵ (λ x → λ̵ (λ y → η x)) works fine02/09 18:35
Saizanoh, by substitute there i meant using PropositionalEquality.subst02/09 18:36
danbrownoh, meta lambda02/09 18:41
danbrownright, that's exactly the problem!02/09 18:41
danbrownhow do i unscrew myself? :P02/09 18:42
danbrownis there really no way to tell agda that these are the same?02/09 18:43
Saizanyou either postulate extensionality or try to see if you can write a conversion by exploiting the specific context where this lambda appears02/09 18:44
danbrownis extensionality known to be unsound?02/09 18:44
Saizani don't think so02/09 18:46
danbrowni did try exploiting the context: the simp! function forces the conversion, but I couldn't get it to work with the simp′ rewrite02/09 19:02
danbrowni'll see what I can do with extensionality02/09 19:02
Saizanwell, simp! works no? can you implement rather than postulate it?02/09 19:24
Saizanah, maybe it doesn't02/09 19:29
copumpkinanyone have any ideas about my question from yesterday? about the binary tree order preservingness02/09 19:39
Saizanwhat do you mean by order preservingness?02/09 19:40
copumpkin:P02/09 19:41
copumpkinwell, my tree has no data in leaves, and data in the inner nodes, and I want to ensure that left branches are always less than node data which is less than right branch02/09 19:42
copumpkinI was thinking of indexing my nodes by the max value in them02/09 19:42
copumpkinbut then I'm not sure what to do about te empty leaves, besides wrapping said max value in a Maybe02/09 19:42
copumpkinwhich feels ugly :)02/09 19:42
Saizanyou'd need min too02/09 19:42
copumpkinyeah02/09 19:45
Saizandata Tree (a : Set) (p : a -> Set) : Set where Leaf : Tree p a; Node : (x : a) -> p x -> Tree (\y -> y < x) a -> Tree (\y -> x < y) a -> Tree p a ?02/09 19:45
Saizani think i remember something similar in one of pigworker's colorful slides02/09 19:46
copumpkinmmm, does he still make those? I haven't seen any in a while02/09 19:46
copumpkinthat looks like it could work nicely02/09 19:46
copumpkinI'll give it a go, thanks!02/09 19:47
pigworkerYeah, my scanning rate is slow...02/09 19:47
copumpkin(mmm, functions in indices :P)02/09 19:47
copumpkinpigworker: you should get an ipad and draw on it! ;)02/09 19:47
copumpkinit's actually not very pleasant02/09 19:47
copumpkinit also doesn't smell like markers02/09 19:47
pigworkerThe medium is the message.02/09 19:47
Saizancopumpkin: it's a parameter, not an index :P02/09 19:48
copumpkinoh yeah02/09 19:48
* copumpkin hides in a hole02/09 19:48
pigworkerSaizan: I beg to differ. It isn't parametric.02/09 19:49
copumpkinoh by the way, what is the point of having relations in higher universes?02/09 19:50
Saizanpigworker: it's not a regular type, but all the constructors produce a "Tree p a"02/09 19:50
copumpkinI see a lot of complexity in the standard library arising from things like orders giving you one universe level for the carrier, then another one for the equality relation and another for the order relation02/09 19:51
pigworkerSaizan: which makes it a particularly well-behaved index, but not a parameter02/09 19:51
pigworkerYou'd see the difference if you coded this in IDesc. You'd make (a : Set) a parameter to the code and (p : a -> Set) the index.02/09 19:52
Saizanah, true02/09 19:53
Saizani've always took index to mean that pattern matching could refine it to something else, i've never seen a formal definition of these terms though02/09 19:54
pigworkerThere's a shortage of terminology here. The "well-behaved" indices are described in Hancock-McBride jargon as "Presbyterian", whilst the ones which get instantiated are "Catholic".02/09 19:55
copumpkinlol02/09 19:55
pigworkerCatholicism enables an equality with transubstantiation.02/09 19:56
copumpkinI feel that being in rome, I should only use the latter02/09 19:56
pigworkerAgda's data declaration thus has Blah <parameters and Presbyterians> : <Catholics> -> Set02/09 19:59
pigworkerMeanwhile, I recommend indexing ordered trees with loose intervals: the indices need to live in the key set extended with bot and top.02/09 20:02
copumpkinhm, that makes sense02/09 20:04
copumpkinone other concern I have is that many of these balanced tree structures temporarily break the invariants during operations02/09 20:05
copumpkinI was wondering if there was a standard way of dealing with that, or if you just have to figure out the details02/09 20:05
Saizanoh, i guess my definition wasn't quite right because it didn't propagate p so you'd lose bounds along the way02/09 20:05
copumpkin(considering that the invariants would be encoded in the indices)02/09 20:05
pigworkercopumpkin: what breaks do you have in mind?02/09 20:13
pigworkersometimes you can deal effectively with a local invariant break by storing a (zipper, anomaly) pair, where an anomaly is something you're trying to stuff in the hole of the zipper02/09 20:15
copumpkinI was thinking of something like red-black trees02/09 20:16
copumpkineven in okasaki's presentation of them, the invariant is temporarily broken, where you have red nodes under red nodes02/09 20:17
pigworkerno need for that02/09 20:17
pigworkerMcKinna and I invented the (zipper, anomaly) method to do red-black trees!02/09 20:18
copumpkin:O02/09 20:18
pigworkerA program so old, it's in EPIGRAM! http://personal.cis.strath.ac.uk/~conor/epigram1/durham/examples/ctm/redblack.epi02/09 20:19
copumpkingreat, thanks :)02/09 20:20
pigworkerThat just does the balancing, not the ordering, however.02/09 20:20
copumpkinyeah, the ordering is straightforward (I think?)02/09 20:21
pigworkerThere are lots of infuriating little choices with ordering. Some take a while to bite.02/09 20:22
copumpkinah, okay02/09 20:22
copumpkinI'll play around with it a bit, anyway02/09 20:22
copumpkinthis looks helpful02/09 20:22
pigworkerHere's one I prepared earlier: http://personal.cis.strath.ac.uk/~conor/fooling/Sorted.agda02/09 20:25
--- Day changed Fri Sep 03 2010
danbrownSaizan: i didn't understand your suggestion earlier—how can i use extensionality to substitute under a lambda?03/09 03:32
danbrowni see it in the abstract—(λx.M)a = M[a/x] = N[a/x] = (λx.N)a ⇒ λx.M = λx.N—but how can i use that to convince agda to do the rewrites i want?03/09 03:35
Saizanas a type:  {A B : Set ℓ} {f g : A → B} → (∀ x → f x ≡ g x) → f ≡ g03/09 03:51
Saizanso, when you've to fill the (∀ x → f x ≡ g x) argument, there you have access to that 'x' that was out of scope earlier03/09 03:52
lispyweird, so I'm trying to get started with agda.  I followed the instructions to install agda mode in emacs, fired up emacs, and then tried to created ~/tmp/Basics.agda and now emacs is using 100% of my CPU without doing anything that I can descern03/09 06:56
lispyI was able to make emacs abort and now I can switch to Basics.agda and see that it is in agda mode...not sure what this means03/09 06:57
lispyI hit C-c C-l and now emacs is using 100% CPU again03/09 06:58
copumpkinhmm, are you using the standard library?03/09 07:00
copumpkincause it might be typechecking all your dependencies for the first time03/09 07:00
copumpkinwhich often takes a while03/09 07:00
lispyCan't exec program: /opt/local/bin/ghci03/09 07:00
lispyProcess ghci exited abnormally with code 103/09 07:00
copumpkinI've found that in the cases when I do kill the underlying ghci process, emacs will peg my CPU and I have to kill it too03/09 07:00
copumpkinso try to avoid that03/09 07:01
copumpkinoh so ghci doesn't work at all?03/09 07:01
lispySo, I have no idea at all why it would look in opt for ghci03/09 07:01
lispyWho would install ghci to opt?03/09 07:01
lispyand how do I make it look in my path03/09 07:01
copumpkinsounds like macports if you're on a mac03/09 07:02
lispyls: /opt/local/bin/ghci: No such file or directory03/09 07:02
lispyas near as I can tell, agda-mode dreamed up that path arbitrarily03/09 07:02
copumpkinhm03/09 07:03
lispyI have an idea03/09 07:03
lispyI never use ghci integration with emacs, but once up on a time I did03/09 07:03
lispyI'll comment out the stuff for that03/09 07:03
lispyI actually think making tools run inside emacs is retarded (I say this as a heavy emacs user)03/09 07:04
lispy(rant provided later upon request)03/09 07:04
lispyOkay, now it finds the module and loads it03/09 07:04
lispyyay03/09 07:04
lispyInteresting, it's not highlighting my agda code yet...03/09 07:05
lispyah, there it goes03/09 07:08
lispyI have to load it before I get coloring03/09 07:08
lispy(by load I mean C-c C-l)03/09 07:08
lispyI wonder how hard it would be to port agda mode to ghci for Haskell stuff03/09 07:11
lispy(I know, ironic after my last statement about retarded to run things in emacs.  I'm more interested for new Haskell users than myself.)03/09 07:11
stevancopumpkin: more red-black trees: http://web.student.chalmers.se/groups/datx02-dtp/html/LLRB2.html   ,   http://bitbucket.org/anyfoo/agda-std-trees/src/tip/RBTree/LLRBTree.agda03/09 14:12
skihm .. "presbyterian index" being one's which you actually pattern-match on ?03/09 14:20
ski(like `Vector (A : Set) (n : Nat) : Set = case n of Zero -> data {}; Succ n -> data {Nil , Cons A (Vector A n)}' in Agda1)03/09 14:22
skipigworker : ^03/09 14:23
Saizanthat'd be catholic, afaiu03/09 14:24
skii thought the catholic ones would correspond more to the indices of GADTs in GHC03/09 14:24
Saizanin fact if you define Vector as a data-family it'd have that role03/09 14:25
Saizans/data-family/GADT/03/09 14:25
Saizan'n', i mean03/09 14:25
skiyeah, but the above was actually `Vector' being a function that gives a different type for each natural number03/09 14:26
Saizanpattern matching like in your snippet seems just another encoding of the same thing03/09 14:26
skiwell, if you define `Foo : Set -> Set', with constructors like `Blah : ... -> Foo (X -> Y)', then that `X -> Y' isn't really something you pattern-match on (you can't match on elements of `Set')03/09 14:27
skiit's just a bunch of constructors, each having their own pecular arguments given to `Foo'03/09 14:28
ski.. at least, afaiu .. i could easily be confused on the details03/09 14:29
Saizani wonder if allowing Set as an index is really justified, actually03/09 14:31
skii don't see why not03/09 14:32
Saizananyhow, presbyterian seems to be one you _don't_ pattern match, but that doesn't get simply passed to the recursive occurrences like a parameter would03/09 14:32
skiafaiui, the type of the indices, when use that way, shouldn't matter (probably restricted by some stratification scheme, though)03/09 14:33
Saizani guess it makes sense if you desugar it to constructors holding equalities03/09 14:34
skiSaizan : yes, that's the part i doubted, and wanted confirmation or otherwise on :)03/09 14:34
skii was thinking that presbyterian indices might be ones which you pattern-match on, while parameters are just constant in the recursive calls, and catholic indices can do "strange" things03/09 14:35
skii.e. basically, for each combination of possible patterns for presbyterian indices, you'd define a *separate* type03/09 14:36
* ski is just speculating here, though ..03/09 14:36
Saizanwhat suggested that?03/09 14:36
skithe separation between presbyterian and catholic03/09 14:37
skii.e. i don't see why "non-constant parameters" couldn't be arbitrary patterns03/09 14:38
ski(.. anyway, it's probably better to wait for pigworker to give an explanation or reference)03/09 14:39
Saizani think it's just that presbyterians don't introduce refinements so they don't have some of the catholic's issues with pattern matching03/09 14:39
Saizanhence Agda putting them on the same side of the colon as parameters03/09 14:40
Saizanbut if you describe data families as fixed points of some indexed functor they'd go in the index03/09 14:41
skihm03/09 14:43
skibtw, what does `codata' give exactly ?03/09 14:44
ski(probably foolishly) i was thinking it'd give be a coninductive record type .. but that appeared not to be the case03/09 14:44
skispeficially, i tried03/09 14:44
ski  codata _#_ {A : Set} (a : A) : A -> Set03/09 14:45
ski    where03/09 14:45
ski    #Irrefl : a # a -> False03/09 14:45
ski  data False : Set03/09 14:45
ski    where03/09 14:45
skii.e. i thought `x # y' would then be a record type, where the `#Irrefl' field existed precisely when `x' and `y' was identical03/09 14:46
Saizanno, you define constructors like for data03/09 14:47
skiyeah .. :/03/09 14:49
Saizanbut you can use the Coinduction module to have coinductive records03/09 14:49
pigworkerhi! (was conspiring with agundry)03/09 15:43
pigworkerthe catholic indices are the ones constrained GADT-style, and it's interesting to consider pattern matching on the presbyterians03/09 15:44
pigworkerInevitably, Hancock refers to presbyterians which admit matching as episcopalians.03/09 15:45
skiok03/09 15:46
pigworkerEpiscopalians do sort-of Catholic stuff (as in Vec) but there's still no transubstantiation.03/09 15:46
skiexample ?03/09 15:47
pigworkerSo, things like the numerical indices for Vec and Fin are fine Episcopalian examples03/09 15:48
pigworkerBut you can't define Martin-Löf's equality in an Episcopalian style.03/09 15:48
skiso must episcopalians be data, or could they be in `Set' ?03/09 15:48
pigworkerThe size question is open.03/09 15:49
skihm .. i suppose i really meant to ask whether *non-trivial* episcopalians (i.e. non-variable patterns) must be data, or could be in `Set'03/09 15:50
ski(and i'm asking about the occurances in the result type of the constructors)03/09 15:50
pigworkerIt's known that parameters can be large. It's known that small indices (of all denominations) are ok. It's not known whether large indices are ok or not, but lots of people guess that they're ok.03/09 15:51
skiok03/09 15:51
skii guess i'm treating indices differently from things you pattern-match on, in my head03/09 15:52
pigworkerThings you patttern match on are indices. An index is anything treated in a non-parametric way.03/09 15:52
skiafaiu, in the original Agda1, you could define a recursive function, which returned a different data type (with different sets of constructors) in each case03/09 15:52
pigworkerYes, Agda 1 supported Episcopalianism but not Catholicism.03/09 15:53
ski.. this being opposed to having a single datatype, but where the constructors have indices which restrict so that only a couple of them must be considered in each specific case03/09 15:53
skiok03/09 15:54
* ski likes the way Alfa can propagate instantiations, when filling a hole ..03/09 15:55
pigworkerConstructors with restricted return types can sometimes be turned into pattern matching, but may sometimes require equality.03/09 15:55
ski*nod*03/09 15:55
skihow about fields/selectors/deconstructors for record types, where the record type is restricted in each case ?03/09 15:56
ski(like my hypothetical `_#_' above)03/09 15:56
skiis there any system with direct support for something like that03/09 15:56
ski?03/09 15:56
pigworkerso, isn't your codata type the one with Catholic "coconstructor"  yuk : False -> a # a  ?03/09 16:00
pigworkerIt's quite reasonable to have indexed record types which offer different fields for different indices (and indeed, structure variance depending on values of internal fields).03/09 16:02
skino, that lets me prove03/09 16:02
ski  #OopsB : {A : Set} {a0 a1 : A} -> Not (a0 # a1)03/09 16:02
ski  #OopsB (#Irrefl ())03/09 16:02
ski(i for some reason called your `yuk' there `#Irrefl', still)03/09 16:03
pigworkerI thought #Irrefl was the destructor. But I think I see.03/09 16:05
skiwhen i fooled around before, trying a constructor for the `codata' just like the `yuk' you suggested, i apparently didn't bother to invent a better name for the deconstructor-now-turned-into-constructor03/09 16:06
skibtw03/09 16:07
ski  #OopsA : {A : Set} {a0 a1 : A} -> (a0 # a1) -> (a0 === a1)03/09 16:07
ski  #OopsA (#Irrefl _) = ===Refl03/09 16:07
pigworkerUsing equality to mark explicit Catholicism, I had   yuk : False -> a = a' -> a # a',  but what you want is  yuk : (a = a' -> False) -> a # a'03/09 16:07
ski(i.e. if the match on `#Irrefl' succeeds, it knows that `a0' is `a1')03/09 16:07
skipigworker : yes, something like that .. except i was wanting to *avoid* going through `.. -> False', hoping to get a more direct encoding03/09 16:09
ski(btw, is there some sane analogue of leibniz-equality for inequality/apartness ?)03/09 16:10
danbrownSaizan: extensionality indeed does the trick: http://acandystore.org/agda/M.Type.html03/09 16:10
danbrownSaizan: thanks :)03/09 16:10
pigworkerski: do you mean intensional apartness (mergeSort # bubbleSort) or a more extensional notion?03/09 16:11
skifor the above `_#_', i was going for something "corresponding" to `data _===_ {A : Set} (a : Set) : A -> Set where ===Refl : a === a'03/09 16:12
* ski always mixes up which is which of intensional vs. extensional equality/apartness03/09 16:13
pigworkerintensional is "same from inside"  mergeSort is not intensionally equal to bubbleSort03/09 16:14
pigworkerif you add intensional apartness, you can't have extensional equality03/09 16:15
skihm, well i suppose i want to be able to prove functions that give the same outputs for same inputs equal03/09 16:15
skii definitely don't want to be able to prove `mergeSort' is distinct from `bubbleSort'03/09 16:16
pigworkerphew!03/09 16:16
skiwhether i would want `mergeSort' to definitely be provably equal to `bubbleSort' is another question03/09 16:16
ski(ideally, i'd like that, but it might be that the system is too weak to prove such things, generally)03/09 16:17
pigworkerI think mergeSort is equal to bubbleSort, but 'mergeSort' is different from 'bubbleSort'.03/09 16:17
skisorry, i'm just using quotes to refer to formal objects from english .. i wasn't referring to the *code* of those03/09 16:18
pigworkerI know, but the point rather is about levels of quotation.03/09 16:18
pigworkerOne can imagine wanting to distinguish implementations, in which case a deep embedding is called for. One might want to distinguish complexity, in which case an instrumented semantics is called for.03/09 16:20
skihm, yes03/09 16:28
skithe former seems more like a meta vs. object language thing to me03/09 16:29
skimaybe one could build some kind of type system keeping track of complexities (with approximations) .. i don't know03/09 16:29
Saizandanbrown: np03/09 16:37
ski(btw, i'm not really happy with having to manually talk about setoids, and functions which respect those, instead of having some kind of real quotient types in the system .. but then i don't really know very much about the obstacles .. would you happen to know any good reference ?)03/09 16:46
pigworkerhmmm, there's some work by Milly Maietti that tells some of the story; meanwhile, team Epigram has most of a plan and some of an implementation, but we haven't written it up except on the blog03/09 16:48
Saizanpigworker: i've heard there was a way to make the representative sneak out through a sigma in the current epigram impl.?03/09 17:00
pigworkeryou can only get the representative if you can prove you respect the equivalence03/09 17:01
ski"Quotients over Minimal Type Theory" <http://www.math.unipd.it/~maietti/papers/exin.pdf>. "About effective quotients in constructive type theory" <http://www.math.unipd.it/~maietti/papers/equ.ps.gz>03/09 17:03
pigworkerwhat I haven't figured out is a nice way to define "choice functions"03/09 17:03
ski(from the titles, those appear like they could be relevant)03/09 17:03
skichoice functions, in which sense ?03/09 17:03
pigworkerski: that looks like the sort of thing, starting from a basis of extensional TT; so the question is if we can OTT-ify it.03/09 17:05
* ski has pondered a little a connective `Forgotten' such that constant functions from `A' to `B' are (naturally) isomorphic to functions from `Forgotten A' to `B' (where `f' being constant here means that `forall x0 x1. f x0 = f x1')03/09 17:05
ski.. so `Forgotten' is a monad and `forget : A -> Forgotten A' is constant, while if you have `Forgotten A' and a *constant* function from `A' to `B', you can get a `B'03/09 17:07
pigworkergiven a function f : (A / S) -> (B / R), you might hope there was an actual function g : A -> B, which, moreover, respected the equivalence (like a setoid morphism), but it ain't always so;03/09 17:07
pigworkerski: Forgotten acts like quotienting with the always-true relation.03/09 17:09
ski(one could also ponder adding a modified Markov principle, replacing the double negation with `Forgotten')03/09 17:09
skipigworker : yeah, i think so, semantically. operationally, the idea was that instead of computing representatives, which we aren't allowed to depend on, we just omit creating the representative (we only know that in principle we could have done so, up to being given representatives for `Forgotten' inputs)03/09 17:11
ski(so `exists x : A. Forgotten (P x)' would be more like `{x : A | P x}' than `Sigma \x : A -> P x')03/09 17:12
pigworkeryes, but there are subtle issues of strictness here03/09 17:13
skimhm ?03/09 17:14
pigworkeryou need to take care that you don't give the liars room to break your definitional equality03/09 17:14
pigworkerall functions are provably constant03/09 17:15
pigworker(in certain contexts)03/09 17:15
skiyou mean in inconsistent contexts ?03/09 17:15
pigworkeryes03/09 17:15
skiyeah .. so i suppose one needs to make sure such things are only evaluated if a proof of the context is given (which should be impossible for the inconsistent ones) .. and that there's no way for things to "escape" that03/09 17:17
* ski idly wonders how Agda2 handles inconsistent contexts .. GHC apparently gives a type error when trying to match an input of type `Equal Int Bool' with `Refl'03/09 17:18
pigworkerAgda won't let you make that match either.03/09 17:19
skipigworker : btw, do you know roughly at what time i should look at <http://www.e-pig.org/epilogue/> for info on plan on quotients in Epigram ?03/09 17:19
pigworkerOne can work in inconsistent contexts as long as one is strict in potential lies. But cutting corners can be fatal.03/09 17:19
ski.. yeah03/09 17:20
ski(the "same" problem appears in typed logic programming, if you allow empty types)03/09 17:20
pigworkerhttp://www.e-pig.org/epilogue/?p=31903/09 17:21
skity03/09 17:21
edwinbSo, we (by which I mean Ulf) have been implementing forcing for datatypes in Agda03/09 17:22
edwinbso far it has had absolutely no effect except in contrived examples, where it's really good03/09 17:22
ski("forcing" being ?)03/09 17:23
edwinbmarking duplicated arguments in data types so that they don't get normalised, checked for equality, etc03/09 17:23
edwinbwe briefly made the type checker twice as fast, but only by ignoring when it broke03/09 17:24
copumpkindoes it affect memory usage? :)03/09 17:25
copumpkinwait, is the AIM already in session?03/09 17:25
edwinbyes, this is day 303/09 17:25
copumpkinoh!03/09 17:25
copumpkinexciting :)03/09 17:26
pigworkeredwinb: for the win, don't you also want to get rid of those arguments (so you never do stuff like substituting in them)03/09 17:26
pigworker?03/09 17:26
edwinbpigworker: so far, we've aimed to avoid doing any work under markings03/09 17:30
edwinbapparently there are some problems with completely getting rid of them which I don't fully understand03/09 17:30
pigworkerpity, 'cos you want to stop all that ghastly whoops-not-sharing-any-more03/09 17:31
edwinbwe have some thoughts about being more aggressive03/09 17:32
pigworkerFaster Agda! Kill! Kill!03/09 17:34
copumpkinI'd be happy if it stayed same speed and just ate less memory :) I'd really like to be able to typecheck the monoidal category module :P03/09 17:35
skipigworker : hehe ;)03/09 17:35
pigworkercopumpkin: I'd worry if it ate less memory but somehow found more ways to spend time on the memory it did use.03/09 17:36
copumpkin:P03/09 17:36
ski(btw .. i was hoping `A : Prop' could be simulated by `A : Set', and then using `Forgotten A' instead of `A' (with some way to speak about the forgotten element of type `A' inside))03/09 17:36
edwinbIn any case, the analysis we do will be usable at run-time03/09 17:38
edwinbso it's not completely wasted effort03/09 17:38
pigworkerski: I think you can do something like that, but you can't have definitional proof-irrelevance, just propositionally equal proofs.03/09 17:38
pigworkeredwinb: it does sound like progress03/09 17:38
skimhm03/09 17:39
skiby03/09 17:39
ski   (P:Prop) <-> (Q:Prop) = (P => Q) /\ (Q => P)03/09 17:39
Laneycopumpkin: Apparently this isn't going to help for records. :(03/09 17:39
skii assume you mean that `P <-> Q' is equal to the latter, when `P : Prop' and `Q : Prop' ?03/09 17:39
copumpkinLaney: aw03/09 17:39
pigworkerski: that's what happens03/09 17:40
skiwell, first i was thinking you wanted to express something like a "dependent equivalence"03/09 17:41
pigworkertoo many = signs03/09 17:41
pigworker<-> computes by recursion on the structure of types03/09 17:42
skilike `(x : A) <-{R x y}-> (y : B)' meaning `((x : A) -> (y : B) * R x y) * ((y : B) -> (x : A) * R x y)' (possibly also including proofs of isomorphism, not only biimplication)03/09 17:42
ski.. anyway, then i get confused on what you mean to express by03/09 17:45
ski  (p:-P) <-> (q:-Q) = TT03/09 17:45
pigworkerThe Epigram 2 <-> is bad notation: it's biimplication for things in Prop, but it's other kinds of equality at other types. It means "equals"03/09 17:45
skiyeah, but afaiu, `p :- P' is not a term, so how can it be claimed to be equal to some other term ?03/09 17:46
pigworkerSo (p:-P) <-> (q:-Q) = TT means "the proposition that 'proofs p and q are equal' computes to the proposition 'true'".03/09 17:46
ski  "We abbreviate p : (:- P) by p :- P when we talk about proof objects at all."03/09 17:46
pigworker:- P is the set of proofs of P. Propositions are *not* types.03/09 17:47
skiok, so then it means `p <-> q  =  TT, whenever `p :- P' and `q :- Q'03/09 17:47
ski(yes ?)03/09 17:47
pigworkeryes03/09 17:47
ski(i was first reading it like you were wanting to express an equality between `P' and `Q', there, only that it was to be dependent on the proofs of the propositions `P' and `Q', somehow .. which didn't seem to make sense, here)03/09 17:48
pigworkerproofs (regardless of proposition) are provable equal; proofs of definitionally equal propositions are definitionally equal03/09 17:49
skiok (sounds sensible)03/09 17:49
pigworkerpropositions themselves are provably equal if they imply each other03/09 17:50
skiyeah (since i think you can prove the compositions are identity, in such a case)03/09 17:50
pigworkerby proof irrelevance!03/09 17:51
ski*nod*03/09 17:51
pigworkerwe can get away with that, because proofs are deleted at run-time anyway03/09 17:52
pigworker(by which I mean closed-term-only run-time)03/09 17:52
skido you think something like `(P : Nat -> Bool) -> Forgotten (exists n : Nat. P n == true) -> exists n : Nat. P n == true' might be sensible ?03/09 17:54
pigworkerHa ha, perhaps, if strict.03/09 17:56
copumpkinis there a running commentary on what's going on at AIM by the way? I saw a talk schedule, but couldn't see what was being worked on in the hacking sessions03/09 17:56
ski(under the operational interpretation of `Forgotten' as identity (i.e. actually construct every "forgotten" value), i think this would be valid .. which might then be admissable, if we don't add anything which would make it impossible to construct the `Forgotten' representatives, if we really wanted to)03/09 17:57
ski(s/admissable/admissable even when not constructing them/)03/09 17:58
pigworkercopumpkin: at least this http://wiki.portal.chalmers.se/agda/pmwiki.php?n=AIMXII.Notes03/09 17:58
edwinbit's being edited as we speak...03/09 17:59
copumpkinaha!03/09 17:59
pigworkerski: nasty dilemma...03/09 18:01
skidilemma, how ?03/09 18:02
pigworkeroperationally, if you make that thing really get the witness by running the construction, you break the abstraction (you can observe the difference between forgotten things);03/09 18:03
skinot if i only allow to eliminate `Forgotten A' by constant functions from `A' to any `B', i think03/09 18:03
pigworkermeanwhile, if you rather make the thing retry all the possibilities starting from 0, the liars will make you spin03/09 18:04
skithe "actually construct representants" operational semantics would be to keep the system "honest", so that since we actually *could* have constructed representants (given they have been constructed for assumptions), we don't actually need to do it03/09 18:05
skiand the "markov-principle" above should of course not return the same natural number witness .. it would typically return the smallest witness (and "doing induction" on the `Forgotten' input, to ensure termination)03/09 18:07
pigworkerski: I don't expect to be able to implement the Markov thing just by respects-equivalence elimination.03/09 18:07
skithe idea being that we could define the above, barring the `Forgotten', and then, after proving that it returns the same witness regardless of the input, we could left-introduce the `Forgotten' there03/09 18:09
pigworkerski: ok, so what might work is to compute the "forgotten" number, check it strictly down to 0, then compute the smallest witness.03/09 18:09
skis/define the above/define the above by induction on the natural number input/03/09 18:09
skipigworker : yeah, except i hoped that the actual operational semantics would not need to compute any of the "forgotten" things .. doing "blind" induction on the forgotten number, so to speak03/09 18:10
ski(i.e., operationally, just loop until you find an example)03/09 18:11
pigworkerski: you can make that the closed-term semantics, but if you do that for open terms, the liars kill you03/09 18:11
skihm .. that could be so03/09 18:12
* ski doesn't know very much of the details of the open-term-reduction used in Agda2 (or Epigram)03/09 18:12
pigworkerThe point is that open-term-reduction often needs to be stricter than closed-term-reduction to ensure that lie-dependent computations don't compute to anything usable.03/09 18:16
skiyeah .. i think that makes sense, since you're working with unknown skolems which you can't operationally check what they actually are03/09 18:17
pigworkerLike when you do a termination proof by an accessibility argument: on open-terms, you need to be strict in the termination proof to let computation unfold. 'cos you can prove that f x = f x terminates!03/09 18:18
skihm. what is "termination proof by an accessibility argument" ?03/09 18:19
pigworkerAs in "Terminating General Recursion" by Bengt Nordström, or as in the "Bove-Capretta method".03/09 18:20
ski"Terminating General Recursion" <http://www.cse.chalmers.se/~bengt/papers/genrec.p(s|df)> 199803/09 18:22
skity03/09 18:22
pigworkerIf you define the domain of a function inductively, you can define the function-restricted-to-its-domain by recursion on the proof of domain-inhabitation; show that all inputs live in the domain, and you're done.03/09 18:24
pigworkerOn open terms, however, you really need to be strict in the proof of domain-inhabitation, even though the regular inputs are enough to determine the control flow. Or the liars kill you. Fortunately, for closed terms, you can dump the proof.03/09 18:26
pigworkerAnd the latter is indeed what happens if you let edwinb compile your program...03/09 18:27
ski(er, s/1998/1988/ :)03/09 18:28
skiok03/09 18:28
pigworkeryeah, it's stood the test of time03/09 18:29
ski"Modelling General Recursion in Type Theory" at <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.57.6947> by Ana Bove,Ana Bove in 200203/09 18:30
ski(argh, stupid paste, s/Ana Bove,Ana Bove/Ana Bove,Venanzio Capretta/)03/09 18:31
skipigworker : anyway, ty for the info03/09 18:31
pigworkeryep; and it goes back to Ana's Licentiate thesis in 1999, with unification as the example03/09 18:31
pigworkerski: ok, yes, I see that you can define the Markov operator you want, and it is strict in the sense I suggested.03/09 18:36
skilic. th. "Programming in Martin-Löf Type Theory: Unification - A non-trivial Example" at <http://www.cse.chalmers.se/~bove/Papers/lic_thesis.pdf> by Ana Bove in 1999-1103/09 18:36
skipigworker : can define it in what system ?03/09 18:37
pigworkeryep, that's the thesis I mean03/09 18:37
pigworkerwith the quotient encoding03/09 18:37
ski(yeah, i figured. i just wanted to give the direct link, for completeness)03/09 18:38
pigworkerso you get  elimForgotten : (X : Set)(P : Forgotten X -> Set)(p : (x : X) -> P (forget x))(r : (x x' : X) -> p x == p x') -> (f : Forget X) -> P f03/09 18:39
pigworkerand elimForgotten X P p r (forget x) = p x03/09 18:40
pigworkeryou do *not* get an eta-rule for (Forget X)03/09 18:41
skiyeah, that sounds more or less like it03/09 18:41
skithough i guess that in that, `x' will actually need to be constructed (unless you specifically avoid it in cases like this, for closed terms, as you said)03/09 18:42
skipigworker : yeah, i already figured that one out :)03/09 18:43
pigworkerski: took me a while to notice; I really wanted that eta-rule.03/09 18:44
skiyeah, it feels nice to have equality "distribute" over the connectives .. but apparently that isn't compatible with the constantness of `forget' (iirc)03/09 18:46
pigworkeryou can write  expose : Forgotten X -> X  by expose = elimForgotten X (\_ -> X) (\x -> x) bullshit03/09 18:46
pigworkeroperationally, expose (forget true) = true, expose (forget false) = false03/09 18:47
pigworkerit's harmless to prove true == false this way, because you already have bullshit03/09 18:48
pigworkerbut it's fatal to take (forget true = forget false) definitionally, because that makes true = false definitionally, too03/09 18:48
skioperationally, i was thinking of `forget E' to reduce to `forget -' (where `-' stands for a nice "bullet"), where that would be a value03/09 18:50
skiand, since we have a monad structure, we'd then have `forget - >>= _' reduce to `forget -' (without even considering the right-hand-argument)03/09 18:51
pigworkerski: same deal03/09 18:51
skihm, what do you mean by "take (forget true = forget false) definitionally" ?03/09 18:51
pigworkerIf P : Forget X -> Set, are P (forget true) and P (forget false) equal sets (as in the conversion rule)?03/09 18:53
pigworkerif you make forget blah compute to forget -, then yes they are!03/09 18:53
pigworkernow if P = \f -> if (expose f) then Nat else Nat -> Nat, I have that Nat is the same type as Nat -> Nat, and I can typecheck (\x -> x x)(\x -> x x).03/09 18:56
pigworkerSo, has AIM decanted to the pub yet?03/09 19:03
skiyes, i was thinking `forget' should be constant, so those two sets should probably be equal, then03/09 19:03
skiok03/09 19:03
skiso i suppose either we need to not treat the sets as equal, or we need to be careful with `expose (forget blah)', somehow03/09 19:04
skipigworker : anyway, ty for the info03/09 19:04
* ski should probably go to sleep soon03/09 19:05
pigworkerdelicate stuff; I should go to the shops...03/09 19:05
danbrownLaney: i have a one-line css patch for the irc logs03/09 20:47
danbrownLaney: add "white-space: nowrap" under "a.time"03/09 20:48
Laneyok03/09 20:48
danbrownLaney: keeps the table row heights under control03/09 20:49
danbrownwhen a.time wraps the rows get excessively tall03/09 20:49
danbrownthanks :)03/09 20:49
* copumpkin was creeped out when he saw orangesquash.co.uk03/09 20:50
copumpkinthought it was my cousin03/09 20:50
copumpkinbut turned out not to be03/09 20:50
djahandarie"Watch the Jesus film live in over forty languages." lol03/09 20:51
Laneydanbrown: there, much better03/09 20:51
danbrownLaney: beautiful, ty :)03/09 20:52
--- Day changed Sat Sep 04 2010
lispyin agda, what is analogous to haskell's Prelude?04/09 04:34
lispyI feel like I want to start there for understanding agda04/09 04:34
copumpkinhmm, the standard library :) you don't really get anything by default, and there's no "catchall module" unlike Prelude in haskell04/09 04:35
copumpkinunless you consider Everything04/09 04:35
copumpkinwhich gives you everything in the entire standard library04/09 04:35
copumpkinmost people just redefine their own datatypes for simple proofs or import the specific modules they need from the standard library04/09 04:36
lispyinteresting04/09 04:36
lispyThe reason I wanted it was because learning the Prelude was a good "exercise" to learn Haskell04/09 04:37
lispyI thought I would repeat that strategy04/09 04:37
lispyThere is an agda type I don't understand, maybe I should start there04/09 04:37
copumpkinwell, reading things like Data.List and Data.Vec04/09 04:37
lispyBut, that question might be better on the mailing list04/09 04:37
copumpkinyou on a mac? you can also navigate the source in the editor04/09 04:37
lispy(the type I'm struggling with is the type of function composition)04/09 04:38
copumpkinfor me right command + click jumps to the definition of any identifier04/09 04:38
copumpkinlispy: oh, the fully dependent one?04/09 04:38
lispycopumpkin: yes04/09 04:38
copumpkinjust the fact that it's big and ugly?04/09 04:38
copumpkin∀ {a b c}04/09 04:39
copumpkin        {A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} →04/09 04:39
copumpkin      (∀ {x} (y : B x) → C y) → (g : (x : A) → B x) →04/09 04:39
copumpkin      ((x : A) → C (g x))04/09 04:39
lispypage 6 of the Ulf's tutorial04/09 04:39
copumpkinoh, hmm04/09 04:39
copumpkinthat'll be something like the one I wrote above, minus the little a, b, c04/09 04:39
lispyyeah04/09 04:39
lispylooks close04/09 04:39
lispy_?_ : {A : Set}{B : A -> Set}{C : (x : A) -> B x -> Set}04/09 04:40
lispy(f : {x : A}(y : B x) -> C x y)(g : (x : A) -> B x)04/09 04:40
lispy(x : A) -> C x (g x)04/09 04:40
lispy(f ? g) x = f (g x)04/09 04:40
copumpkinso ignoring the implicit values04/09 04:40
copumpkin(∀ {x} (y : B x) → C y) → (g : (x : A) → B x) → ((x : A) → C (g x))04/09 04:40
lispy(quick bio break, keep explaining and I'll ask questions when I get back, thanks!)04/09 04:40
copumpkin(f : ∀ {x} (y : B x) → C y) → (g : (x : A) → B x) → ((x : A) → C (g x))04/09 04:41
copumpkinso there are two parameters there, f and g04/09 04:42
copumpking is the simpler one, and it's a dependent function from A to B x, where x is the value of type A that was passed in04/09 04:42
lispyback04/09 04:44
lispyisn't x also a parameter?  Or am I misreading the parens?04/09 04:45
copumpkinjust looking at (g : (x : A) → B x)04/09 04:45
copumpkinit means that g is a dependent function that takes an A as input04/09 04:45
copumpkinbut the return type depends on the input value04/09 04:45
copumpkinso you need to name it x, and pass it into B04/09 04:45
copumpkinso B is a function from A to types04/09 04:45
lispyokay, so unlike haskell you don't have to put arrows between parameters when the delimiters are obvious?04/09 04:45
lispyI shouldn't say parameters04/09 04:46
copumpkinyeah, you don't04/09 04:46
copumpkinyou can also write (x y z : List A) or something04/09 04:46
lispyin haskell it would have been like, g :: A -> B, but in agda you can write g : A B04/09 04:46
copumpkinand that's the same as List A -> List A -> List A04/09 04:46
copumpkinoh, not like that04/09 04:47
copumpkinin agda you'd still have to write g : A -> B04/09 04:47
lispyso how is it that here we can write g : ( x : A) B x, and have it mean (abusing notation) g : A -> B04/09 04:47
copumpkinoh, maybe that is possible, but I've never seen it that way on the last arrow04/09 04:48
copumpkinthat's just a syntactic thing though04/09 04:48
copumpkinI'd leave the arrows in for now04/09 04:48
lispyso we could have written g : (x : A) -> B x ?04/09 04:48
copumpking : (x : A) -> B x04/09 04:48
copumpkinthat's what is up there04/09 04:48
copumpkinoh04/09 04:48
copumpkinI see04/09 04:48
copumpkinyou don't see my unicode04/09 04:49
copumpkin:P04/09 04:49
lispyohh04/09 04:49
copumpkinthere are unicode arrows in there04/09 04:49
lispyYeah, lame04/09 04:49
lispyI'm using xchat aqua04/09 04:49
lispyAny idea how we can resolve this?04/09 04:49
copumpkinbut anyway, yeah, there are some syntactic cases where you can leave arrows out, but don't worry about them for now04/09 04:49
copumpkinI use textual on mac os :)04/09 04:49
copumpkinbut for now, we can just write ascii arrows04/09 04:49
copumpking : (x : A) -> B x04/09 04:49
copumpkinso A is of type Set (the type of types) and B is of type (A -> Set)04/09 04:49
copumpkinthat is, a function that takes an A and gives you a type04/09 04:50
lispySo, why is it incorrect to say, g : A -> B ?04/09 04:50
copumpkinit isn't, but that's a different type04/09 04:50
lispy(I get what g : (x : A) -> B x means)04/09 04:50
copumpkinokay04/09 04:50
copumpkinit's just a more restricted type04/09 04:50
lispyActually. the B x part is a bit fuzzy in my brain04/09 04:50
lispyI think of B x as B is some how indexed by x04/09 04:50
copumpkinA -> B === (x : A) -> ((const B) x)04/09 04:50
copumpkinso A -> B is just sugar for a dependent function that ignores the dependent value, let's say04/09 04:51
lispywhere would you write the foralls in that?04/09 04:51
copumpkinyou don't need them unless you want it to try to infer the type04/09 04:51
copumpkinyou could write forall x -> B x04/09 04:51
copumpkin(so it'll see that B takes an A as input, and figure out that x needs to be of type A)04/09 04:52
lispyforall x such that x in A, const B x04/09 04:52
lispySorry, I didn't meant to use a language feature, I meant the forall in terms of logic04/09 04:52
copumpkinoh, that's just any function04/09 04:53
copumpkinpf : (x : A) -> B x04/09 04:53
copumpkinmeans that for all values of x, we can prove B of x04/09 04:53
lispyHaskell signatures have taught me that the placement of the forall matters.  So I want to make sure I understand where they (implicitly) are04/09 04:53
copumpkinA might be naturals, and B might be a proposition saying the natural is even04/09 04:53
copumpkinso pf : (x : Nat) -> even x04/09 04:53
copumpkinthat's clearly not true, so you wouldn't be able to prove it04/09 04:54
* lispy nods04/09 04:54
copumpkinthe foralls might even be easier to think about in agda, since they're fairly consistent04/09 04:54
* copumpkin shrugs04/09 04:55
lispyis it okay if I back up for a second?04/09 04:55
copumpkinsure04/09 04:55
lispySupposed I defined compose the way it's defined in Haskell, and with that type.  Would it be wrong in some way in Agda?04/09 04:55
copumpkinnot at all04/09 04:55
copumpkinit's just not as flexible as it could be04/09 04:55
lispybecause then it could only work on values instead of types too?04/09 04:56
copumpkinagda gives you more flexibility with the types, and as such the types can get more bloated04/09 04:56
copumpkinnot so much working only on values04/09 04:56
copumpkinbut the types are fixed04/09 04:56
copumpkinin agda, the type of the output can depend on the value of the input04/09 04:56
copumpkinso f 0 might give me a Bool04/09 04:56
lispygot it04/09 04:56
lispythanks04/09 04:57
copumpkinand another input might give me another type as output04/09 04:57
copumpkinnp04/09 04:57
lispyyeah, that's pretty cool04/09 04:57
lispyI guess that property would be really interesting in a parser?04/09 04:57
copumpkinyeah, it's pretty awesome04/09 04:57
copumpkinit's amazing everywhere, really04/09 04:57
* lispy nods04/09 04:57
lispyI've studied Isabelle a bit, have you ever used that?04/09 04:57
copumpkinfor example, you could write a printf that actually parses the format string, and gives you a function that's only accepts the right types04/09 04:57
copumpkinnope :/04/09 04:57
copumpkin(oh, going back to your question, about haskell composition, http://www.cs.nott.ac.uk/~nad/listings/lib/Function.html#894)04/09 04:58
copumpkinthat's plain old haskell composition04/09 04:59
lispyisabelle's programming language is based on ML so the syntax is rubbish, but a cool thing about it is that you can state totally arbitrary theorems/properties about the code you wrote and then try to prove them (whereas you can do the equivalent thing here, the proofs are a bit more like programs than they are in agda)04/09 04:59
copumpkinthe proofs are very much programs in agda too, in fact they look identical :)04/09 04:59
lispyno that's what I mean is different04/09 05:00
lispyIn isabelle your theorems can be kind of separate04/09 05:00
copumpkinoh I see04/09 05:00
copumpkinyeah04/09 05:00
lispyWhich can also be nice, but I <3 the agda syntax04/09 05:00
lispyWhich is why I'm here instead of in #isabelle right now :)04/09 05:01
copumpkinwell, in agda you can choose whether to keep them separate or not04/09 05:01
copumpkinthey keep the same syntax though04/09 05:01
lispythanks for the example file BTW04/09 05:01
copumpkinoh no problem04/09 05:01
lispycan you define _;_ in agda?04/09 05:01
copumpkinif you look at http://www.cs.nott.ac.uk/~nad/listings/lib/Function.html#894 for example, you'll see it's almost identical to haskell's equivalent thing04/09 05:01
copumpkinhmm, I think semicolon might be reserved04/09 05:02
lispyah bummer, some math texts use _;_ as flip _o_04/09 05:02
copumpkinah :/04/09 05:02
lispyat first I thought that was confusing but it's actually kind of nice to be able to write function composition in application order04/09 05:03
lispyLooking at _o_ these days, it's not as confusing as I once thought it was04/09 05:05
lispyit's a very long type signature, but it's logical04/09 05:05
copumpkinyeah, the stuff gets easier to read quickly :)04/09 05:06
copumpkinunless you go looking at that presburger arithmetic solver :)04/09 05:06
lispydoes agda have anything analogous to type classes?04/09 05:07
copumpkinnot really, but you can pretend you do with records, although you don't get the automatic lookup of instances04/09 05:07
copumpkinthe records and modules are way more flexible than haskell's04/09 05:07
lispydoes anyone work on performance opportunities in the code gen?  It seems like agda programs would have a lot of information available to aid the compiler in generating very lean code04/09 05:08
copumpkinhardly anyone even uses agda's compiler(s) but even if they did, I don't think they do much in terms of optimization04/09 05:09
copumpkinthey go through haskell with a lot of unsafeCoercing I think04/09 05:09
copumpkinbut there have been papers on the additional opportunities presented by all the extra compile-time knowledge04/09 05:09
lispyriht04/09 05:10
lispyright*04/09 05:10
lispyI think performance is actually important, even for a language as niche as agda04/09 05:10
copumpkinI think most attempts are still trying to make the language itself more pleasant to use04/09 05:10
* lispy wonders how open the agda compiler development is04/09 05:10
lispyokay, essentially BSD license, that's good04/09 05:14
lispyoh, darcs repo, that's cool too04/09 05:15
copumpkinit's pretty actively developed, too04/09 05:15
lispymaybe I'll get involved at some point04/09 05:15
lispyNeed to learn the language a bit :)04/09 05:15
copumpkin:)04/09 05:16
copumpkinI'd set simple things to prove first, just to get a feel for it04/09 05:16
copumpkinmaybe even things that djinn could prove04/09 05:16
lispyone "project" that occurred to me was following the typing haskell in haskell paper but doing it in agda04/09 05:18
lispyI have no idea how daunting it would be, but I know I would learn a lot by the end about haskell, type checkers, agda, and proofs04/09 05:19
copumpkinoh04/09 05:20
copumpkinit'd be pretty hard :)04/09 05:20
copumpkinI'd start with trivial properties of natural numbers and stuff like that04/09 05:20
copumpkinmaybe try to prove associativity or commutativity of addition04/09 05:20
copumpkinor stuff about even/odd numbers04/09 05:20
lispyokay, the agda devs need to learn the power of tagging in darcs :)04/09 05:21
lispy(better yet, we need to make darcs automatically do invisible tags (checkpoints?) for users)04/09 05:22
copumpkinyeah04/09 05:24
lispyI actually have a secret motive in having agda be high performance (and me learning agda)...what if we rewrote the core of darcs in agda??04/09 05:25
copumpkinalso, something to realize is that agda's inductive families (like haskell's GADTs) are ridiculously powerful, and if you can express your properties/proofs in terms of very expressive types defined that way, they tend to be easier to work with04/09 05:26
copumpkinI didn't realize that at first and wrote even uglier stuff than I do now04/09 05:26
lispyI think I learned that bit of advice from glguy's agda snippets04/09 05:26
lispyat least, assuming I understand you correctly (which I may not being I'm a n00b)04/09 05:27
copumpkinprobably do04/09 05:27
copumpkinsomething like defining evenness for numbers, for example04/09 05:27
lispyThe way I internalized his examples is that you cookup data types that are kind of like definitions you'll use in a proof.  Then you write some functions over those data types to prove your lemmas then you can apply those lemmas to your "normal" code definitions04/09 05:28
copumpkinone way would be even : Nat -> Set; even 0 = \top; even (suc zero) = \bot; even (suc (suc n)) = even n04/09 05:28
copumpkinor a mutually recursive version with odd in there too04/09 05:28
copumpkinbut it's a lot more pleasant to make a custom datatype for it04/09 05:29
lispyI think I've seen the mutually recursive variant of that, though possible in Isabelle04/09 05:29
lispyand how does the data type variant look?04/09 05:29
copumpkinthere are a few ways of doing it, really04/09 05:30
copumpkinlet me think of one04/09 05:30
lispyI would think that you define a data family where even is a constructor and so is odd04/09 05:30
copumpkinyeah04/09 05:31
copumpkinindexed by the Nat04/09 05:31
lispyright04/09 05:31
copumpkinwell, that's not really giving you a statement about the evenness of the number though04/09 05:31
copumpkinbut something like04/09 05:31
copumpkindata Even : Nat -> Set where zero : Even 0; sucsuc : forall n -> Even n -> Even (suc (suc n))04/09 05:32
copumpkinyou could even call the constructors something like 0# and 2+_04/09 05:33
copumpkinso a proof of Even 4 would be 2+ 2+ 0#04/09 05:33
lispyoh actually, agda repo does have tags, even as recently as the last release04/09 05:33
lispyI wonder why lazy get was so slow04/09 05:33
copumpkinor you could have a pair of mutually recursive datatypes04/09 05:34
copumpkinwhich is very cute04/09 05:34
copumpkin:P04/09 05:34
lispyyes actually04/09 05:34
lispyThat sounds nice now that you mention it04/09 05:34
copumpkinmutual; data Even : Nat -> Set where zero : Even 0; suc : forall n -> Odd n -> Even (suc n); data Odd : Nat -> Set where suc : forall n -> Even n -> Odd (suc n)04/09 05:35
copumpkinnote the overlapping constructor names :P04/09 05:35
copumpkin(also, that unlike haskell, agda is linear unless you put it in a mutual block)04/09 05:36
copumpkinso if A appears below B in the file, B won't see A04/09 05:36
lispySadly, I don't know what that means04/09 05:36
lispyah04/09 05:36
copumpkinlispy: here's a simple example: http://pastie.org/113737804/09 05:41
lispycopumpkin: yes, very pretty04/09 05:42
copumpkinone thing to try proving might be that the sum of two evens is even, and stuff like that04/09 05:42
lispycopumpkin: and I think this follows typical development of mathematics.  Even and odd are your definitions, now you can state (and prove) propositions about them.  Quite amazing considering I first learned programming in Visual Basic and it was nothing like maths!04/09 05:43
copumpkinyeah :)04/09 05:43
copumpkinanyway, this same technique can be used to express arbitrary relations04/09 05:44
copumpkinthe <= in the standard library is defined inductively too04/09 05:44
lispyI should rewatch glguys agda talk this weekend while this is fresh, maybe i'll understand more this time around04/09 05:45
copumpkinis it online?04/09 05:46
lispywait a sec, did we not post it??04/09 05:46
lispyhttp://vimeo.com/channels/galois04/09 05:46
copumpkinbeats me, I haven't ever seen a galois talk04/09 05:46
copumpkinaha04/09 05:46
lispyhttp://www.galois.com/blog/2010/08/10/galois-inc-wins-three-department-of-energy-small-business-research-awards/  I'm currently working on this project from that list: Collaboration and Sharing on the Grid04/09 05:48
copumpkinah cool04/09 05:49
lispycopumpkin: http://www.galois.com/blog/2010/06/11/tech-talk-introducing-well-founded-recursion/04/09 05:49
lispycopumpkin: I can't find it on vimeo, but I'm like 90% that we recorded it04/09 05:51
copumpkinah, I'd like to see that if you can get someone to upload it :)04/09 05:51
copumpkinI'll watch the other talks in the mean time04/09 05:51
copumpkinhow many people show up for these talks?04/09 05:52
lispycopumpkin: it really varies a lot04/09 05:52
lispycopumpkin: and not all talks are public04/09 05:52
copumpkinah I see04/09 05:53
lispycopumpkin: but we regularly get PSU students (and sometimes profs), people from random companies around portland (from startups to Intel) and then usually about 10 galois folks.  so ya know, like, 10-25 people?04/09 05:53
copumpkinthat sounds really nice04/09 05:54
copumpkinlispy: oh, another quick note about agda which may not be obvious, is that all data is finite04/09 05:54
lispyoh and speaker notoriety  matters.  Don Stewart can bring a bigger crowd than me by far :)04/09 05:54
copumpkinlispy: so no infinite lists for you, unless you use the (slightly more esoteric) codata construct04/09 05:55
lispythat makes sense04/09 05:55
lispyI've familiar with codata from sigfpe's blog04/09 05:55
copumpkinah ok04/09 05:55
lispyall hail sigfpe's blog!04/09 05:55
copumpkinyeah, it's pretty fun :)04/09 05:55
Mathnerd314say, I did read that blog from beginning to end a few months ago :p04/09 05:56
lispyMathnerd314: and your mind when from this big ( |    | ), to this big?  (|                                                                              |) ?04/09 05:56
Mathnerd314more like (|             |) to (|                      |)04/09 05:57
lispyit's truly a high quality blog, that's for sure04/09 05:57
lispyI think ezyang's blog will rival it in time :)04/09 05:58
Mathnerd314idea: codata is a monad, so Agda should get do-notation for it04/09 05:59
Mathnerd314you can think it over while I sleep04/09 06:00
Adamantlispy: I was thinking the Grid bit was for the Smart Grid stuff.04/09 06:12
AdamantI was like, "yes, please give me verifiable code so haX0rs do not turn my thermostat up to 100"04/09 06:13
lispyAdamant: ah, more like open science grid04/09 06:15
Adamantyeah, still a worthy pursuit04/09 06:16
lispyhttp://www.opensciencegrid.org/  LHC runs on OSG :)04/09 06:16
lispyAdamant: IIRC, we have made proposals to help with Smart Grid stuff04/09 06:16
lispyI don't think we won any of those04/09 06:16
Adamantlispy: damn.04/09 06:17
lispyeither that or we didn't hear back yet, I lost track :)04/09 06:17
Adamantlispy: good luck.04/09 06:17
lispySomeone really needs to be working on04/09 06:17
AdamantI would like a non-crappy language and good secure web libraries for anything that gets used04/09 06:17
Adamantand it sounds like Galois is all about that04/09 06:18
lispysometimes the pipeline for working on an identified problem can be several years.  so it could be that in say, 5 years time we've helped04/09 06:18
Adamantyeah.04/09 06:18
Adamantlook at epub; we're finally all using or looking at ereaders now04/09 06:18
Adamantit was designed back in the 2000-2002 era IIRC04/09 06:18
lispyheh yeah04/09 06:19
* Saizan is going to use an AVL tree to index his terms04/09 12:28
copumpkinmy emacs agda always opens up with the agda status on the right04/09 20:10
copumpkinand I can move it back under the text input by hand, but it never sticks04/09 20:10
copumpkinany idea how to force it to open underneath?04/09 20:10
lispycopumpkin: what is the agda status?  Mine doesn't do that...04/09 20:15
copumpkinyeah, mine didn't in the past either04/09 20:15
copumpkinI just mean the little bit that tells you the types of holes and context04/09 20:16
copumpkinand normalized terms and the like04/09 20:16
lispyokay, it's a feature I haven't explored yet04/09 20:16
lispySounds handy though04/09 20:16
copumpkinyeah, it's invaluable04/09 20:17
copumpkinlispy: the top commands I use are C-c C-, inside a hole04/09 20:17
copumpkintells you what's expected and what the context is04/09 20:17
copumpkinC-c C-a fills in easy holes for you04/09 20:18
copumpkinC-c C-r will fill in easy holes with additional holes if only one constructor (or lambda, or record) fits, or you can write what to fill in and it'll put in the right number of arguments for you04/09 20:18
copumpkinC-c C-n will normalize (sort of evaluate) any term you write in04/09 20:18
lispyhttp://www.cs.nott.ac.uk/~nad/listings/lib/Data.List.html04/09 22:13
lispyIn that definition of List A, why is there an {a}?04/09 22:13
copumpkinit's universe polymorphism04/09 22:13
copumpkinnot fundamental04/09 22:13
lispywhy not, data List ( A : Set ) : Set where ..04/09 22:14
copumpkinmeans the list can contain regular types, or types of types, or types of types of types04/09 22:14
copumpkinand so on04/09 22:14
copumpkinthat would work too, but this is more general04/09 22:14
copumpkinSet == Set zero04/09 22:14
copumpkin(just a syntactic shortcut)04/09 22:14
lispyso my definition would be lists of values only04/09 22:14
copumpkinyeah, values of any "small" type04/09 22:15
copumpkinso anything you can write in haskell, for example04/09 22:15
lispyhow do you type this identifier? _??_04/09 22:16
copumpkinbut you could also conceivably do Nat :: Bool :: Fin 3 :: List Bool :: []04/09 22:16
lispy_::^r_ ?04/09 22:16
copumpkin_\::_04/09 22:16
copumpkinI'm assuming04/09 22:16
copumpkinyour encoding was lost and it looks like question marks :)04/09 22:16
lispystupid xchat04/09 22:16
lispyIt has a super script r on the ::04/09 22:16
copumpkinhttp://www.codeux.com/textual/ I never looked back04/09 22:17
copumpkinoh04/09 22:17
copumpkin_\::\^r_04/09 22:17
lispyI feel like I tried textual and it was missing some must have features for me04/09 22:17
copumpkinah04/09 22:17
lispyI might need to do this: http://fileshar3.info/files/aha...utf8./Screen%20shot%202009-10-12%20at%203.28.35%20PM.JPG04/09 22:20
* lispy relogs04/09 22:20
copumpkinyep :)04/09 22:20
lispyhit me with some unicode04/09 22:23
lispy_∷ʳ_04/09 22:23
lispyCan you see it now?04/09 22:23
copumpkinyep04/09 22:24
* lispy wonders why you'd make an irc client in this day and age that doesn't default to utf804/09 22:27
--- Day changed Sun Sep 05 2010
lispyAm I right that, Agda is really intended for proving statements and not for (directly) providing implementations of anything?05/09 00:39
benmachinedoes agda-mode want haskell-mode installed?05/09 00:39
lispyPart of why I ask: Agda1 had Int but Agda2 does not05/09 00:39
copumpkinlispy: the question in the topic indicates that people haven't decided yet05/09 00:40
copumpkinlispy: well, you have Data.Integer05/09 00:40
lispycopumpkin: That's my next question.05/09 00:40
copumpkinwhich I believe has a compile-time binding to Haskell's Integer type05/09 00:40
copumpkineven though it's expressed as an algebraic type for ease of reasoning05/09 00:41
lispycopumpkin: it seems that Data.Integer is for arbitrarily sized integers.  That could give me "incorrect" proofs if i translated code using Integer to code using a bounded int type in some other language05/09 00:41
copumpkinoh, machine words and the like?05/09 00:41
lispycopumpkin: http://www.cs.nott.ac.uk/~nad/listings/lib/Data.Integer.html05/09 00:42
copumpkinthe other day I wrote SizedWord n = Fin (2 ^ n) :P05/09 00:42
copumpkinyeah, most of the time you want to talk about the general algorithm, and not deal with machine-level specifics05/09 00:42
lispycopumpkin: yes, I mean one  possible use of Agda programs is for incorporation into a larger Haskell program. You could imagine implementing key core algorithms in Agda. But I'm concerned that you'd end up with slow algorithms.05/09 00:43
lispycopumpkin: well, talking about the general algorithm so generically means I could still have a buggy implementation05/09 00:43
lispycopumpkin: it would be at least nice if I could get the final proof to have some "proof obligations" related to assumptions I'll have to make when I port the algorithm (machine word size being one)05/09 00:44
Saizanbenmachine: yes05/09 00:44
benmachineSaizan: do you know where I can get haskell-mode that isn't currently down?05/09 00:44
copumpkinlispy: yeah, not much work has been done on actually extracting stuff to haskell, as far as I know. The compilers don't seem to see much action in general05/09 00:45
copumpkinlispy: it's also harder than say coq, because it doesn't really have a prop/set separation05/09 00:45
copumpkin(even though I think Prop is reserved or actually available still)05/09 00:45
lispycopumpkin: I'm unfamiliar with that distinction or coq05/09 00:46
Saizanbenmachine: you could use ssh instead of http, i guess :)05/09 00:46
lispycopumpkin: is it a logic vs. meta-logic distinction?05/09 00:46
benmachineSaizan: I don't have ssh :(05/09 00:46
benmachineI mean I do05/09 00:46
benmachinebut I don't have an account05/09 00:46
Saizanbenmachine: maybe your distro has it packaged?05/09 00:47
lispycopumpkin: is this what you meant about using Haskell under the hood? {-# BUILTIN NATURAL ℕ    #-}05/09 00:48
copumpkinlispy: nah, it's just a distinction between "programming types" versus "propositions"05/09 00:48
copumpkinlispy: yeah, I think something like that05/09 00:48
Saizanbenmachine: http://www.archlinux.org/packages/community/any/emacs-haskell-mode/ <- you could download arch's package05/09 00:48
copumpkinlispy: where programming types have an effect at runtime and propositions don't05/09 00:48
benmachineSaizan: oh, I'm on arch :)05/09 00:48
copumpkinso all propositions can get erased from the runtime representation05/09 00:48
benmachineI just tend to prefer getting haskell stuff from darcs or whatever than by pacman05/09 00:48
Saizanthe pragma is {-# COMPILE05/09 00:48
Saizanbenmachine: arch's one worked fine for me05/09 00:49
lispycopumpkin: gotcha05/09 00:50
lispycopumpkin: for me, being able to extract high performance code in an automated way would make things like agda/coq/isabelle significantly more accessible05/09 00:51
lispycopumpkin: hence my very pointed questions :)05/09 00:51
benmachineSaizan: yeah, apparently for me too, thanks05/09 00:51
copumpkinlispy: yeah, unfortunately that's still open research questions on how to do well :)05/09 00:51
lispyyeah, I guess I need to familiarize myself with that research or something05/09 00:52
copumpkinwell a lot of it simply isn't there yet :P05/09 00:53
copumpkinclosest you'll get to something sort of DTish but also "practical" is ATS05/09 00:53
Saizanjust compile with cool optimizations and import via FFI :P05/09 00:53
copumpkinwith its horrendous syntax :P05/09 00:53
copumpkinand buttloads of inline C05/09 00:53
lispycopumpkin: I'm pretty ignorant of the challenges though.05/09 00:56
* benmachine immediately forgets his entire emacs tutorial, again05/09 00:56
lispycopumpkin: like the challenges to using a machine Int05/09 00:57
copumpkinlispy: how much "ridiculous" type-level haskell have you written? it's possible to do a fair amount of type-level stuff that simulate common uses of DTs with GADTs and/or type families05/09 00:57
copumpkinlike, my failed attempt at statically sized vectors :P05/09 00:57
lispycopumpkin: have you seen my MS thesis?05/09 00:57
copumpkin(with Saizan's generous contributions :)05/09 00:57
copumpkinlispy: nope, what's it on?05/09 00:57
* lispy grumbles about his blog being ridiculously slow05/09 00:58
lispyoh, I have files hosted on community.haskell.org, is that down again?05/09 00:58
lispyFFS05/09 00:58
copumpkinlooks like it :P05/09 00:58
* lispy stabs community.haskell.org05/09 00:58
lispycopumpkin: files.codersbase.com/thesis.pdf05/09 00:59
lispycopumpkin: er, http://files.codersbase.com/thesis.pdf05/09 00:59
copumpkinah, cool, I'll check it out05/09 00:59
copumpkinthanks05/09 00:59
lispycopumpkin: basically using gadts to help with invariants in Darcs05/09 01:00
lispycopumpkin: I'd love to do some proofs of darcs itself at some point.  Igloo was doing that for Camp (a darcs clone)05/09 01:00
copumpkinyeah, I see him talking about it in #coq occasionally05/09 01:01
lispywhich is down because community.haskell.org is down :( :(05/09 01:01
* lispy is DEEPLY bothered by the communities inability to keep these servers running05/09 01:01
lispycommunity's05/09 01:01
lispyI'd probably take a totally different approach than Igloo05/09 01:02
lispyI think I would actually model the repository "things" in the proofs05/09 01:02
lispyCome up with an abstract view of directory trees, for example05/09 01:03
lispyand make a notion of when they are equivalent05/09 01:03
jmcarthurMAlonzo expects BUILTIN STRING to be a linked list, i suppose? i can't have the builtin string be something like ByteString or Text, i'm guessing?05/09 03:02
djahandarieAghh longer paper... I hate writing papers, and that's probably the reason I won't do anything beyond undergrad05/09 03:06
jmcarthurshapr: i didn't realize you were an #agda lurker05/09 03:35
shaprshh! I'm lurking!05/09 03:36
lispyheh, #agda is just another way to spell #haskell ;)05/09 03:43
lispyShould this module: http://www.cse.chalmers.se/~ulfn/code/tphols09/Basics.html#283  cleanly type check in agda 2.2.6 with 0.3 of the standard lib?05/09 09:15
lispyI get a bunch of things in yellow05/09 09:15
lispyand then when I try to import it elsewhere, I'm told, "Unsolved metas at the following locations:"05/09 09:16
Saizanlispy: it could be universe polymorphism's fault05/09 12:15
Saizanit's amazing how simpler proofs can get when using the right representations05/09 17:37
benmachineok, I'm still doing my first exercises from Dependently Typed Programming in Agda, and I've introduced a second datatype using the _::_ constructor, and this has given me 'Unsolved metas' in locations using the first data type, what's up with that?05/09 17:50
kosmikusyou might need more type signatures once the constructor is overloaded05/09 17:51
benmachinehow do I give an implicit argument to an infix function?05/09 17:53
benmachine(i.e. the A in data _==_ {A : Set}(x : A) : A -> Set where)05/09 17:54
TheOnionKnightyou have to write it in the non-infix form, "_==_ {A} x y", for example.05/09 17:55
benmachineah, okay05/09 17:55
benmachinethanks05/09 17:56
lispySaizan: But, that code is from the introduction to agda, shouldn't it be correct?05/09 19:15
lispySaizan: I can't get it to work and that's sort of blocking me05/09 19:16
copumpkinwhat's the code?05/09 19:16
benmachine09:15:13 < lispy> Should this module: http://www.cse.chalmers.se/~ulfn/code/tphols09/Basics.html#283  cleanly type check in agda 2.2.6 with 0.3 of the  standard lib?05/09 19:19
benmachinecopumpkin: ^ that I assume05/09 19:20
lispycopumpkin: yes, that code05/09 19:20
lispycopumpkin: I'm told that I have unsolved metas, and quite a few of them at that05/09 19:20
lispyI tried to google or unsolved metas but I didn't find much to get me unstuck either05/09 19:21
copumpkinoh the issue is that they've since added universe polymorphism to most things (like Vec)05/09 19:22
copumpkinand that means your forall A (where you'd expect A to be Set) could be Set zero, Set (suc zero) and so on05/09 19:23
lispyWow.  I got that stuff from the most recent tutorial I could find :(  Something in 200905/09 19:26
lispycopumpkin: I'm glad you understand the problem, but I don't understand how to fix it.  Any ideas?05/09 19:31
copumpkinjust write forall {a} {A : Set a}05/09 19:33
copumpkinor just write {A : Set}05/09 19:33
lispythanks, I think I'll use the latter on to keep the original meaning05/09 19:34
lispythat way it shouldn't require modifying the proofs05/09 19:34
lispyright?05/09 19:34
copumpkinyeah05/09 19:34
lispythanks05/09 19:35
lispytis working!  yay05/09 19:39
copumpkin:)05/09 19:40
lispyNF : ℕ → Set05/09 19:57
lispyNF n = Vec ℕ n05/09 19:57
lispythe description of that says:05/09 19:57
lispyThe values in NF n are vectors recording the number of occurrences of each05/09 19:57
lispyvariable:05/09 19:57
lispyNF n = Vec N n05/09 19:57
lispySo then Vec N n is a list of length n with entries from N, right?05/09 19:58
Saizanyes05/09 19:58
lispySo, how does that record the number of occurences of each variable?05/09 19:58
lispyWouldn't Vec N n be a type?05/09 19:58
lispyan element of Set zero in this case05/09 19:58
Saizan"the values in NF n"05/09 19:58
copumpkinyeah, it is05/09 19:58
copumpkinthere's presumably a counting function somewhere05/09 19:58
copumpkinthat returns a value of NF n05/09 19:58
lispyyou mean like this: eval : ∀ {n} → Expr n → NF n05/09 19:59
Saizan"the values in NF n" means those x such that "x : NF n" holds05/09 19:59
Saizaneval seems an odd name, but that's the type one'd expect05/09 20:00
jmcarthurwith --universe-polymorphism, is {A : Set A} the same as {A : Set 0} or is it the same as forall {a} {A : Set a}?05/09 20:01
jmcarthuroops05/09 20:01
jmcarthurthe first one should be {A : Set}05/09 20:01
jmcarthurinstead of {A : Set A}05/09 20:02
copumpkinit's same as Set zero05/09 20:02
copumpkin(don't think you can use number literals as levels, unless you stop using them as naturals too)05/09 20:02
jmcarthurokay, that's what i figured, but i was confused by your earlier suggestion of either forall {a} {A : Set a} or {A : Set}05/09 20:02
jmcarthuryeah i was just doing shorthand05/09 20:02
lispyis \forall {a} ... treated the same by agda as forall {a] ... ?05/09 20:03
lispyThat is, can you use "forall" in place of the unicode version?05/09 20:03
lispydo you guys know the key strokes for the blackboard bold [ ?05/09 20:20
lispyI tried \b[ but I get something weird when I dot hat05/09 20:21
TheOnionKnightDon't know, but if you have it in a a file you can put the cursor over it and do  C-u C-x = to find out.05/09 20:22
lispyoh, the pdf I'm looking at cheated05/09 20:25
lispyIt's not a symbol I can enter05/09 20:25
lispyin the source it's [\|05/09 20:25
* Saizan wishes Agda had an eta-rule for \bot05/09 22:20
benmachinehow do fixity declarations interact with overloaded operators?05/09 23:22
benmachineone for all?05/09 23:23
Saizangood question05/09 23:30
copumpkinbenmachine: I think so05/09 23:42
benmachinethat's what I would expect but this paper seems to have given _::_ a second fixity declaration05/09 23:44
benmachinewhich wouldn't be that surprising except it's supposed to be a literate agda file05/09 23:44
--- Day changed Mon Sep 06 2010
benmachinehttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=29750#a29750 I'm fairly sure eqsuc is redundant here but I don't know how to get rid of it, I suspect it involves a 'with' but I can't make that work, any pointers?06/09 01:17
copumpkincong suc06/09 01:19
benmachinecong wat06/09 01:19
copumpkincong is x == y -> f x == f y06/09 01:19
benmachineoh06/09 01:19
* benmachine fiddles06/09 01:20
copumpkincong is in Relation.Binary.PropositionalEquality(.Core) I think06/09 01:20
benmachinecopumpkin: but can I pattern-match on +-right-identity directly?06/09 01:26
copumpkinyou could with it, but then the type inference won't figure out the implicit cor you06/09 01:27
copumpkinfor you06/09 01:27
copumpkin+-right-identity {suc n} with +-right-identity {n}06/09 01:28
copumpkin... | refl = ?06/09 01:28
copumpkinor you could use rewrite on it06/09 01:28
benmachine...sometimes I get the feeling that this tutorial skipped over half the language >_>06/09 01:29
benmachinebut that with thing goes, n + zero != n of type Nat06/09 01:29
benmachinewhen checking that the pattern refl has type n + zero == n06/09 01:29
copumpkinah yeah06/09 01:30
copumpkinyou need to bring more things into scope and use dotted patterns on them06/09 01:30
copumpkinpattern matching can be ridiculously difficult in agda :)06/09 01:31
benmachineho hum06/09 01:31
benmachineshould I just stick to cong then?06/09 01:31
copumpkinyes, that's how I think most people would write that06/09 01:31
benmachineok, thanks06/09 01:32
copumpkinalthough the basic idea behind that error is that some of your parameters or metas are "too free06/09 01:32
copumpkinso say for example you had a function like06/09 01:32
benmachineyeah, but what parameters? I can't see any that aren't forced06/09 01:32
benmachineok go on06/09 01:32
copumpkinf : Nat -> Nat ->06/09 01:33
copumpkinf : (x : Nat) -> (y : Nat) -> x == y -> ...06/09 01:33
copumpkinand you wrote06/09 01:33
copumpkinf x y refl = ...06/09 01:33
copumpkinit would complain that x != y06/09 01:33
copumpkinbecause in a sense you're letting them be different in your pattern06/09 01:33
copumpkinthe solution is to write f x .x refl or f .x x refl06/09 01:34
benmachineoh, this is where dot-patterns come in?06/09 01:34
copumpkinyeah06/09 01:34
copumpkinthe dot means that the value is determined elsewhere06/09 01:34
copumpkinso in your case, it isn't a parameter06/09 01:34
benmachineso I'd heard, but I've not actually used them yet06/09 01:34
copumpkinbut you still need to bring the unfree thing into your pattern to reveal that you know it isn't free, by putting a dot in it. So you'd have to add another with clause for probably, and stick a dotted pattern in it06/09 01:35
benmachinefor what?06/09 01:36
copumpkinhm, don't remember the details :P but whatever was equal06/09 01:36
copumpkinbring the two sides of the equality into scope and dot one of them in terms of the other06/09 01:37
copumpkinthe rewrite clause takes care of that for you06/09 01:37
benmachinehmm ok06/09 01:37
copumpkinso that might work fro you06/09 01:37
benmachineah06/09 01:38
benmachinenow I have, +-right-identity {suc m} with m + zero | +-right-identity {m}06/09 01:38
benmachine... | .m | refl = refl06/09 01:38
benmachineand that compiles06/09 01:39
copumpkinnow try06/09 01:39
copumpkin+-right-identity {suc m} rewrite +-right-identity {m} = refl06/09 01:39
benmachineNo binding for builtin thing EQUALITY, use {-# BUILTIN EQUALITY06/09 01:40
benmachinename #-} to bind it to 'name'06/09 01:40
copumpkinoh, you're not using the standard library06/09 01:40
benmachineno, I'm not even sure I have it06/09 01:40
copumpkinah :)06/09 01:40
benmachine:P06/09 01:40
copumpkinanyway, you can use that pragma to tell agda about your equality06/09 01:40
copumpkinand then rewrite makes things like this a lot more pleasant06/09 01:40
benmachineok06/09 01:41
* benmachine decides to come back to rewrite later06/09 01:41
* benmachine hugs copumpkin06/09 01:41
copumpkin:)06/09 01:41
benmachineafter doing so much haskell it's weird being a noob again :P06/09 01:41
benmachinekinda cool actually!06/09 01:41
copumpkinif you want to play with rewrite:06/09 01:44
copumpkin  {-# BUILTIN EQUALITY _≡_ #-}06/09 01:44
copumpkin  {-# BUILTIN REFL refl #-}06/09 01:44
benmachineit took me about 40 loc but I proved + is commutative :O06/09 02:41
copumpkin:)06/09 02:41
copumpkinyeah, it's not trivial06/09 02:41
copumpkinusing rewrites and convenient lemmas can make it a bit shorter06/09 02:41
benmachineI did it on a blackboard afterwards to check, you actually do need quite a few auxiliary results06/09 02:42
benmachinewhich surprised me btyg06/09 02:42
copumpkinhave you done associativity yet?06/09 02:42
benmachinenooope06/09 02:42
benmachineone thing at a time eh :P06/09 02:42
copumpkin:)06/09 02:42
benmachineand the next thing is sleep, because it's quarter to three06/09 02:42
copumpkinisn't it fun though!06/09 02:42
benmachinehee hee06/09 02:42
benmachineI'm still getting used to it I think :P06/09 02:43
benmachinenot very good at telling what agda can and can't work out for me yet06/09 02:43
benmachinewhat should be explicit or implicit06/09 02:43
benmachineso it just goes unsolved metas and I throw a bunch of {n}s and {m}s in06/09 02:44
benmachineand it works >_>06/09 02:44
copumpkin:)06/09 02:44
benmachinethank you much for your help :)06/09 02:44
copumpkinno problem106/09 02:45
copumpkin!06/09 02:45
djahandarieAw, I missed larrythesquid06/09 05:12
copumpkinhe's too slick for you06/09 05:12
lispyhttp://www.cse.chalmers.se/~ulfn/code/tphols09/Semantics.html  <-- I can't get the first equation of sound to type check06/09 05:49
lispyIf I change the type to: sound : ∀ {n} (e : Expr n) ρ → [ e ] ρ ≈ [ norm e ] ρ06/09 05:49
lispythen it does type check06/09 05:49
lispyoh!06/09 05:50
lispyI see it now06/09 05:50
lispyThe damn unicode is so hard to read in emacs :(06/09 05:50
lispyI used the wrong comparison06/09 05:50
lispyno wait, still doesn't type check but it's closer06/09 05:50
lispysound : ∀ {n} (e : Expr n) ρ → e ≈ norm e06/09 05:50
lispyExpr n !=< C of type Set06/09 05:51
lispywhen checking that the expression e has type C06/09 05:51
lispyheh, okay that was a waste of time.  It should be ≅ that and that doesn't type check06/09 05:54
lispyhttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=29757#a2975706/09 05:56
PeakerDoes Agda support partiality through a monad?06/09 07:52
Peakeror is it total everywhere? If latter, how does FFI to Haskell/etc work?06/09 07:52
Peakerfrom a tutorial "In Haskell and ML the type of not can be inferred from the defining clauses and so in these languages the type signature is not required. How-ever, in the presence of dependent types this is no longer the case and we are forced to write down the type signature of not. This is not a bad thing, since by writing down the type signature we allow the type checker, not only to tell us when we make mistakes, but also to guide us in the construction06/09 07:54
Peaker of the program."06/09 07:54
Peakera bit disingenuous to say it is always a good thing, isn't it? :)06/09 07:55
copumpkinit just said it's not a bad thing06/09 07:59
copumpkinand it's not true, you can omit type signatures on non-functions06/09 07:59
copumpkinagda will just believe you when you FFI out06/09 08:00
PeakerThere's no way to escape totality like in Epigram?06/09 08:00
copumpkinwell, IO for example is coinductive06/09 08:00
copumpkinnot sure you ever want to escape totality06/09 08:00
copumpkinproductive coinduction is good enough for most real infinite programs06/09 08:00
copumpkin(corecursion, I mean)06/09 08:01
Peakerwell, you might want to escape totality in the same sense you sometimes escape to imperative progrmaming06/09 08:01
PeakerYou don't yet know how to do it the "right way"06/09 08:02
PeakerOr maybe you're writing a Turing machine interpreter :)06/09 08:02
copumpkinyou can turn off the termination checker :)06/09 08:02
copumpkinbut then you can't really trust your proofs anymore06/09 08:03
Peakerif partiality was a monad, you could just allow proofs only when they're not wrapped in it06/09 08:04
Peakerno?06/09 08:04
Peakerbut you could still have parts of your program in it06/09 08:05
Peaker(not proofs)06/09 08:05
copumpkinthat would require a lot of introspection of the typechecker behvaior into language terms, wouldn't it?06/09 08:05
copumpkinthe language would need to be aware of this monad, and considering we don't have typeclasses or even a terribly satisfying monad record06/09 08:05
PeakerMaybe when you take a proof you just take it as a strict argument06/09 08:07
PeakerAnd then if you're given a partial proof in a Partial monad -- it will make the entire Partial computation not terminate06/09 08:07
Peakerbut if you're in a pure computation, your proofs are fine..06/09 08:07
PeakerMaybe the kinds of proposition types should be different, and a constraint on prop. types made them impossible to store in the partial monad06/09 08:08
copumpkinwe don't have a separation currently06/09 08:09
Peakerhow does Epigram deal with it? It has general recursion.. what happens in Epigram if you construct a proof in a non-terminating function?06/09 08:10
copumpkinnever used epigram 106/09 08:11
copumpkindoes epigram 2 still do that?06/09 08:11
copumpkin(I sort of doubt it since it doesn't have a language yet)06/09 08:11
lispycopumpkin: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29757#a2975706/09 08:36
lispycopumpkin: I'm stumped again06/09 08:36
copumpkinlispy: I'd guess you didn't apply a function completely06/09 08:38
copumpkin(ρ' : Vec C .n) → [ var i ] ρ' ≈ [ Expr.Σ (zipWith _⊗_ (eval (var i)) (tabulate var)) ] ρ'06/09 08:39
copumpkinvs.06/09 08:39
copumpkin_391 CM i ρ ! i ≈ [ Expr.Σ (zipWith _⊗_ (unit i) (tabulate var)) ] (_422 CM i ρ)06/09 08:39
lispycopumpkin: http://www.cse.chalmers.se/~ulfn/code/tphols09/Semantics.html06/09 08:39
Saizancopumpkin, Peaker: you can define your own partiality monad with coinduction, which also let you prove separately that your function is total of that's the case, no language support though, so it might be a bit clunky, especially if you want lazyness since you've to put the monad inside your datatypes too06/09 11:14
Saizan(in that case)06/09 11:14
Saizanhttp://wiki.portal.chalmers.se/agda/pmwiki.php?n=AIMXII.FutureOfAgda <- sounds quite cool06/09 17:48
edwinbyou mean the "make other people know how Agda works" bit?06/09 17:50
edwinbThat would probably be good, yes...06/09 17:50
Saizanyep06/09 17:51
edwinbUlf seemed quite keen on the "complete ban on Ulf implementing Agda" bit ;)06/09 17:52
Saizanhehe, i can imagine :)06/09 17:52
Saizanmeanwhile it seems a lot of interesting things are already being implemented in the current AIM, so maybe there isn't such a severe lack of manpower :)06/09 18:03
edwinbwell, yes, but an awful lot is dependent on Ulf06/09 18:17
pumpkinoh that's what you guys mean by dependent types06/09 18:18
edwinbyes, we're all very dependent06/09 18:18
kosmikus:)06/09 18:25
mind123123good evening06/09 22:43
--- Day changed Tue Sep 07 2010
Saizanwhat does it mean when the lines where the case alternatives of a with get yellow?07/09 13:55
Saizans/the lines where//07/09 13:56
copumpkinremind me not to use Fin (2 ^ 32) as an approximation of machine words07/09 21:15
kosmikushehe07/09 21:26
copumpkinfor some things it works fine07/09 21:27
copumpkinbut just now the typechecker ran wild07/09 21:28
kosmikusyes, I guess as soon as the typechecker feels the need to evaluate the argument to Fin ...07/09 21:30
copumpkinyeah07/09 21:32
jonrafkindI need some basica agda help. I have this type 'mine : {A : Set} → Time → SF [ E A ] [ E A ] dec' where Time is defined in a file as Time = ℕ, but I get this error when I run agda: Set != (suc _3). when checking that the expression Time has type _307/09 23:03
jonrafkindim not sure what (suc _3) means here07/09 23:04
Saizan_3 looks like a metavariable07/09 23:37
Saizanand suc is probably ℕ's constructor there07/09 23:37
jonrafkindso (suc ...) is not a set, thats what its saying?07/09 23:37
jonrafkindyes07/09 23:37
Saizanyeah07/09 23:37
jonrafkindmine : ℕ -> ℕ07/09 23:38
jonrafkindmine x = x + 007/09 23:38
jonrafkindeven this doesnt work, i get the same error but its (suc _1) isntead of _307/09 23:38
jonrafkindbut strangely, if I copy the definition for N out of the file it comes from into my local file then it works07/09 23:39
Saizanweird07/09 23:39
Saizanjonrafkind: how are you importing the module?07/09 23:40
jonrafkindopen import NeilPrelude07/09 23:40
Saizanthat should work, assuming _+_ : ℕ -> ℕ -> ℕ and the right builtin declarations07/09 23:43
jonrafkindyea its all there, i literally copy the definitions into my local file and it works07/09 23:44
jonrafkindbut if they come from an import then it doesnt work07/09 23:44
copumpkinmaybe the .agdai file is broken?07/09 23:45
copumpkinI had strange issues once when I upgraded agda07/09 23:45
jonrafkindok rm *.agdai, agda blah.. lets see07/09 23:46
jonrafkindsame error07/09 23:47
jonrafkindoh my lord.. i typed -> instead of the unicode ->07/09 23:48
jonrafkindi mean i typed '-' and '>'07/09 23:48
Saizan-> works too07/09 23:50
jonrafkindoh yea you're right07/09 23:51
jonrafkindso what else could be wrong..07/09 23:53
jonrafkindok it seems to be this, the file im importing from has {-# OPTIONS --type-in-type #-}. what does that mean?07/09 23:59
--- Day changed Wed Sep 08 2010
danbrownthat's impredicativity: Set : Set instead of Set = Set0 : Set1 : Set2 : ...08/09 00:01
danbrownlets you encode paradoxes like Russell's and makes the type theory unsound08/09 00:02
danbrownalso, try "open import NeilPrelude using (_+_)" to see if you can narrow down the problem. that will import only the name _+_ from the module08/09 00:03
danbrownerr, or "using (N; zero; suc)", or whatever it was you were copying back and forth08/09 00:04
Saizansuppose you've a type like "T = nu X. A -> B x X" (a sort of automaton), would you consider a value of T which will make the evaluator loop if it normalizes under that lambda but will always be able to produce B when applied productive?08/09 02:03
danbrownSaizan: seems like if you simplify the question to streams (T = νX. B × X) then the answer is clearly 'yes', even though there aren't any lambdas left08/09 04:25
Saizanyeah, lambdas were a crucial part of the doubt08/09 04:33
Saizannot so much i guess, since in my case i actually require lazy eval to avoid a loop08/09 04:35
Saizaneven after it's applied08/09 04:35
Saizan(if a subterm looped before it continues to loop, i guess :)08/09 04:36
Saizananyhow, with codata at least the typechecker doesn't seem to loop anymore..08/09 04:39
Saizanit did with data X : Set where x : (A -> B x \inf X) : X; but not with data X : Set where x : \inf (A -> B x X) : X08/09 04:41
stevankosmikus: hi, is the prototype agda code of the multirec stuff available somewhere? thanks.08/09 13:01
Saizanis there a normalization by evaluation agda example that also proves soundness?08/09 21:42
lispySaizan: there is in the agda overview from 2009, but it doesn't compile on the latest agda08/09 22:04
lispySaizan: in the Semantics.agda module08/09 22:04
--- Day changed Thu Sep 09 2010
dolioWoo, one more proof of false patched out.09/09 03:57
copumpkinoh nice09/09 03:58
copumpkinhow's it work?09/09 03:58
dolioRecords were allowed to be recursive, but weren't checked for positivity.09/09 03:58
dolioI'm not sure which part they fixed.09/09 03:59
copumpkinoh09/09 03:59
dolioBut I got an email saying "fixed".09/09 04:00
copumpkinthat's pretty terse :)09/09 04:00
dolioOh, they enabled positivity checking.09/09 04:00
dolioI just skipped that line.09/09 04:00
copumpkinah09/09 04:01
dolioI think NAD wants recursive records, so that isn't surprising.09/09 04:03
jonrafkindwhat does this error mean? 'ℕ != .A of type Set'09/09 16:32
stevanthat you are giving the hole something of type N while it wants to be plugged with something of the implicit type A?09/09 16:35
jonrafkindok i forced A = N, now I get 'ℕ !=< ℕ of type Set'. is that "not equal or subset" ?09/09 16:43
stevancan you paste the code perhaps?09/09 16:47
jonrafkindhttp://pastebin.com/tAfH3DjU09/09 16:49
stevanwhat you are doing there, {A = N}, is saying let N be the implicit type A and then you pass this to pureE, i think what you want to do is replace A with N in the type declaration of mine09/09 16:52
jonrafkind{N = A} ?09/09 16:53
jonrafkindor SF [E N] ?09/09 16:53
stevanyes, SF [ E N ]09/09 16:53
jonrafkindso I cant have a polymorphic function?09/09 16:53
stevanyou can, but "+ 1" only makes sense for N?09/09 16:54
jonrafkindyea but I thought it could figure out that A = N09/09 16:56
stevanwell that's not a polymorphic function anymore.09/09 16:57
jonrafkindseems the {A : Set} is irrelevant09/09 16:57
jonrafkindok so when a polymorphic type is instantiated with some concrete type T, I have to mention T in the signature rather than tell the polymorphic type to try to use T for implicit types09/09 16:58
leohi09/09 17:58
leowhen working with products,   how i can do pattern matching inside a lambda, i mean, as the haskell notation \ (x,y) -> . It is possible ?09/09 18:01
stevannot possible.09/09 18:01
leoBuu! :'(. Thanks ;D09/09 18:02
dolioOh man, codata is gone?09/09 19:53
dolio(The keyword.)09/09 19:53
copumpkin:O09/09 19:54
copumpkinis the sharp and flat stuff primitive now?09/09 19:54
dolioDunno.09/09 19:54
dolioYou heard about this irrelevance stuff?09/09 19:54
copumpkinnope?09/09 19:55
copumpkinin agda?09/09 19:55
copumpkinhttp://www.cs.nott.ac.uk/~nad/listings/lib/Coinduction.html#23409/09 19:55
copumpkinwow09/09 19:55
dolioYeah. I just pulled from darcs and there's patches about relevance, forcing analysis, and such.09/09 19:55
copumpkininteresting09/09 19:55
dolioAnd there are non-dependent functions '.A -> B' where the A argument is checked for irrelevance.09/09 19:56
dolioWhich, I'm not certain what good that does.09/09 19:56
dolioOther than that equality on such types is on erased values or something.09/09 19:56
dolioOh, postulates.09/09 19:57
copumpkinwell, it's better than "here's your codata keyword but please don't use it kthx"09/09 19:57
copumpkinI guess09/09 19:57
dolioYes.09/09 19:58
dolioIt'd probably be good to not call it 'coinduction' either.09/09 19:59
dolioAnyhow, if the irrelevance stuff is the kind I think it is...09/09 20:03
dolioThe dependent case is one of the major points.09/09 20:03
pedagandit is irrelevance a la Andreas Abel09/09 20:04
copumpkinwhere did you read about this stuff?09/09 20:04
copumpkinI didn't see anything on the list09/09 20:04
dolioBecause you can make the first argument of (A : Set) -> A -> A irrelevant.09/09 20:04
dolioAnd erase it for a speed boost.09/09 20:04
stevanhttp://wiki.portal.chalmers.se/agda/pmwiki.php?n=AIMXII.Notes09/09 20:04
dolioBut that's a dependent function space.09/09 20:04
dolioOh, is this for proof irrelevance?09/09 20:05
dolioNot parametricity?09/09 20:06
pedagandI think (don't quote me on that) that it's computational irrelevance09/09 20:10
dolioIs it like the Mishra-Linger/Sheard stuff?09/09 20:10
dolioErasure Pure Type Systems?09/09 20:10
pedagandhe checks that you do not mark something as irrelevant when it actually is computationally relevant09/09 20:10
dolioIt sounds similar.09/09 20:10
dolioOoo, mixfix with binders.09/09 20:11
dolioThat's one of my few remaining gripes.09/09 20:11
pedagandif the check passes, then it could not evaluate the things (I don't know if they had the time to actually implement that)09/09 20:11
dolioIs there a paper or slides on it?09/09 20:12
dolioThe Abel stuff, that is.09/09 20:13
dolioThe AIM notes aren't very specific.09/09 20:13
dolioAnd they give the impression that their purpose is to be used with proofs.09/09 20:13
pedagandAndreas presented some code from MiniAgda09/09 20:13
Saizanon mini-agda it says "Erased arguments in the style of the Implicit Calculus of Constructions by Alexandre Miquel and Bruno Barras / Bruno Bernardo"09/09 20:13
dolioBut I don't think the EPTS stuff really works for proof irrelevance in general.09/09 20:14
pedagandAndreas gave a talk at DTP on a very similar topic09/09 20:14
dolioSometimes you might need to match on a proof to get refinement, so it's not strictly speaking computationally irrelevant in the EPTS sense (and it isn't safe to make it so). But it's still proof irrelevant in that it only has one canonical value.09/09 20:15
pedagandI can't find the slides for DTP either..09/09 20:16
pedagandyour best bet is to ask Andreas directly I think, or look at MiniAgda09/09 20:16
dolioWell, in one of the EPTS papers, they mention that they're sort of extending the ICC to a family of languages, like pure type systems formalize typed lambda calculi as a parameterized family of languages.09/09 20:17
dolioSo I guess that answers my question.09/09 20:17
dolioI'm skeptical that does what it wanted, though.09/09 20:18
dolioWhat is ...09/09 20:18
doliopigworker understands this stuff better than I do, as well.09/09 20:21
dolioI suppose that's no surprise.09/09 20:21
pedagandI wish I had the time to read Miquel's thesis: I believe that most of the story is there09/09 20:23
pedagandAndreas mentionned Miquel's work several times at DTP09/09 20:23
dolioIs it in French?09/09 20:24
dolioLooks like it.09/09 20:25
dolioI've read most of Mishra-Linger's thesis, which is about how to do their computational irrelevance stuff.09/09 20:26
pedagandyeah09/09 20:26
dolioExtending it to inductive types.09/09 20:26
dolioAnd doing irrelevance analysis.09/09 20:26
dolioHe has some good examples where it fails for proof irrelevance, though.09/09 20:27
dolioFor instance, the eliminator for propositional equality can't safely be computationally irrelevant in the proof of equality.09/09 20:28
dolioI should say, the Agda-like intensional equality.09/09 20:31
Saizanbtw, when talking about erasure pigworker says you can't erase "collapsible" during open terms evaluation otherwise you might be trusting a proof that implies A = A -> A and loop, but == lives in Prop in epigram..09/09 20:31
Saizanyeah, that :)09/09 20:32
Saizani guess "coe : (S T : Set) -> :- S == T -> S -> T" must be strict on something else then09/09 20:33
doliocoe is strict in S and T.09/09 20:34
dolioAlso, it's weird to talk about strictness in a total language.09/09 20:34
Saizaneager?09/09 20:35
dolioAnyhow, my main concern is that EPTS and (I think) ICC-type computational irrelevance is about parametric definitions, not proof irrelevance.09/09 20:36
dolioAnd having the former won't necessarily make space usage problems that the latter would solve go away.09/09 20:37
--- Day changed Fri Sep 10 2010
copumpkinwhat does == between Sets mean?10/09 16:07
Saizanwhere did you find that?10/09 16:08
copumpkinwell, in one of the bugs, someone proved that Fin 2 /= Bool10/09 16:08
copumpkinhttp://code.google.com/p/agda/issues/detail?id=29210/09 16:09
Saizanah, yeah, it seems like the topologists don't like being able to tell apart two types if they are isomorphic, iirc it'll invalidate some models10/09 16:17
Saizanor a i guess you might imagine that they both desugar to 1 + 1, if you have a closed universe10/09 16:18
jixis the semiring solver known to take ages even for simple one variable stuff?10/09 16:21
Saizanit's not very fast10/09 16:21
Saizancopumpkin: i think the "Equivalence axiom => extensionality" thread is related to this, but it's over my head10/09 16:22
copumpkinah10/09 16:23
copumpkinway over mine then :)10/09 16:24
jixbut it shouldn't take over 10 minutes for (a * a) + ((a * (a * a)) * (a * (a * a))) = (a * a) * (a * (a * (a * a)) + 1) i guess10/09 16:28
jixkilled it now, it even started to swap10/09 16:31
jixproving (x * x) * x = x * (x * x) also hangs10/09 16:42
jixlem3 from the wiki page works here tho10/09 16:42
jixah (x * x) * x = x * (x * x) finished now, i guess the algorithm used just doesn't like such equations10/09 16:43
Saizani wonder if anyone has written down the time complexity for it10/09 16:43
djahandarieO(long-as-hell)10/09 16:44
Saizandjahandarie: do you have the \theta too?:)10/09 16:44
copumpkinhttp://wiki.portal.chalmers.se/agda/pmwiki.php?n=MixFixBinders.MixFixBinders10/09 17:05
copumpkinmmm10/09 17:05
dolioThat looks kind of like coq's notation.10/09 17:10
dolioI hope it's not totally in that direction.10/09 17:12
dolioOne nice thing about Agda was being able to define things directly using the notation you want.10/09 17:12
dolioInstead of defining an ordinary function first, and then specifying a nicer notation for it.10/09 17:13
dolioOf course, having binders would probably be worth sacrificing that.10/09 17:13
copumpkinyeah10/09 17:13
jixif the ring solver implements the algorithm as described in the mentioned paper i can't see how it could take 2 minutes just to prove (x * x) * x = x * (x * x) :/10/09 17:17
copumpkinit doesn't, it's slower10/09 17:25
copumpkinthe one in the paper allows you to lift exponents by arbitrary amounts10/09 17:25
copumpkinwhereas the ring solver lifts one at a time10/09 17:25
jixstill that shouldn't be a problem for (x * x) * x = x * (x * x)10/09 17:27
copumpkinnope10/09 17:27
dolioOh man. You can use the new mixfix stuff to make a 'x : T' annotation.10/09 17:49
copumpkinhe did mention something for flipping arguments10/09 17:50
copumpkinagda's tagline should be what ulf just said today :P "Agda isn't Coq"10/09 18:52
copumpkin:P10/09 18:52
Saizanhah10/09 18:53
Saizanwhere?10/09 18:55
TheOnionKnightthat was my first thought as well, most recent message on the mailing list10/09 18:55
copumpkinin response to dolio's email about being worried about not being able to use mixfix in patterns10/09 18:56
* dolio is relieved.10/09 18:56
dschoepehttp://hpaste.org/fastcgi/hpaste.fcgi/view?id=29862#a29862 -- why does agda tell me that line 6 is an unreachable clause?10/09 19:08
dschoepe(agda-2.2.6, stdlib-0.3)10/09 19:08
Saizancheck the type of _<_10/09 19:17
Saizanit probably doesn't return a Bool and those true/false are just variables10/09 19:18
dschoepeSaizan: oh, thanks10/09 19:19
pigworkerg_cross: would that be your message on the list about finite types?10/09 23:54
pigworkerIt ought to be possible to build a brute force decision procedure for a language of predicates over finite domains, as in Martijn Oostdijk's masters thesis.10/09 23:58
--- Day changed Sat Sep 11 2010
pigworkerI remember Per Martin-Löf being a bit discombobulated by Henk Barendregt's presentation of Martijn's proof that 61 is prime: "we checked - it is".11/09 00:00
pigworkerThat was Types 1998, iirc.11/09 00:00
edwinboh, I remember reading that. It was about the first types paper I actually understood...11/09 00:08
edwinbit is strangely disappointing though11/09 00:08
pigworkerGiven p : X -> Bool, P : X -> Set, with p x deciding P x for all x, and a list xs enumerating X, it should be pretty easy to show that all p xs decides (x : X) -> P x.11/09 00:13
edwinbI suppose that'd be the neater/more generic way to write +-comm11/09 00:15
edwinbActually, now might be a good time to revisit the doing-crazy-things-with-numbers work11/09 00:17
* edwinb files that thought away for a rainy Sunday11/09 00:17
pigworkerThe killer way to prove +-comm is to extract + from an upper-triangular matrix in the first place. (If the point you want is in the lower triangle, then flip!)11/09 00:18
g_crossYes, thanks pigworker!11/09 03:38
g_crossYeah, what you've stated is exactly what I was thinking.11/09 03:42
g_crossIt's the details of how to do that, though, that escapes me.  :-011/09 03:42
g_cross:-), I mean11/09 03:42
g_crossI am stuck on seeing how to be able to prove that my list xs is everything that there is in the set, and so by deciding for every case in it I have decided the proposition.11/09 03:43
Saizanafaiu, that's where you can't really avoid some boilerplate mapping each element to a position in the list (or vector, in which case it'd be like mapping to Fin (<number of constructors>))11/09 03:49
g_crossI'm find with that11/09 03:50
g_crossI mean, I'm fine with that11/09 03:50
g_crossI'm just not sure what exactly I'm supposed to be mapping them to11/09 03:50
g_crossit's easy to place an ordering on them and convert them to a list or something11/09 03:50
g_crossI'm just not sure what kind of list-thingy I should be mapping to11/09 03:50
g_crossin such a way that I can prove things about the original type11/09 03:51
g_crossbased on enumeration through that list11/09 03:52
Saizanone option is simply to prove "(x : X) -> x \in xs" where xs is your list of all the elements and \in is from Data.List.Any11/09 04:00
Saizanthere might be something better though11/09 04:01
g_crossCool, I'll check that out.   Thanks everyon111/09 04:21
g_crosse!  :-)11/09 04:21
dark"In the same way as functions are not allowed to crash, they must also be terminating."11/09 11:43
darkso adga functions aren't turing-complete?11/09 11:43
dark(I wished to have the "type of terminating functions" at many languages, but retaining non-termination power)11/09 11:45
pigworkerAgda is at least supposed to be total. You can still compute the execution trace of an arbitrary Turing machine as a coinductive structure.11/09 11:49
dark? really? hmm..11/09 11:50
darki.e. an always-terminating function can be turing-complete?11/09 11:50
darkpigworker, I fail to see this, since there are non-terminating turing machines11/09 11:51
pigworkerAnd there are infinite coinductive structures!11/09 11:51
darkwhat do you mean.. ._.11/09 11:52
edwinbthere are also "always producing" functions...11/09 11:52
darkyou mean, passing an infinite data structure to a "terminating" function?11/09 11:52
darkthe function will be applied again to a "smaller" structure, that is also infinite11/09 11:53
pigworkerA coinductive list is a potentially infinite structure, unfolded on demand. A total program may only inspect a finite prefix of such a thing, but we may (indeed must) explain how to generate however much is demanded.11/09 11:53
pigworkerAs we can explain the one-step evolution of a TM, we can specify the means to generate the trace a bit at a time, however much is demanded.11/09 11:55
darkbut you can't actually run the entire machine at a time?11/09 11:55
darkwhen you say "supposed to be total" you mean "no valid agda program is non-terminating"?11/09 11:56
pigworkerI mean that if a non-total program creeps in, that's a bug.11/09 11:56
* dark goes to a dictionary(?) to check what's to creep in11/09 11:57
edwinbI wonder if it's a bit confusing (that is, not entirely true) to say that functions must always be terminating11/09 11:57
pigworkerto get in, not welcome, while nobody is looking11/09 11:58
darkedwinb, it's stated in a prominent way at the 'tutorial'11/09 11:58
edwinboh ;)11/09 11:58
darkpages aren't numbered there, but it's on page 3, 5th paragraph11/09 11:59
pigworkeredwinb: yes, recursion consuming inductive data must always be terminating; corecursion, delivering coinductive data must always be productive11/09 11:59
edwinbthe tutorial may be pre-coinduction11/09 12:00
pigworkerThe impact of that for the partial evaluation machinery used in typechecking is that computation always terminates (infinite structures are unfolded on demand and demand is guaranteed to be finite).11/09 12:00
darkpigworker, isn't the type-check supposed to not terminate in some cases?11/09 12:00
darknon-termination at type-check would mean the program isn't valid?11/09 12:00
pigworkerno, the typechecker is supposed to terminate11/09 12:00
darkbut, but, isn't agda type system "too powerful" to guarantee termination?11/09 12:01
darkwhere's the catch then11/09 12:01
darkeven some ghc type extensions doesn't guarantee termination11/09 12:01
pigworkerghc is much sloppier about the programs you can write at the type level, when you turn that stuff on (and much too tight when you don't)11/09 12:02
darko.o11/09 12:03
benmachinepigworker: if demand is guaranteed to be finite, you can't demand the whole execution of an arbitrary turing machine?11/09 12:08
pigworkerSo the only catch is that, unlike in Haskell, pure means pure. If you want to express potentially nonterminating computations, use coinduction to define a delay monad. The typechecker won't run them (at least not forever) but perhaps the RTS might.11/09 12:08
pigworkerbenmachine: indeed, you can't demand the whole execution of a TM; you can, of course, construct other infinite processes which run a TM a bit at a time...11/09 12:10
benmachineso agda *isn't* turing-complete, which was the original question?11/09 12:11
benmachineas in you can't write an agda program that takes as input a turing machine and starting state and gives as output the finishing state11/09 12:12
benmachineif it finishes, that is11/09 12:12
pigworkerAgda isn't Turing complete in the same sense that you can't do any IO in Haskell!11/09 12:12
pigworkeryou can't write   halts : TM -> Bool   you can write   halts : TM -> Delay Bool11/09 12:16
pigworkerif your run-time system is willing to run Delay computations, then good luck to you!11/09 12:16
dark<pigworker> Agda isn't Turing complete in the same sense that you can't do any IO in Haskell!11/09 12:24
darkwhat do you mean? one can do any i/o in haskell....11/09 12:24
darkand one can get the description of a turing machine and its input, and generate its output, in haskell11/09 12:26
darkpigworker, suppose someone wants to write a verified interpreter for a turing-complete language. hence, this someone can't write it in agda.11/09 12:27
darkright?11/09 12:27
darkbut he might be able to write a *compiler*11/09 12:27
Saizanit'll just be an interpreter into the Delay monad, like if you want to write an interpreter for an impure language in haskell you'll have to write one into the IO monad11/09 12:28
darkhm11/09 12:28
darkI can carry state through function parameters11/09 12:28
darkbut I have to use the IO monad to read the input and write the output11/09 12:29
pigworkerit's up to the RTS how to treat Delay, just as it's the Haskell RTS which interprets IO values as instructions to communicate11/09 12:29
darkhm11/09 12:29
darkDelay means "potentially non-terminating"?11/09 12:30
pigworkeryeah, e.g., informally, codata Delay x = Done x | Wait (Delay x)11/09 12:31
dark(i.e. my step function can be something like state * input -> state * output, simulating an impure language)11/09 12:31
pigworkeryes, and you could well write an interpreter as a function which uses that step to consume a stream of inputs and produce a stream of outputs11/09 12:32
darkexactly, but for a turing-complete language, the "step" of each input symbol might be non-terminating11/09 12:33
dark(or the interpreter might otherwise need to go back and see previous symbols)11/09 12:34
pigworkeryou confused me by calling it a "step function"; but if that's so, then you can add a Wait constructor to your output stream11/09 12:36
pigworkerThe point is that there are honest ways to model infinite processes. Agda merely excludes the dishonest ways to do it.11/09 12:37
dark(I confused myself too. "step" is supposed to be always terminating, but then there must be some other trick somewhere to achieve non-termination. consider this script while sleep 60; do cat /proc/acpi/battery/BAT0/state; done, any terminating interpreter would do the wrong thing)11/09 12:38
dark(maybe it's too much to expect to verify /bin/sh..)11/09 12:39
pigworkerI was guessing that nontermination was to be achieved by stepping forever, hence producing an infinite trace, rather than nothing at all11/09 12:40
darkyes, stepping forever :)11/09 13:11
darkproducing nothing at all isn't very useful..11/09 13:12
pigworkerquite; the stream model works here; you can write such an interpreter; you just can't make the *typechecker* run it *forever*11/09 13:15
dark<pigworker> quite; the stream model works here; you can write such an interpreter; you just can't make the *typechecker* run it *forever*11/09 15:16
darkby this you mean that type-checking will terminate, or that the type-checker will forbid it to run forever?11/09 15:17
pigworkerTwo things run programs: one is the typechecker, the other is the run-time system; to keep the type system decidable, we ensure that the typechecker does not run programs forever. The typechecker does not forbid the RTS to run programs forever.11/09 16:52
leo_Hi!11/09 21:57
copumpkinhi!11/09 21:57
leo_postulate11/09 21:57
leo_Int  : Set11/09 21:57
leo_Real : Set11/09 21:57
leo_int-to-real : Int -> Real11/09 21:57
leo_{-# COMPILED_TYPE Int Int #-}11/09 21:57
leo_{-# COMPILED_TYPE Real Float #-}11/09 21:57
leo_{-# COMPILED int-to-real ?? #-}11/09 21:57
copumpkinfromIntegral?11/09 21:58
leo_that is my question xD11/09 21:58
leo_fromIntegral :: (Integral a, Num b) => a -> b11/09 21:59
leo_{-# COMPILED int-to-real (fromIntegral :: Int -> Float) #-} ??11/09 21:59
Saizani'd guess so11/09 22:03
leo_OK11/09 22:04
leo_thanks11/09 22:04
benmachinepeople use Float in agda?11/09 22:04
* benmachine melts11/09 22:04
copumpkinleo_: keep in mind that your proofs about Real will be (possibly) wrong unless you account for Float's odd behavior11/09 22:05
--- Day changed Sun Sep 12 2010
lispyor they could be wrong because agda is a moving target and the code examples/tutorials you find no longer compile12/09 03:25
lispybut i'm not bitter12/09 03:25
* lispy is bitter12/09 03:25
copumpkinjust ask #agda, we have answers!12/09 03:26
lispycopumpkin: I did, but no one seemed to know12/09 03:27
copumpkinoh?12/09 03:27
copumpkinwell if you post a large example that we'd need a lot of context to understand, it takes a lot more time to give help :P12/09 03:27
lispyhttp://www.cse.chalmers.se/~ulfn/code/tphols09/Semantics.html12/09 03:27
lispythat code doesn't compile on my machine12/09 03:28
dolioThat website is unreachable on my machine.12/09 03:28
copumpkinsame here, but I remember you linking to that before12/09 03:28
lispy3rd tutorial in the list here: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Othertutorials12/09 03:28
lispySince then, I've learned that Coq has a feature similar to what I want (extraction to Haskell)12/09 03:29
dolioAnyhow, Agda is definitely a moving target.12/09 03:29
lispyBut, there are somethings I still don't like (Coq syntax is ugly, call me shallow, and I really want to write my Haskell code and then prove theorems about it)12/09 03:30
dolioNo argument here.12/09 03:30
lispyso some of us at work has banded together to write a haskell-verifier that goes from ghc core to HOLCF12/09 03:30
dolioPeople often say syntax doesn't matter. But they're wrong.12/09 03:30
dolioI don't see anything in the accompanying paper that would have stopped working.12/09 03:32
dolioUnless you're talking about compilation-to-haskell not working. I could believe that.12/09 03:32
darklispy, the problem of verifying a production code is that people aren't interested, and will see this as a difficulty to change specifications, etc12/09 03:33
copumpkinfrom the error lispy gave last time, it looked like one of the functions simply hadn't been fully applied12/09 03:33
lispydolio: the compilaton to haskell is a separate thing.12/09 03:33
copumpkinmaybe just a typo in the commit to the repo12/09 03:33
lispydark: no where I work :)12/09 03:34
copumpkinit was one of those x -> y != errors12/09 03:34
darkfor example, in the haskell history paper, the guy attributes to the lack of specs (planned but never delivered) the great diversity and innovations that is happening in ghc right now12/09 03:34
lispydark: we are actually actively looking for ways to incorporate more formal methonds12/09 03:34
lispymethods*12/09 03:34
darklispy, hm12/09 03:34
darkwill you fork ghc?12/09 03:34
lispydark: I don't think so12/09 03:35
darkI mean, I would love to run a verified OS and toolchain and etc etc right now .-.12/09 03:35
dark.-.12/09 03:35
lispydark: we're going to translate the output of ghc to holcf and then prove things about that12/09 03:35
dark'output' you mean 'compiled code'?12/09 03:35
lispyat least, that's the current roadmap.  Depending on wat works and what doesn't we may need to try different things12/09 03:35
lispydark: are you familiar with the stages of ghc?12/09 03:36
dark..but people perceive verified software as something more 'static' because verification is perceived as expensive)?_12/09 03:36
darklispy, no ^^12/09 03:36
copumpkinlispy: anyway, I'd just stick a hole on the function in question and see what it wants12/09 03:36
darkbut I know it compiles to an intermediate language12/09 03:36
lispydark: ah, well one of the earlier steps is to translate to a 'core' language which is simpler than the haskell you normally work with.12/09 03:36
lispydark: we want to experiment with proving things about that intermediate language12/09 03:36
darkhm12/09 03:36
lispyInitially we'll probably stick to unoptimized core12/09 03:37
darkis this language specified formally?12/09 03:37
darkor specified at all12/09 03:37
lispyThere are other researchers working on formal semantics of haskell at the moment12/09 03:37
dark(as opposed to being a quick internal hack)12/09 03:37
lispyIt's a stable format12/09 03:37
lispyI don't know off hand where the spec is12/09 03:37
lispyBut, it's sometimes called "external core"12/09 03:38
lispydark: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/ext-core.html12/09 03:38
darkI found odd that haskell isn't formally specified while sml is12/09 03:38
darksince haskell had such initial goals12/09 03:39
lispythat will change in the next 2 years12/09 03:39
darkhaha nice:)12/09 03:39
darkwill be attempted to specify formally haskell 98?12/09 03:39
darkhaskell 98 is somewhat detached from practice as it seems (i'm a newbie to haskell actually)12/09 03:40
lispydark: http://www.haskell.org/haskell-symposium/2010/accepted.html12/09 03:40
lispyMaciej Pirog and Dariusz Biernacki. A Systematic Derivation of the STG Machine Verified in Coq12/09 03:40
lispySTG machine is what GHC uses12/09 03:40
darkwould then this be a formal "operational semantics"?12/09 03:41
lispydark: but yeah, haskell and ghc's rts will catchup eventually in the formal arena12/09 03:41
dark(I'm somewhat confused by those terms)12/09 03:41
lispydark: I'm not sure to be honest.  I know SPJ gave an operational semantics in his book about implementing haskell12/09 03:41
darkI ask myself: why specify a first "standard" for haskell in plain english? If there were no need for formalism, is a standard necessary at all? Due to this, verifying haskell looks very hard to me12/09 03:45
darkotherwise they would make some effort to verify it. (but maybe they weren't sure about the most adequate semantics. but this is also an argument against standardization at all)12/09 03:46
darkthey = the committee, that disbanded after haskell 9812/09 03:47
dark"Invertible syntax descriptions: Unifying parsing and pretty printing" - looks a lot interesting õ.o12/09 03:47
* Saizan has seen optimized external core, he wouldn't ever try to prove anything about it12/09 10:39
darkSaizan, that's the problem. I've saw too much times some gcc optimizations miscompiling without notice12/09 12:20
darksometimes optimizations interact with each other in odd ways, and one has to be sure that any possible interaction will result in a correct compilation12/09 12:20
Saizanproving that would be easier than what i was thinking of12/09 12:59
Saizansince you are proving properties of a program written by a human :)12/09 12:59
Saizaneven if that program is a translator between languages12/09 13:00
Saizanwhat i wouldn't attempt is to take the output of optimizations as the program i want to prove properties of12/09 13:00
dschoepeI'm reading Ulf Norell's agda tutorial and have a question about the suggested exercise of proving that all elements in the list returned by filter satisfy the predicate corresponding to the given function. That's what I got so far: http://agda.pastebin.com/y5sfWfUp -- I'm having trouble filling out that last hole though, could someone give me a hint?12/09 21:25
copumpkinyou probably don't want true/false12/09 21:28
copumpkinas much as a decidable predicate12/09 21:28
copumpkinit's similar to yes/no12/09 21:28
copumpkinI mean, it's similar to true/false, but carries proof of the thing being satisfied or not12/09 21:28
Saizani'd guess that you just have to put "_" in place of the ? and it'd work12/09 21:29
Saizansince T true = \top; T false = \bot12/09 21:30
copumpkinoh, yeah12/09 21:30
Saizanthough maybe it doesn't interact so well with pattern matching in this case12/09 21:31
dschoepeSaizan: I tried that and agda acts as if there was still a hole(showing _78 : T (p x)).12/09 21:31
copumpkinah, is it yellow?12/09 21:31
dschoepeyes12/09 21:31
Saizanyeah, since T (p x) wasn't in the context earlier it doesn't get refined by you matching on p x12/09 21:31
dschoepeIn such a case, do I have to match on something different or is there some way to trigger that manually, like coq's simpl-tactic?12/09 21:33
Saizanyou could use the Inspect idiom from Relation.Binary.PropositionalEquality12/09 21:36
codolioTry 'with p x | T (p x)'12/09 21:36
Saizani'm afraid that using 'with p x | T (p x)' it won't then remember that the pattern for T (p x) is the same type the hole should have12/09 21:38
codolioAh, yeah.12/09 21:39
dolioThis is why decidable predicates are so much better.12/09 21:40
Saizanmh, i'm following darcs Agda too closely for my own good :)12/09 21:48
copumpkinhow come?12/09 21:48
Saizansuffering from some bugs/incompatibility with the stdlib, they seem to get promptly fixed though :)12/09 21:50
dschoepehmm, I still can't figure it out, I tried inspect and using an own type like this: http://agda.pastebin.com/NyXxdDWK12/09 21:51
dschoepeAm I going in the right direction?12/09 21:51
SaizanIsTrue? b = Dec (T b) -- fyi12/09 21:52
Saizanthat would work, but you also need to pattern match on p x to make filter p (x :: xs) reduce12/09 21:52
doliohttp://agda.pastebin.com/N6DzXpqD12/09 21:53
dolioHow's that for outside the box?12/09 21:53
Saizannice :)12/09 21:54
dschoepehttp://agda.pastebin.com/05yaUeQX -- hmm, I think I'm close now(but still far away from understanding dolio's approach though) :)12/09 22:02
copumpkindon't think that's going to get you there12/09 22:03
copumpkinoh maybe it will12/09 22:03
Saizanheh, sigh, too much reduction there.12/09 22:04
* copumpkin shakes his fist at bools12/09 22:04
copumpkinthey're so uninformative! :P12/09 22:04
* dschoepe is starting to think that he should put this exercise aside for now :)12/09 22:05
doliodschoepe: I don't recommend my approach. :)12/09 22:05
Saizani think it's quite doable with Inspect12/09 22:05
Saizanor if your filter used something like Dec12/09 22:05
doliodschoepe: What I did was use 'with' to refine the type of _:all:_ along with the match on p x.12/09 22:05
dschoepeSaizan: It's the filter from the stdlib12/09 22:06
dolioSo, when 'p x' got matched on, yielding 'true', the type of the '_::_ ...' I was matching on got refined from 'T (p x) -> ...' to 'Unit -> ...'.12/09 22:07
dschoepeah, thanks for the explanation12/09 22:09
Saizanit seems filter changed in my stdlib12/09 22:12
dschoepetrying to solve this with inspect seems to prevent agda from reducing filter, since it generates identical types for both holes: http://agda.pastebin.com/yHLZBqyC12/09 22:15
dschoepeShouldn't inspect save me the trouble of having to match against (p x) again?12/09 22:16
copumpkinSaizan: really? does it use Dec now?12/09 22:16
Saizancopumpkin: it goes through Maybe12/09 22:17
Saizanhttp://pastebin.com/ZkvZmQEU -- with inspect12/09 22:17
Saizandschoepe: yeah, i was a bit surprised by that, luckily we've rewrite :)12/09 22:18
dschoepeThanks, didn't know about that.12/09 22:19
Saizanwhen you've (foo | bar) and want to cast it to (foo | baz) using a proof of bar == baz, there's no way to do it with subst, right?12/09 22:29
liyangRewrite?12/09 22:36
Saizanhttps://lists.chalmers.se/pipermail/agda/2009/001513.html <- new in Agda-2.2.612/09 22:37
* copumpkin is a big fan of Rewrite12/09 22:40
* Saizan was going to make a facebook joke but it felt inappropriate.12/09 22:42
--- Day changed Mon Sep 13 2010
leohi!13/09 02:50
leothere is a way to give arguments to main, like the getArgs of haskell ?13/09 02:52
copumpkinyou can bind to haskell :)13/09 02:52
leo:D ok13/09 02:53
leothanks13/09 02:53
dreixelhi13/09 07:26
dreixelI'm having a bit of trouble with syntax of parametrised modules13/09 07:26
dreixelhow can I open a parametrised module?13/09 07:26
dolioopen M x y z13/09 07:27
dreixelyeah, that doesn't seem to work13/09 07:27
dreixelI get parse errors13/09 07:28
copumpkincan we see?13/09 07:28
dreixelif I'm using operators as arguments13/09 07:28
copumpkinyou imported it?13/09 07:28
dreixeldo I need parentheses or anything?13/09 07:28
copumpkinyou're putting them with the underscores?13/09 07:28
dreixelyeah13/09 07:28
dreixelopen import IxFun2 IxCode _∔_ ⟪_⟫ ∔→+ ≡ix13/09 07:28
copumpkinI think you might need to import and open separately?13/09 07:28
copumpkinmaybe not, but I usually do that13/09 07:28
dreixelno, I get the same parse error13/09 07:29
dreixelon \<<13/09 07:29
dolioDoes it work with parentheses?13/09 07:29
dreixelwhere?13/09 07:30
dreixelon each one?13/09 07:30
dreixelon the offending one?13/09 07:30
dolioThe ones that cause errors, at least.13/09 07:30
dreixelI tried a few combinations13/09 07:30
dreixelif I put parentheses on the _+_ the error moves there13/09 07:30
dreixelif I put it on the \<<_\>>, the error stays there13/09 07:30
copumpkinif you put a hole on the <<_>>, does it work?13/09 07:32
copumpkinlike, is that one the only problem?13/09 07:32
dreixelhow do I put holes there?13/09 07:33
dreixelboth ? and _ give parse errors.13/09 07:33
copumpkin:O13/09 07:33
dreixelmaybe I'm doing something terribly wrong...13/09 07:34
dolioI can't seem to reproduce your problem.13/09 07:34
dreixelno, this is weird13/09 07:35
dolioAre those two things after <<_>> not operators?13/09 07:35
dreixeleven if I try to open it with all Zeros, say13/09 07:35
dreixelI still get an error on the third argument13/09 07:35
dreixelthose after <<_>> are not operators, no13/09 07:36
dreixeloh ok, solved13/09 07:40
dreixelfirst I should import, without parameters13/09 07:40
dreixeland then open, with the parameters13/09 07:40
copumpkinyeah, that's what I meant earlier, sorry13/09 07:41
dreixelcopumpkin was right all along13/09 07:41
dreixelanother question regarding modules13/09 07:44
dreixelis there an easier way to have a couple of modules all parametrised over the same stuff, other than repeating the parameters everywhere?13/09 07:45
dolioPut them inside another module?13/09 07:45
dreixeluhm, yeah, but then they have to be on the same file13/09 07:48
dolioOh. Then no.13/09 07:49
dreixelalright, thanks13/09 07:49
lispyanyone awake?13/09 08:03
lispyequal? : (n m : Nat) -> Equal? n m13/09 08:03
lispyequal? zero zero = eq refl13/09 08:03
lispywhy eq refl instead of eq (zero == zero) ?13/09 08:03
lispy(this is from the agda tutorial pdf)13/09 08:04
lispydata Equal? (n m : Nat) : Set where13/09 08:04
lispyeq : n == m -> Equal? n m13/09 08:04
lispyneq : n13/09 08:04
lispy̸= m -> Equal? n m13/09 08:04
lispythat did not paste well13/09 08:04
TheOnionKnightzero == zero is the type of proofs (aka proposition) that zero equals zero, refl {x} is the proof of the proposition x == x, eq takes a proof of the proposition n == m, hence the refl.13/09 09:37
tsapiis it allowed to use a semicolon in a mixfix binder declaration?13/09 14:12
tsapiwhen I try: syntax mbind e1 (\x -> e2) = x <- e1 ; e213/09 14:13
tsapii get: The right-hand side can only be omitted if there is an absurd13/09 14:15
tsapipattern, () or {}, in the left-hand side.13/09 14:15
tsapiwhen checking that the clause e2 has type _3313/09 14:15
tsapi(or rather, is it supposed to be allowed)13/09 14:15
Saizanthat's one of the examples used.. though maybe <- is the one causing trouble?13/09 14:22
tsapiSaizan: yes, funny if it doesn't work... I tried switching <- for something else but it didn't help13/09 14:24
leosd-pointwise : { s d s′ d′ : ℕ } → (s , d) ≡ (s′ , d′) → s ≡ s′ × d ≡ d′13/09 17:14
leosd-pointwise refl = ?13/09 17:14
leoThere is an error in refl13/09 17:15
leohow i can proof something like this (i'm sorry for my english xD)13/09 17:15
Saizani'd probably go with "sd-pointwise eq = cong proj\_1 eq , cong proj\_2 eq"13/09 17:16
leooh , where is cong ?13/09 17:17
copumpkinRelation.Binary.PropositionalEquality iirc13/09 17:17
leothanks13/09 17:18
copumpkinwe need an agda hoogle :)13/09 17:18
leoyes!13/09 17:18
copumpkinalthough I guess a type-based search is not a trivial problem13/09 17:18
leoegrep, grep13/09 17:18
leoxD13/09 17:19
Saizanepigram 2 can fill in proofs from the context for you, so they must have something like a type based search13/09 17:20
Saizanwhich doesn't guarantee it's efficient :)13/09 17:21
jonrafkindwhat exaclty does '!=<' mean?13/09 20:07
copumpkinnot smaller than!13/09 20:09
copumpkinor equal to13/09 20:10
copumpkin:P13/09 20:10
copumpkinwhat's the context?13/09 20:10
jonrafkindhold on, im gonna paste it13/09 20:11
jonrafkindhttp://pastebin.com/AQtVmTaA13/09 20:12
copumpkinI've seen that before too, but not sure what the reasoning behind using that symbol is. You can see what they mean, though?13/09 20:15
jonrafkindwell not really13/09 20:15
jonrafkinddo you understand whats going wrong here?13/09 20:15
copumpkinwell C Nat13/09 20:15
copumpkinis just a value of SigDesc13/09 20:16
jonrafkindright13/09 20:16
copumpkinyou're saying the type of mine6 is a value of SigDesc13/09 20:16
jonrafkindi thought GADT's let me say that13/09 20:16
jonrafkindthat i could narrow the SigDesc to a specific constructor13/09 20:16
copumpkinnope, it's gotta be Set at some level13/09 20:16
copumpkinany value13/09 20:16
copumpkinmine6 : SigDesc13/09 20:16
jonrafkindmine2 : {A : Set} -> Time -> SF [ C ℕ ] [ C String ] cau13/09 20:17
jonrafkindmine2 t = pure (λ x -> "a")13/09 20:17
jonrafkindthis works13/09 20:17
jonrafkindwhere SF takes a List SigDesc13/09 20:17
copumpkinoften if you see [ ] (by convention) it means interpret a custom universe into a Set13/09 20:17
jonrafkindif i change mine6 to SigDesc I get a different error13/09 20:17
copumpkinyeah, cause 4 isn't Set13/09 20:17
copumpkinmine6 : SigDesc; mine6 = C Nat13/09 20:17
copumpkinshould work13/09 20:17
jonrafkindyea that works13/09 20:18
copumpkinyou probably want some sort of interpreter for your universe13/09 20:18
copumpkinalso, do you have --type-in-type turned on? :P13/09 20:18
jonrafkindyea13/09 20:18
jonrafkindthat seems to be required13/09 20:18
copumpkinnah13/09 20:18
jonrafkindim using a library of some other code13/09 20:18
copumpkinah13/09 20:19
jonrafkindand iwthout it his code wont typecheck13/09 20:19
copumpkinick :P13/09 20:19
jonrafkindsuch is life13/09 20:19
jonrafkindwhat does an interpreter have to do with this13/09 20:19
jonrafkindi mean there is one.. but im not using it yet13/09 20:19
copumpkinwell typically you create custom universes of things you care about using some form of inductive family13/09 20:20
copumpkincould be finite types or whatever13/09 20:20
copumpkinand then you have a function taking that custom universe into Set13/09 20:20
copumpkinto give you "agda types"13/09 20:20
copumpkinlike maybe your function would be [[_]] : SigDesc -> Set13/09 20:20
copumpkinand then [[ E x ]] = ...; [[ C x ]] = ...13/09 20:21
copumpkinand mine6 : [[ C Nat ]]13/09 20:21
copumpkinnot sure I'm being very clear :)13/09 20:21
copumpkinwhat is SigDesc for?13/09 20:21
jonrafkindto encode FRP values13/09 20:21
jonrafkindE = events, C = behaviors13/09 20:22
copumpkinah13/09 20:22
copumpkinso just as a tiny example, you might have data Finite : Set where 0# 1# : Finite; _+_ _*_ : Finite -> Finite -> Finite13/09 20:24
jonrafkindya13/09 20:25
copumpkin[[_]] : Finite -> Set; [[ 0# ]] = \bot; [[ 1# ]] = \top; [[ x + y ]] = [[ x ]] \u+ [[ y ]]; [[ x * y ]] = [[ x ]] \x [[ y ]]13/09 20:25
jonrafkindso the [[_]] is an injective function?13/09 20:25
jonrafkindwhats \u+ and \x13/09 20:26
jonrafkindagda's + and agda's * ?13/09 20:26
copumpkin\u+ is basically Haskell's Either13/09 20:26
copumpkinand \x is (,)13/09 20:26
copumpkinthey're just in the standard library, but yeah13/09 20:26
jonrafkindoh ok, set combinations or whatever13/09 20:26
jonrafkindim not a haskell pro, so i dont know (,)13/09 20:26
copumpkinsimple sum and product13/09 20:26
copumpkinah okay13/09 20:26
copumpkinyeah, just a disjoint sum and a pair13/09 20:27
jonrafkindok13/09 20:27
copumpkinso if I understand your SigDesc correctly, you're making some sort of a universe representing the kinds of types you care about in FRP13/09 20:27
copumpkinand you want to carry that universe into plain old agda types13/09 20:28
copumpkinso you can make easy values for it13/09 20:28
jonrafkindyes I think so13/09 20:28
copumpkinso you'd basically need to figure out what your SigDesc -> Set would look like (note that your SigDesc -> Set could itself be another type, this time a family indexed by the type of elements it creates)13/09 20:29
copumpkinjonrafkind: so if you consider C <agda type> and E <agda type> to be types themselves, what would their values look like?13/09 20:32
jonrafkindjust the agda type13/09 20:32
jonrafkindC and E are to pass them around13/09 20:32
copumpkinoh, so then that's simple13/09 20:33
copumpkin[[ E x ]] = x; [[ C x ]] = x13/09 20:33
copumpkin:)13/09 20:33
jonrafkindyea13/09 20:33
jonrafkindthe intepreter is for pushing values through the FRP functions13/09 20:33
jonrafkindwhere time is a parameter to every function13/09 20:34
copumpkinah13/09 20:34
g_crossIs there a function in the standard library that allows one to convert a Dec P to a Dec Q given maps (P -> Q) and (Q -> P)?13/09 20:43
g_crossAlso, out of curiosity, what general structure is it where you can take a type F A and convert it to a type F B given maps (a -> B) and (B -> A)?  It's not a functor or a cofunctor, but something that's both and probably has some sort of name.  :-)13/09 20:44
Saizaninvariant functor13/09 20:45
g_crossYay!  I knew it.  :-)  Can we put it in the standard library and make Dec an instance of it?13/09 20:45
g_crossI mean, I don't mind writing up patches for this, but I don't know what the policy is.13/09 20:45
Saizan(btw, "cofunctor" is quite an abuse of the co- prefix)13/09 20:46
copumpkincontrafunctor!13/09 20:46
g_crossOHHHH, thanks, I hadn't realized that.13/09 20:47
g_crossWhy in retrospect should I have known to use contra- instead of co-?13/09 20:48
Saizang_cross: dunno either, though even without a record type for invariant functors a map function in the module that defines Dec would make sense13/09 20:48
Saizanwell, co- is when you interpret a definition in the dual category but still seeing it from the original one13/09 20:49
Saizanbut if you do that to a covariant functor you still get the same covariant functor :)13/09 20:49
Saizanand instead covariance (contravariance) is used in various field to roughly mean "changing in the same (opposite) way"13/09 20:52
g_crossOh, I see;  so technically in general use when one sees a "functor" one is really seeing a "cofunctor" since the "co-" is implicit;  thus, the dual to a functor is not a cofunctor but a *contra*functor.13/09 20:54
Saizannono13/09 20:54
g_crossThat is, a functor can be covariant or contravariant, but because people are lazy they say just "functor" when they mean covariant functor.13/09 20:54
dolioNo. "Co" just isn't applied to functors.13/09 20:54
Saizanthe fact that "covariant" starts with "co" is not related to the common use of co- as a prefix13/09 20:55
g_crossAh, okay.13/09 20:55
dolioA lot of category theory doesn't talk about covariant vs. contravariant functors.13/09 20:55
dolioThey just talk about functors, which means the first case, where f : A -> B  => Ff : FA -> FB.13/09 20:55
g_crossOkay, so "co-" is never used as a prefix for functors, but "contra-" is?13/09 20:55
dolioAnd then a contravariant functor from C to D is a functor from C^op to D.13/09 20:56
dolioAnd an "invariant" functor above would be a functor from some other category related to C to D.13/09 20:57
Saizansame objects as C but arrows are isomorphisms?13/09 20:58
dolioIt would have all the objects of C, but instead of C's arrows, it would have arrows f : A -> B being a pair of C-arrows (g : A -> B, h : B -> A).13/09 20:58
dolioI'm not sure it'd need to be isomorphisms.13/09 20:58
dolioI can't say I've seen that used before, though.13/09 20:59
dolioThe only thing I know of that talks about them is (I think) Bananas in Space.13/09 21:00
dolioWhere they're called expfunctors.13/09 21:00
Saizanheh13/09 21:00
dolioAnd they don't bother with the category theoretic definition of them.13/09 21:00
dolioThey just go with expmap :: (a -> b) -> (b -> a) -> F a -> F b.13/09 21:00
dolioI think that's how they are in category-extras, too.13/09 21:01
g_crossSo:13/09 21:02
g_crosshttp://pastebin.com/RiMn1Anr13/09 21:02
Saizani'd call it "map"13/09 21:02
g_crossFair enough13/09 21:02
g_crossI guess my thought in calling it something else is that it requires both a map from P to Q and a map from Q to P.13/09 21:03
doliomapDec is a sensible name.13/09 21:03
g_crossOkidoke13/09 21:03
g_crossSo how do I get this put in the standard library?13/09 21:03
dolioNot sure. Does the wiki have instructions for submitting changes?13/09 21:04
Saizanhttp://www.cs.nott.ac.uk/~nad/listings/lib/README.html <- last paragraph of the header13/09 21:05
g_crossCool, just saw that13/09 21:06
g_crossTo whom should I send the e-mail?13/09 21:06
Saizanthe mailing list seems appropriate13/09 21:06
g_crossExcellent13/09 21:07
g_crossSo, in order to do this I need to be running the development version of the library and of Agda.13/09 21:07
g_crossIn your experience, how stable is the development version of agda?13/09 21:07
g_crossI was hesitant to use it because I was afraid of getting frustrated with running into lots of bugs.13/09 21:08
dolioPretty stable.13/09 21:08
Saizanfairly stable in general, but somewhat less lately since they are implementing quite a few things13/09 21:08
dolioI don't think I've ever used a release version.13/09 21:08
Saizani had to unpull a patch to make the stdlib typecheck13/09 21:09
dolioYeah, they can get desynced there sometimes.13/09 21:09
g_crossSo, any thoughts for how one might introduce an invariant functor class to the standard library?13/09 21:17
g_crossPresumably it would be done in a manner analagous to Functor, i.e. create a record RawSomething with fields.13/09 21:18
g_crossSo really it's just a matter of figuring out what to call it and which module it should go into.13/09 21:18
dolioAgda doesn't have classes.13/09 21:18
g_crossYes, sorry, I mispoke there.13/09 21:19
g_crossToo used to Haskell terminology  :-)13/09 21:19
g_crossWhat is the term I should have used?13/09 21:19
dolioDon't know. :)13/09 21:21
Saizanwe can bikeshed between ExpFunctor and InvariantFunctor (the former is probably more common overall), but it should probably go under Category13/09 21:21
dolioDoes the standard library have functors? I forget.13/09 21:21
g_crossYes.13/09 21:21
g_crossIn Category.Functor13/09 21:21
dolioWell, it would go in a similar place.13/09 21:22
g_crossAgreed.13/09 21:22
Saizana -> a could also be an "instance"13/09 21:22
g_crossHowever, should that be in Category.Functor, Category.ExpFunctor, Category.Functor.ExpFunctor?13/09 21:22
SaizanCategory.Functor.Exp ? :)13/09 21:23
g_crossWorks for me.13/09 21:23
Saizaneasy to change anyway13/09 21:24
g_crossHeh, it's kinda nice working with such a young language because there are still easy, obvious ways in which one can contribute.  :-)13/09 21:26
g_crossWhy is there a convention of putting so much functionality into a submodule called "Core" and then importing that module publicly?13/09 21:34
liyangMutual dependencies, I believe.13/09 21:42
jonrafkindif [ 1 ] is a list with one element, 1, then how do i write a list with two elements?13/09 23:07
Saizanwith the stdlib list it'd be "1 \:: [ 1 ]" or "1 \:: 1 \:: []"13/09 23:11
jonrafkindyea.. i got that to work. thats pretty awful syntax13/09 23:16
Saizanmaybe you can make something closer to haskell's notation with mixfixs :)13/09 23:39
dolioIt'd be pretty evil.13/09 23:41
dolioI think I've done it.13/09 23:41
Saizanistr that too13/09 23:41
dolio[ = id, _,_ = cons, ] = nil probably works.13/09 23:41
dolioOh wait, no, that's got a , ].13/09 23:42
dolioYou need _] = singleton.13/09 23:43
* dolio disappears.13/09 23:43
benmachinethat syntax never bothered me, though13/09 23:43
benmachinehow often to you construct big list literals in agda anyway?13/09 23:44
jonrafkindmy inner-scheme child is crying :p13/09 23:45
--- Day changed Wed Sep 15 2010
camiohehe, love the topic.15/09 19:44
Spockzis it new? :)15/09 19:46
camionew to me :)15/09 19:46
SpockzI'm starting with Agda again with this course: http://www.cs.uu.nl/education/vak.php?stijl=2&vak=INFOMDTP&jaar=2010 :D15/09 19:51
--- Day changed Thu Sep 16 2010
* glguy gets his module to fully check for the first time: http://www.galois.com/~emertens/integer-properties/DataIntegerProperties.agda16/09 03:59
glguyisCommutativeSemiring : IsCommutativeSemiring _≡_ _+_ _*_ (+ 0) (+ 1)16/09 03:59
glguyfor Data.Integer16/09 03:59
glguynow its time to make it "clean" :)16/09 04:00
dolio(+ 0) (+ 1)?16/09 04:02
dolioOh, positive 0 and positive1.16/09 04:02
glguy+_ is the Data.Integer cons.16/09 04:03
glguyyeah, that16/09 04:03
glguyThe real joy is that now we can just use the RingSolver instead of mucking about with integers16/09 04:03
copumpkinvery nice16/09 04:06
copumpkinsubmit a patch to the std lib :)16/09 04:06
glguyIf you look at the link you'll notice that the module has a long way to go before it is good enough to submit16/09 04:07
glguyI've got a bunch of things I couldn't think of names for named case1,case2...16/09 04:08
copumpkinyeah16/09 04:08
glguyand I took no notice of line lengths16/09 04:08
glguythe chains of rewrite rules are ugly...16/09 04:09
copumpkinI dunno, I quite like using chains of rewrites :) but I guess they aren't very clear16/09 04:11
glguythey are great for when I was working through the proof16/09 04:11
glguythey are pretty opaque, however16/09 04:11
glguyThe RingSolver kick's the agda executable's ass...16/09 05:13
glguys/'//16/09 05:13
copumpkinhow so? eats lots of resources?16/09 05:14
glguyfiles take *minutes* to load and use hundreds of MB of ram16/09 05:14
copumpkinyeah :/16/09 05:14
copumpkinthe paper it's based on gives a more efficient way of doing it16/09 05:15
lispy_glguy: congrats16/09 05:15
glguybut it sure is convenient...16/09 05:15
copumpkinthe ringsolver uses one constructor per exponent lift, if you know what I mean16/09 05:15
copumpkinwhereas the paper it's based on allows you to lift by an arbitrary nat each time16/09 05:15
* copumpkin would like to change it to the more efficient form, and possibly use the goal quoting stuff in conjunction with it16/09 05:17
copumpkinbut it's a lot of work :P16/09 05:17
glguythanks, lispy16/09 05:17
copumpkinand I don't actually have a use for it16/09 05:17
glguyhttp://www.galois.com/~emertens/integer-properties/DataIntegerProperties.agda first round of clean ups... moved the Commutative Monoid proofs for + and * to their own files...16/09 05:19
glguyThis might actually end up being readable16/09 05:19
jonrafkinddoes agda have printf or something?16/09 17:09
copumpkinyou could write a fully typesafe one :)16/09 17:09
copumpkinin fact, I vaguely remember seeing one in an example somewhere16/09 17:10
copumpkinanyone have any idea why a simple case of quickcheck on a one-line non-recursive function (100 tests) in ghci would eat up 400+ MB of RAM (I kill it before it finishes)?16/09 18:03
copumpkinwhoops, wrong channel16/09 18:06
glguycopumpkin: were you using some complicated Arbitrary instance?16/09 18:08
copumpkinno, just Int on all three parameters16/09 18:08
copumpkinmm, lots of yummy new things in the 2.2.8 notes16/09 18:16
jonrafkindtypes have types and values have types, but declaring types and values use the same syntax. how can you tell when some identifier is a type or if its a value?16/09 18:33
jonrafkindi guess a type declaration has 'foo : Set' ?16/09 18:34
Saizanyeah, the type of types end with Set n16/09 18:35
Saizan*ends16/09 18:35
jonrafkindare people happy with that syntax? I would prefer some clear separation between type declarations and value declarations16/09 18:35
copumpkinhow about types of types?16/09 18:36
copumpkinand so on?16/09 18:36
copumpkinyou'd need an infinite amount of syntax!16/09 18:36
copumpkin:P16/09 18:36
jonrafkindanything that can be used as a type should use one syntax16/09 18:36
jonrafkindfoo : N. foo = 2. you cant use foo as a type in any other context16/09 18:36
copumpkinhmm16/09 18:37
jonrafkindfoo : Set. foo := N. something like that16/09 18:37
* Saizan doesn't follow16/09 18:38
* copumpkin neither16/09 18:38
copumpkinyou want some sort of syntactic indicator (case?) that a given variable is a member of Set n ?16/09 18:38
jonrafkindfoo : N. foo = 2. bar : foo; thats an error16/09 18:38
jonrafkindyea i guess16/09 18:39
Saizananyhow i like the lack of lexical distinctions because i often name values (or variables) after their type16/09 18:39
copumpkinjonrafkind: how about Set-valued functions?16/09 18:39
jonrafkindthose are values, so what about them16/09 18:39
copumpkinjonrafkind: well, fun : (x : Nat) -> f x -> ...16/09 18:40
copumpkinjonrafkind: if f returns a Set, you're good16/09 18:40
copumpkinotherwise, you aren't16/09 18:40
copumpkinfurthermore16/09 18:40
copumpkinthe return type of f could vary16/09 18:41
jonrafkindok ill think about it16/09 18:41
Saizancopumpkin: nice objection16/09 18:44
copumpkinalthough the varying return type would always be a sort16/09 18:47
copumpkinmm16/09 18:47
copumpkinactually16/09 18:48
copumpkinhttp://snapplr.com/7mye16/09 18:49
Saizanyeah16/09 18:50
copumpkinalthough I guess you couldn't write h : (x : Bool) → g x → Unit at all in that case16/09 18:51
copumpkinhm16/09 18:51
SaizanF x /= Set n16/09 18:51
copumpkinyeah16/09 18:51
jonrafkindin that example is F's real type Bool -> Set2 ?16/09 18:53
Saizanno, Bool -> Set116/09 19:00
jonrafkindok so x : Set2, x = Set1 -> Set1, ?16/09 19:01
jonrafkindor I gues more generally, x : Set2, x = Set116/09 19:01
copumpkinthe type of Set n is Set n + 116/09 19:01
copumpkinSet (n + 1) ,that is16/09 19:01
jonrafkindok16/09 19:01
jonrafkinddoes haskell have a notion of Set N, or just agda?16/09 19:02
copumpkinand if x : Set n and y : Set m, then x -> y has type Set (max(n + 1, m)), I think16/09 19:02
jonrafkindhrm, that is wierd16/09 19:03
copumpkinhaskell doesn't have arbitrary set levels, nope16/09 19:04
copumpkinit has kinds, which are the types of types, but they don't really behave like regular types much at all16/09 19:04
jonrafkindok i was reading some haskell documentation to try to learn parts of agda, because there is so little documentation on agda16/09 19:04
SaizanSet 0 == haskell's *, but in haskell you never have to talk about the type of *16/09 19:05
jonrafkindoh I thought * was Set 1?16/09 19:05
jonrafkindtype of values = Set 0, type of Set 0 is Set 116/09 19:05
SaizanSet 0 is the type of types of values16/09 19:06
copumpkinoh no, Set 0 (a.k.a., Set) is the type of smal ltypes16/09 19:06
Saizanjust like * in haskell16/09 19:06
jonrafkindso whats the type of values? Set -1 ?16/09 19:06
Saizanthere isn't a single type of values16/09 19:07
jonrafkindoh hm ok16/09 19:07
copumpkinyou can ask agda-mode to tell you types with C-c C-d16/09 19:07
copumpkinif you did C-c C-d true16/09 19:07
copumpkinit would tell you Bool16/09 19:08
Saizanbut yeah, in agda you can also have types of values that are of type Set n with n >= 0, so copumpkin's definition is more correct16/09 19:08
jonrafkindheh I use vim :p16/09 19:08
copumpkinjonrafkind: oh, I really wouldn't recommend not using agda-mode, especially when you're just getting started16/09 19:08
copumpkinI know there's a vim one but I think it's mostly neglected isn't it?16/09 19:08
camioIs Set1 the set of all types and Set0?16/09 19:10
camioWhich doesn't include Set1.16/09 19:11
copumpkinthey're not subtypes, if that's what you're asking16/09 19:11
copumpkinif I have something that wants a Set5, I can't pass in a Bool (which is Set)16/09 19:11
camioI haven't come across an explanation of the multiple Setn types.16/09 19:12
camiookay16/09 19:12
copumpkinyou can declare a Bool that lives in Set5 though16/09 19:12
copumpkinlike I did in that pic, for BigBool in Set116/09 19:12
camiopic?16/09 19:13
* camio looks at prior conversation16/09 19:13
copumpkinhttp://snapplr.com/7mye16/09 19:13
camioI think that answers my question.16/09 19:21
camiothanks16/09 19:21
camiog in that example is a bit mindblowing. I'm going to go scream now.16/09 19:22
copumpkinanyone tried building agda HEAD?16/09 19:29
copumpkinoh, I see16/09 19:30
dolioI built it yesterday or the day before.16/09 19:49
dolioSo that I could try out the binding syntax.16/09 19:50
dolioThere's really a dearth of good characters to make your own syntax in that regard, though.16/09 19:50
dolioReally, you probably want '\Sigma x : A . T' or something along those lines.16/09 19:51
dolioBut both the : and the . are illegal.16/09 19:51
copumpkinyou can use the pseudo : (\:) :P16/09 19:56
copumpkinbut not sure about that dot16/09 19:56
dolioYeah, I used \:.16/09 19:56
copumpkinit also feels like a hack16/09 19:56
dolioBut it's blurry and wide.16/09 19:56
dolioAnd I think I used & instead of .16/09 19:56
dolioAnyhow, I think the : should be unambiguous, at least, so it'd be nice if it were usable.16/09 19:57
copumpkinyeah16/09 19:57
dolioSince : is exactly what's being declared there.16/09 19:57
jonrafkindso printf in agda? anyone know how to do it?16/09 21:26
Saizanit really depends on how you want the format string to look like, i'm not even sure there are string literals..16/09 21:40
jonrafkindok can I at least do assert?16/09 21:42
Saizananyhow, you'd have to write a function f : FormatString -> Set that parses the string to tell which arguments to expect that constructs the right function type16/09 21:43
Saizanso then printf : (str : FormatString) -> f str16/09 21:43
jonrafkindyea I found http://code.haskell.org/Agda/test/succeed/Printf.agda but it didnt work16/09 21:43
jonrafkindjust gave me some strange type errors16/09 21:43
Saizanworks here16/09 21:44
Saizanmaybe you need a more recent agda version16/09 21:45
jonrafkindis there assert?16/09 21:45
jonrafkindi just want to do assert(blah == "a")16/09 21:45
Saizanwhat should that do?16/09 21:46
jonrafkindraise an error of some sort if its false16/09 21:47
jonrafkindlike what assert does in most languages16/09 21:47
Saizani don't know of a way to do that16/09 21:48
jonrafkindok what are you supposed to do with values in the agda language?16/09 21:48
jonrafkindif i cant inspect them, whats the point?16/09 21:49
Saizanyou can inspect them..16/09 21:49
Saizane.g. by pattern matching16/09 21:49
jonrafkindand do what with the result?16/09 21:49
jonrafkind"a" -> true, _ -> false, ok now what?16/09 21:50
Saizanproduce other values?16/09 21:50
jonrafkindhow can I tell if it produced true or false?16/09 21:50
Saizanyou can use C-c C-n to evaluate an expression to normal form16/09 21:50
Saizanor you could define foo : some_expr \== some_value; foo = refl16/09 21:51
jonrafkindoh alright, i guess thats reason enough to use agda mode16/09 21:51
Saizanand see if that passes the typechecker16/09 21:51
Saizanassuming "data _\==_ (A : Set) (x : A) : A -> Set where refl : x \== x"16/09 21:52
Saizanyou can also write a complete program with a main, compile and run it16/09 21:53
jonrafkindand presumably print something from the main function?16/09 21:54
Saizanyes16/09 21:55
jonrafkindhow can I tell if agda mode is working properly? i ran 'agda-mode setup' and it added some lines to my ~/.emacs. C c C n doesnt work though16/09 22:15
Spockzjonrafkind: isn't there some buffer that shows some errors/16/09 22:19
Spockzjonrafkind: are you on zsh by any chance?16/09 22:19
jonrafkindbash16/09 22:19
jonrafkindno buffer with errors16/09 22:20
jonrafkindtheres a "-UUU:**--F1' bar at the bottom of my emacs16/09 22:20
Spockzbut with aggda-mode setup you don't need to add anything I remember?16/09 22:20
Spockzjonrafkind: no idea. I'm just a user…16/09 22:20
jonrafkindit automatically added some lines to my ~/.emacs16/09 22:20
jonrafkindi didnt do anything manual otehr than run agda-mode setup16/09 22:21
Spockzjonrafkind: are you on OS X?16/09 22:26
jonrafkindlinux16/09 22:26
jonrafkindgnu emacs16/09 22:27
Spockzno idea than sorry, do you have an `Agda' menu item?16/09 22:28
Spockzo16/09 22:28
Spockzdid you try C c C l first?16/09 22:28
jonrafkindundefined16/09 22:29
jonrafkindno agda menu item16/09 22:29
Spockzthan it really didn't load agda16/09 22:29
Spockzdo you have the haskell-mode?16/09 22:29
jonrafkindI guess not16/09 22:29
Spockzyou need that too apparently don't know how to get it16/09 22:29
Spockzgot it somehow last time16/09 22:29
jonrafkindgentoo has it, i can just emerge it16/09 22:30
jonrafkindok agda mode works after installing haskell mode16/09 22:37
Spockzjonrafkind: but maybe you should look into getting some error messages16/09 22:37
jonrafkindi get error messages from agda now16/09 22:38
Spockzok16/09 22:38
jonrafkindugh, syntax highlighting makes some characters dissappear (like =)16/09 22:40
Saizanis there an agda encoding of the halting problem?16/09 23:24
--- Day changed Fri Sep 17 2010
Guest13799Hi, I'm an agda beginner trying to use it for dependently typed functional programming. I'm looking for a way to convert a natural number to a string, any pointers?17/09 11:19
copumpkindolio: in your email you just referred to a datatype with a constructor with a dotted type. Is this already valid agda syntax?17/09 11:19
copumpkindomi2: I think there's a function for that in the standard library17/09 11:20
copumpkindomi2: but most of the time we just use C-c C-n in agda-mode to view the numeric result of evaluating something17/09 11:20
domi2copumpkin: C-c C-n appears to be sufficient for what I'm trying to do, thx. I looked for a conversion function in the std lib but couldn't find one.17/09 11:21
copumpkinlet me find it17/09 11:22
copumpkinhttp://www.cs.nott.ac.uk/~nad/listings/lib/Data.Nat.Show.html#19117/09 11:22
domi2copumpkin: damn, I looked only in Data.Nat and some others that were linked from http://www.cs.nott.ac.uk/~nad/listings/lib-0.3/README.html17/09 11:23
domi2copumpkin: any better way to search for stuff in the std lib?17/09 11:23
copumpkinnot really17/09 11:26
copumpkin:P17/09 11:26
copumpkinpeople want a hoogle-like thing for agda, but it seems hard to do well17/09 11:26
copumpkinof course, I'd settle for something that doesn't even work very well17/09 11:26
domi2copumpkin: k, no prob, thanks for the help17/09 11:26
domi2yeah, something hoogle-like would be great17/09 11:26
domi2:)17/09 11:27
domi2\quit\17/09 12:44
domi2\quit17/09 12:44
Spockzagda-cabal? :P17/09 12:45
doliocopumpkin: It is somewhere, but it might be in Andreas Abel's local repository.17/09 19:53
dolioActually, maybe it's only MiniAgda right now.17/09 19:54
dolioNot sure.17/09 19:54
--- Day changed Sat Sep 18 2010
glguyI started a module tonight for dealing with unsigned word arithmetic... finite numbers supporting bitwise operations, modular arithmetic. Is there already something like this that I'm just duplicating? http://www.galois.com/~emertens/modularfin.agda18/09 08:42
copumpkinnope, I started something like that (but operating directly on Fins, rather than bit-wise) but didn't put it up anywhere18/09 08:43
copumpkinthis looks nice18/09 08:43
glguyI'm not sure if this is better or worse than operating on Fins18/09 08:43
glguyI started on Fins and then switched to bit vectors18/09 08:43
copumpkindoing modular arithmetic on fins was a pain18/09 08:43
copumpkinalso18/09 08:43
copumpkinI was playing with machine words as Fin (2 ^ n) and if you do the wrong thing and accidentally make agda evaluate such a thing18/09 08:44
copumpkinyou basically need to kill agda18/09 08:44
copumpkinbefore it runs off with all your RAM, so I think the binary approach may be better :)18/09 08:44
glguyI want to prove some properties about multiplication, but I haven't worked out an implementation that is amenable to such things.18/09 08:46
copumpkinI'd be interested in contributing if you wanted help with it18/09 08:57
copumpkinI do a lot of fairly low-level stuff that I'd like to model in agda18/09 08:58
glguyYou are more than welcome to use that module in any way18/09 08:59
copumpkinthanks :)18/09 08:59
glguyI just don't know how much long term maintenance I'll do on it (probably depends on how things go)18/09 08:59
copumpkinit'd be nice to get something like this into the standard library one day, sometihng like Data.Word or Data.BinaryWord18/09 09:00
copumpkinor just BitVector actually :P18/09 09:01
lispyClearly, agda needs Data.ByteString.Char818/09 09:01
copumpkinlol18/09 09:01
copumpkinbut a usable binary numeric type with laws proved for it18/09 09:02
lispy(actually such a thing could be useful for modeling UTF-8 stuff)18/09 09:02
copumpkin(up to finite fieldness, maybe)18/09 09:02
lispyyes, modular types that much machine types would be nice18/09 09:02
lispyI don't budget much time to my adga odyssey, but I'd like to model a "generic" unix-inspired file system in agda18/09 09:03
lispyat least at the files/directories/simple attributes level18/09 09:03
glguyI sent the Data.Integer.commutativeRing to Nils the other day18/09 09:10
glguyI'm hoping he'll want to add it to the lib18/09 09:10
copumpkinnice18/09 09:10
copumpkindid you make sure it had lots of unicode in it??18/09 09:11
copumpkinotherwise it's not eligible18/09 09:11
lispyhehe18/09 09:11
lispyglguy: is there a trick to making emacs display unicode on osx in a readable way?18/09 09:11
lispyI find things like \oplus and \otimes are indistinguishable in my emacs18/09 09:11
copumpkinthe old version of aquamacs did it much better18/09 09:12
glguymake your font bigger?18/09 09:12
lispyI'm using emacs23 directly18/09 09:12
lispyfont bigger makes me cry18/09 09:12
glguyI'm using Monoco 18 and those two are easy to distinguish18/09 09:12
lispyglguy: did you see that chrisdone rewrote hpaste from scratch?18/09 09:12
glguynope18/09 09:12
lispyI could try Monoco18/09 09:13
lispyI don't actually know what font I'm using...I find out18/09 09:13
lispyglguy: yeah, he wanted to take over hpaste.org as mmorrow has fell of the internet18/09 09:13
lispyglguy: as part of it he rewrote hpaste18/09 09:13
copumpkinhttp://snapplr.com/mzgr18/09 09:14
lispyI'm using the default font18/09 09:14
lispyMonaco 218/09 09:15
lispyer 1218/09 09:15
glguyCan he use the highlighting-kate library?18/09 09:15
glguyand still release as BSD3?18/09 09:15
lispyThat I don't know18/09 09:16
lispyfont size 18 is huge18/09 09:16
glguyat what resolution?18/09 09:17
lispychecking18/09 09:17
lispy1440x900 on a 15in18/09 09:18
glguyI'm doing 1680x1050 on the same sized screen18/09 09:18
glguyI don't know if the fonts adjust for DPI or not18/09 09:18
lispyI don't either18/09 09:18
copumpkinthey don't18/09 09:18
lispyBut you're right that at this size you can see the difference between \oplus and \otimes18/09 09:18
glguybut getting more pixels on your display is a good way to help distinguish without it being huge :)18/09 09:18
lispyI'm at max res for my video card :(18/09 09:19
lispyoh, I need to reinstall agda because I had to reinstall ghc18/09 09:20
copumpkinglguy: might this code be more readable if you just made a data Bit : Set where 0# 1# : Bit, and replaced all your true/false with the bits? :P18/09 09:20
glguyyeah, that's probably true18/09 09:21
copumpkinby the way, is it possible to ask case-splitting to split on multiple parameters at once?18/09 09:22
lispyhmm18/09 09:22
copumpkinseems like it'd be useful18/09 09:22
lispyoh, what version of emacs do you guys use on osx?  aqua, carbon or gnu emacs?18/09 09:22
copumpkinI use the latest aquamacs18/09 09:23
lispyhmm18/09 09:23
copumpkinalthough emacs purists look disapprovingly at me when I do18/09 09:23
lispyI seem to recall some versions of emacs on osx don't work correctly with modifier keys18/09 09:23
lispyand I thought it was aqua emacs that randomizes the bindnigs18/09 09:23
copumpkinmaybe :)18/09 09:23
copumpkinI don't use emacs other than for agda18/09 09:24
lispyI used to use emacs for everything.  Then I realized the folly of my ways.18/09 09:24
copumpkinso I wouldn't really notice18/09 09:24
lispyI even wrote an email client in emacs based on an existing one18/09 09:24
copumpkinyou know what's annoying? that the builtin bindings for number literals have to be constructors18/09 09:24
lispyI wish I could have those hours back.18/09 09:25
copumpkin:)18/09 09:25
lispyglguy: I signed up for japanese 101 this term at PSU tonight18/09 09:26
glguyThat ought to be fun18/09 09:26
lispyYeah :)18/09 09:26
glguyhow often will you have class?18/09 09:26
lispyI need to talk to the instructor, the entry in the course catalog is ambiguous18/09 09:27
lispyThey list 4 times but I think it's actually 4 lectures during the week and you only need to attend one18/09 09:27
lispyit's an evening class18/09 09:27
lispyI way just try using emacs with this font size, or make my agda-mode hook change to this font size18/09 09:29
lispyI wish emacs supported per-buffer font sizes18/09 09:29
lispyit's a giant font, but the readability is a HUGE perk18/09 09:30
glguycopumpkin: I updated that link to use 1# and 0# :)18/09 09:37
copumpkinsweet :)18/09 09:38
copumpkinthat'll definitely help you write your multiplication proofs!18/09 09:38
copumpkin:P18/09 09:38
copumpkin_⁻¹ : ∀ {n} → BitVector n → BitVector n18/09 09:39
copumpkinthat seems like an odd name18/09 09:39
glguy_⁻¹ : ∀ {n} → Op₁ (BitVector n)18/09 09:39
copumpkinyeah, I like that more, but I mean18/09 09:39
copumpkinright under _*_18/09 09:39
copumpkinone might think it's a (modular) inverse of multiplication18/09 09:39
glguyyeah, I did multiplication later18/09 09:40
glguythe -1 was because that was what the AbelianGroup had as its record field18/09 09:40
copumpkinyeah18/09 09:40
copumpkinI'll write the left- and right- identity proofs for multiplication for you if you don't want to deal with tedium :P18/09 09:40
copumpkinlooks a lot easier than doing -comm or -assoc :P18/09 09:41
glguy-_ : ∀ {n} → Op₁ (BitVector n)18/09 09:41
lispyis that unary minus?18/09 09:42
glguyyes18/09 09:42
lispyoh I see: x ⁻¹ = one _ + bitwise-negation x18/09 09:42
lispy2's complement?18/09 09:43
copumpkinthe worst thing about mac os: downloading a file (such as your modularfin.agda) and having it append a .txt to it. Then, in finder, renaming the file to remove the .txt suffix, and having it interpret that as "hide extension" rather than renaming it18/09 09:43
glguylispy: right18/09 09:44
lispyglguy: are you going to write a GHC Core to Agda translator for the haskell-verifier project? :)18/09 09:44
glguycopumpkin: I download files like that using curl :)18/09 09:44
glguylispy: nope :)18/09 09:44
copumpkinlol18/09 09:44
glguyso much smiling18/09 09:44
lispyyou totally should18/09 09:44
copumpkinlispy: how would you address the translation of non-terminating programs to agda?18/09 09:45
copumpkin(and how would you detect them? :P)18/09 09:45
glguyThe same way that the stdlib does now18/09 09:45
copumpkinby lying?18/09 09:45
glguymake sequencing codata18/09 09:45
copumpkinor the coinductive IO18/09 09:45
copumpkinah18/09 09:45
glguyor rather embed the IO operations in a coinductive data type18/09 09:45
lispycopumpkin: I'm not sure.  The planned stuff for now is to translate to HOLCF which has support for reasoning about _|_18/09 09:45
copumpkinthat still assumes productivity though18/09 09:46
copumpkinyou can write evil haskell18/09 09:46
copumpkinI guess the answer is to make a best effort and reject some things that are good but aren't obviously so18/09 09:46
lispyI thought non-termination was a form of bottom18/09 09:47
lispySo I'm not sure what you mean18/09 09:47
lispyI agree that you want to prove termination whenever you can18/09 09:47
lispyand the goal is to prove properties about programs not just arbitrarily encode in HOLCF, so we are definitely targetting "well-behaved" programs18/09 09:47
lispycopumpkin: http://community.galois.com/mailman/listinfo/haskell-verifier18/09 09:49
copumpkinyeah, I signed up when I saw someone mention it on twitter18/09 09:49
copumpkinhaven't been following closely yet though18/09 09:49
lispyah cool18/09 09:49
copumpkinlooks like a fun project though18/09 09:49
lispynot much happening yet, still figuring out the roadmap18/09 09:49
lispycopumpkin: are you in Portland?18/09 09:50
copumpkinI wish :P rather far away from there unfortunately18/09 09:50
copumpkinfeel rather detached from the haskellverse18/09 09:50
lispycopumpkin: This is the chunk I'm working on: http://community.galois.com/pipermail/haskell-verifier/2010-September/000017.html18/09 09:52
lispyI'm going to try learning the formal aspects, but I'm at a bit of a learning deficit relative to most of the people involved18/09 09:52
copumpkinyeah, some of this verification stuff is pretty hair-raising18/09 09:53
copumpkinwow, even writing the multiplicative identities is painful :P18/09 09:56
glguycopumpkin: just gotta find the right implementation, first18/09 10:00
copumpkinyeah :)18/09 10:00
glguyperhaps18/09 10:01
glguy_*_ : ∀ {n} → Op₂ (BitVector n)18/09 10:01
glguy[] * [] = []18/09 10:01
glguy(0# ∷ xs) * yys = 0# ∷ xs * init yys18/09 10:01
glguy(1# ∷ xs) * yys = yys + (0# ∷ xs * init yys)18/09 10:01
copumpkinthat seems a hell of a lot cleaner than what you have now18/09 10:02
copumpkinalthough the init is still a bit of a pain18/09 10:02
copumpkinI vaguely remember an older version of the std lib having an Init datatype18/09 10:03
copumpkinor something like that18/09 10:03
glguystill does, afaik18/09 10:03
copumpkinoh yeah, InitLast18/09 10:03
lispyhmm18/09 10:03
lispyI was thinking it could be a zipWith but I guess not due to carry bits18/09 10:04
copumpkinwell, you'd want a fold over that too18/09 10:04
copumpkin(or it wouldn't be quadratic)18/09 10:04
lispyand I guess there is a repeated turm18/09 10:06
lispyterm*18/09 10:06
lispy(1# ∷ xs) * yys = yys + (0# :: xs) * yys18/09 10:06
copumpkinclearly the best solution is to do the fourierish transform and multiply in n log n18/09 10:08
copumpkinthat'll be super easy to prove things about :)18/09 10:08
lispyyeah....18/09 10:08
lispyDon't you need rather large numbers before that wins even in optimized cases?18/09 10:09
copumpkinyeah18/09 10:09
glguy  *-identityˡ : ∀ {n} (x : BitVector n) → one n * x ≡ x18/09 10:10
glguy(done / copied to previous link)18/09 10:10
copumpkinoh nice18/09 10:10
copumpkinoh that's much nicer than the monster that was emerging from my struggles with the previous _*_18/09 10:11
Saizani wonder if one could do these proofs with Data.Fin.Dec + induction on the size of the vector18/09 13:29
copumpkingah, I keep forgetting the command to turn quail completions on and off18/09 13:33
copumpkinand then turn it off accidentally18/09 13:33
copumpkinSaizan: do you remember what it is?18/09 13:37
Saizancopumpkin: no18/09 13:38
copumpkinI want a quickcheck for agda18/09 16:55
copumpkin(again)18/09 16:55
Spockzcopumpkin: is agda complete enough for that?18/09 17:06
Saizanif the predicate is decidable it should be just a matter of porting the code18/09 17:12
pigworkerproblem with qc for Agda is that the stronger your invariants, the harder it is to write good generators18/09 17:25
copumpkinyeah18/09 17:25
pigworkerit's uncannily like writing an automated theorem prover18/09 17:25
copumpkinjust sometimes I set out to prove something that's not obviously false, but I'm sure plain old quickcheck could find a counterexample18/09 17:25
copumpkin:P18/09 17:25
copumpkinand then I feel stupid18/09 17:26
copumpkinwhen I finally realize it's false18/09 17:26
pigworkerI remember John Hughes had a go at porting quickcheck to Agda 1, back at AIM1. It was a tough ask. Then again, roll yourself a universe and have a go!18/09 17:28
Saizanso you'd use a universe for what Arbitrary does in haskell, rather than a record?18/09 17:31
pigworkerreckon I'd take a universe (U, El) and try to write some sort of  generate : Nat -> (T : U) -> List (El T), where the Nat is some sort of gasoline, used any time the type gets bigger18/09 17:34
pigworkerprobably need to generalise to provide a context of hypotheses; tricky part is deciding when you can use a hypothesis, as that involves testing type equality18/09 17:37
pigworkerso, we need a model of type theory in type theory, plus ça change...18/09 17:38
Saizanheh18/09 17:39
copumpkinthat semiring solver sure is hungry18/09 17:57
Mathnerd314so how does proving stuff in Agda work? can you write a function in Agda that searches for and returns a proof?18/09 18:05
dschoepeMathnerd314: you prove something by showing that the type corresponding to your theorem is inhabited18/09 18:07
dschoepewhich is done by constructing a term with the appropriate type, so no real automatic proof search.18/09 18:07
copumpkinexcept agsy for tiny things :)18/09 18:08
copumpkinbut sometimes agsy finds me f = f18/09 18:08
Mathnerd314so let's say I want to prove that the sum of n odd integers is the nth square. Can I even do that in Agda?18/09 18:09
copumpkinsure18/09 18:09
copumpkinfirst figure out how to express your property18/09 18:10
copumpkinoften the representation you use to express your property and the structure of the algorithms you use can greatly affect how elegant your proof is18/09 18:10
* copumpkin just wrote a horrendous divMod by 218/09 18:11
copumpkindivMod₂ : (n : ℕ) → ∃₂ (λ q r → 2 N* q N+ r ≡ n)18/09 18:11
copumpkin:P18/09 18:12
copumpkinMathnerd314: I'd start by defining simpler things. Do you have a solid grasp of type-level haskell and GADTs in particular?18/09 18:14
Mathnerd314I think so18/09 18:14
copumpkinhttp://www.cse.chalmers.se/~ulfn/papers/afp08/tutorial.pdf is a fairly accessible (if a bit outdated) tutorial18/09 18:16
Adamantcopumpkin: go tactical again!18/09 18:20
AdamantI want to see a longcat crawling up on a proof with a Rambo knife18/09 18:21
copumpkinlol18/09 18:21
copumpkinMathnerd314: let us know if you have any questions18/09 18:31
Mathnerd314ok, so everything has exactly one type, yes? e.g. true : Bool : Set1 : Set2 : Set3 : ...18/09 18:32
copumpkinBool : Set18/09 18:32
copumpkin(where Set == Set0)18/09 18:32
Mathnerd314oh, missed one then.18/09 18:33
copumpkinbut yeah, otherwise18/09 18:33
Mathnerd314so, you can also have true : BigBool : Set118/09 18:34
copumpkinyeah, value constructor names are allowed to overlap18/09 18:34
copumpkinand you can stick new datatypes in any universe level you choose18/09 18:34
Mathnerd314I'm guessing it distinguishes by the type signature?18/09 18:35
copumpkinyeah18/09 18:35
Mathnerd314how does the universe level matter, other than what types it contains?18/09 18:36
copumpkinwell, if you didn't have the tower of universe levels, you could prove false18/09 18:37
Mathnerd314how? something to do with Russel's paradox?18/09 18:38
copumpkinyeah, I think it's usually Girard's in constructive logic, but a similar idea18/09 18:38
* copumpkin hugs the new --termination-depth flag18/09 18:40
copumpkin=2 fixed my problem without me resorting to hacks18/09 18:40
* copumpkin just wrote the longest chain of rewrite he's ever done18/09 19:02
SaizanMathnerd314: the main point is that a type that contains a quantification over a something in Set n has to be at least in Set (suc n)18/09 19:05
Mathnerd314but the actual value of n doesn't matter, so long as it's finite.18/09 19:08
Mathnerd314so maybe there's some way to do just check that it terminates18/09 19:11
copumpkinglguy isn't going to like this :P18/09 19:15
SaizanMathnerd314: yeah, it's possible to be more implicit about this stratification, i think i'd like a mix18/09 19:24
Mathnerd314ok, I've made up my mind that Agda is a proof-assistant based on intuitionistic type theory, and *not* a dependently-typed programming language18/09 20:03
copumpkinwhy?18/09 20:09
Mathnerd314because of that hierarchy of universes; nobody except a person trying very hard to ensure that only correct proofs type-check would put in such a thing18/09 20:13
copumpkinwell, you want your underlying logic to work or your proofs are meaningless :P18/09 20:14
copumpkinyou can write programs and completely forget about the hierarchy of universes18/09 20:14
Mathnerd314bu the fact that it's there means that Agda is a proof assistant and not a language18/09 20:19
copumpkin"not a language" o.O18/09 20:19
copumpkinyou can write programs and algorithms in it18/09 20:20
camioMathnerd314: I think I see what you're saying. If agda has to be either a proof assitant or a programming langauge, considering this feature doesn't make sense for a programming language it must be a proof assistant.18/09 20:21
copumpkinnot sure why having a design that is logically consistent precludes it from being "a real language"18/09 20:21
copumpkinit doesn't not make sense for a programming language18/09 20:21
camioI wouldn't know how to demonstrate if a language feature "makes sense" for a programming language.18/09 20:23
copumpkinI think we'd need to define "programming language" beforehand :)18/09 20:23
copumpkinand whether extra features that aren't strictly necessary for "programming" preclude it from being one18/09 20:23
copumpkinsomeone else might claim that haskell's type functions are unnecessary for real progrmaming18/09 20:24
copumpkinin agda, we get similar behavior by creating custom higher universes18/09 20:24
camioRight. Or even infix functions are unnecessary for real programming.18/09 20:25
camioI'm getting a sense that this whole line of thought is loquacious.18/09 20:25
Saizanfrom a programming perspective consistency makes sure you can erase values that are only there to witness some property18/09 20:41
Saizanand those are needed even if you're just programming once you want to be fancier18/09 20:43
lispyWe should reduce Agda to brainfuck.  Everything else is unnecessary in a programming language.18/09 20:47
Saizanis there an iff somewhere in the stdlib?18/09 20:57
Saizanwith an associates equational reasoning :)18/09 20:57
copumpkinhmm, I haven't noticed one, but I'm sure there must be!18/09 20:59
Saizanthere's Function.Equivalence but it doesn't have an "instance"18/09 21:04
copumpkinyou playing with the idea you mentioned before of proving the binary number properties through Fin?18/09 21:27
dolio"=2 fixed my problem without me resorting to hacks"18/09 21:33
dolioHacks other than --termination-depth, you mean. :)18/09 21:33
copumpkin:P18/09 21:34
copumpkinyou consider that a hack?18/09 21:34
dolioI weakly consider the whole idea of a termination checker a hack.18/09 21:34
dolio--termination-depth just kind of illustrates why.18/09 21:37
Saizani think i like the sized types idea, if it can be made to not get in the way most of the time18/09 21:38
Saizanwhich universe levels are not an example of :)18/09 21:39
dolioIt may be getting better soon.18/09 21:39
copumpkinoh?18/09 21:40
copumpkinGAH18/09 21:40
Saizan?18/09 21:40
copumpkinmy buffer got itself into read-only mode18/09 21:40
dolioAndreas Abel said he had cumulativity of universes in MiniAgda, I think.18/09 21:40
dolioAnd I think he's working on getting that and the irrelevance stuff into ActualAgda.18/09 21:40
Saizanis the irrelevant stuff going to cover propositional equality?18/09 21:41
dolioWhat do you mean?18/09 21:42
Saizanso that e.g. two values of "Sigma A \\ x -> x == y" are equal without having to look at the second field18/09 21:43
dolioWell, that depends on other factors. But potentially.18/09 21:44
dolioThus far, I think the irrelevance isn't tied to type.18/09 21:44
dolioSo you can't say, 'equality is irrelevant.'18/09 21:45
dolioThere may be places where you need to use equality in an ostensibly relevant way (even though the fact that there's a single proof of equality makes it in fact irrelevant).18/09 21:45
Saizanah, yeah, you covered that in the thread18/09 21:46
dolioBut, there would be a different Sigma that treated its second argument as irrelevant, and potentially two values of that would be definitionally equal based only on the first component.18/09 21:47
Saizansigh, no associative functor composition then :) (without applying coercions at least, which require extensional equality..)18/09 21:48
dolioActually, it might work all right for category theory.18/09 21:48
dolioBecause you tend to have, using standard library terminology, RawFoo with the terms, and IsFoo with proofs.18/09 21:49
dolioThe IsFoo stuff can be made irrelevant, because it's never used in the RawFoo stuff.18/09 21:49
dolioThen, when writing stuff over Foo, the IsFoo is ignored.18/09 21:50
Saizani wonder if you don't sometimes have to use the IsFoo to build some other RawFoo18/09 21:51
dolioFrom what I've seen, there's a pretty clean divide in most category theory stuff (and algebra as well) between the terms you care about doing stuff, and sideline proofs about them.18/09 21:52
dolioSo and EPTS-style erasure/irrelevance system would work all right there.18/09 21:53
copumpkinthese binary number proofs are tedious18/09 22:01
copumpkinprobably just cause I suck at proving things :)18/09 22:02
--- Day changed Sun Sep 19 2010
copumpkinglguy: I have a commutativity proof and a couple of others19/09 05:03
glguyoh, cool!19/09 05:03
copumpkinit'll make your eyes bleed though, so if you have one of your own it's better for your health19/09 05:04
glguyI haven't played with it since  Iwent to bed last night19/09 05:04
copumpkinah ok19/09 05:04
glguyput it up somewhere19/09 05:04
copumpkinhttp://hpaste.org/30189/modularfin added a few helpers and other functions here and there, too. http://hpaste.org/30189/modularfin19/09 05:07
copumpkinmain thing was writing my own init :P cause the Data.Vec.init is a nightmare to work with19/09 05:07
glguyThat doesn't actually look so bad19/09 05:08
copumpkinI felt uncomfortable about the repeated rewrites of the same thing, and it felt like I was missing a cleaner way of doing the whole thing19/09 05:09
copumpkinalso, I should probably be using that equational reasoning thing19/09 05:10
glguyBitVector will be a CommutativeRing in no time :)19/09 05:12
copumpkinhah19/09 05:12
copumpkinassociativity was getting ugly when I tried it19/09 05:13
copumpkindistributivity might be nicer19/09 05:13
glguyI don't think that distrib will be19/09 05:13
glguyat least with Integers it was messier than assoc19/09 05:13
copumpkinI was also trying to think of how to write a bitwise modular multiplicative inverse19/09 05:13
copumpkinthat wasn't impossible to prove things about19/09 05:13
copumpkinbut then failed :)19/09 05:14
glguyyeah, I've almost given up on that one before I've started19/09 05:14
copumpkinah well, with the commutative ring we can use the solver and who needs anything else!19/09 05:14
glguycopumpkin: I have a cleaner proof to share momentarily19/09 06:01
copumpkinoh, nice19/09 06:01
glguyhttp://www.galois.com/~emertens/modularfin.agda19/09 06:02
glguyinspired by yours19/09 06:02
glguy"cleaner" is subjective, of course19/09 06:02
copumpkinoh, definitely cleaner19/09 06:02
copumpkinaha, you moved away from init19/09 06:03
glguyyeah, it isn't good at being productive19/09 06:03
copumpkinyeah19/09 06:03
copumpkinthat's much nicer19/09 06:03
copumpkinthat'll probably make assoc easier too19/09 06:03
glguythe *-comm and *-comm1 split helped the termination checker see what was going on19/09 06:04
copumpkinah19/09 06:04
copumpkinthe --termination-depth couldn't see through it?19/09 06:04
glguyOh, I don't know about that flag19/09 06:04
copumpkinthey just added it, I think I had it in my file19/09 06:04
copumpkinbut it only works on the darcs version from a few days ago19/09 06:05
glguyI have darcs version from last night19/09 06:05
copumpkinah okay19/09 06:05
glguyso... I'm sure I have it19/09 06:05
copumpkinyeah, I needed to turn it on at some point in my proof19/09 06:05
copumpkinwell, set it to 219/09 06:05
glguyyou end up (without the split) matching the size parameter as suc (suc n)19/09 06:06
glguyand then doing recursion on suc n19/09 06:06
copumpkinyeah19/09 06:06
copumpkinI like your approach a lot better19/09 06:06
copumpkinnone of that double-deep matching I was doing19/09 06:06
glguyOK, now you have to figure out how to do assoc so I can look at that19/09 06:06
glguy;)19/09 06:06
copumpkinlol19/09 06:06
copumpkinI'll give it a go :P I also wanted to write fromNat19/09 06:07
copumpkinor even to/fromFin19/09 06:07
glguyDidn't you have some of that in your file already?19/09 06:07
copumpkinyou may have seen a seemingly unrelated divMod by 2 function in there19/09 06:07
copumpkinyeah19/09 06:07
copumpkinI have toNat19/09 06:07
copumpkinbut not fromNat, cause either it'd be exists BitVector or BitVector (ceillog_2 n)19/09 06:08
copumpkinor I guess I could just happily truncate19/09 06:08
copumpkinanyway yeah, my proof doesn't pass the termination checker without the --termination-depth=219/09 06:08
copumpkinfor comm19/09 06:08
copumpkinanyway, I'll be happy to get rid of it and replace it with yours :P19/09 06:08
glguyI'm rather amazed that the proof looks like it does19/09 06:10
glguyI was trying to visualize why this implementation was commutative19/09 06:10
glguyand having a hell of a time19/09 06:10
copumpkinyeah, I gave up trying to figure it out abstractly in mine and just did an iterative "look at the expression and try to figure out how I'd rewrite it" until it reduced to something manageable :P19/09 06:11
copumpkinoh by the way, you have a typo in your rename of _+_ from Nat that left me quite confused with parse precedence errors for a while19/09 06:12
copumpkin_+_ to _N+19/09 06:12
copumpkin:P19/09 06:12
glguytypo?19/09 06:12
copumpkinmissing the other _19/09 06:13
glguybecause it wasn't \bn?19/09 06:13
glguyoh!19/09 06:13
copumpkinoh by the way, my initial approach to this19/09 06:15
glguyto which19/09 06:16
copumpkinwas trying to prove that init distributes over *, but then I stopped being convinced that was true19/09 06:16
copumpkinoh, any of these multiplication proofs19/09 06:16
copumpkinit would've come in handy in many places19/09 06:16
glguyGoal: 0# ∷ xs * (droplast y * droplast z) ≡19/09 06:16
glguy      0# ∷ xs * droplast (y * z)19/09 06:16
copumpkinyeah, exactly19/09 06:16
glguyThis is true19/09 06:16
glguyI don't know why yet, but it has to be if multiplication is actually associative19/09 06:17
copumpkinyeah, on one hand I convinced myself it had to be true, and on the other hand it didn't seem to make sense that taking off the last bit had that behavior19/09 06:18
copumpkinoh wait19/09 06:18
copumpkinthe order is backwards, it does make sense19/09 06:18
* copumpkin kicks himself19/09 06:18
copumpkinokay, I might start by writing that helper then :P19/09 06:18
glguyGoal: add′ 0# y' (0# ∷ xs * droplast y') * z' ≡19/09 06:18
glguy      add′ 0# (y' * z') (0# ∷ xs * droplast (y' * z'))19/09 06:18
glguythat's my other boal19/09 06:18
glguygoal19/09 06:18
glguyI really hope I don't have to develop distrib in parallel19/09 06:19
copumpkinI'm gonna try the droplast (x * y) ≡ droplast x * droplast y first19/09 06:20
copumpkinmostly cause it has fewer parameters and looks less scary than assoc :P19/09 06:20
glguyOK, then I19/09 06:20
glguywill leave that goal unsolved19/09 06:21
glguywhat are you calling that lemma?19/09 06:25
copumpkinhmm, I'm terrible with names, but have it down as droplast-distrib-*19/09 06:26
copumpkin:P19/09 06:26
copumpkindefinitely not attached to it though, so I'll be happy to rename it to something else19/09 06:27
glguyOK, assoc is done (assume we can do *-distrib and droplast-distrib-*)19/09 06:28
copumpkincool19/09 06:28
glguyI'm going to tip-toe thorugh distrib now19/09 06:29
copumpkinokay :)19/09 06:29
copumpkinsorry on phone, might be a while19/09 06:32
copumpkinlooks like I'll need the same property for + :P19/09 07:21
* copumpkin sighs19/09 07:21
glguyI did that one19/09 07:21
copumpkinah okay19/09 07:22
copumpkindid you already do the droplast distrib over * too?19/09 07:22
copumpkincan I borrow your + one?19/09 07:22
copumpkinoh19/09 07:22
copumpkinyou did it :)19/09 07:22
glguyrevised19/09 07:23
copumpkinjust a couple of leftover holes in your distributivity proof19/09 07:23
copumpkinvery nice19/09 07:23
glguy"just"19/09 07:23
copumpkinlol19/09 07:23
glguyI'm pretty sure that that hole is as big as the rst of that proof19/09 07:23
* copumpkin trembles19/09 07:23
glguyyeah, that emotion was why I jumped over to the distrib proof19/09 07:26
glguyI didn't know how long you'd be19/09 07:26
copumpkinno problem :P19/09 07:26
copumpkinI didn't either19/09 07:26
* copumpkin tries19/09 07:29
copumpkinseems like we might need to start with a generalized distrib over add\' instead of +19/09 07:32
glguyyeah...19/09 07:32
glguybut I think they need to be separate because * distributes differently over add 1#19/09 07:34
copumpkinyeah19/09 07:35
copumpkinare you sure distrib^r is easier than distrib^l ?19/09 07:35
glguyI have no idea if it is19/09 07:35
copumpkinwith your definition of multiplication decomposing the first arg, I might try the other direction19/09 07:36
copumpkinI'll work through that and see if it looks any easier19/09 07:36
copumpkingah, I hate it when case splitting insists on rewriting variable names it has no authority over19/09 07:56
copumpkineven when unnecessary19/09 07:56
glguy"but x' is a much better variable name than y"!19/09 07:57
dolioYes. It'd be nice if it didn't rewrite the whole line.19/09 07:57
copumpkinlike I have19/09 07:57
copumpkinpf (0# :: xs) (0# :: ys) (z :: zs) = ?19/09 07:58
copumpkinI ask it to split z19/09 07:58
copumpkinit gives me back pf (0# :: xs') (0# :: ys') (0# :: zs') = ?19/09 07:58
copumpkinwith all the primes stuck in19/09 07:58
copumpkinnot sure distrib^l is any easier than ^r :P19/09 07:59
* copumpkin ponders19/09 07:59
glguyI think that this is going to help19/09 08:12
glguy  extract-carry : ∀ {n} (xs ys : BitVector n) → add′ 1# xs ys ≡ one _ + add′ 0# xs ys19/09 08:12
copumpkinoh, good point19/09 08:13
copumpkindid you already write it?19/09 08:13
glguyyes19/09 08:14
glguyhttp://hpaste.org/30195/extractcarry19/09 08:15
copumpkinthanks19/09 08:16
lispyis hpaste down?19/09 08:23
copumpkinit'd be funny if we could mutually define this on the semiring solver that would arise from us being able to define the properties19/09 08:23
copumpkinyay circular reasoning19/09 08:23
copumpkinseems to work for me19/09 08:24
lispyhmm...page not loading here19/09 08:24
dschoepeworks fine here, too19/09 08:24
copumpkinmaybe some routing issue19/09 08:25
copumpkinI've not been able to access it a few times when others have19/09 08:25
copumpkinI wish I could ask agda to not reduce something past a certain point, for display in goals19/09 08:25
copumpkinlike, I really want to just see _+_ instead of add\' 0#19/09 08:25
glguythe end is in sight19/09 08:31
copumpkinsame here, for the first hole :P19/09 08:31
copumpkinmine is ugly though19/09 08:32
glguyoh, I haven't started on the prettifying stage yet19/09 08:32
copumpkin:)19/09 08:32
copumpkindo you mean for both of the holes?19/09 08:33
copumpkinor just one?19/09 08:33
glguyI see the way forward on both19/09 08:33
glguyi just have to build up a few helpers19/09 08:33
copumpkinaha, I've been brute forcing the first one :P19/09 08:34
copumpkinand have almost finished it19/09 08:34
lispywhen hpaste does load it loads really slowly19/09 08:35
copumpkinokay, now I just need my old helper19/09 08:35
copumpkinshowing that shift x = x + x19/09 08:35
copumpkinand I'll be done with the first hole19/09 08:35
* copumpkin realizes that this sounds really bad19/09 08:36
glguyha19/09 08:38
glguy  shift-to-add : ∀ {n} (x : BitVector n) → droplast (0# ∷ x) ≡ (x + x)19/09 08:38
copumpkinawesome19/09 08:38
copumpkinthen there's only one hole left!19/09 08:38
glguyrevised the link to have that proof19/09 08:41
copumpkinhttp://snapplr.com/8we019/09 08:41
glguybut I plan to unify the two halves of it19/09 08:41
copumpkin:P19/09 08:41
copumpkinokay19/09 08:41
glguydone?19/09 08:42
copumpkinjust the first of the holes19/09 08:42
glguyright on19/09 08:42
copumpkinprobably way uglier than it needs to be19/09 08:43
copumpkinbut I usually try to get something that works and then try to clean it up :P19/09 08:43
copumpkinI actually think the other half will be somewhat similar19/09 08:44
glguy   shift-to-add : ∀ c {n} (x : BitVector n) → droplast (c ∷ x) ≡ add′ c x x19/09 08:44
glguy   shift-to-add _ [] = refl19/09 08:44
glguy   shift-to-add c (0# ∷ xs) rewrite shift-to-add 0# xs = refl19/09 08:44
glguy   shift-to-add c (1# ∷ xs) rewrite shift-to-add 1# xs = refl19/09 08:44
copumpkinnice :) I had something even smaller with an auxiliary two function in that original paste19/09 08:44
copumpkinbut it's probably simpler with that19/09 08:44
copumpkinand I don't really need 2 * x here19/09 08:44
glguyoh, if you don't need it you don't need it :)19/09 08:45
copumpkinnoo, this was very useful19/09 08:45
Adamantyou sound like you could do some hardware from this19/09 08:45
copumpkinglguy: should I bother pasting that ugly thing or will you try to figure a cleaner one out?19/09 08:46
glguyif you finished the proof you should definitely post it19/09 08:46
glguyyou can collapse those last two holes into one goal19/09 08:46
copumpkinhttp://hpaste.org/30196/half_a_proof19/09 08:47
copumpkinI tried that, but it didn't seem to have enough information19/09 08:47
copumpkinnot sure why I mutualized it19/09 08:47
copumpkinfelt like a good idea at the time19/09 08:47
copumpkincollapsing the two goals doesn't seem to work here19/09 08:49
copumpkin(unless I was doing it wrong)19/09 08:49
copumpkinI'm gonna go get some breakfast then work on the other one19/09 08:50
glguyI just havea little + manipulation and I'll be done19/09 08:50
glguyand I can show my way of consolidating those two19/09 08:50
copumpkinawesome19/09 08:51
copumpkinnow we just need to convince the agda people to let us bind to number literals more liberally19/09 08:52
glguyAdamant: That's basically my goal (being able to model algorithms using Word32, for example)19/09 08:56
copumpkinsame here :)19/09 08:56
Adamantnice.19/09 08:57
copumpkinglguy: I might start writing a <= for it19/09 08:58
copumpkinor maybe just peano induction thing19/09 08:59
copumpkinhmm19/09 08:59
glguygood idea19/09 08:59
copumpkinpeano induction seems more useful19/09 08:59
* copumpkin gets back to his food19/09 09:00
glguy(Agda:Checked)19/09 09:03
glguyuploaded19/09 09:03
copumpkincongratulations!19/09 09:04
copumpkinI wonder if the ring solver will be faster with this19/09 09:05
glguyThe ring solver is symbolic, so I'm not sure that it matters19/09 09:05
copumpkinyeah, I know, but if you have constants in your equations19/09 09:07
copumpkinI actually ported the ringsolver to haskell a while back19/09 09:07
glguywas it faster?19/09 09:20
copumpkindidn't really play with it much afterwards :)19/09 09:21
glguy  isCommutativeRing : IsCommutativeRing _≡_ _+_ _*_ -_ (zero n) (one n)19/09 09:21
copumpkinnice!19/09 09:22
glguyand on that note it is time for bed19/09 09:24
glguylet me know if you come up with any clever induction principals or nat conversion functions19/09 09:25
glguyprinciples*19/09 09:25
copumpkinokay, will do :)19/09 09:25
copumpkinnight!19/09 09:25
dschoepe /join #xmonad19/09 09:39
copumpkinPanic: blocked by dot pattern19/09 10:05
copumpkinthat's one I haven't seen before19/09 10:05
copumpkinman, it sure is hard pattern matching against types with functions in their indices19/09 11:47
copumpkinthere we go, induction : ∀ {n} (P : BitVector n → Set) → P (zero n) → (∀ m → P m → P (suc m)) → ∀ x → P x19/09 12:36
copumpkinand now I can write toNat really elegantly19/09 12:40
copumpkintoℕ = induction _ 0 Nsuc19/09 12:40
* copumpkin is confused19/09 13:41
copumpkinI import Data.Nat hiding _<=_19/09 13:42
copumpkinand then it bugs me that my _<=_ is a duplicate name of the one in Data.Nat19/09 13:42
Saizanmaybe you've more than one import of Data.Nat? or some other module is exporting it?19/09 13:43
copumpkinnope :/19/09 13:43
copumpkinlooked for that19/09 13:43
* copumpkin tries latest agda in case it was a bug19/09 13:44
copumpkingah! :P19/09 13:48
copumpkinrenaming it to something else doesn't work either19/09 13:50
copumpkinif I do C-c C-d it says it isn't in scope o.O19/09 13:54
copumpkinhttp://snapplr.com/b41g19/09 13:56
copumpkinI'm not completely insane am I?19/09 13:56
copumpkinoh nice, they fixed agsy to not put the comment in every time19/09 14:15
Saizanduplicate definition of _module_ _\le_19/09 14:25
copumpkinwell, they recently changed data types to behave like modules19/09 14:25
copumpkinso you can do Type.constructor19/09 14:26
Saizanyeah19/09 14:26
copumpkindid I do something wrong though?19/09 14:26
Saizani guess hiding doesn't hide the module19/09 14:26
Saizani think it needs to be reported19/09 14:28
Saizandoes one have the same problem with records?19/09 14:29
copumpkinnot sure actually19/09 14:29
copumpkinI already reported it19/09 14:29
Saizanyep, same with records19/09 14:30
Saizani'm surprised that it doesn't cause problems more often19/09 14:31
copumpkinmight be new19/09 14:34
copumpkinalmost done with the decidable total order on those binary numbers too :)19/09 14:40
copumpkinhmm, already one here, http://www.cs.nott.ac.uk/~nad/listings/lib/Data.Bin.html#20619/09 14:41
copumpkinbut doesn't have properties on it19/09 14:42
copumpkinalso, it isn't of a fixed size19/09 14:44
copumpkinso both are probably useful19/09 14:44
copumpkinhmm, the total part is tricky19/09 15:35
copumpkinman, I kind of went crazy on this module19/09 17:15
copumpkinglguy: hey :P I went a little nuts19/09 18:59
glguydo tell19/09 19:00
copumpkinwell, I added a) an (almost) decidable total order b) peano-like induction c) a boolean algebra "instance" for the bitwise operations19/09 19:00
copumpkinbored on sunday, pretty much everything I could think of, basically :)19/09 19:01
glguyWe need to start some kind of directory structure for htis19/09 19:01
copumpkinyeah, it's a huge mess19/09 19:01
glguyand split out the properties from the operations19/09 19:01
copumpkinyeah, I've just been making inline modules19/09 19:01
copumpkinwhich is ugly19/09 19:01
glguyand "private" all of the details, only exposing the commutativeRing module19/09 19:01
glguy(and itis slow not to)19/09 19:01
copumpkinyeah19/09 19:02
copumpkintoℕ = Peano.induction _ 0 Nsuc19/09 19:02
copumpkin:)19/09 19:02
copumpkinonly thing I'm missing is a couple of holes in the total part of the decidable total order19/09 19:02
glguyCan you host your changes somewhere?19/09 19:04
glguyor split them into modules and then do it19/09 19:04
glguy(or should I split?)19/09 19:04
copumpkinsure, I can split it if you give me a little19/09 19:04
copumpkinmeanwhile I stuck the mammoth up at http://hpaste.org/30215/huge_mess19/09 19:04
glguy  isBooleanAlgebra : ∀ {n} → IsBooleanAlgebra _≡_ bitwise-or bitwise-and bitwise-negation (ones n) (zero n)19/09 19:05
glguythat's a fun addition19/09 19:05
copumpkinyeah, and was really easy too, as you can see in the proofs :P19/09 19:06
glguyyou know, the other way we could have done that would be to import Data.Bool renaming true and false to 1# and 0#19/09 19:06
copumpkinyeah :P19/09 19:06
copumpkinthat would've been smarter19/09 19:06
* copumpkin takes the blame19/09 19:06
copumpkinyou have a github account, right?19/09 19:07
* copumpkin vaguely remembers findingone19/09 19:07
copumpkindo you prefer darcs or git? I'm pretty neutral19/09 19:07
glguyyeah, I use git where possible19/09 19:07
glguyhopefully it only stays in the git repo for a short time19/09 19:07
glguyand we get merged into stdlib19/09 19:07
copumpkinyeah :)19/09 19:07
copumpkinthere's an unbounded one already in the std lib19/09 19:08
copumpkinbut it doesn't have any properties proved about it19/09 19:08
glguyunbounded what?19/09 19:08
copumpkinbinary natural19/09 19:08
copumpkinI only just noticed it19/09 19:08
copumpkinnot sure how long it's been there19/09 19:08
glguyoh..19/09 19:08
copumpkinbut since it's unbounded, it doesn't have the wraparound properties we want19/09 19:08
copumpkinso it seems like there's room for both19/09 19:09
copumpkin(it's represented as a List of bits instead of a Vec of tem)19/09 19:09
copumpkinwant me to get rid of the custom bit stuff and replace it with bool before pushing?19/09 19:15
glguymaybe19/09 19:16
glguyI think it will help us to reuse all of the properties19/09 19:16
copumpkinyeah19/09 19:17
copumpkinwe can also make a commutative semiring out of the bitwise ops19/09 19:17
copumpkinbut I didn't get around to that19/09 19:17
copumpkinanyway, will replace with Bool and then push to github19/09 19:17
glguyis there already such a semiring made from Data.Bool?19/09 19:18
copumpkinyeah19/09 19:18
copumpkinData.Bool.Properties is full of nice stuff19/09 19:18
copumpkinwith that, it might pay to actually abstract out the zipWith-preserves-properties19/09 19:18
copumpkindammit, it ate up all my memory :P19/09 19:22
copumpkinbrb19/09 19:23
copumpkinglguy: http://github.com/pumpkin/bitvector19/09 19:32
copumpkinjust split it into two files for now19/09 19:33
copumpkinand the Bool transition was remarkably painless19/09 19:33
copumpkinoh, forgot to uncomment the original algebraic properties19/09 19:33
copumpkinpushed a fixed version19/09 19:35
glguyI'm playing EVE Online right now, if you are wondering why I'm a bit unresponsive19/09 19:36
copumpkinhah okay19/09 19:37
copumpkinI'm in no rush19/09 19:37
copumpkinhave various other things I should be doing19/09 19:37
glguycopumpkin: I did a file reorg19/09 20:32
glguyhttp://github.com/glguy/bitvector19/09 20:32
copumpkincool19/09 20:32
copumpkinby the way, have any ideas about that total order thing?19/09 20:34
copumpkinit'd be nice to make a DecTotalOrder19/09 20:35
glguyI haven't looked at it yet19/09 20:36
copumpkinah okay19/09 20:36
copumpkinI might throw together the commutative semiring19/09 20:37
glguyon Bit?19/09 20:37
copumpkinthe bitwise one on bitvector19/09 20:37
glguycommutativeRings are already commutativeSemirings, right?19/09 20:38
copumpkinyeah, but I mean the one over or/and/not instead of +/*/neg19/09 20:38
glguyahhh19/09 20:39
glguyok19/09 20:39
llambdaDoes that have a name19/09 20:39
copumpkindon't know of one19/09 20:40
copumpkinit's a dioid though19/09 20:41
copumpkinbut Algebra doesn't have those19/09 20:41
llambdaWhat is a dioid? I see "A set with two inner operations" on some random Google result but I'm not sure that is authoritive at all19/09 20:42
copumpkina semiring where addition is idempotent (x or x = x)19/09 20:43
llambdaAh okay19/09 20:43
glguyproving that commutativesemiring property should be as easy as writting fmap19/09 20:47
glguysince the bits don't interact19/09 20:48
copumpkinyeah, exactly19/09 20:51
copumpkinit's the same with the lattice ones19/09 20:51
copumpkinall the proofs in that module have the exact same structure19/09 20:51
copumpkinI just didn't feel like figuring out how to express that generically19/09 20:52
copumpkindoes the std lib have an n-ary zipWith/map ?19/09 20:58
glguyData.Vec.N-ary has some helpers19/09 21:00
glguyI don't know if that is relevant19/09 21:00
copumpkinah, I'll check it out19/09 21:00
copumpkinthanks19/09 21:00
Mathnerd314anyone ever heard of/used Sage (http://sage.soe.ucsc.edu/) ?19/09 21:02
Adamantis that the mixed typing one?19/09 21:04
AdamantI have a paper on that, IIRC19/09 21:04
Mathnerd314can I read it?19/09 21:04
Adamantlisted on the frontpage, second DL provided19/09 21:18
Mathnerd314Adamant: you mean "Compositional and Decidable Checking for Dependent Contract Types" ?19/09 21:21
Adamanthttp://sage.soe.ucsc.edu/sage-tr.pdfhttp://sage.soe.ucsc.edu/sage-tr.pdf19/09 21:21
Adamantbleh19/09 21:22
Adamantsorry19/09 21:22
glguycopumpkin: This is specific to Commutativity, but I'm hoping that I could further generalize it:19/09 21:29
glguypromote-comm : ∀ {a} {A : Set a} (op : Op₂ A) → Commutative _≡_ op → ∀ n → Commutative _≡_ (Data.Vec.zipWith {n = n} op)19/09 21:29
glguypromote-comm op p zero [] [] = refl19/09 21:29
glguypromote-comm op p (suc n) (x ∷ xs) (x' ∷ xs') rewrite promote-comm op p n xs xs' | p x x' = refl19/09 21:29
copumpkinah yeah, I was trying to be too general and confusing myself19/09 21:36
glguyI'm working on getting more general, but I'm starting from something concrete19/09 21:37
copumpkinhmm, getting tired, will work on it more tomorrow :)19/09 21:37
glguykk19/09 21:37
copumpkinfeel free to implement anything I said I'd implement (and/or rewrite/dump anything I already have implemented) :P I won't be offended19/09 21:37
glguystill there?19/09 21:40
copumpkinyep19/09 21:44
glguycheck this out then bfore you go19/09 21:44
copumpkinnot going to sleep yet, just didn't feel like thinking hard anymore :)19/09 21:44
glguyhttp://hpaste.org/30218/lift_properties19/09 21:44
copumpkinah, that looks nice19/09 21:45
copumpkinthat'd cover several of the repetitive properties nicely :)19/09 21:45
Mathnerd314that looks confusing :p19/09 21:46
copumpkinMathnerd314: it's almost haskell! with more complicated types :P19/09 21:48
copumpkinand that strange rewrite construct that has no analog in haskell19/09 21:48
copumpkinue19/09 21:49
Mathnerd314yeah, what is rewrite?19/09 21:49
copumpkinit's takes an equality value (x == y) and rewrites your context by it19/09 21:50
copumpkinso if you have an x in your context, it'll turn into a y19/09 21:50
copumpkinit was love at first sight for me19/09 21:50
copumpkinsure beats miles of subst19/09 21:50
Mathnerd314so what's it's type?19/09 21:52
copumpkinit doesn't have one, it's a syntactic construct19/09 21:53
copumpkinit's mostly syntactic sugar for a with, I think19/09 21:53
glguyI think that it is completely syntactic sugar for a with and a pattern match on a refl19/09 21:54
copumpkinwell, it needs that builtin equality binding for some reason19/09 21:55
copumpkinI guess it just needs to know what constructor to stick in19/09 21:55
glguyso that it knows what "refl" is19/09 21:56
copumpkinyeah19/09 21:56
copumpkineither way, it's a hell of a lot prettier :)19/09 21:56
glguycertainly19/09 21:56
Mathnerd314so... a with is like Haskell's guards or case-of?19/09 22:00
copumpkinmore powerful19/09 22:00
copumpkinit gives you more stuff to pattern match on, basically19/09 22:01
copumpkina bit like a haskell view pattern19/09 22:01
glguycopumpkin: By using this construct I can go back to naming all of my properties types, again19/09 22:02
glguymodule P {n : ℕ} where19/09 22:02
glguy  import Algebra.FunctionProperties as FP; open FP (_≡_ ∶ Rel (BitVector n) _) public19/09 22:02
glguy  identityˡ : ∀ {n} → P.LeftIdentity (zero n) _+_19/09 22:02
copumpkingreat19/09 22:02
glguyIs there a simpler way to do that?19/09 22:03
copumpkinthe implicit n getting passed everywhere?19/09 22:03
glguyYou can't lock it down to one 'n' or you can't do your inductive case19/09 22:04
copumpkinyeah :/ I tried that at first19/09 22:04
copumpkinI don't know of anything better19/09 22:05
glguyit is interesting that we are defining families of properties (indexed over the vector size)19/09 22:07
glguyI want there to be a name for:   f (op x y) == f x `op` f y19/09 22:10
glguywith binary operations we have DistributesOver19/09 22:10
copumpkinnaming is always the worst part of programming19/09 22:15
benmachineglguy: it looks sort of like a homomorphism19/09 22:52
benmachineeven though it isn't actually19/09 22:52
copumpkinsorry about all that19/09 22:55
--- Day changed Mon Sep 20 2010
glguycopumpkin: ping20/09 04:10
glguycopumpkin: I think that the reason you can't figure out that last proof for "less than or equal to" is that the relation is wrong20/09 04:22
glguyshouldn't I be able to construct (1# ∷ 0# ∷ []) q≤ (0# ∷ 1# ∷ [])20/09 04:22
glguyThe issue is that the most significant bit is on the right20/09 04:24
lispy|dagitglguy: what is q≤ ?20/09 04:50
lispy|dagit(I mean, why q?)20/09 04:50
glguy  -- Silly agda bug is preventing me from using the _≤_ name even though it's not in scope :(20/09 04:51
glguyapparently20/09 04:51
lispy|dagitah20/09 04:59
lispy|dagitI thought it was like quotient less than20/09 05:00
copumpkinglguy: lol, good point20/09 05:31
* copumpkin looks ashamed20/09 05:31
copumpkinI can't believe I was able to prove so much about it with it being wrong :P20/09 05:39
copumpkinah well, I guess it's good that it got caught :P20/09 05:39
* copumpkin tries to figure out a way to fix it20/09 06:18
copumpkinokay, I think I fixed it20/09 07:43
copumpkindamn, he's gone20/09 07:43
* copumpkin hugs agsy20/09 07:59
dolioWhich part is agsy?20/09 08:02
dolioIs that the one that handles refine?20/09 08:02
copumpkinC-c C-a20/09 08:02
dolioI've been getting some use out of that lately.20/09 08:02
copumpkinrefine is nice too20/09 08:02
copumpkinagsy is the automatic proof finder20/09 08:02
dolioAh.20/09 08:02
copumpkinit's nice to avoid writing tedious constant proofs and such20/09 08:03
copumpkinand bits that are painfully obvious but _ can't figure out20/09 08:03
copumpkinto avoid the fiasco from yesterday's broken inductive ordering on the binary naturals20/09 08:03
copumpkinI wrote a bunch of "Testcases" and asked agsy to prove them all20/09 08:04
copumpkinso now I won't have to waste my time proving a bunch of properties that are obviously false20/09 08:04
dolioHeh, does it always insert "by agsy" comments?20/09 08:05
copumpkinin the older builds it inserted them everywhere20/09 08:06
copumpkinnow it only seems to do it if you pass -c20/09 08:06
copumpkinreally annoying :P20/09 08:06
dolioI assume you do that by typing -c into the shed?20/09 08:09
copumpkinyeah20/09 08:09
copumpkinmain options I use are -m, which gives it top-level signatures (iirc and lets it sometimes prove recursive properties), -c for case-splitting, and -t increases the timeout20/09 08:09
copumpkinalthough usually if it can't find something within the default 5s timeout, it won't find it at all20/09 08:10
copumpkinokay, my relation is reflexive and antisymmetric20/09 08:18
* copumpkin crosses fingers20/09 08:18
copumpkinit's transitive too!20/09 08:52
copumpkin:P20/09 08:52
copumpkinmost horrifyingly repetitive mutual block I've written20/09 08:52
* copumpkin will clean it up later20/09 08:52
copumpkinI'll be so pissed if this doesn't wor20/09 10:20
copumpkindrum roll20/09 10:28
copumpkinmy < is trichotomous20/09 10:28
copumpkinYAY20/09 10:38
copumpkinMY RELATION IS TOTAL20/09 10:38
* copumpkin dances20/09 10:38
copumpkinsyntax type-signature A x = x ∶ A20/09 13:04
copumpkin<#20/09 13:04
copumpkin<3, even :)20/09 13:04
* copumpkin feels accomplished20/09 14:26
copumpkinglguy: I fixed it :)20/09 17:18
copumpkinway more complicated than the broken one, though20/09 17:18
glguypushed to github?20/09 17:19
copumpkinyep20/09 17:20
copumpkinso we have three orders on it now20/09 17:20
copumpkina strict total <, a dec total <=, and a bitwise containment dec partial order20/09 17:20
copumpkinthe strict total < kind of arose as a consequence of how I defined the <=20/09 17:21
glguyyeah, I figured you'd need to do < first so you could detect when it didn't matter what the low bits were20/09 17:21
copumpkinyeah20/09 17:22
copumpkinso it's just mutual now20/09 17:22
copumpkinit can probably be simplified a bit more20/09 17:22
copumpkinbut it's not too bad (I already cleaned up the initial version a bit)20/09 17:22
copumpkinas usual, I wasn't sure what to name things :)20/09 17:25
copumpkinI'm not sure that the way I've constructed the < and <= proofs, that proofs are unique20/09 17:26
copumpkinbut I got tired of it and did something else20/09 17:27
glguyI was thinking that you could embed == into the < relation instead of <=20/09 17:33
glguyand then <= could just be the sum or < and ==20/09 17:33
copumpkinhmm, that could work20/09 17:33
copumpkinI tried something with == before, but I didn't get very far20/09 17:33
copumpkinanyway, feel free to rewrite/elegantize it :P20/09 17:35
copumpkinbtw, did you put up your efforts to make generic bool=>bitvector property transformers?20/09 17:36
glguyI expect I'll muck with it tonight20/09 17:36
glguyI had trouble with things like:   zipWith (\ x y -> op y x) xs ys   not being obviously equal to20/09 17:36
glguyzipWith op ys xs20/09 17:36
glguyI need to find a project at work that needs an agda implementation of Word32 :)20/09 17:37
copumpkinlol20/09 17:37
copumpkinwe should write an implementation of haskell98 in agda and beat the haskell-verifier people to it :P20/09 17:38
copumpkinhave you played with isabelle btw?20/09 17:38
glguyI have some (brb)20/09 17:39
copumpkinah20/09 17:44
glguyJohn Matthews ran an "intro to isabelle" course at work20/09 17:47
copumpkinah20/09 17:48
glguywhich is my primary source of isabelle experience20/09 17:48
glguyI suspect that doing these proofs in Isabelle would have been pretty boring.20/09 17:48
glguyYou don't seem to do a lot of manual specification of rewrite rules like we do.20/09 17:48
copumpkinah20/09 17:49
copumpkinhow does it figure such things out?20/09 17:49
copumpkinmaybe I'll install it and take a look20/09 17:49
glguyYou can install your simplification rules and run "auto" tactic20/09 17:51
glguyand then it thinks for a moment and your proof is done ;)20/09 17:51
copumpkinwow :P20/09 17:51
copumpkinoh wow, it even has a nice disk image for mac20/09 17:52
copumpkinI'd started specifying instruction encodings for ARM in agda a while back20/09 17:58
copumpkinmight see if I can give myself a nice basis using this bitvector stuff and then automate generation of the agda code from the pdf spec20/09 17:59
glguyf x rewrite y = z20/09 18:47
glguywhy is it that the "where" clause of this expression is in scope in z but not y?20/09 18:47
glguyIs there a theoretical issue or isthis an implementation choice?20/09 18:48
copumpkinI think the latter20/09 18:48
copumpkina where is a with and a with is a helper function20/09 18:48
copumpkinI mean20/09 18:49
copumpkina rewrite is a with and a with is a helper function :)20/09 18:49
copumpkinso I guess they just didn't carry the where context to the generated function20/09 18:49
Saizanso i guess that "rewrite y" also affects the where clause?20/09 18:51
copumpkinI think so, but it's hard to notice cause where-bound variables don't show up when you ask it to print context20/09 18:52
Saizani use the infer type command from the shed for that20/09 18:53
copumpkinyeah20/09 18:53
glguyI don't think that rewrite affects where clauses20/09 18:53
copumpkinweird, I thought it did20/09 18:56
glguyI tried to construct an example where it did and failed.20/09 18:57
glguyMaybe give it a shot?20/09 18:57
copumpkinsure20/09 18:57
copumpkinit's not like I have any reason to think it does beyond a vague recollection that it did20/09 18:57
Saizanhttp://hpaste.org/30247/rewrite_where20/09 19:02
glguySaizan: that didn't rewrite y20/09 19:03
glguyit rewrote your goal20/09 19:03
glguyy stayed teh same20/09 19:03
Saizanit rewrited the type of x20/09 19:04
Saizanotherwise i couldn't use it as the body of y20/09 19:04
Saizan*rewrote20/09 19:04
copumpkinin my experiment it didn't seem to rewrite it20/09 19:04
glguyyeah, it rewrote x and the change was in scope in teh where20/09 19:04
glguybut it didn't rewrite anything defined in the where20/09 19:05
copumpkinoh actually20/09 19:05
Saizanok, i guess we meant different things by "affect" :)20/09 19:05
copumpkinyeah, it didn't rewrite it20/09 19:05
copumpkin(in mine)20/09 19:06
Saizananyhow, if where lives in a context where other bound variables are already rewritten, then things defined in that where are reasonably out of scope in the rewrite clause20/09 19:06
copumpkinwhere clauses are a pain :P20/09 19:08
copumpkin(especially if you need to prove something about them)20/09 19:08
copumpkinthey should make functions into modules too :P so you can pull out where-bound variables of it20/09 19:08
Saizanwhere clauses are fine if you don't pattern match in the definition :) (or if you can make the whole thing abstract anyhow)20/09 19:11
copumpkinit seems like if you want to use a where clause in a function you want to prove something about, it needs to return a proof of everything you want to specify about it in addition to whatever it would normally return20/09 19:13
Saizanthe way i see it is that function names are more special than they should be20/09 19:16
Saizanbecause even if f and g are defined with the exact same code f x and g x are not convertible if those functions pattern match on their argument20/09 19:19
pumpkinI wonder how hard it'll be to actually prove things about haskell programs that weren't written with proofs in mind once there's an extractor to HOL20/09 21:33
Saizanpumpkin: how did one restart quail mode?20/09 22:07
pumpkinno clue :/ I gave up after a while and restarted all of emacs20/09 22:07
glguypumpkin: I don't know that the point is to actually prove things about programs that weren't designed with verification in mind20/09 22:34
glguyIt might be to be able to prove things about the actual haskell code that was written with verification in mind and was then executed20/09 22:34
Saizanor-elim? : ∀ {A B C1 C2 D E F G : Set}{f : D -> C1}{g : E -> C2}{x : D ⊎ E} -> (A ↔ F) -> (B ↔ G) -> [ (\_ -> A) , (\_ -> B) ]′ (Data.Sum.map f g x) ↔ [ (\_ -> F) , (\_ -> G) ]′ x <- very general combinator20/09 22:48
glguycan you paste that again, I just turned off emoticons20/09 22:52
Saizanhah20/09 22:54
Saizanor-elim? : ∀ {A B C1 C2 D E F G : Set}{f : D -> C1}{g : E -> C2}{x : D ⊎ E} -> (A ↔ F) -> (B ↔ G) -> [ (\_ -> A) , (\_ -> B) ]′ (Data.Sum.map f g x) ↔ [ (\_ -> F) , (\_ -> G) ]′ x20/09 22:54
Saizan"very general combinator" was a joke, btw20/09 22:55
glguyperhaps you could generalize the arrows?20/09 22:55
Saizanabstract over ↔ , you mean?20/09 22:56
glguysure20/09 22:57
Saizanfun, that ends up requiring more type annotations where i use it20/09 22:59
Saizanwhich might be a sign of unification being over-zelous somewhere20/09 23:00
--- Day changed Tue Sep 21 2010
Saizanwhen you use C-c C-r there's no way to get a more informative message than "can not refine"?21/09 02:40
glguy_Saizan: What about using C-c C-.21/09 08:24
glguy_so that you can see the type of the expression you have next to the type you need21/09 08:25
Sean_McEligotdoes anyone know of a good list of symbols I can use to get emacs keybinds?21/09 13:22
Sean_McEligotby keybinding I meant like \bn21/09 13:23
Saizanhttp://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.UnicodeInput <- says "Type M-x agda-input-show-translations RET RET to see all the characters you can type using this input method", is that what you want?21/09 13:31
pumpkinis there a nice idiom for supporting "open" type functions like type families in haskell? I can make a custom universe for closed ones21/09 13:44
Sean_McEligotthanks Saizan, I read that page, but didn't see that21/09 13:45
pumpkinSaizan: turns out my "bug" wasn't a bug, but PEBKAC :)21/09 13:48
Saizanpumpkin: oh, how should one deal with that situation then?21/09 13:48
pumpkinSaizan hiding (_<=_; module _<=_)21/09 13:49
pumpkinunintuitive, but apparently in the .8 release notes21/09 13:49
pumpkinthat I didn't read carefully enough21/09 13:49
Saizanmakes sense21/09 13:50
pumpkinanyway, fixed the order on githu21/09 13:50
pumpkinthat package is coming together nicely!21/09 13:50
pumpkinmaybe we can actually have somewhat efficient machine integers :)21/09 13:50
Saizani've typed down the halting problem instead21/09 13:54
pumpkinoh yeah?21/09 13:55
pumpkinhow's that look?21/09 13:55
pumpkinI've been working on universal algebra separately21/09 13:55
pumpkinI almost have something I like21/09 13:55
Saizanhttp://code.haskell.org/~Saizan/halting/CompModel.agda <- a bit weird because it's parameterized on the computational model, as i've found in an agda1 paper21/09 13:56
pumpkinoh, interesting21/09 13:57
pumpkinlol, {A B C1 C2 D E F G : Set}21/09 13:58
Saizanyeah, that's quite funny :)21/09 13:59
* pumpkin is trying to come up with an elegant way to introduce consistent names across algebraic structures21/09 14:02
copumpkinN-ary : ∀ {a b n} → Vec (Set a) n → Set b → Set (a ⊔ b)21/09 14:09
copumpkinanyone know how to write that?21/09 14:09
copumpkinmight need to be suc (a lub b)21/09 14:09
copumpkinbut still doesn't work21/09 14:09
ccasinhas the promised cumulativity addition appeared yet?  Otherwise you'll probably need to compare and lift explicitly21/09 14:13
copumpkinick21/09 14:14
ccasinsince, without it, neither "Set a"s nor "Set b"s are "Set (a ⊔ b)"s21/09 14:15
copumpkinyeah :/21/09 14:15
Guest47215Hi, is there an analogon for Haskell's Data.Set in Agda?21/09 14:16
ccasinbut the mailing list they said they added cumulativity at the last AIM21/09 14:16
ccasindon't know if it made it to the public repo yet21/09 14:16
copumpkinccasin: oh, maybe it has an option for it21/09 14:17
copumpkinor maybe that21/09 14:17
copumpkindomi2: Data.AVL.Sets21/09 14:17
domi2copumpkin: k, thx!21/09 14:31
* domi2 misses hoogle21/09 14:31
* Saizan is so sad that irrelevance doesn't work in records21/09 14:36
Saizanhttp://hpaste.org/40013/squashing_laws <- is there a way to write dual so that dual∘dual≡id typechecks without pattern matching on squash?21/09 17:13
copumpkinlol, agsy doesn't know about irrelevance it seems21/09 17:17
copumpkincan I prove (∀ {A : Set} → .A → A) → ⊥?21/09 17:20
nappingwhat is the ⊥?21/09 17:21
copumpkinthe empty type21/09 17:21
copumpkina.k.a. false21/09 17:22
nappingIsn't (∀ {A : Set} → .A → A) inhabited by the identity?21/09 17:22
copumpkinexcept the first parameter is irrelevant, so it can't return it21/09 17:22
Saizancopumpkin: i don't think agda knows enough about parametricity to prove that21/09 17:23
nappingI don't know what tools you have for working with irrelevance21/09 17:23
Saizandarcs agda21/09 17:23
copumpkinnapping: me neither, trying to figure out how it works now :)21/09 17:24
copumpkinmaybe I'll make my universal algebra work wonderfully irrelevant21/09 17:24
nappingbut I imagine you'd have something like \forall {A B} {f : .A -> B} {a b} -> f a = f b21/09 17:24
Saizanyep, that's provable21/09 17:26
Saizantest : ∀ {A B : Set} {f : .A -> B} {a b} -> f a ≡ f b21/09 17:26
Saizantest = refl21/09 17:26
copumpkinhah, I just wrote out the exact same thing, name and \forall => ∀21/09 17:27
Saizan\forall => ∀ was included in the copy/paste here :)21/09 17:27
copumpkin:o21/09 17:28
nappingthat's proved by refl?21/09 17:28
Saizanyeah, i.e. they are convertible21/09 17:29
nappingso, it seems the question is what convertability allows with the irrelevant arguments21/09 17:31
nappingcan you then prove ∀ {A B : Set} {f : .A -> B} -> exists x, forall y, f y == x?21/09 17:41
Saizanheh, i think i'd have to produce an A out of thin air to do that21/09 17:47
copumpkinwhat if B is \bot?21/09 17:48
Saizanyeah, B = \bot is quite a counter example21/09 17:49
glguySo what's this new irrelevance feature in the darcs verison of agda?21/09 17:55
glguyI just saw some mention in the comments, but I haven't read any details21/09 17:56
copumpkinyou can specify that arbitrary parameters be irrelevant21/09 17:56
copumpkinso f : A -> .A -> A can only be f x y = x21/09 17:56
copumpkinI wonder if this makes agda more efficient :)21/09 17:57
glguyand you do that with the leading period on the type name?21/09 17:57
copumpkinyeah21/09 17:57
nappingwhere else are irrelevant arguments used?21/09 17:57
nappingI assume you can pass them into lemmas that take irrelevant arguments?21/09 17:58
glguyI would assume you could pass them to any lemma but that the result would be irrelevant21/09 18:01
glguylike the GPL21/09 18:02
copumpkinseems you can't declare that your output is irrelevant21/09 18:02
nappingcopumpkin: how would you prove (forall A, [A]) -> False ?21/09 18:02
nappingwait, that one is easy21/09 18:02
copumpkinyep21/09 18:03
copumpkinactually21/09 18:03
copumpkinit isn't false21/09 18:03
nappingwell, what would be an example of parametriciy21/09 18:03
nappinghow about a positive example21/09 18:03
nappingcan you prove \all {A} {f : A -> A} {a} f a == a?21/09 18:04
copumpkin[] has type forall a. [a]21/09 18:04
glguyYou could prove False with a: (forall A. [A] -> A)21/09 18:04
nappingyeah, that's a bad example21/09 18:04
copumpkinnapping: no21/09 18:05
nappingso, you are expecting that irrelevant arguments might help to prove parametricity results?21/09 18:05
nappingit seems like positive results from parametricity are quite hard21/09 18:06
nappingI haven't thought of an example of something that is false for parametricity reasons, but can't be trivially instantiated to produce a False21/09 18:06
pumpkinglguy: oh by the way21/09 18:18
pumpkinglguy: the <= issue was pebkac on my part21/09 18:18
pumpkinglguy: so it's fixed on github now21/09 18:18
pumpkindamn21/09 18:20
nappingis there any online library documentation?21/09 18:24
pumpkinthe documentation is the source :)21/09 18:26
pumpkinand there are almost no comments :P21/09 18:26
pumpkinglguy: did you get my message?21/09 18:26
pumpkinI guess that's a dumb question21/09 18:27
pumpkinglguy: anyway, I fixed the <= naming issue for the numeric order21/09 18:27
nappingI have a fresh install, so why is C-c C-x C-c trying to compile this MAlonzo thing?21/09 18:27
copumpkinMAlonzo is the compiler, I wouldn't use that21/09 18:27
nappingI just want to typecheck a file with some functions using this irrelevant stuff21/09 18:27
copumpkinI just use C-c C-l21/09 18:27
nappingah, that's the one21/09 18:28
glguypumpkin: I didn't see your message21/09 18:29
copumpkinglguy: turns out I just needed to hide both the _<=_ name and the _<=_ module21/09 18:29
pumpkinso the horrible q<= is gone21/09 18:31
nappinghow do you add a "with"?21/09 18:36
nappingoh, it seems it doesn't work at all21/09 18:42
nappingbar : ∀ (f : .Bool -> Bool) (H : (x : Bool) -> f x ≡ x) -> ⊥21/09 18:42
nappingthen the after even bar f H with true21/09 18:42
nappinganything I write produces an internal error!21/09 18:42
pumpkinthat might be a bug, but it's just a hunch :)21/09 18:43
nappingcopumpkin: have seen https://lists.chalmers.se/pipermail/agda/2010/001809.html21/09 18:54
pumpkinI saw it but haven't played with it21/09 18:58
pumpkindolio was doing some parametricity proofs a couple of weeks ago21/09 18:59
* pumpkin is a member of the agda organization on github!21/09 19:09
pumpkiny'all should join too :)21/09 19:09
glguyis proof irrelevance interesting if you aren't generating code?21/09 19:13
Saizanit should speed up typechecking, and also make more things obviously equal21/09 19:16
Saizandata Squash (A : Set) where squash : .A -> Squash A, implies forall {x y} -> squash x == squash y21/09 19:17
nappingis the theory behind irrelevant arguments written up somewhere?21/09 20:04
nappingthis seems to be a different sort of thing from Prop always being irrelevant21/09 20:04
nappingor at least rather more general21/09 20:04
Saizanthere's a discussion on the mailing list about the theory and future design choices21/09 20:37
nappingwhat is the title?21/09 20:39
Saizan"[Agda] Re: [Coq-Club] Re: Universe Polymorphism" so i guess it started elsewhere :) "[Agda] Records and irrelevant fields" is also relevant21/09 20:43
nappingI saw the records one, I'll see about the other21/09 20:44
napping"EPTS" seems to be the thing to search for21/09 20:59
nappingI think I read that paper a while back, but didn't realize it would be interesting in a programming language21/09 21:06
ccasinthat discussion is really interesting - I had never thought about the difference between cumulativity and "full" cumulativity before21/09 21:08
ccasinIn my naive agda-like prototypes I often add a cumulativity rule, but because they lack agda's sophisticated definitional equality one then loses principle types21/09 21:09
ccasinwho knew!21/09 21:09
nappinghow does that go?21/09 21:10
ccasinthe example in luo's book is the function:21/09 21:10
nappingI can see a cumulativity rule that allows multiple paths could be a problem21/09 21:10
ccasin\x:Type 0 . x21/09 21:10
ccasinwhat is the type of this function?21/09 21:10
ccasinType 0 -> Type 0, certainly21/09 21:10
ccasinbut also Type 0 -> Type n for any n21/09 21:10
nappingI don't see that things are forced to go wrong21/09 21:11
ccasinthere is just no "most general" type for this function21/09 21:11
ccasinbecause (Type 0 -> Type 0) and (Type 0 -> Type 1) aren't comparable21/09 21:12
nappingCouldn't you write your typing rules so it is only Type 0 -> Type 0, and do the subtyping in application?21/09 21:12
ccasinif one naively adds the cumulativity rule but not also a definitional equality that picks apart pis and applies it in various palces21/09 21:12
ccasin*places21/09 21:12
ccasinSure, but then that function applied to some term won't have a most general type21/09 21:13
ccasinoh, no, sorry21/09 21:13
ccasinyes, that might work, but of course there are other compound types too and one would have to think about them21/09 21:13
nappingit seems like it could be pretty tricky21/09 21:14
ccasinluo solves it with a complicated cumulativity relation, instead of just the one standard rule.  It's kind of interesting21/09 21:14
nappingPerhaps some sort of universe polymorphism would work as well21/09 21:14
ccasinanyway, my point was just that I learn a lot from reading the agda list :)21/09 21:14
nappingI don't see where you get that from the post on universes21/09 21:15
ccasinnapping: perhaps, although it came up because Randy Pollack mentioned that his universe polymorphism paper had cumulativity but not full cumulativity21/09 21:15
ccasinso it seems universe polymorphism is compatible with either21/09 21:15
ccasinalas, have to run to a meeting21/09 21:15
ccasinlater21/09 21:15
nappingI'm not too sharp today, but the sepecific thing Dan was pointing out was that he ended up with distinct unit types promoted form lower levels21/09 21:15
nappingbye21/09 21:15
dolioglguy: On the Strength of Proof Irrelevant Type Theories is a paper about why programming in a theory with proof irrelevance can be nice, aside from optimization.21/09 21:44
glguy(for reference: http://arxiv.org/pdf/0808.3928)21/09 21:45
ccasinnapping: yes, I agree, it was only mentioned in passing in the thread21/09 22:07
glguyI think taht it is a bug that I can't C-c C-c on an irrelevant parameter if that parameter is impossible21/09 22:10
glguyand the C-c C-c should have matched with ()21/09 22:10
--- Day changed Wed Sep 22 2010
glguySo at some point would it make sense to make the proofs contained in the fields of things like IsMonoid proof irrelevant?22/09 00:40
Saizani think it depends on your use cases, since if they are marked irrelevant then you can't use them to coerce terms that are relevant, with the current rules at least22/09 00:41
Saizans/that are relevant/that are used in a relevant position/22/09 00:42
copumpkinwhat would be the problems with letting you use irrelevant proofs to coerce relevant terms?22/09 00:48
Saizanthat you can make open term evaluation loop, i think22/09 00:51
Saizan(which is needed for typechecking)22/09 00:53
* Saizan wishes you could link messages from gmail22/09 00:54
Saizanhttps://lists.chalmers.se/pipermail/agda/2010/002044.html <- so i guess there's a detailed answer here http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.154.561922/09 00:58
copumpkinspeaking of what he wrote in there, it feels weird that this is allowed: http://snapplr.com/j7ae22/09 01:05
dolioThat weirdness is at least one motivation for the irrelevance stuff.22/09 01:22
Sean_McEligotfrom Nat.agda:22/09 20:31
Sean_McEligot_+_ : ℕ → ℕ → ℕ22/09 20:31
Sean_McEligotsuc m + n = suc (m + n)22/09 20:32
Sean_McEligotwhat's going on on the right side n+m. is this like joining two lists?22/09 20:32
jonrafkindits defining + recursively22/09 20:42
jonrafkindsuc (m + n) -> suc (suc (m' + n)) ...; until you get m' = 0 and then its just n22/09 20:42
jonrafkindso you get suc(suc(suc(n))), which is mathematically equal to m + n22/09 20:43
jonrafkindsince suc appears m times22/09 20:43
Sean_McEligotthanks, I'm still pondering it... could the same thing be done in haskell> I'm used to x:xs style functions in haskel22/09 20:48
Sean_McEligotI guess it's pretty simple. thanks. I'll keep playing around22/09 20:50
jonrafkindits essentially the same thing, the function is defined by pattern matching on the input and destructuring it to reformulate the answer into some known quantity22/09 20:51
jonrafkindgiven + exists how can you compute suc m + n, well you can suc the result of +, and thats exactly what its doing22/09 20:51
jonrafkindx:xs style says, given some function f that operates on a list and a function g that operates on a single element of a list, take apart a list by getting its head and apply g to that, then apply f to the tail of the list22/09 20:53
jonrafkindwhere the function f is usually the one you are already defining22/09 20:53
Sean_McEligotnice, so no we have numbers without symbols (1,2) to compare, do we check the length?22/09 20:56
Sean_McEligots/no/now22/09 20:56
jonrafkindyou can compare the number of times suc has been applied22/09 20:58
jonrafkindsuc(suc(suc(O))) = 322/09 20:58
jonrafkindsuc x > O, so to check if x > y you can do | suc x > O -> true, | suc x > suc y -> x > y, | O > _ -> false22/09 20:59
Sean_McEligotzero is just a type not related to 0, so = would work, but what's > doing22/09 21:01
jonrafkindi think you still have define what = means22/09 21:05
jonrafkindunless agda comes with structural equality or something..22/09 21:05
Sean_McEligotzero == zero is the only comparison that I can see working22/09 21:06
jonrafkindgiven x and y, and you match them both to zero then you can say they are equal. x > y | 0 > 0 = false22/09 21:06
jonrafkindyou can only match a variable to either 0 or suc blah22/09 21:07
Sean_McEligotoh, so this is a pattern match by the compiler on suc(suc(suc(zero)))22/09 21:08
jonrafkindyea you can match a variable to any pattern22/09 21:09
jonrafkindx | suc(suc(suc(zero))) = ...; if it matches then thats what you got22/09 21:10
Sean_McEligotok,  my brain is rewired enough to continue, thanks22/09 21:12
--- Day changed Thu Sep 23 2010
jonrafkindhow do I pattern match on things inside a lambda? (λ x -> case x of ...)23/09 00:22
Saizanthat's a quite annoying part, since there's no case expression23/09 00:25
Saizanso you've to define a named function, or use a fold-like operator23/09 00:26
jonrafkindugh.. alright23/09 00:26
jonrafkinddoes agda use a GLR parser?23/09 00:49
Spockzhow can I pass implicit arguments to a infix constructor/function? suppose (x , xs) (, for Product) How would I add the implicit variables?23/09 10:31
dolio_,_ {t} x xs23/09 10:33
Spockzok, I get a yellow highlighting, but I'm not quite sure why. :(23/09 10:42
g_crossDoes anyone have a reference I can check out to read about how the MAlonzo compiler works?23/09 20:28
--- Day changed Fri Sep 24 2010
commanaceHey... i'm trying to install agda on my gentoo machine (using portage) however ghc fails to recognize the package afterwards and indeed ghc-pkg list doesn't show any agda packages... might be a gentoo related problem but more likely I simply forgot to do something obivous :P24/09 21:37
commanaceany suggestions?24/09 21:37
jonrafkindi installed agda in gentoo..24/09 21:42
jonrafkinddid you emerge agda-mode ?24/09 21:43
commanacejonrafkind: there is no package called agda-mode, but i think agda installed the corresponding files for emacs...24/09 21:48
jonrafkindoh right, use cabal to install agda mode I think24/09 21:49
jonrafkindI think I installed agda itself from source24/09 21:49
jonrafkindseems 2.2.6 is in portage24/09 21:49
jonrafkindwith ~x8624/09 21:50
commanacewait, are you talking about the emacs agda-mode?24/09 21:50
jonrafkindyea24/09 21:50
commanaceyes, i'm on ~x8624/09 21:50
commanaceagda-mode is installed and loaded24/09 21:50
commanacejust ghci won't find the package24/09 21:50
jonrafkinddo you have haskell-mode installed to?24/09 21:51
jonrafkindghc-pkg list -- shows this for me: /home/jon/.ghc/i386-linux-6.12.3/package.conf.d24/09 21:51
jonrafkind   Agda-2.2.624/09 21:51
commanacejonrafkind: yes, there's the problem... its not listed for me... do i have to run some kind of updater to update the package list?24/09 21:52
commanacei doubt it's an emacs-related problem24/09 21:52
jonrafkindhow did you install agda?24/09 21:53
commanaceemerge agda24/09 21:53
commanace:)24/09 21:53
jonrafkindhm im not sure whats wrong, do you have cabal?24/09 21:54
commanacemaybe it's gentoo related and the cabal or source version works better... don't know24/09 21:54
commanaceyes, i can try cabal24/09 21:54
jonrafkindim pretty sure all I did was 'make install' in the agda source tree24/09 21:54
commanacei'm always scared that using to many packaging system at the same time will lead to a huge chaos at some point :P24/09 21:55
commanacebut i'll check the cabal version24/09 21:55
--- Day changed Sat Sep 25 2010
stevanSaizan, pumpkin: hi, i just tried out the field irrelevance stuff on the ct library. managed to get rid of the whole functor extensionality bit  :-)25/09 15:53
Saizannice, i was going down that route yesterday but then i had to sleep :)25/09 15:54
* Saizan pulls25/09 15:54
Saizanstevan: now we can uncomment the adjuction laws :)25/09 16:04
dolioHow's it affect the performance? Much faster?25/09 16:05
stevanstill parts of the code which don't use irrelevance / haven't been updated since the use (i.e. broken), so it's hard to say yet...25/09 16:07
dolioAlso, do you need an option to turn on the irrelevance stuff? And if so, what is it?25/09 16:08
stevanyou dont25/09 16:09
Saizani tried to cheat by just switching _\==_ to one wrapped in a record version of Squash but i get much more yellow25/09 16:11
* dolio needs to start building agda without profiling.25/09 16:51
--- Day changed Sun Sep 26 2010
nappingI wonder if it could work to implicitly quantify free names26/09 02:29
nappingah, I hadn't noticed named implicit parameters had to be supplied in order26/09 02:31
stevanhmmm, shouldn't mapFold pass the termination checker? http://hpaste.org/40134/term26/09 12:29
doliostevan: The I case looks problematic.26/09 12:32
dolioAlthough it still looks decreasing in the last argument.26/09 12:34
dolioOh, but it isn't inductive, which may be the issue.26/09 12:35
dolioThe only thing to do induction on in that function is F, and in the I case, you arbitrarily replace it with G.26/09 12:36
dolioWhich isn't a subcomponent of I.26/09 12:36
stevanthis works: http://hpaste.org/40135/sa26/09 12:37
stevanwhat's the difference?26/09 12:38
stevanrecord vs datatype for product?26/09 12:39
dolioOh... maybe.26/09 12:40
dolioDoes Test2 still work?26/09 12:41
stevantest2 works. http://hpaste.org/40136/term3   doesn't work26/09 12:42
stevanso it seems to be something with product26/09 12:42
dolioOkay.26/09 12:43
stevanbug?26/09 12:43
dolioNot necessarily.26/09 12:43
dolioMatching on the product like that is justified by translation to projections.26/09 12:43
dolioSo, you have to ask if you'd expect it to work with 'mapFold F1 G phi (proj_1 p) ...'26/09 12:44
dolioYou probably would, because I think you can derive induction from eta equality, but I suppose the termination checker could be justified in not simply assuming it.26/09 12:47
dolioIt's kind of weird even with the inductive product, though.26/09 12:48
dolioSince the termination checker is accepting it based on piece-wise induction, to coin a term.26/09 12:49
dolioInstead of induction on the Functor, which is the most obvious choice.26/09 12:49
stevanif the |Id| functor is removed, it passes26/09 12:50
dolioThat's not to say that it'd be impossible to write that function without pattern matching+termination checker, but it seems like you'd have a bunch of stuff to prove beforehand.26/09 12:51
dolioSo the termination checker seems to be enabling a non-trivial recursion scheme.26/09 12:51
stevanor if the |x| functor is removed, it also passes.26/09 12:52
stevani don't know, but i think if the inductive product version passes then so i think the record version should. wasn't one of the reasons for the switch from the former to the latter in the std lib that they behaved the same?26/09 12:59
Saizanno, they don't behave the same26/09 13:02
Saizanthe record version gets eta-expanded during type checking, so "p = proj1 p , proj2 p" but that's not true for the data version26/09 13:03
dolioThis is the first example I've seen where the inductive version behaves better, though.26/09 13:04
stevanyeah26/09 13:04
stevani just tried the same example using an older version, and it works...26/09 13:08
Saizanpattern matching on records wasn't rewritten to projections then26/09 13:09
Saizananyhow, i don't know if eta rules should have this impact on termination checking, but it seems likely to me26/09 13:10
stevanwhat was the motivation behind rewriting pattern maching on records to projections?26/09 13:20
dolioBecause projections are primitively defined for records, and pattern matching isn't.26/09 13:32
Saizanalso because subject reduction was lost26/09 13:37
doliostevan: So, I thought about it, and came to the conclusion that it probably should allow the function somehow, even with the record product.26/09 15:55
dolioThe fact that it allows 'in : [[ F ]] (Mu F) -> Mu F' means that it recognizes that [[ F ]] is a strictly positive functor.26/09 15:56
dolioSo the induction principle should be like '(F : Functor) (P : Mu F -> Set) ((m : [[ F ]] (Mu F)) -> All P m -> P (in m)) -> (x : Mu F) -> P x'.26/09 15:57
dolioWhich is the eventual goal anyway.26/09 15:57
dolioSo the termination checker and the datatype validator aren't really in sync.26/09 15:57
stevanok, i guess we should report it then26/09 16:07
dolioWell, I'm still not surprised that it doesn't work.26/09 16:09
dolioBut, there's kind of a mismatch.26/09 16:09
dolioI mean, I don't think the checker ever accepts that induction principle.26/09 16:09
dolioThat's why you have to define mapFold or whatever as an auxiliary.26/09 16:10
Saizandon't they define something white similar for Desc in epigram's agda models?26/09 16:11
stevanthey do26/09 16:12
dolioI also had an epiphany about why I can't define the Epigram desc stuff using just induction recursion: it's impredicative.26/09 16:21
dolioSo you need to hijack the built-in impredicativity of large indices to make it work.26/09 16:22
ccasinbuilt-in impredicativity of large indices?26/09 16:38
ccasincan you elaborate on what you mean by that? :)26/09 16:38
dolioHaving a type T indexed by Set and inhabiting Set is impredicative in a sense.26/09 16:42
ccasinhmm, interesting26/09 16:44
dolioThe index kind of ranges over the very set that the type inhabits.26/09 16:44
ccasinyes26/09 16:44
ccasinthough, it seems to dependa bit on one's mental picture of inductive type definitions26/09 16:44
ccasinare they really building "new" types?26/09 16:44
ccasinpicturing them as building new types runs into trouble, since then they'd naturally be injective26/09 16:45
ccasinand, if not - if they are just names for things already in Set - then there is not much impredicative here26/09 16:47
ccasinor maybe I'm just running my mouth about things I don't understand :)26/09 16:48
dolioWell, if you read about, say, Luo's UTT, he defines a system in a logical framework...26/09 16:49
dolioAnd the way he defines universes is something like...26/09 16:50
dolio"Here are a bunch of ways of building types."26/09 16:50
dolio"The first universe, U0, contains all the types capable of being built that way."26/09 16:50
dolio"Then, you can build types making use of U0."26/09 16:50
dolio"U1 contains all types buildable that way."26/09 16:51
dolioAnd so on.26/09 16:51
ccasinyes, but, I think even in UTT26/09 16:51
ccasinif I defined for example26/09 16:51
ccasintwo unit types26/09 16:51
ccasinI couldn't prove them distinct26/09 16:51
ccasinHe gives you ways to "build" types, and it's nice to think of them as being really new things, but the system can't show that26/09 16:52
ccasinyou can actually show them distinct in agda right now, but I'm pretty sure it's a bug26/09 16:52
dolioWell, that wasn't really my point. You don't have to take type declarations as building new types.26/09 16:52
dolioYou could view them as identifying types that already exist.26/09 16:53
dolioBut, nevertheless, U0 doesn't contain types that require U0 to define.26/09 16:53
dolioBut in Agda, Set does.26/09 16:53
ccasinOK, I see26/09 16:54
ccasinbut I'm still not sure I entirely believe you :)26/09 16:54
dolioOr, if you look at the category theory underlying inductive families, I believe they're initial algebras in slice categories.26/09 16:54
ccasinif we think if an indexed datatype as some opaque function into the world of Set26/09 16:54
dolioWhere an initial algebra in C/A is a family with an index A.26/09 16:54
ccasinthen it doesn't really "define" types.  It just names them26/09 16:55
ccasinI confess my category theory is weak26/09 16:55
dolioIndexing by Set would imply that you can slice over Set, but the category it's in is Set as well.26/09 16:55
dolioSo it'd be Set/Set, and Set would be an object of itself, which is kind of bad.26/09 16:56
dolioI can believe that this isn't so viciously circular in Agda, though.26/09 16:57
dolioIn reality, what Agda does may be closer to induction recursion.26/09 16:58
dolioYou're indexing your datatype by Set, which hasn't been finished being defined yet.26/09 16:58
dolioBut you can only refer to the previously named elements as indices.26/09 16:59
dolioI'm not sure if that stands up to scrutiny.26/09 16:59
ccasinI don't know either :)26/09 16:59
ccasinbut calling indexed datatypes "definitions" of types makes me nervous26/09 17:00
dolioAnyhow, there's nothing necessarily bad about impredicativity.26/09 17:00
ccasindolio: well, it's a trick you can pull once26/09 17:00
ccasinif every Set n is impredicative, then shouldn't there be some logical inconsistency?26/09 17:00
dolioBut it explains why I can't get it to work using induction recursion.26/09 17:01
dolioBecause impredicativity ends up as negativity there.26/09 17:01
ccasinyes26/09 17:01
ccasinit's a shame we don't have a good tool with an impredicative universe and induction recursion26/09 17:02
ccasinoften I want both26/09 17:02
ccasinnot that anyone has done the metatheory for such a language26/09 17:02
dolioWell, the impredicativity of large indices seems, to my eyes, weaker than the usual impredicativity that enables Girard's paradox if you have it at higher levels.26/09 17:03
dolio"Impredicativity" is kind of an overloaded term.26/09 17:03
ccasinyes26/09 17:04
dolioSome folks think induction is impredicative, after all (if I'm recalling correctly).26/09 17:05
Saizanedwinb: /win 2026/09 19:09
Saizanedwinb: since i've pinged you anyhow, i've fixed a build problem for epic, and improved build errors reporting: http://github.com/Saizan/EpiVM/commit/615b6efc546a55c50de3d61990d6482ff475f77a26/09 19:43
--- Day changed Mon Sep 27 2010
stevanhi, could someone with 2.2.6 test if this works: http://hpaste.org/40161/bug  ? thanks.27/09 13:27
stevanfound an old 2.2.6 version laying around, seems to have worked back then27/09 13:47
edwinbSaizan: thanks for the patch.27/09 21:21
edwinbNow I just need to remember how to drive git ;)27/09 21:22
Saizanyeah, that's always the hardest part :)27/09 21:24
edwinbI still haven't got the hang of this sort of thing since I switched27/09 21:25
Saizanbtw, if you don't mind requiring Cabal 1.8 you could avoid building the library modules twice27/09 21:25
edwinbthat'd be nice27/09 21:25
edwinbI don't really understand cabal ;)27/09 21:25
Saizanthat seems to be common :)27/09 21:26
* edwinb goes to poke avsm since he's in the same room and it was him who made me switch ;)27/09 21:32
Saizanedwinb: http://github.com/Saizan/EpiVM/commit/e461fccd6045ae86d4b8840ae7d9c14b7d0c959e another patch :)27/09 21:41
Saizananyhow i think most of the confusion wrt Cabal is that there isn't much documentation effort, it's a system that has a fair amount of detail to deal with all the various bits, but it's not fundamentally complex27/09 21:46
Saizan*is due to the fact that27/09 21:46
copumpkindoes NAD ever hang out in here?27/09 23:26
Saizani think he only reads the logs :)27/09 23:26
copumpkinah damn27/09 23:26
llambdaYou can send messages to him through logs27/09 23:50
llambdaExpect a response via e-mail a month down the road27/09 23:50
copumpkin:)27/09 23:50
--- Day changed Tue Sep 28 2010
stevanso working with records with irrelevant fields: http://hpaste.org/40174/irr   the only way to get this to work is to parametrise all functions on C rather than having it as a module parameter?28/09 00:26
stevanbtw, 2.2.8 just got released :-)28/09 00:26
pumpkinstevan: oh you're still developing the CT stuff?28/09 00:26
stevanyeah the new irrelevance stuff makes somethings a lot nicer28/09 00:27
pumpkinoh nice28/09 00:27
pumpkinwhere was the readme again? to browse the modules28/09 00:27
pumpkin(I'm on a different computer from the one I have the bookmark on)28/09 00:27
stevantinyurl.com/CTinAgda   but i haven't updated the html yet28/09 00:28
pumpkinah ok28/09 00:28
Saizanstevan: heh, pattern match on C in a with?28/09 00:32
stevan!28/09 00:32
Saizannot much better.28/09 00:33
stevanhmm, i can't get it to work. how did you do?28/09 00:38
Saizani've never tried it personally28/09 00:38
stevanpumpkin: op (op C) == C  http://patch-tag.com/r/stevan/ctfp10/snapshot/current/content/pretty/src/Category/Opposite.agda      and  functor o-assoc and id and now be done without functor extensionality thing  http://patch-tag.com/r/stevan/ctfp10/snapshot/current/content/pretty/src/Category/Categories/Cat.agda    :-)     i haven't gotten around updating the rest yet tho, the above problem with the irrelevant stuff not ...28/09 00:47
stevan... being in scope unless you pattern match on it causes some rewriting...  if atleast the with trick worked, not sure why it doesn't... have to try some more...28/09 00:47
copumpkinwhat's a good name for a heterogeneous vector indexed on a homogeneous vector of types?28/09 02:45
dolioHList?28/09 02:46
copumpkinList and not Vec?28/09 02:49
dolioThat was sort of a joke.28/09 02:51
llambdaIsn't it AList around these parts28/09 02:54
dolioThe H stands for heterogeneous.28/09 02:54
dolioNot Haskell.28/09 02:54
dolioThen again, I guess that means HTrue is heterogeneous True.28/09 02:55
llambdaAmorphusList28/09 02:55
pumpkin:)28/09 02:58
edwinbSaizan: avsm has told me the magic incantation, so I've got your patch now, thanks28/09 16:11
stevanhmm, i'm confused: why doesn't this work? http://hpaste.org/40188/irr28/09 16:15
stevan"variable idL is declared irrelevant, so it cannot be used here"28/09 16:15
copumpkinthat's quite a constructor there!28/09 16:16
stevan:-)28/09 16:17
copumpkinit seems like maybe that ==-reasoning thing might need to be revised to accept irrelevant arguments in the < >, since it doesn't use them anyway?28/09 16:17
stevanthis works: http://patch-tag.com/r/stevan/ctfp10/snapshot/current/content/raw/src/Category/Functors.agda28/09 16:19
stevani can't see any difference?28/09 16:19
Saizanstevan: that in the paste left-identity is defined separately while in Functors you use the irrelevant fields to fill an irrelevant field directly28/09 17:06
stevanok, can left-identity be proven?28/09 17:15
Saizani'd say no, you've to wrap it in a Squash type28/09 17:21
stevanhmm :-/28/09 17:22
* copumpkin is trying to think of a good extensible notion of "identity" for operations/elements/sets/properties in a general algebra module in agda28/09 17:55
* copumpkin wants cumulative universes :(28/09 18:47
dolioGo use MiniAgda.28/09 18:47
copumpkin:(28/09 18:47
copumpkinokay, it's that time of the night28/09 19:55
copumpkinanyone around remember how to turn quail completions on and off?28/09 19:55
dolioWhat do you mean? The stuff that makes \neg turn into unicode?28/09 20:03
dolioWhy do you want to turn that off?28/09 20:03
copumpkinoh, I want to turn it on28/09 20:04
copumpkinsometimes I accidentally press the magic key combo that turns it off28/09 20:04
dolioOh.28/09 20:04
copumpkinand can never remember how to turn it back on28/09 20:04
copumpkinwithout restarting the whole thing28/09 20:04
copumpkinpoking around on the wiki on key combos doesn't seem to reveal anything28/09 20:04
copumpkinbut next time I find it out I'm putting it on28/09 20:04
stevanset-input-method "Agda" ?28/09 20:04
dolioTry M-x, and then type in 'quail' and press tab to see what commands with that name are available?28/09 20:05
dolioOr 'agda' if the whole agda mode is off.28/09 20:05
copumpkinnah, it's just quail that turns off28/09 20:05
copumpkinhmm, there seems to be a quail-inactivate but not a corresponding activate28/09 20:07
dolioI think Agda might be in trouble with regard to GHC 7.28/09 20:09
copumpkinhow come?28/09 20:10
dolioI think it has multiple dependencies that in turn depend on base 3.28/09 20:10
copumpkinoh28/09 20:10
dolioWhich is gone.28/09 20:10
doliohaskell-src is one. Maybe that will change.28/09 20:17
dolioI guess that's it. syb requires base < 4.3, but that's an easy fix.28/09 20:19
dolioI had thought that haskeline also depended on base 3.28/09 20:20
copumpkinhttp://hpaste.org/40192/algebra_with_identity_issues thoughts anyone?28/09 20:24
copumpkinI've come up with a horrible (but extensible) way to give sets/operations/properties identities so you can actually compare structures, but was wondering if anyone else had any ideas28/09 20:31
dolioWhat does "compare structures" mean?28/09 20:33
copumpkincheck if a structure claims to support a named operation, and if that operation satisfies named properties28/09 20:34
copumpkinif that makes sense28/09 20:36
dolioIs it like extensible records?28/09 20:37
dolioAnd row polymorphism?28/09 20:37
copumpkinI guess it's sort of an attempt to do algebra that way, yeah28/09 20:37
dolioThen I'm not surprised it's unwieldy trying to implement it in a system without support for it.28/09 20:38
copumpkinyeah :/28/09 20:38
dolioExtensible dependent records would be a nice feature.28/09 20:40
dolioThey're a little more complicated than the non-dependent version, though.28/09 20:40
dolioMaybe a lot more complicated.28/09 20:42
pumpkinhm, haven't really thought it through in those terms28/09 20:49
copumpkinwhat's the syntax for an irrelevant implicit argument?28/09 23:02
jonrafkind{_} ?28/09 23:02
copumpkinI mean irrelevant in the sense that you couldn't use it if you tried28/09 23:02
copumpkinthinking of unamb : ∀ {a} {A : Set a} → (x y : A) → {pf : (x ≡ y)} → A28/09 23:03
copumpkinI can write unamb : ∀ {a} {A : Set a} → (x y : A) → .(x ≡ y) → A28/09 23:04
dolioIt's probably not an option.28/09 23:33
dolioYou can't write irrelevant arguments without a name, right?28/09 23:33
dolioI mean, implicit arguments.28/09 23:34
dolioAnd irrelevant arguments with names isn't valid syntax yet, from my experiments.28/09 23:34
dolioEven though it will print types that way.28/09 23:34
pumpkinyeah :/28/09 23:41
pumpkindamn, so close to actually being able to write a safe unamb!28/09 23:42
Saizanyou can always wrap it in a squash28/09 23:44
copumpkinsquash is my cousin28/09 23:45
stevangrrr, cabal installed the latest darcs version, now i get: "Loading package Agda-2.2.9 ... linking ... ghc: /home/stevan/.cabal/lib/Agda-2.2.9/ghc-6.12.3/HSAgda-2.2.9.o: unknown symbol `__stginit_Agdazm2zi2zi9_AgdaziSyntaxziTranslationziConcreteToAbstract_'28/09 23:56
stevanghc: unable to load package `Agda-2.2.9'"28/09 23:56
stevaninside the *ghci* buffer28/09 23:56
stevanany ideas?28/09 23:57
--- Day changed Wed Sep 29 2010
Saizanno, it seems to link fine here29/09 00:11
Saizanmaybe "cabal clean && cabal install"? and then restart ghci29/09 00:12
stevanmagic, now it works :-). thanks29/09 00:28
copumpkinstevan: how's CT going?29/09 01:09
doliocopumpkin: You could bug Andreas Abel to get it in. The printing of types at least seems to suggest that some of the machinery is already there.29/09 01:10
dolioAnd I think MiniAgda already has it.29/09 01:10
copumpkinwas he notabel on IRC a few days ago?29/09 01:10
dolioI don't know.29/09 01:10
dolioI guess that would make sense.29/09 01:10
stevancopumpkin: didn't get far today. been trying to define Func (the category of functors), but something is wrong with NT or NT composition i think -- can't get it to work. ran into an irrelevance bug also, spent some time minimising the code causing it, etc.29/09 01:19
stevancopumpkin: file a bug report/ feature request regarding the irrelevant implicit stuff, perhaps?29/09 01:24
danbrowndid the termination check get dumber in the last month or so?29/09 17:08
danbrown*checker29/09 17:08
danbrownalso a new bug with MAlonzo29/09 17:11
danbrownhrmf. i'll file a bug after lunch29/09 17:12
pumpkindanbrown: I thought it got smarter, if you ask it to look deeper than one level29/09 17:14
danbrownpumpkin: i tried --termination-depth=5, but no luck29/09 18:41
danbrownok, good. not a MAlonzo bug. probably just a stale interface file somewhere29/09 19:44
danbrowndoes `agda --vim' not support the new syntax-with-binders yet?29/09 20:18
danbrownis the wiki not publicly editable?29/09 21:18
danbrownyay, i'm finally pushing all of my agda+vim workflow hacks out to the wiki29/09 21:42
danbrownbeen hoarding those for too long29/09 21:42
pumpkin:o29/09 22:01
danbrowngrr at wiki markup...29/09 22:03
danbrowncan't seem to get unicode into a preformatted [@ ... @] block29/09 22:03
pumpkinsurely there are other examples of it fitting?29/09 22:03
danbrownaaaand the wiki's down...29/09 22:26
danbrownso close!29/09 22:26
danbrowndone29/09 22:44
danbrownmore vim goodness is now up on the wiki: syntax highlighting and unicode entry29/09 22:45
* benmachine hugs29/09 22:47
danbrownalso better tokenizing for `agda --vim`, whenever someone gets a chance to add it: http://code.google.com/p/agda/issues/detail?id=33929/09 23:00
danbrowncan't pattern match on ♯ anymore? bummer.29/09 23:19
danbrownthat used to be a constructor29/09 23:19
danbrownah, it used to be a codata, which is now banished29/09 23:21
pumpkinyeah, it's just a primitive now29/09 23:21
pumpkinyou weren't supposed to match on it before, either :P29/09 23:22
benmachineaww but codata is a cool word :(29/09 23:22
benmachinemy decisions on which language features I like are based largely on the aesthetics of the keywords, yes29/09 23:23
--- Day changed Thu Sep 30 2010
stevanhmm: "* added projections for irrelevant record fields (with --irrelevant-projections)"30/09 15:56
wireshi I'm super new to emacs & agda. A tutorial tells me to use the "Case" command when i'm at a goal, this should try to expand all the cases. Where do I find this "Case" command?30/09 16:33
wiresalso, any hints on a nice tutorial somewhere that explains interactive agda?30/09 16:33
stevanhi, C-c C-c30/09 16:34
stevani'm afraid there is no such tutorial, would be nice if someone made a video explaining it30/09 16:35
wiresCool, thanks... where do I go to get documentation on this?30/09 16:35
wiresOk... Well i don't mind making a video once I know this a bit...30/09 16:36
stevanthere is this: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.QuickGuideToEditingTypeCheckingAndCompilingAgdaCode30/09 16:36
wiresAh I see.. saw that one, but I missed the case command. thanks30/09 16:37
stevanwhat tutorial are you following btw?30/09 16:41
wiresstevan: I've decided to do a masterclass DTP at utrecht, just found out yesterday. I'm using anything I can find on http://wiki.portal.chalmers.se/agda/agda.php?n=Main.Othertutorials30/09 16:47
wiresWent through "Ana Bove and Peter Dybjer. Dependent Types at Work"30/09 16:47
stevanok :-)30/09 16:48
wireshmm parted room.. weird30/09 17:04
wiresWhat's the easiest way to test some code in one of the files you are editing? Is there something like a lisp repl? I'm completely new to agda & emacs...30/09 17:04
Saizanif you want to evaluate something there's C-c C-n30/09 17:04
wiresLet me try that, thanks30/09 17:05
stevanyou could also do something like:   test : 1 + 2 == 3; test = refl30/09 17:05
stevanbtw Saizan , one can prove left-identity now :-)30/09 17:11
Saizan yeah, just saw the commits :)30/09 17:19
pumpkinleft-identity where?30/09 17:19
pumpkinfor the CT?30/09 17:19
stevanyea30/09 17:19
* pumpkin pulls30/09 17:20
pumpkinoh some of the old stuff doesn't work anymore, right? you're mid-refactor?30/09 17:21
stevanyea30/09 17:21
pumpkinah okay30/09 17:22
stevanbut a feature that got implemented a few hours ago fixes alot of things30/09 17:22
pumpkinoh which one?30/09 17:22
stevansee test/succeed/IrrelevantProjections.agda30/09 17:23
pumpkinI was wondering if there was a nice way to define universality that worked for all things30/09 17:23
stevandunno...30/09 17:26
pumpkinwe need a universal universality law!30/09 17:27
stevan:-)30/09 17:28
pumpkinit actually seems fairly simple30/09 17:28
stevanperhaps we could use a universe  :-p30/09 17:28
stevancan you explain how you are thinking? i can't see the simplicity of it30/09 17:29
pumpkinwell, in general it's saying "you have an X with a few properties, and if you had any other Y with properties of the same shape, then there is a unique morphism from Y to X"30/09 17:30
pumpkinas far as I can see30/09 17:30
pumpkinnot sure if that covers all uses of it, as I'm still very much a beginner :)30/09 17:31
pumpkinproperties generally meaning some morphisms to other objects30/09 17:32
stevanhow would you capture that typewise?30/09 17:34
pumpkinnot sure how to deal with the sets30/09 17:36
Saizan"Universal (X : | C |) (P : | C | -> Set) = (Y : | C |) -> P Y -> exists_unique (C [ Y , X ])" ?30/09 17:51
pumpkinI was thinking of the | C | -> Set thing30/09 17:52
pumpkinbut it wouldn't let you enumerate them30/09 17:52
pumpkinbut maybe you don't need to30/09 17:52
wiresis there a way to "putStrLn" some random value to the console? or should I write my own "toString" fn ?30/09 18:59
stevansome datatypes in the standard library have show functions, but generally you would have to write your own. but why would you like to print stuff? :-)30/09 19:12
wiresstevan: thanks.. i've dropped to vim + cli and running a script and then printing values to console, this emacs stuff is a bit to much to learn right now...30/09 19:21
stevan:-/, tried viper-mode?30/09 19:22
wiresnope.. isn't that mainly keybindings? I'm completely n00b with emac.30/09 19:23
wires+s30/09 19:23
stevanit emulates vi keybindings in emacs yes, modulo buffer switching i find little difference between emacs and vi using it30/09 19:27
stevanSaizan: pumpkin : http://web.student.chalmers.se/~stevan/ctfp/html/README.html30/09 19:29
pumpkinwhat's new?30/09 19:29
stevanirrelevance where possible30/09 19:29
pumpkinah cool30/09 19:29
wiresHi, after importing Data.Nat, how does one check for nr equality, like p : ℕ → Bool; p x = x == 030/09 20:43
wiresDo I need to use propositional equality? ie. the "is defined as" symbol (http://www.cs.nott.ac.uk/~nad/listings/lib/Relation.Binary.Core.html#4612). I'm sorry, still a bit confused as to how all this is build up...30/09 20:44
stevanthere is _\==?_ in Data.Nat that will give you a Dec, which you can turn into a bool if you like using a function from Relation.Nullary.Decidable.30/09 20:51
wiresthis one? http://www.cs.nott.ac.uk/~nad/listings/lib/Data.Nat.html#291430/09 20:58
stevanyea30/09 21:00
wiresstevan: thanks30/09 21:01
stevanare you back in emacs? :-)30/09 21:07
wiresI am actually :)30/09 21:11
wiresI just had first thing running.. *yay* a "filter" fn...30/09 21:11
wiresbtw. thanks for your help30/09 21:12
stevan:-), btw if you wanna try viper-mode out there is a sample config towards the bottom of: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.VIMEditing30/09 21:13
wireslet me try that30/09 21:16
stevandoes it work?30/09 21:34
wiresstevan: it's does, but it's extremely weird, haha30/09 21:34
stevan:-)30/09 21:35
wiresstevan: I tried all modes, but ... weird :)30/09 21:35
wiresI guess I'll stick to plain emacs for a while...30/09 21:35
stevanone gets used to it after a while :-)30/09 21:36
wiresactually.. at mode 2 it is indeed not that bad an even quite natural30/09 21:39
stevanmode 2?30/09 21:39
wires"level 2"30/09 21:39
stevanah ok, that's more restricted i guess?30/09 21:40
wiresHow much of a "guru" (5) or "nab" you are (1)30/09 21:40
wiresyes, 2 = less emacs, more vim30/09 21:40
wires5 = less vim, most emacs30/09 21:40
stevanbtw, if you are into programming languages there are some nice exercises here: http://www.cse.chalmers.se/edu/course/DAT140_Types/30/09 21:42
wireshey thanks, I have that book next to me actually :)30/09 21:43
stevan:-)30/09 21:46
copumpkinstevan: do you have slice categories in there anywhere?30/09 22:01
stevannope30/09 22:03
stevanrunning some benchmarks now, to see how much irrelevance has speeded things up30/09 22:07
pumpkinooh30/09 22:12
pumpkinI'm curious30/09 22:12
pumpkinmight monoidal categories one day be possible to typecheck?! :P30/09 22:12
dolioWhy weren't they possible before?30/09 22:13
pumpkinwell, I don't think anyone who tried had enough memory to30/09 22:13
dolioReally? I guess it depends on how much background you expect them to depend on.30/09 22:13
pumpkinoh I just mean the ones in that library30/09 22:14
pumpkinthere's some properties commented out30/09 22:14
pumpkinbecause typechecking them takes too much memory30/09 22:14
copumpkinthe whole Category.Categories.* thing seems a little odd30/09 22:25
stevanwith irr: 2m 17s     without: 6m 15s (ran out of memory on monoidal (last module))30/09 22:26
stevanhow so copumpkin ?30/09 22:27
copumpkinjust naming-wise30/09 22:27
copumpkinoh wow, that's a great improvement30/09 22:27
stevanthinking of product and monoidal?30/09 22:28
copumpkinwell I was going to stick Slice under there30/09 22:28
copumpkinwould that make sense?30/09 22:28
copumpkinit just seems like a repetitive module name :)30/09 22:28
stevanit used to be only category instances there, but then product and monidal came along...30/09 22:29
copumpkinalso, do you plan to eventually get rid of the plurals for things like Category.Functors?30/09 22:30
copumpkinor will this always coexist with the existing standard library definitions?30/09 22:30
stevanFunctor/ Monad clases with std lib30/09 22:30
copumpkinyeah30/09 22:30
copumpkinI mean, do you think this will one day replace those?30/09 22:31
copumpkinmaybe I'll do an Arrow category too while I'm at it30/09 22:31
stevanthe ones in the std lib are more haskell-like; useful for programming, while ours are not?30/09 22:32
copumpkinfair enough :)30/09 22:32
copumpkinI'm getting a syntax error on some of your stuff30/09 22:33
copumpkinoh maybe I don't have the latest agda30/09 22:34
stevanyou need todays darcs version i think30/09 22:34
copumpkinyeah that seems to have fixed it30/09 22:34
copumpkinsorry :)30/09 22:34
copumpkinhmm30/09 22:45
copumpkinhow would I represent the slice category actually?30/09 22:45
copumpkinlike, it takes a category C, an object of C, but what are its objects? ∀ y → C [ x , y ]30/09 22:46
copumpkin?30/09 22:46
copumpkinthat doesn't feel right30/09 22:46
copumpkinoh30/09 22:48
copumpkinit's an existential30/09 22:48
Saizanseems so30/09 22:49
stevandoes anyone know what happend to the rest of the icfp videos?30/09 23:05

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!