companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
zebrag has joined #ocaml
zebrag has quit [Client Quit]
kor1 has quit [Quit: Leaving.]
hackinghorn has quit [Quit: Leaving]
hackinghorn has joined #ocaml
mbuf has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
ansiwen has joined #ocaml
bartholin has joined #ocaml
yoctocell has joined #ocaml
olle has joined #ocaml
mbuf has quit [Quit: Leaving]
wonko has joined #ocaml
mbuf has joined #ocaml
glassofethanol has joined #ocaml
kakadu has joined #ocaml
vb has quit [Quit: Lost terminal]
vb has joined #ocaml
gravicappa has joined #ocaml
<olle> Hmmmm
<olle> Not updated to use let* notation?
glassofethanol has quit [Quit: Lost terminal]
glassofethanol has joined #ocaml
mbuf has quit [Quit: Leaving]
glassofethanol has quit [Remote host closed the connection]
glassofethanol has joined #ocaml
wonko has quit [Ping timeout: 268 seconds]
mbuf has joined #ocaml
Haudegen has joined #ocaml
mattil has joined #ocaml
mattil has quit [Remote host closed the connection]
mattil has joined #ocaml
average has quit [Quit: Connection closed for inactivity]
oriba has joined #ocaml
wonko has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
Tuplanolla has joined #ocaml
infinity0 has quit [Ping timeout: 268 seconds]
infinity0 has joined #ocaml
glassofethanol has quit [Quit: leaving]
kor1 has joined #ocaml
average has joined #ocaml
wonko has quit [Ping timeout: 272 seconds]
Haudegen has quit [Quit: Bin weg.]
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
zebrag has joined #ocaml
mbuf has quit [Quit: Leaving]
gravicappa has quit [Ping timeout: 245 seconds]
<d_bot> <arctumn> So i was implementing some Natural Numbers arithmetic using Piano Axioms but with a catch i cannot use equal sign implemented in the stdlib
<d_bot> <arctumn> however I started to question myself if the pattern matching is not using itself the equal sign operator, because if it is i flawed myself and all
<d_bot> <arctumn> that i implemented is invalid by my own terms, did i really locked myself (because matching is using the equal operator behind)? Or is there an alternative so I don't contradict my own terms?
<Corbin> You are onto something quite interesting and deep, yes. Equality on natural numbers can be defined by primitive recursion.
<d_bot> <NULL> Do you consider as equally invalid equality on `nat` and equality of constructors of a sum type ?
<d_bot> <NULL> I'm not sure how you can discriminate between `O` and `S _` without some sort of equality
<Corbin> First, figure out how to test whether a nat is zero, and also how to take the predecessor of a nat. Both are primitive recursive. Then, you can build equality from primitive recursion on (WLOG) the left side; the base case is when the right side is zero, and the recursive case takes the predecessor of the right side.
Haudegen has joined #ocaml
<d_bot> <arctumn> I assumed that there are only two possible cases for number : type number = Zero | Successor of number.
<d_bot> <arctumn> my invalid equality would be straight using for example number = number to check if they're different or equal
<Corbin> How did you define primitive recursion?
<d_bot> <arctumn> For example to generate the next number ?
<d_bot> <arctumn> i matched if the number is Zero -> Successor Zero | Successor x -> Successor (Successor x)
<Corbin> Sure. That's the sucessor function. Here's what I've worked on recently: https://bpa.st/3XQA
<Corbin> You can think of `pr`, the primitive recursion axiom, as generalizing the match-expression. Instead of writing `match` yourself, you provide it with two functions which handle the Zero and Successor cases.
wonko has joined #ocaml
<d_bot> <arctumn> I see, so in the end there is no way around avoiding some equality... well thanks for the help 🙂
<Corbin> What do you mean? Peano's axioms explicitly include primitive recursion. From primitive recursion, we can build equality.
olle has quit [Ping timeout: 268 seconds]
<companion_cube> or you can assume a logic with pre-existing equality :)
<d_bot> <arctumn> For the example you posted the match will always appear in a way or another to represent, unless I'm misunderstood the "match" in ocaml it will check if any of the cases is what its going to be matched, and my initial idea was to try to avoid that any representation of equality
<d_bot> <arctumn> I implement my own equality, but at some point its being based in already existing equality https://bpa.st/GRAA
<Corbin> Sure. The beauty of Peano is that we *only* need primitive recursion in order to talk about equality for natural numbers, and moreover that we get an algorithm for how to do it.
<Corbin> I would like to give you a glimpse of something not easy to read. https://bpa.st/KMTA is a compiler-generated program. You can ask OCaml to type-check it for you; it should have type `nat -> nat -> bool`. And there's only a single `match`, in the definition of `pr`.
olle has joined #ocaml
<d_bot> <Deadrat> Is there any point in esy rn as opam 2.1 brought a lot qol changes in easy to use form?
olle_ has joined #ocaml
gravicappa has joined #ocaml
olle_ has quit [Ping timeout: 272 seconds]
wonko has quit [Ping timeout: 248 seconds]
yoctocell has quit [Ping timeout: 248 seconds]
adanwan_ has quit [Remote host closed the connection]
adanwan has joined #ocaml
mattil has quit [Quit: Leaving]
<companion_cube> hmm, is [%error] valid in types/signatures?
mosterdt_ is now known as mosterdt
gravicappa has quit [Ping timeout: 245 seconds]
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
berberman_ has joined #ocaml
<d_bot> <leviroth> As in ppx_optcomp?
berberman has quit [Ping timeout: 268 seconds]
<companion_cube> no, just an OCmal extension point
<companion_cube> turns out it is and my type error was somewhere else, though
wonko has joined #ocaml
wonko has quit [Ping timeout: 268 seconds]
landonf has joined #ocaml
Serpent7776 has quit [Quit: leaving]
<d_bot> <froyo> hey is loop invariants in auxillary recursive call's args faster or outside of it?
Tuplanolla has quit [Quit: Leaving.]
bartholin has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 248 seconds]
schube[m] has quit [Ping timeout: 252 seconds]
Tardigreat[m] has quit [Ping timeout: 252 seconds]
smondet[m] has quit [Ping timeout: 256 seconds]
labor[m] has quit [Ping timeout: 245 seconds]
krnkktz has quit [Ping timeout: 272 seconds]
marinelli[m] has quit [Ping timeout: 268 seconds]
fluxm has quit [Ping timeout: 268 seconds]
mewfree[m] has quit [Ping timeout: 276 seconds]