HN user

tromp

11,121 karma

tromp.at.hn

Homepage https://tromp.github.io/

Posts80
Comments3,707
View on HN
www.engadget.com 12d ago

The PocketMage E Ink digital assistant

tromp
1pts0
cleantechnica.com 1mo ago

Donut Lab's Manufacturing Is Different

tromp
4pts0
decrypt.co 3mo ago

'Finding Satoshi' Makes the Case for Hal Finney, Len Sassaman as BTC Co-Creators

tromp
2pts2
apnews.com 3mo ago

Robot sprints to victory in Beijing, beating the half-marathon world record

tromp
16pts0
www.theverge.com 4mo ago

Donut Lab's solid-state battery could barely hold a charge after getting damaged

tromp
1pts1
www.wired.com 5mo ago

EVs Coming in 2026

tromp
1pts1
tromp.github.io 5mo ago

The largest number representable in 64 bits

tromp
121pts85
supercarblondie.com 6mo ago

Chinese Tennis Playing Robot

tromp
1pts0
www.economist.com 8mo ago

Ukraine survives another crisis with Donald Trump

tromp
6pts6
www.wsj.com 8mo ago

XPeng Gears Up to Launch Robotaxis Next Year

tromp
1pts1
electrek.co 8mo ago

I rode in Xpeng's $20,000 Tesla FSD competitor

tromp
3pts1
www.sciencedaily.com 9mo ago

Sodium batteries are finally catching up

tromp
27pts12
www.propublica.org 9mo ago

The EPA Hasn't Released a Toxicity Report on this Forever Chemical

tromp
23pts0
www.reuters.com 9mo ago

How the United States is eating Trump's tariffs

tromp
18pts3
en.chessbase.com 11mo ago

The Babson Task has been achieved in an endgame study

tromp
1pts0
www.dailydot.com 1y ago

Fake police knock on man's door at 2am

tromp
2pts1
www.wsj.com 1y ago

China's Economy Is Burdened by Years of Excess

tromp
4pts1
www.wsj.com 1y ago

A Looming Threat to Bitcoin: The Risk of a Quantum Hack

tromp
6pts1
www.teslarati.com 1y ago

Tesla Model Q is reportedly coming in first half 2025

tromp
4pts1
www.economist.com 1y ago

Donald Trump and Tulsi Gabbard are coming for the spooks

tromp
7pts3
www.economist.com 1y ago

Vladimir Putin is in a painful economic bind

tromp
7pts3
www.tomsguide.com 1y ago

New Google Gemini model goes straight to the top of the LLM leaderboard

tromp
2pts0
www.theguardian.com 1y ago

Neom CEO departs as Saudi Arabia scales back mega-projects

tromp
5pts0
www.engadget.com 1y ago

Lightfoot solar scooter

tromp
1pts0
www.wired.com 1y ago

The Incredible Power of Quantum Memory

tromp
2pts0
www.notebookcheck.net 1y ago

Apple M4 Pro analysis – fast, but not as efficient

tromp
19pts6
slate.com 1y ago

The Biggest Clue That the Supreme Court Has Lost Touch with Reality

tromp
4pts0
arstechnica.com 1y ago

The paper no one read before declaring the demise of modern cryptography

tromp
3pts0
www.wsj.com 1y ago

Electric Motors Are About to Get a Major Upgrade Thanks to Benjamin Franklin

tromp
2pts1
www.reuters.com 1y ago

Years of miscalculations by US/NATO led to dire shell shortage in Ukraine

tromp
2pts1

Shor doesn't solve an NP hard problem. It's even possible that factoring and discrete log are in P, while P != NP.

The paper builds on the results of "Nonlinear quantum mechanics implies polynomial-time solution for NP-complete and #P problems" by Abrams and Loyd [1], from which I quote:

The last qubit now contains all the information that we need; however, for small s, a measurement of the last qubit will almost always return |0>, yielding no information. We wish to distinguish between the cases s=0 and s>0.

Step 4. Repeatedly apply the nonlinear operation to drive the states representing these two cases apart at an exponential rate: eventually, at a time determined by a polynomial function of the number of qubits n, the number of solutions s, and the rate of spreading (Lyapunov exponent) λ, the two cases will become macroscopically distinguishable.

[1] https://arxiv.org/abs/quant-ph/9801041

One of the main instruments of obfuscation (and the way to get more out of the size constraints) is making the code as short as possible, so in that example you'd prefer

    if (!(x/2-1)) { ...
EDIT: Oops, confused the original with x==2 || x==3. Instead, we can use !(x-1>>1), which precedence rules parse as !((x-1)>>1).

The author presents most known numeral systems (ways of representing natural numbers) in lambda calculus, classified by whether the term use their bound variables exactly one time (linear), at most one time (affine), or multiple times (non-linear). Mackie's paper [0] (one of the references) provides a good introduction to these. (although he strangely gets the definition of Church numerals wrong with "Church numerals encode numbers with repeated application: λx f. f^n x." in which he reversed the order of arguments f and x).

He illustrates some numerals in each system with a graphical notation that strongly reminds me of interaction nets [1], a computational model closely related to lambda calculus. The notation they use for lambda terms is rather non-standard. Compare

In β-reduction, k[(x⇒b)←a]⊳k[b{a/x}]k[(x⇒b)←a]⊳k[b{a/x}]

with Wikipedia's [2]

The β-reduction rule states that a β-redex, an application of the form (λx. t) s, reduces to the term t[x:=s].

The k[...] part means that β-reduction steps can happen in arbitrary contexts.

[0] https://www.researchgate.net/publication/323000057_Linear_Nu...

[1] https://en.wikipedia.org/wiki/Interaction_nets

[2] https://en.wikipedia.org/wiki/Lambda_calculus

The task is to place four black queens and one black bishop on the chessboard so that there is no square not under their attack. In other words, after arranging the five black pieces, it must be impossible to place the white king anywhere without it being in checkmate.

That last word should be "check". not "checkmate". A king next to an unprotected queen will be in check but not checkmate as it can capture the queen.

Next Friday always means the Friday after the next one

You're using "the next one" i.e. the next Friday, to refer to the first one after today.

Except on Friday's, when "this Friday" means today. On other days, many people indeed use "this" and "next" synonymously.

The Simple Rule

If the Friday you’re referring to is beyond seven days from today, including today, it’s next Friday.

That's not a such simple rule. I'm not even sure what "including today" means.

A simple rule would be: next Friday is the first Friday after today.

The whole existence of this website suggests that the term "Next Friday" is at best ambiguous. Especially on a Saturday or Sunday, many people will interpret "Next Friday" as the Friday of next week. So just be explicit and say "Friday next week".

One of the smallest implementations is my heavily obfuscated https://www.ioccc.org/2012/tromp/ :

           Int L[A],m,b,*D=A,
            *c,*a=L,C,*U=L,u;s
             (_){u--&&s(a=*a);}
              char*B,I,O;S(){b=b
               --?b:m|read(0,&I,1
                )-1;return~I>>b&1;
                 }k(l,u){for(;l<=u;
                  U-L<A?*U++=46^l++[
                   "-,&,,/.--/,:-,'/"
                   ".-,-,,/.-,*,//..,"
                  ]:exit(5));}p(Int*m){
                 return!*U?*m=S()?U++,!S
                ()?m[1]=p(++U),2:3:1,p(U)
               :S()?U+=2:p(U[1]++),U-m;}x(
              c){k(7*!b,9);*U++=b&&S();c&&x
             (b);}d(Int*l){--l[1]||d(l[d(*l),
            *l=B,B=l,2]);}main(e){for(k(10,33
           ),a[4]-=m=e-2&7,a[23]=p(U),b=0;;e-2
          ?e?e-3?s(D=a),C=a  [3],++1[a=a[2]],d(
         D):c?D=c,c=*D,*D=    a,a=D:exit(L[C+1])
        :C--<23?C=u+m&1?O      =O+O|C&1,9:write(m
       ||(O=C+28),&O,1)+        1:(S(),x(0<b++?k(0,
      6),U[-5]=96:0)):(          D=B?B:calloc(4,X))
     ?B=*D,*D=c,c=D,D[            2]=a,a[++D[1]]++,D
    [3]=++C+u:exit(6)              )e=L[C++],u=L[C];}
while a less obfuscated and highly performant implementation https://github.com/tromp/AIT/blob/master/uni.c based on combinatory graph reduction takes 446 lines.

Alonzo Church developed the lambda calculus in 1929.

His first publication that showed the elements of the lambda calculus was the 1932 paper "A set of postulates for the foundation of logic", as I cited in my recent paper [1]. It's quite possible he worked on it prior to 1932, but I don't know of any credible evidence on that (would be very interested to learn about any).

Wait! How the heck is this a "programming" language? At first glance, this simple language seems to lack both recursion and iteration, not to mention numbers, booleans, conditionals, data structures and all the rest. How can this language possibly be general-purpose?

What most stops lambda calculus from being a programming language is that it doesn't directly support I/O. However, one can adopt some very simple conventions for representing bits, lists of bits (bytes), and lists of bytes, and for letting a lambda term operate on these [2] which make the so-called Binary Lambda Calculus (BLC) a programming language.

And a very expressive language it is too: a BLC self interpreter [4] can be as small as the 170-bits

    01000110100001000
    00001100000010111
    00110000111111100
    00101110011111110
    00000111100000010
    11101110011011110
    01111111100001111
    11110000101111010
    01110100101111101
    00101101010011010

 which encodes the term

    (λ11)(λ(λλλ1(λλ2(1(λ6(λ2(6(λλ3(λλ23(14))))(7(λ7(λ31(21)))))))(41(111))))(11))
in De Bruijn notatation, with lambda diagram [3]
    ┬─┬ ────────────────────────────────────────────┬─┬
    └─┤ ──────┬───────────────┬──────────────────── ├─┘
      │ ──────┼───┬───────────┼─┬─────────┬──────── │
      │ ┬─────┼───┼───────────┼─┼─────────┼──────── │
      │ │ ┬───┼───┼───────────┼─┼─────────┼──────── │
      │ │ ┼─┬─┼───┼───────────┼─┼─────────┼─┬─┬─┬─┬ │
      │ │ │ │ ┼─┬─┼───────────┼─┼──────── └─┤ └─┤ │ │
      │ │ │ │ │ ┼─┼─┬─────────┼─┼─┬──────   │   ├─┘ │
      │ │ │ │ │ │ │ ┼───────┬ │ ┼─┼───┬──   ├───┘   │
      │ │ │ │ │ │ │ ┼───┬───┼ │ │ ┼─┬─┼─┬   │       │
      │ │ │ │ │ │ │ │ ┬─┼───┼ │ │ └─┤ ├─┘   │       │
      │ │ │ │ │ │ │ │ ┼─┼─┬─┼ │ │   ├─┘     │       │
      │ │ │ │ │ │ │ │ └─┤ ├─┘ │ ├───┘       │       │
      │ │ │ │ │ │ │ │   ├─┘   ├─┘           │       │
      │ │ │ │ │ │ │ ├───┘     │             │       │
      │ │ │ │ │ │ ├─┘         │             │       │
      │ │ │ │ │ └─┤           │             │       │
      │ │ │ │ │   ├───────────┘             │       │
      │ │ │ │ ├───┘                         │       │
      │ │ │ ├─┘                             │       │
      │ │ └─┤                               │       │
      │ │   ├───────────────────────────────┘       │
      │ └───┤                                       │
      │     ├───────────────────────────────────────┘
      └─────┘
10 times smaller than the 7 lines of R5RS Scheme
    (define (eval e env) (cond
      ((symbol? e)       (cadr (assq e env)))
      ((eq? (car e) 'λ)  (cons e env))
      (else              (apply (eval (car e) env) (eval (cadr e) env)))))
    (define (apply f x)
      (eval (cddr (car f)) (cons (list (cadr (car f)) x) (cdr f))))
    (display (eval (read) '())) (newline)
> This code will read a program from stdin, parse it, evaluate it and print the result.

Except that it leaves all the actual parsing to the "read" library function.

In contrast, the BLC code does all parsing itself. One of the neatest tricks is how it represents the environment as a list built with

      cons' =  \x\y\zx\zy. zx x (zy y)
which allows a list of bits like "1110" (the code for de Bruijn index 3) to index the environment by simply applying it to the environment.

[1] https://www.mdpi.com/1099-4300/28/5/494 "The Largest Number Representable in 64 Bits"

[2] https://gist.github.com/tromp/86b3184f852f65bfb814e3ab0987d8...

[3] https://tromp.github.io/cl/diagrams.html

[4] https://github.com/tromp/AIT/blob/master/ait/int.lam

import Control.Monad (guard)

"fizz" <$ guard (rem i 3 == 0)

I prefer the more transparent

    if i `mod` 3 == 0 then Just "fizz" else Nothing

But the value of a 51% attack is roughly proportional to marketcap, so while they are cheaper to attack, there's less incentive for the attack. The most (relatively) vulnerable coins are those where the daily dollar value is low relative to the market cap.

Correct; both Bitcoin and Monero use Hashcash as PoW, only differing in the choice of hash function. Verification is only different from a solution attempt in asymmetric (i.e. non-Hashcash) PoW, such as Cuckoo Cycle or (the poorly named) Equihash.

Zugzwang 3 months ago

just none are good for you and all lead to a loss given perfect play.

That's exactly what it means to be in a lost position; all moves lose. A lost position is only Zugzwang though if the same position with the opponent to move is not lost.

Zugzwang 3 months ago

You run out of time on your clock. If you press your clock without moving, the opponent will alert the referee to sort you out. And if you play without a clock, your opponent will get annoyed at you taking forever to move.

In 2010, Prime Minister David Cameron told an Indian television show that returning the diamond would set a dangerous precedent. “What tends to happen with these questions is that, if you say yes to one, you suddenly find the British Museum would be empty,” he told New Delhi Television.

Emptying the British museum of all its looted treasure is quite a noble goal.

As is emptying Gitmo of all its illegally held prisoners.