Better HN
topnewbestaskshowjobs
Log inSign up

less_less

493 karma · joined Jun 11, 2021 (5y ago) · 191 submissions

Submissions

comment 4d ago · link · parent

No, neither of these.

Very roughly, P = "easy to solve", and NP = "easy to check whether a proposed solution is correct". All problems in P are also in NP. The P =? NP question is whether the reverse is also true. A problem is "NP-hard" if it's at least as hard (in some very particular sense) as every problem in NP, and it's "NP-complete" if it's NP-hard and also itself in NP. It's these NP-complete problems which are in some sense all equivalent to each other.

There are still a lot of technical details omitted here. To scratch the surface:

"Problem" aka "Language" = "yes-no questions about strings", so for example "is this string the base-10 representation of a square integer?" (in P, and therefore also in NP) or "does this string represent a square grid of numbers that's a Sudoku (generalized to allow larger grids than 9x9) with at least one solution?" (in NP, and in fact NP-complete). "Easy" = "there exists a deterministic Turing machine which correctly answers the question on every input, and always runs in a number of steps which is less than some particular polynomial in the length of the input string". (In the real world, though, "polynomial-time" is not the same thing as "easy".) A language L being NP-hard means that for any NP language M, there's a polynomial-time deterministic Turing machine which maps M-inputs to L-inputs, where yes-instances map to yes-instances and no to no. Swapping yes and no is not allowed. For NP problems you only have to be able to check solutions in poly-time if the solution indicates that the answer is "yes". The corresponding family where you can check "no" quickly is called co-NP, and it is believed that NP != co-NP. Etc etc etc.

comment 4d ago · link · parent

Right, but to the extent that Lean is correct (both the semantics of the language and the implementation(s) used to check) and the proof checks with the expected axioms, then the length of the proof doesn't much matter since Lean has checked it.

You'd still have to check the theorem statement, which is not going to be nearly as easy as with FLT (Riemann uses analytic continuations etc) but it's much easier than checking a 250,000 page proof.

comment 1mo ago · link · parent

I'm not a lawyer. But IIUC, they probably care because of issues like contributory or vicarious copyright infringement, at least in the US.

If they are providing you a service through which you infringe someone's copyright (by playing a video game in violation of its licensing agreement) in exchange for giving them money, then they are risking a lawsuit. If they knowingly enable infringement (e.g. by rolling out a gaming service that lists and can automatically install games where they know, or could easily have checked, that the terms do not allow you to install on such a service), then they probably run a higher risk than if they don't knowingly enable it (e.g. by letting you rent cloud machines with GPUs, completely blind to what you're running on them), but in both cases they run a risk.

I'm sure there's a lot of law, and case law, that sets boundaries for this, but I could easily imagine cloud gaming falling on the wrong side of the boundaries.

comment 1mo ago · link · parent

Yeah. And e.g. NIST's glossary for IV&V is also the opposite of what I said:

> independent verification & validation (IV&V)

> A comprehensive review, analysis, and testing, (software and/or hardware) performed by an objective third party to confirm (i.e., verify) that the requirements are correctly defined, and to confirm (i.e., validate) that the system correctly implements the required functionality and security requirements.

In my experience it's more common to use "verify" for the lower-level "conforms to specs" and "validate" for the higher level "are the specs right" but in other areas it might be different.

comment 1mo ago · link · parent

Isn't it more like:

    Verification: code does what the specifications say

    Validation: specifications describe something we wanted to build
where with formal verification, the specifications are lower-level, so validation is extra-important.

comment 2mo ago · link · parent

I've seen similar ads. For the ones I've seen the device isn't necessarily fake: it's just a swamp cooler. They're cheap and efficient if you're suffering in a dry heat.

ETA: the ads I've seen are still deceptive because they're claiming this is revolutionary new technology, which of course it isn't.

comment 2mo ago · link · parent

> My belly says the naive formula is summing the triangle pyramid volumes to the origin with sign in orientation.

Yeah, that would also work but it's a slightly slower formula, sum(det(v1,v2,v3))/6. This one is summing sort of prism+pyramid shapes made by projecting each triangle to the yz plane.

comment 3mo ago · link · parent

It's still relevant (and probably also rather difficult) to prove that seL4 itself conforms to those best practices.

comment 3mo ago · link · parent

Power draw is a side channel, yeah. It's not as easy to exploit in software as timing (including memory timing), but there are software exploits in some cases if it affects the CPU's frequency (HertzBleed) or if it can be read through channels like a sound card or radio receivers. For attackers who have physical access it's very much in scope.

For software like seL4 it would generally be out-of-scope, because it depends too much on the specific hardware and specific application, not just on the kernel, and protection usually requires extensive countermeasures in those places.

comment 4mo ago · link · parent

I agree to some extent with your thesis. But also you don't have to encode all the properties of the program in dependent types everywhere. You can have the implementation contain either no proofs or fairly few (e.g., termination and no UB, which can often be automatically discharged), and then separately prove things about it. E.g.

    def function_spec bleh blah := math_blargh
    def function_impl bleh blah := code_blargh
    theorem function_correct: forall bleh blah, function_impl bleh blah = function_spec bleh blah := by { long proof }
or whatever. That way the function's spec and implementation remain separate and readable. In my limited experience, Lean code usually works more this way rather than having the whole function and its spec in a giant dependently-typed object. For imperative code you can also use Hoare triples and vcgen, but that's currently only partly baked (i.e. proving things is a giant pain).

Maintenance is still a headache. If you change a small piece of your code, you would then need to change all the proofs that refer to it, and then if the specs also changed then you need to change all proofs that refer to those specs, etc.

comment 4mo ago · link · parent

It isn't balanced quinary, but rather redundant balanced quaternary (base 4). In balanced quinary (base 5), each digit has 5x the significance of the previous one, but in Booth's encoding algorithm it's 4x.

If digit i has significance b^i, then b (the base of the exponentiation) is the base (or radix) of the number system.

The page you linked explicitly mentions the binary version of Booth encoding as having base b=2 and three signed digits {-1, 0, 1}. The quaternary version similarly has b=4 and five signed digits {-2, -1, 0, 1, 2} ... and possibly sometimes -0 in practice, not sure.

comment 4mo ago · link · parent

It's still a modified base 4, because the significance of the i'th digit is 4^i, not 5^i.

Edited to add: I'm also not sure whether real-life implementations have -0 as an option. Of course -0 could be normalized to +0, but it might be cheaper not to bother if the sign is applied after the digit selection.

comment 4mo ago · link · parent

The model usually measures in terms of fixed-size operations, e.g. 2-input binary gates. There's some variation in how to count memory lookups, but even in models where accessing a large memory counts as only one step, any tables present in the code still have to be fixed-size (except in models like P/poly, but even then they can't be exponential size).

comment 4mo ago · link · parent

Yeah, that shift-and-add algorithm is sometimes used on microcontrollers, either in software if there's no hardware multiplier, or in hardware if you want the bare minimum in acceleration at a tiny cost in area.

Adds are not really considered negligible; the article is just sloppy. (Some shifts might be negligible in some models because a fixed shift requires no logic gates.) The cost of the adds in Karatsuba is significant both theoretically and in practice, and determines the cutoff where Karatsuba is useful. But the exponent in O(n^(log_2 3)) is dominated by the recursive multiplications; the adds only affect the leading constant hidden in the O().

comment 4mo ago · link · parent

Residue number systems are really neat! They're sometimes used in crypto implementations, but there you're doing modular multiplication and in most cases the modular reduction then becomes costly, so it's not a free lunch. (Except in RSA and a few other cases. RSA-CRT gets you a "free" ~4x performance boost except it's more brittle to mistakes and side-channel / fault attacks.)

There's also NTT / Fourier multiplication as an option, for big integers or polynomials or modular arithmetic.

comment 4mo ago · link · parent

Hardware multipliers often use a sort of base-4-ish lookup table trick as well, using the Booth-Wallace algorithm. Booth's idea is to rewrite one of the inputs in base (usually) "4", except that the digits go from -2 to +2 instead of 0 to 3. (That's five possible digits! This helps the rewriting stage not have to propagate carries. Carry propagation is very expensive.) You can use Booth in a base higher than 4, especially if you know one of the multiplicands before the other, but you run into tradeoffs pretty quickly.

Then for each digit, you select between the other input multiplied by 0 (all zeros), +1 (identity), +2 (shift left by one bit), or -1 or -2 (flip all the bits of +1 or +2, plus a correction). Since a number has about half as many digits in base 4 as in base 2, you have about half as many digits to sum as if you'd done this in base 2.

Then you sum up all those results, but since carry propagation is expensive, you mostly use "compressors", e.g. you sum up three intermediates at a time, but you do it bit-by-bit, where three 1-bit numbers add up to a 2-bit number (from 0 to 3). This is called a Wallace Tree. The point is that you are generating carries, but you aren't propagating them, just adding them back into the set of things to be summed.

At the end of the tree step, you have just two numbers left, and you add them conventionally. That's the only step that needs full carry propagation.

If you are implementing a multiply-add, or multiplying several numbers and adding up all the results or similar, then you usually only need one full carry propagation stage.

The overall circuit has quadratic area but only a logarithmic depth in gates. IIRC whether to do Booth or not is a tradeoff: at least in some circumstances the rewrite steps make it slower but smaller. Hardware tool vendors have done a lot of work to tune these circuits very tightly, using e.g. specialized gates like AOI, heuristics for how to set up the tree, etc.

comment 6mo ago · link · parent

Ah, thanks for the correction. Do I have the soundness bit right? I guess it might apply even if the proof system is only computationally sound, since the simulator has to be efficient, right?

comment 6mo ago · link · parent

Cryptographer here, but this is not my area and I've only skimmed the paper. As far as I can tell, it's a purely theoretical result but a really cool one. Wall of text that might be wrong, as a rough summary of the result as I understand it:

There are different definitions of "zk", of "proof". Eg do "proofs" of false statements not exist, or are they just hard to find? If they exist but are hard to find, then it's often called an "argument" instead, which is the "AR" in zk-SNARKs and zk-STARKs.

One common definition of zero-knowledge protocols is that you can make an efficient simulator that makes convincing transcripts of the protocol without knowing the relevant secret (up to and including whether the statement to be proved/argued is even true). For interactive proofs, the simulator is usually supposed to output a transcript of the messages sent between the prover and the verifier, and the trick to making the simulator work is to choose later messages before earlier ones (e.g. challenges before commitments). But in non-interactive proofs, there's only one message, so that trick doesn't work and the simulator would have to output the proof itself.

The Goldreich-Oren result shows that this definition of ZK conflicts with soundness, unless the type of problem you're doing ZK proofs for was easy to begin with. IIUC this is for a simple reason: if a simulator can efficiently output a convincing proof of any true statement of the type your zk proof system covers (this is the zero-knowledge property); and if for false statements there is no proof that will convince the verifier (soundness); then you have an efficient algorithm for checking whether the statement is true or not, which is just to check whether your simulator convinces the verifier. This means that the underlying problem is by definition easy, so there's not much point to having zk proofs for it.

Goldreich-Oren doesn't apply to zk-SNARKs or zk-STARKs, because they are not perfectly sound, and in particular because you can get around the impossibility using the trusted setup in zk-SNARKs (essentially a secret key that lets you efficiently prove false statements) and/or by messing around with the random oracle model (pretend that the hash functions are replaced by magic, and then let the simulator tinker with that magic). Also zk-S?ARKs are arguments of knowledge (not just e.g. "a discrete log of this point exists" but "the prover knows the discrete log") which also changes the model.

As I understand it, the new result is basically to make your proof a NIWI-proof ("Non-Interactive Witness Indistinguishable proof", a weaker notion of zk-proof) that:

* Either [real statement you're trying to prove]

* or else [false statement that's almost impossible to prove false], e.g. "there are contradictions in your axiom system".

Such a proof can be made perfectly sound, since NIWI can be perfectly sound, and the second half is supposed to be false. There's no simulator, but if the false statement were true then there would be a simulator, where you always feed the NIWI eg a contradiction in the axiom system, instead of a proof of the real statement. (The definition of NIWI is that it should be hard to distinguish the proof resulting from these two cases.) The new paper also argues that this result, where there's no simulator but it's hard to prove that there's no simulator, is almost as good as the simulator actually existing.

Probably in practice you wouldn't do this, but you would instead try to make sure that a zk-SNARK, zk-STARK, NIWI etc is good enough in your use case.

comment 7mo ago · link · parent

I've hung out with a lot of pharma folks, and the business is really complicated. Most of the companies aim to both help people and to make a lot of money, and will choose projects based on some balance of those -- sometimes in dubiously ethical ways (e.g. tweaking formulations of existing products to extend the patent) and sometimes in basically fine ways (e.g. lots of the improvements in diabetes management which have helped a ton of people; at least the targeting is fine here though often not the pricing). Obviously chronic diseases that affect lots of rich people are a prime target to make money, so drug companies make lots of drugs for these, and they usually aren't curative because chronic diseases are hard to cure (but see e.g. Hep C which is now curable). There are also companies with rich investors who want to cure death, or at least cure particular diseases that they fear or have a genetic predisposition to (lots of unethical behavior from a certain now-defunct company that tried to do this).

For cancer in particular, pharmas don't (and mostly can't) just target a drug to chronically treat some cancer over the long term but not cure it. Instead they pick some target that's believed to contribute to development (/ metastasis / treatment resistance / whatever) in whatever cancer, and make a drug to interfere with it or to target an immune response to cells that make it. If it's stable, nontoxic, and looks potentially effective enough they'll take it to clinical trials. During clinical trials they'll find out whether it does nothing, gives you a few extra months, or has a chance at curing the disease. Usually the answer is that it does nothing or almost nothing, or isn't worth the side effects, and then the company wasted its time and money. Drugs with a chance to cure common types of cancer can be enormous successes -- see eg Herceptin.

Cancers are difficult diseases and it's rare to find something that reliably cures them. But drug companies aren't pulling their punches. Like they would never say "oh this drug clears breast cancer too reliably, we should make it less effective so that people will be more likely to die but also might take it for longer".

comment 7mo ago · link · parent

I'm pretty the spec sheet claimed 1000 cycles when I bought my iPhone 17.

They do claim it at least for iPhone 15 "under ideal conditions": https://support.apple.com/en-us/101575

comment 7mo ago · link · parent

If I understand correctly, Baillie-PSW has been shown to be correct for all integers < 2^64, so for 64-bit ints you might use (some variant of) that instead of M-R.

Edited to add: Sieving has got to be much faster than M-R if you want all primes of a certain size. You would use M-R or Baillie-PSW if you are testing them one at a time.

comment 9mo ago · link · parent

I picked Hunter's Point because I used to live near it. The problems from decommissioning radioactive ships are bad, but they're far from the only pollution that was there. Lots of VOCs, solvents, oils, radiation from other stuff (eg, glow-in-the-dark equipment made with radium), heavy metals, pesticides, PCBs, and what have you.

But sure, there are other shipyards they cleaned up in less than three decades.

comment 9mo ago · link · parent

Yeah. It's especially relevant for the author's focus on shipbuilding. The old shipyard at Hunter's Point in San Francisco is horribly polluted, and they've been working to decontaminate it for more than three decades in order to reclaim the land for other uses (in particular, housing). Treasure Island and Yerba Buena Island also have a lot of pollution from the former naval base there. There is a cost to overregulation, and there is a cost to underregulation.

And OK, sure, there's a lot of industry that ought to happen somewhere. Someone has to build ships and electronics and whatever, and if California's code is too strict then it just becomes NIMBYism. But if some company moves their gigafactory to Reno for easier permitting, I don't whether (or more likely by how much) CA is too strict, or NV is too lax. And I know that CA has NIMBYish and overregulatory tendencies, but given the clear bullshit on this website, I'm not inclined to give it the benefit of the doubt either.

I'm especially doubtful when it says "THE classic example of what you can't do in CA" is auto paint shops ("Impossible"!) ... but then the detail it gives is that they're "effectively impossible" to permit in the Bay Area AQMD, that being only one of the state's 35 AQMDs (albeit one of the larger ones).

comment 9mo ago · link · parent

The laptop keyborad is good enough, but I'd enjoyed using the Kineses before. I moved long distance and the Kinesis was bulky and didn't make the cut for things to haul. Once I was settled I started looking to set up a proper office again, and that included a keyboard. But I didn't find one that was enough better than a laptop keyboard to get regular use.

comment 9mo ago · link · parent

In addition to what others have pointed out, many of these aren't actually missing from traditional dictionaries: they're just inflected differently. So your example lists phrases like "operating systems", "immune systems" and "solar systems" as missing from traditional dictionaries, but at least the online OED and M-W have "operating system", "immune system" and "solar system" in them. It's just that your script is apparently listing the plural as a separate phrase.

On languages other than English: in general, different languages do word division very differently. At least in German and Dutch, many of those phrasal verbs are separable, meaning that they are one word in the infinitive but are multiple words in the present tense. So for example, where in English you would say "I log in to the website", in Dutch it would be "Ik log in op de website". "Log in" is two words in both cases, but in Dutch it's the separated form of the single-word separable verb inloggen ("I must log in now" = "Ik moet nu inloggen"). The verb is indeed separable in that the two words often don't end up next to each other: "I log in quickly" = "Ik log snel in".

Dutch, like German, has lots of compounds. But there are also agglutinative languages, which have even more complex compound words, perhaps comprising a whole sentence in another language. Eg (from Wikipedia) Turkish "evlerinizdenmiş" = "(he/she/it) was (apparently/said to be) from your houses" or Plains Cree "paehtāwāēwesew" = "he is heard by higher powers"; and these aren't corner cases, that's how the language works.

comment 9mo ago · link · parent

Glove80 is super nice, though rather expensive.

I got one with low-force switches. It's very comfortable to type on, but between the low-force switches and slightly different layout from a regular keyboard (column-staggered, concave, symbols in different locations) I make more mistakes. So I usually type on my laptop instead, especially while coding.

comment 10mo ago · link · parent

This thread is pretty weird.

My phrase "how economists expect you to set it" is probably wrong here, since I'm not an economist, I've just read the most basic theory about how to use this tool, and also used it myself (on eBay, you know, years ago when the site was mostly auctions). So I don't really know what "economists expect", but rather the basic guidelines for using this tool. You got me there.

> I think this is the problem. When most sciences observe reality diverge from the model, they see that as a flaw in the model. When economists (at least you HN "economists") observe reality diverge from the model, they seem to see that as a flaw in reality.

But like, to double-check here: "reality" means your imagined use of a tool that you do not in fact use, right? Like you say you "don't do auctions" and I'm trying to explain what that option is for, and you're countering that the basic "how to use this tool" explanation is a wrong model of reality?

comment 10mo ago · link · parent

I'm not defending "you shouldn't ever need to snipe, just bid your max price" as a hard principle, just trying to explain where the idea comes from. Sniping can be strategic for lots of reasons: you don't have to commit to a bid until the last second (in case you find a similar item for cheaper elsewhere), you deny other people information, you might avoid anxiety from wondering whether your bid will win, etc.

That said, the max price is supposed to be a price where you are not especially happy to get the item at that price, but not really sad either, a price where you would say "well, I hoped for better but I guess that's a fair deal". That's not realistically pinned down to the cent. But if you set a max price at $5000 and would be happy to get the item at $5000.02 (for some reason other than satisfaction from sniping), then you set your max price wrong, or at least differently from how economists expect you to set it.

comment 10mo ago · link · parent

It's not supposed to be some red line absolute max price, but rather "how much is this item worth to you?" You set that as your max bid price. If you get it at auction for less than that, you got a good deal, but if you buy it for more, you got a bad deal. If someone outbids you, then maybe it was worth it to them, but you (supposedly) would not have wanted to buy the item for that much, and would rather use your money for something else.

For tricky-to-price items like unique art pieces, the idea that you can pin this down might be a fantasy, but for commodity items it's pretty reasonable. If you can buy the same thing at costco dot com for $500, then it's probably not worth more than $500 to you, and if at auction you get outbid and it sells for $500.01 then you'll shrug and go order the same thing for a cent less, having wasted only a few minutes of your time. If the item you're bidding on is discontinued (e.g. it's last year's model) but you can buy a slightly better one for $550, and you can spare that extra $50, then again you won't be too sad about getting outbid. Online auctions are more popular for used items, but again in that case you usually still have an idea of what a used item is worth to you.

comment 10mo ago · link · parent

See also the paper Ribbon filter: practically smaller than Bloom and Xor: https://arxiv.org/abs/2103.02515, which is a similar idea though not by the same authors.

IIRC, binary fuse filters are faster to construct than ribbon filters, but typically not quite as space-efficient. There are also frayed ribbon filters (by me) which are slower and more complex to construct but more space-efficient. There's no paper for those, just a Rust implementation.

Ribbon filters are deployed in Mozilla's Clubcard for distributing compressed certificate revocation lists: https://github.com/mozilla/clubcard and https://jmschanck.info/papers/20250327-clubcard.pdf. CRLs are an almost ideal application of this sort of compressed set tech, since the aggregator runs batch jobs and needs to distribute the set to very many clients. It's not perfectly ideal because CRLs require frequent updates and none of these methods support delta updates. There is a straightforward but inelegant workaround, which is to send a compressed set that represents the delta, and query both on the client.

1234567