No.216
I'm really sorry about textboard.org but Bitdiddle said the stress tests were badly needed and kept encouraging me. I hope it's back up soon.
No.217
>>216It seems to have returned from death.
…
Why are you testing in production?
No.257
Currently implementing truth tables for propositional logic in Python. I am aiming to make it general enough so that I can represent every possible table (not just AND, XOR and the usual) with any number of truth-values.
Fun fact: if you have V truth values, then the number of possible truth tables for a binary connective (a truth table with two inputs, basically) is: V ^ (V ^ 2).
This number gets very big very quickly:
V - V ^ (V ^ 2)
1 - 1
2 - 16
3 - 19683
4 - 4294967296 (4.3 billion)
5 - 298023223876953125 (298 quadrillion)
No.258
>>257>with any number of truth-valuesWhat are you going to use for not(not(x))?
No.261
>>258Aha. My impression is that NOT(NOT(p)) has the same truth value as p in most many-valued logics, especially those with a finite number of truth values. The Wikipedia article will give some examples:
https://en.wikipedia.org/wiki/Many-valued_logicThe program I'm writing won't be able to handle intuitionistic logic, where NOT(NOT(p)) =/= p, because intuitionistic logic does not use truth tables. At least, it doesn't use finite ones.
No.286
I am giving Coq another go, this time using
Programs and Proofs:
https://ilyasergey.net/pnp/I expect to lose track of what is going on somewhere around the middle of the third chapter.
No.287
>Coq
>Lego
>Isabelle
You forgot to add TypeScript.
No.291
>>287What do you mean? If this is a joke, I don't get it.
No.292
>>291It is. You'll get it when you're older.
No.302
>>286As expected, it was progressing a bit too fast for me. Before continuing on to chapter 4, I am reading this tutorial:
https://mdnahas.github.io/doc/nahas_tutorialI like that it uses only the most basic parts of Coq and explains them in terms of the Curry-Howard correspondence. It makes me want to write my own proof assistant!
No.315
Is there a better way to repeatedly destruct a hypothesis so that it can be handled in one go like here?
Goal forall n, n = 0 \/ n = 1 \/ n = 2 \/ n = 3 -> n - 3 = 0.
intros n Cs.
destruct Cs as [C|Cs]; try destruct Cs as [C|Cs]; try destruct Cs as [C|C];
rewrite C;
reflexivity.
Qed.
I guess "repeat" would kind of work, except for the last one where the naming wouldn't match.
No.321
>>286I finished this. I liked it a lot, although the last chapter maybe progressed a bit too quickly, I ended skipping most of the exercises there. Maybe I will return to it someday.
Should I continue with Software Foundations or should I try The Little Prover before it?
No.324
OK, it's back up.
>>323>What are you working on, textboard engineering?Nothing so lofty. I'm just contributing in my small way to the SchemeBBS community by providing bugfixes.
No.325
>>321Wow I thought
The Little Schemer will be some quick enjoyable read, but it is quite laborious. It took me a while to figure out how to follow along with the code as the instructions are not very user-friendly. I use "J-Bob/step" for the actual proving and only copy it into the proper "J-Bob/define" once it is done. It is pretty fun though and I am looking forward to reading the actual implementation too. It is just a bit too manual after Coq, you have to type a lot!
No.328
>>325I finished it but I am not satisfied. It could have had more examples on the main techniques, like how to construct the totality claims and such. It did not feel like by the end I understood the main principles, if there were any.
No.331
>>330Nice little website, good job!
No.333
The SchemeBBS "fossil repositories" link gives
https://fossil.textboard.org/502 Bad Gateway
nginx/1.18.0
Posting in the sandbox gives
https://textboard.org/sandbox/1error 502
bad gateway
Anyone else seeing this?
No.334
>>333Nice repeating digits. Yes, for me everything dynamic gives 502 error, even viewing individual posts like here:
https://textboard.org/sandbox/1/1 No.373
Nothing, I'm slacking off.
No.374
>>211Fixing a PS One the only issues it has is the black & white screen and the CD didn't run but i got that fixed and now i'm trying to find some cheap PS1 games.
No.375
>>374How do you go about something like that? I never had such a device.
No.380
Is anyone else getting NXDOMAIN for bunkerchan.xyz?
No.383
>>381Yep, it's back up, thanks. It seems the registration with ovh was renewed at 2020-09-10T11:44:55.0Z.
No.384
>>357>Do you know any good books for intermediate programmers? Or maybe even for experts?For what language Anon?
No.386
>>385I haven't read this one myself but try "Expert C Programming: Deep C Secrets" and SICP is recommended by some.
No.387
>>386I've actually read both already… SICP is an introductory textbook, it's really good but not for experts. Expert C Programming had some fun stories but it's mostly just a collection of war stories.
No.388
>>387Have you tried reading the source of some of the languages themselves? Surely that would help you to become proficient
No.402
Has anyone else started getting
>Please turn JavaScript on and reload the page.
>DDoS protection by Cloudflare
for bunkerchan.xyz?
No.403
>>402https://bunkerchan.xyz/gulag/res/7295.html#7296 says they will take it down in a week, when they are not being bot-raided anymore.
My cloudflare blocker already went off on bunkerchan for a while.
They must have had this in place for some time.
No.405
>>404What are you working on?
No.407
The cloudflare JS is back on bunkerchan.
>>405Tempting Raven, from the looks of it.
No.460
>>459I know what you mean, fug
No.540
Rate my run-length encoding functions in OCaml. Here's the most simple:
let rec rle l =
match l with
| [] -> []
| h::t ->
match rle t with
| (h', n)::t' when h' = h -> (h, n+1)::t'
| t' -> (h, 1)::t'
And a somewhat more involved:
let rle l =
let rec iter c n l =
match l with
| [] -> [(c, n)]
| h::t ->
if h = c then iter c (n+1) t else (c, n)::(iter h 1 t)
in match l with
| [] -> []
| h::t -> iter h 1 t
No.541
>>540>Rate my run-length encoding functionsThe first one is recursive in the obvious way, which is why it's "most simple". The second one still has a pending "(c, n)::" operation to perform after the "(iter h 1 t)" subcall, so unless OCaml rewrites this for you this is also recursive, despite the "iter" name. To get an iterative version with what are effectvely cons-style lists, you'll need to build a partial result in an accumulator and reverse the accumulator at the end, ensuring that the reversal operation is also iterative.
iter-is-still-recursive/10
No.542
>>541Sorry, hope you like this better:
let rle l =
let rec aux c n l =
match l with
| [] -> [(c, n)]
| h::t ->
if h = c then aux c (n+1) t else (c, n)::(aux h 1 t)
in match l with
| [] -> []
| h::t -> aux h 1 t
I don't like the full accumulator passing style because the extra reverse is often more costly than saving some returns to the stack.
No.543
>>542>I don't like the full accumulator passing style because the extra reverse is often more costly than saving some returns to the stack.The recursive version performs a linear pass on the input list going up the stack, and a linear pass for the result list coming down the stack. The iterative version performs a linear pass on the input list to build the accumulator, and a linear pass for the result list to reverse the accumulator. The reversal phase is the same size as coming down the stack, so unless there is some OCaml peculiarity that intervenes, your cost assertion is false. Furthermore on large and poorly rle-compressible input lists the recursive version dies by overflowing the stack, while the iterative version keeps working.
renamed-not fixed/10
No.544
>>543Yes, if the list is that large, there's not much else to do other than moving the call stack to the heap. But for shorter lists, pushing three values to the stack is cheaper than constructing an extra cons cell for each element of the result.
No.548
>>544Does OCaml offer some way to write a conditional that tests whether the recursive version would blow the stack if it were to be run?
No.550
>>548It does not. But I know, Big Data and Machine Learning is the hip thing now, so here's your industrial strength run-length encoding:
let rle l =
let rec aux c n a l =
match l with
| [] -> List.rev ((c,n)::a)
| h::t ->
if h = c && n < max_int then aux c (n+1) a t else aux h 1 ((c, n)::a) t
in match l with
| [] -> []
| h::t -> aux h 1 [] t
No.572
Find songs by artist in bash
find_by_artist() {
find . -type f -print0 \
| xargs -0 exiftool -artist 2>/dev/null \
| awk -v RS='======== ' -v FS='\n' -v ORS='\0' \
'$2 ~ /'"${1}"'/ { print $1 }'
}
No.578
>>357Try writing a lexer. I'm not adept at making algorithms and this confused me. Try making something to recognize numbers, comments, strings, and a few key words from C. Just tokenize an input txt file.
No.581
I wanted to try write a simple dependently typed program because I always just prove things but Coq can do this too. So here are the Fibonacci numbers. First, the specification of what it means for a number to be "Fibonacci", the proposition `fibonacci n m' says that the nth Fibonacci number is m:
Inductive fibonacci : nat -> nat -> Prop :=
| fib0 : fibonacci 0 0
| fib1 : fibonacci 1 1
| fibS n a b m (Ha : fibonacci n a) (Hb : fibonacci (S n) b) (Hm : a + b = m) : fibonacci (S (S n)) m.
This is straightforward, we know that the 0th number is 0 (fib0), the 1st is 1 (fib1), and the (n+2)th is m, if m is a + b where b is the (n+1)th number and a is the nth.
No.582
>>581Here is the program itself:
Definition fib n : { m | fibonacci n m } :=
let aux :=
fix f n :=
match n with
| 0 => (exist (fibonacci 0) 0 fib0, exist (fibonacci 1) 1 fib1)
| 1 => (exist (fibonacci 1) 1 fib1, exist (fibonacci 2) 1 (fibS 0 0 1 1 fib0 fib1 eq_refl))
| S (S n) =>
let (Xa, Xb) := f n in
let (a, Ha) := Xa in
let (b, Hb) := Xb in
let Hab := fibS n a b (a + b) Ha Hb eq_refl in
(exist (fibonacci (S (S n))) (a + b) Hab,
exist (fibonacci (S (S (S n)))) (b + (a + b))
(fibS (S n) b (a + b) (b + (a + b)) Hb Hab eq_refl))
end
in fst (aux n).
The first line says that fib takes an argument n, and produces such an m, that it is the nth Fibonacci number. (But only a single one and does not say anything about possible other such values.) `exist' is what builds the dependently typed value: its first argument is the property of the value, the second the value itself, and the third is the proof of the property holding for that value. The algorithm is a bit unusual because of Coq's type system. To keep the system logically sound, every algorithm must terminate. In many cases, Coq can automatically detect which argument is decreasing with each recursive call, but in case of the usual recursive definition of Fibonacci, it cannot. With a small trick it can, but that leads to another problem: it must also keep track of `n' to make sure that what it returns is indeed the `n'th number. For this reason both that and the usual iterative version, where it counts from zero up to n, fail type checking because Coq can't establish that the n going in the recursive call and the n coming back are the same.
No.613
Does anyone else keep getting SERVFAIL on DNS requests for wizchan.org?
No.620
>>619What company would feel threatened by the FSF? They are pretty irrelevant.
No.631
>>610I'm doing exercise 3.2 right now, and it told me to
> First, make an arithmetic that defines only addition, negation, and subtraction of vectors over a base arithmetic of operations applicable to the coordinates of vectors. Applying any other operation to a vector should report an error.But if I make it throw an error with `(error "Unsupported vector operation:" operator)', it makes extend-arithmetic fail on zero?. If I return with #f instead of raising the error, it seems to work. I also had to register the `vector?' predicate.
I don't know if I am just not paying enough attention to the text or it really just throws you into deep water with the exercises.