HNHacker News
TopNewBestAskShowJobs

zfnmxt

238 karma · joined April 27, 2020

https://rschenck.com
submissionscomments
zfnmxt··on Ask HN: Who wants to be hired? (July 2024)
Location: US & Europe

Remote: No preference

Willing to relocate: Yes

Technologies: Functional programming, type systems, language design, compilers, parallel programming languages, GPU programming, Haskell.

Résumé/CV: See https://rschenck.com

Email: See https://rschenck.com

I'm a soon-to-be-graduating PhD student at the University of Copenhagen looking for either an industry job or a postdoc. My PhD work has been on the functional array programming language Futhark (https://futhark-lang.org/), including work on the type system (sum types, rank polymorphism) and automatic differentiation. I'm broadly interested in all things type systems/functional programming/compilers/language design. I can work in both the US and the EU without a visa.

zfnmxt··on Recommended Books on Computational Complexity Theory
I personally used Sipser, but I think the book by Neil Jones [1] that takes a programming languages approach is really cool, and potentially more along the average HN reader's interests.

[1] http://hjemmesider.diku.dk/~neil/comp2book2007/book-whole.pd...

zfnmxt··on NumPy-style broadcasting in Futhark
> No, that would error in julia.

Okay, but '[[1,2,3] [4,5,6]] .+ 4` does work! Looks like Julia distinguishes between a two-dimensional array and an array of arrays (which Futhark does not). To me, it feels like semantically '[[1,2,3] [4,5,6]] .+ 4` is two levels deep even if operationally it has some underlying flat representation. (But I'm not familiar with Julia's programming model.)

> The trick is that it just turns into function calls.

Ah, okay. I think `a .+ f.(b)` can roughly be understood in Futhark as `map^N (+) a (rep^M (map^Q f (rep^S b)))` where `map^N` means do N `map`s and you can locally determine N, M, Q, S from the input types. We actually essentially had this in our very first prototype of AUTOMAP but found it insufficient for our purposes because it doesn't play nice with arguments whose types aren't fully known (i.e., that have type variables) and we cannot wait until runtime to figure out those types.

zfnmxt··on NumPy-style broadcasting in Futhark
> Congrats on both the paper and the graduation!

Thanks! Although I still have to actually graduate and the paper is in review, so maybe your congratulations are a bit premature! :)

> A long time ago, I worked on optimizing broadcast operations on GPUs [1].

Something similar happens in Futhark, actually. When something like `[1,2,3] + 4` is elaborated to `map (+) [1,2,3] (rep 4)`, the `rep` is eliminated by pushing the `4` into the `map`: `map (+4) [1,2,3]`. Futhark ultimately then compiles it to efficient CUDA/OpenCL/whatever.

zfnmxt··on NumPy-style broadcasting in Futhark
> Julia’s broadcast doesnt do anything dynamic.

When is a broadcast expression transformed (and fused) into vectorized code?

> If you know the input types of a broadcast expression, you know the output type.

Do you always (statically) know the input types? In Futhark, due to parametric polymorphism, you don't necessarily know the input types.

> Julia’s broadcast doesnt do that either. One dot is one level deep.

Doesn't something like `[[1,2,3]] .+ 4` go two levels deep? Or have I misunderstood something?

zfnmxt··on NumPy-style broadcasting in Futhark
I'd actually say what we did in Futhark is more similar to what Julia does (in the sense that the dot operator is syntactic sugar for Julia's `broadcast`) than what NumPy does---I wrote "NumPy-style" in the title just because I figured that's what most people would be familiar with. A more accurate title might be "Rank-polymorphic function applications in Futhark".

Ultimately it's quite different from both languages, though. Futhark has a strict static type system and we figure out how to broadcast completely statically without runtime information (NumPy and Julia both do it dynamically). This is really the main challenge that the system addresses and it permits you to have broadcasting in an ML/Hindley-Milner/Haskell-style type system along with full type inference and all the usual jazz and goodies.

Our system also doesn't have anything to do with vectorization/performance optimizations---in Futhark, `[1,2,3] + [4,5,6]` is just syntactic sugar for `map (+) [1,2,3] [4,5,6]` (which is how you'd write it without broadcasting), where `map` is already a parallel construct. So broadcasting in Futhark is literally just syntactic sugar for constructs that are inherently parallel, anyway---anything you can express with broadcasting can already be written in stock Futhark and there's no "magic" going on. Broadcasting in Futhark just means that some `map`s can be implicit, rather than explicit.

So it's a very disciplined and transparent (since it's static you can ask the compiler to show you exactly how the broadcasting will work) approach to broadcasting that the user has a lot of control over.

> it’s very important to distinguish between the element-wise application of a function, and a function that is applied to an entire array

Broadcasting in Futhark isn't inherently "element-wise" in the sense of descending through all the ranks of an argument until you get to the scalar level. It tries to actually use the fewest number of `map`s to get a rank-correct function application, so there's a preference for applying a function to higher-dimensional elements over scalars. This might sound non-intuitive/confusing, but it actually almost always aligns with what the programmer intended.

All it really does is use the minimal number of `map`s (and `rep`s) to massage a function and an argument with a rank mismatch into something that makes sense (or is rank correct)---it doesn't even have a notion of scalars, only rank differences!

zfnmxt··on Ask HN: What is not going to change in future?
> but they don't contradict any of this.

Sure, and I agree with what you've said. But as you pointed out, you have to be very particular/exact with language with these things. I just wanted to emphasize that there are many constrained settings (but still practical) where Rice's theorem doesn't apply.

zfnmxt··on Ask HN: What is not going to change in future?
> I understand why verifying can happen in time P for each machine, but I'm still confused on how you're sure that you hit on the right machine in P time.

My monkey stuff was a bit wrong; the enumeration stuff actually goes like this: let every binary string be a Turing machine. So TM 0 is the string 0, TM 1 is the string 1, TM 2 is 10, and so on. Every possible TM machine can be encoded in this way.

For half your time steps, run TM 0. For half of the remaining time steps, run TM 1. For half of those, run TM 2. So the sequence of execution actually looks like this:

0, 1, 0, 2, 0, 1, 0, 3, ...

This means that every 2^(n+1) steps, the nth TM does 1 step of computation. Say that the kth TM is the smallest TM that solves your problem. Then it takes 2^(k+1) * O(m^c) steps to solve your problem, where O(m^c) is a polynomial bound. (I've ignored accounting for the time for verification, but that's polynomial too, so it doesn't matter.) That O(m^c) comes from the fact that we know that a polynomial time algorithm exists for our problem (but we don't know what it is), since P = NP.

But 2^(k+1) is a constant; it doesn't depend on the input size. The smallest program that solves our problem (in general) will always be the kth program. (Technically on some inputs there will be smaller programs that solve the input just by getting lucky, but TM k is the smallest program that solves our problem for all inputs.) So 2^(k+1) * O(m^c) is a polynomial number of steps, just with an absurdly huge constant of 2^(k+1).

I found [1] to be helpful and it probably explains it better than I just did.

[1] https://steemit.com/steemstem/@markgritter/leonid-levin-s-un...

zfnmxt··on Ask HN: What is not going to change in future?
Disclaimer: I didn't know about universal search until I read stephencanon's comment. I just thought it was fun to think about and I think the answer is what follows, but it could be wrong!

Imagine your problem is to write Hamlet by Shakespeare. One way to write Hamlet by Shakespeare is to enlist many monkeys who then type at random (but with the property that no two monkeys type the same thing). Each monkey also has a special "done" button that they press when they're done writing. Some monkeys never press it and write forever.

So you instruct each monkey to type one key and then you check each monkey to see if they pressed "done". If they pressed "done", you check if they wrote Hamlet. Otherwise, you continue and have the monkeys each press another key.

Since there are infinitely many different monkeys, so you can't enlist them all at once, because then checking after each key press would take you infinitely long! This is why you play that game with at the first step you enlist one monkey, then two, then three, etc; it ensures at each step there are finitely many monkeys to check.

Of all the possible monkeys, one monkey will write Hamlet exactly and then press "done". This scheme finds that monkey. Similarly, for Turing machines, there will be at least one (technically, infinitely many) that solves your problem. You just have to figure out which one it is by doing the enumeration that stephencanon detailed. If P = NP, that enumeration process can happen in P time. Keep in mind that all problems in NP have polynomial time verifiers. So you can always check a solution (i.e., checking if the monkey actually wrote Hamlet) in polynomial time.

zfnmxt··on Ask HN: What is not going to change in future?
> - Rice's theorem, that it is impossible to determine computational properties of arbitrary programs, will still apply, making static analysis (including antivirus programs, security scans, etc.) heuristic rather than exact.

I think this is misleading. There are many exact static analyses---proof-checking in theorem provers like Coq is an exact static analysis. More generally, type checking can be an exact static analysis that guarantees semantic properties of your programs, like termination.

If you can force your programs to be in a certain form (e.g., statically rejecting type incorrect programs), you can sufficiently restrict the class of programs (Turing machines) that you're considering that you can indeed determine non-trivial computational properties of your programs.

zfnmxt··on My First 80 Days of VR for Exercise
And I never claimed that physical fitness doesn't include cardiovascular fitness.
zfnmxt··on My First 80 Days of VR for Exercise
When calling me "some brain dead nobody builder" it would be nice if your response actually faithfully represented mine. I did indeed write

> VR exercise is a remarkably poor allocation of time (if your interest is physical fitness, efficiently).

But notice the parenthetical which you left out. My response was about obtaining physical fitness and doing so efficiently. Your response is about exercising and feeling good for today. And that is a totally fine thing to do, but you are not becoming physically fit in the process and it is not a method by which to become physically fit.

Of course it's better than nothing and it's great you do it and it's great you enjoy it and it's great it helps you focus, but the goals my post address are different from yours; even a brain dead nobody like myself can realize that.

zfnmxt··on My First 80 Days of VR for Exercise
I'm having trouble understanding how your comment refutes mine; could you clarify?

> Not the only one, but the notion that the only way to build muscle is to 'tear up' your muscles with huge lifts is both outdated and wrong.

I think you're misunderstanding my point. The bodyweight squat is ineffective because you cannot change the stimulus; the only training variable you can adjust is the number of squats you do. Because it's a relatively easy exercise, this quickly means that you cannot subject yourself to sufficient stress with it, both for myofibrillar and sarcoplasmic hypertrophy purposes. Nobody in the history of the universe has ever gotten big and strong on bodyweight squats. It has never happened and it never will happen.

zfnmxt··on My First 80 Days of VR for Exercise
Everything is a stressor. Doing nothing is a (negative) stressor. The question is is it a sufficient stress. And it is not.

Squatting 120 kg x 5 every day is a stressor, and provided you do no other strength training, it will feel hard. But you'll never get stronger than you already are.

zfnmxt··on My First 80 Days of VR for Exercise
> Increased strength is adversarial to improved cardio efficiency.

This is absolutely untrue. If you take a runner who doesn't squat and get them to squat (and get stronger) they will become a better runner. By becoming stronger, each stride becomes more submaximal. Of course how strong they can become will be modulated by how much weight they can gain--in the case of a runner, that will probably be a very modest amount before the increase in weight begins to negatively impact their performance. But even with extremely minimal weight gain, they can become significantly stronger from an untrained state in a way that only positively impacts their running performance.

> The adaptations come from the cardiac system. Basically, the body can use more oxygen more efficiently.

You misunderstood my question. If the session is easy, what is the stress which sufficiently disrupts homeostasis to lead to an adaptation? Easy things do not result in adaptations.

> Someone who can lift 440lbs but who sweats when they eat isn't fit, either.

Sure, they should do their cardio.

zfnmxt··on My First 80 Days of VR for Exercise
> What works for you doesn't work for other people

I think this mindset is extremely destructive. You do not have some unique fitness journey and have to find some niche thing that works for you. Barring significant physical abnormality, strength training--on a physical level--works for everyone and it works for everyone with the same basic programming tenants and the same exercises.

If by this you meant mentally (i.e., what sticks and what is appealing to them) sure, I'll concede that and agree. On a physical level it is absolutely not the case.

zfnmxt··on My First 80 Days of VR for Exercise
> Only if you come in telling the Perl programmers that they can’t possibly have written useful code. Which is what i hear when zmmmmm says

In hindsight, perhaps the analogy was poor. Perl and Rust can express exactly the same computations (and no more and no less) and are in some sense interchangeable which is not what I was trying to express.

I am indeed arguing that the utility of the strength training I outline exceeds that of VR exercise and that VR exercise is less useful in developing physical fitness.

> Body weight exercise can absolutely help folks reach all kinds of fitness and life goals, which is all we’re trying to say here

I agree with this and your quote

> bodyweight squats don't make you stronger.

is out of context, since I qualified it with people who already have a decent level of fitness. And that is indeed the case. You cannot increase the loading on the bodyweight squats and--assuming your bodyweight isn't drastically changing--that means you cannot change the intensity and hence you will not get appreciably stronger. Doing more reps just puts you in the realm of sarcoplasmic hypertrophy followed by cardiovascular adaptations.

Doing something is always better than nothing; there is no contention there and I agree. What I disagree with is the degree of benefits (especially in regards to strength) people are claiming things like VR exercise can provide and relative of importance of cardiovascular fitness vs. strength and how to best obtain fitness in each area.

I'm strongly opinionated, absolutely. And I absolutely think a lot of the approaches featured in this comment section are ineffective if the goal is to obtain physical fitness. If your goal is to just have fun and just do something you enjoy, then who cares--have fun! It's fine to not especially care about physical fitness and I have no personal interest in your physical fitness. But I believe that life is better physically fit and that the best path to fitness involves lifting weights in a manner which features progressive overload. A lot of people go to the gym with the intent to become strong and most of them fail--not all approaches are equally valid and a lot of them are ineffective.

zfnmxt··on My First 80 Days of VR for Exercise
> what makes me strong

How do you know what makes you strong? That is, how do you measure it?

zfnmxt··on My First 80 Days of VR for Exercise
I should've written more explicitly: bodyweight squats don't make people who harbor a decent level of fitness stronger. Like any novel stimulus, they will make you stronger for a short while and then it will stop once you've adapted.
zfnmxt··on My First 80 Days of VR for Exercise
The lower body musculature is too large to be effectively stressed by bodyweight exercise in people fostering any decent level of fitness, i.e., bodyweight squats don't make you stronger.

Just because an exercise is hard or makes you sore doesn't mean it's effective.

zfnmxt··on My First 80 Days of VR for Exercise
The fallacy everyone is making here is believing that consistency trumps all else. But it doesn't if you're consistently subjecting yourself to a stress which does not result in any new adaptations--then there will be no change.

An oft repeated example of this fallacy is in the case of tanning. If you go out into the sun for 20 minutes and get a tan, what will happen if you continue to go out in the sun for 20 minutes each day? Will you get more tan? No. You've already adapted to the stress (ultraviolet light exposure for 20 minutes) and so the continued daily stress of 20 minutes of sunlight will not result in any new adaptations.

That is why if you are completely untrained, sure, VR constitutes a sufficient disruption to homeostasis that you'll get some muscular adaptations. But the stress is so minimal (and you cannot effectively increase it) that you will quickly adapt to it and subsequent exposure to the stress in the future will not result in any adaptations, it will only maintain what little adaptation you already have.

zfnmxt··on My First 80 Days of VR for Exercise
> To mitigate that risk you then have to start doing additional warm up, foam rolls, recovery routines

How do you know that any of this is effective?

> Oh and lets not forget that most people can't even do squat properly, so add static stretching too.

If you don't squat correctly, you need to do static stretching to ameliorate it? What?

> It's fine to muck around doing 120kg squats if that's your thing, but you're continuously putting yourself to increased risk of injury as the years go by and you're increasing weight.

Being strong decreases risk of injury and death. We're not talking about becoming competitive weightlifters or powerlifters here, we're talking about becoming decently strong. To become strong, you must learn to execute the lifts with sufficiently good technique to not injure yourself. If you can read a book and think somewhat critically (so, hopefully, the entire Hacker News readership) you can learn to execute the lifts correctly.

Would you have the same defeatist attitude if I was talking about joining a recreational soccer team, where injury rates are literally magnitudes higher than in the weight room?

zfnmxt··on My First 80 Days of VR for Exercise
> For that, you'd need to be convinced that exercise/strength training results in better health outcomes long term, and that better health outcomes are an important factor in emotional wellbeing.

On top of this, being physically fit generally results in increased longevity, giving you more total time to enjoy the things you do enjoy. (And enjoy them in a physically superior state.)

> Supposing that, it is safe to acknowledge that particular behaviour can be created by building reward circuits and overcoming initial aversion common when building any habit.

I think humans have a surprising capacity to learn to enjoy things (or, at least, tolerate) and that sticking with something is largely a question of overcoming an initial "enjoyment" curve. Besides, why does everything need to be enjoyable or stimulating? There is certainly value in a lack of stimulation.

zfnmxt··on My First 80 Days of VR for Exercise
> There are adaptations that only happens during long easy sessions.

What sort of adaptations? As far as I'm aware, adaptations are the result of significant stress. What are the stressors of a "long easy session"?

At any rate, my post was about physical fitness and health, not how to become a competitive athlete.

Many competitive athletes are not fit. A marathoner who has no muscle mass and who is physically weak is not fit--regardless of the fact if they can run a 2:15 marathon. Said marathoner is not resistant to adversity, e.g., consider how they'd do on a wasting disease like cancer versus an athletic 215lb male.

What competitive athletes do generally is not a useful consideration when deciding on training modalities. Assuming that what the pros do is effective because they're pros is logical fallacy and, regardless, these people are (genetic) outliers with differing goals.

Low-intensity, long endurance cardio is adversarial to increasing strength. If you want to be a competitive endurance runner then, sure, you need to adapt your training and you will need to do long endurance cardio. If you're just an average Joe who wants to be healthy and fit then it is not in your interest to do long endurance cardio. Injury rates are higher, it makes it harder to become strong, and many of the resulting adaptations are undesirable.

zfnmxt··on My First 80 Days of VR for Exercise
The title of the post is "Virtual Reality: My Digital Dojo for Mental & Physical Fitness". The post is about physical fitness and I think the author is conflating physical fitness with cardiovascular fitness.

> in fact many people do both.

And I argued for both and that strength training also results in cardiovascular adaptations.

zfnmxt··on My First 80 Days of VR for Exercise
> but then you are putting down what other people manage to do.

This is a bizarre argument to me. If I argue that Rust is better than Pearl am I "putting down" Pearl programmers? There is no personal attack here--I firmly believe the methods I outlined in my post are superior. If you cannot find it in your being to find something enjoyable in that method that's unfortunate and if that means you have to do something else that's less optimal, so be it.

zfnmxt··on My First 80 Days of VR for Exercise
That's too bad. Out of curiosity, do you have meaningful progress on Stronglifts? Can you tell me what your starting lifts were and what you're at now?
zfnmxt··on My First 80 Days of VR for Exercise
> You don’t need to min/max and obsess over progression and optimization to get good exercise.

You're right, but I'm not talking about exercise, I'm talking about training. You do need to "obsess" over progression if you intend to progress.

> I’m jacked just doing push-ups, pull-ups, and squats here and there.

You almost certainly are not. Having low bodyfat is not the same thing as being "jacked". Weight/height? How much can you squat?

> Where people fail is the daily consistency and making the lifestyle change of actually exercising at all regularly, not because they aren’t exercising optimally.

My argument is that these things are highly related. That is, lifting effectively makes lifting consistently much easier--if you're seeing continued, measurable progress (every time you lift your numbers go up--how exciting!) and actual physical changes and improvements to your quality of life, it really isn't so difficult to be consistent because the process itself is incredibly enjoyable and rewarding. Continued habits are not formed by discipline, they are formed by finding something you enjoy in the habit; at least some component of the habit itself must become compelling.

zfnmxt··on My First 80 Days of VR for Exercise
VR exercise is a remarkably poor allocation of time (if your interest is physical fitness, efficiently). It also leaves out the most important adaptation of all: strength.

Effective training (not exercising) requires a progression model. That is, on some time frame you must exceed your performance at the end of that time frame when compared to the beginning of the time frame. This must be done in some measurable way--trying "harder" is ineffective. For example, if you squatted 120 kg x 5 two days ago, today you need to squat 122.5 kg x 5. VR cannot support such a progression model because it is incapable of producing a sufficiently intense stimulus (obviously for strength, but also for cardiovascular fitness) to result in continued adaptations; i.e., you cannot effectively scale the stress to produce meaningful adaptations after an initial period of adaptations. I'm sure if the author of the post continues for another 80 days, you'll see progress mostly stall.

At any rate, the bigger issue is that the most important component of fitness--strength--is left out entirely. Strength is extremely correlated with decreased morbidity/mortality but, perhaps more tangibly, becoming strong results in vast, systemic changes to your body and (especially if you're older or extremely unfit already) similarly vast improvements to your quality of life. You are a physical entity and the way you interact with your environment is expressed through forces; the degree to which you can produce such forces is strength. We all depend on strength.

As anyone who is strong will tell you, being strong is a far superior state to being weak. If you only "exercise" or just go for runs or only do VR exercise, you are weak.

(Effective) strength training trains your entire body. Your bones, your nervous system, your balance, and yes, even cardiovascular fitness. You can become very strong lifting just 3x a week for one hour each time. Throw in some HIIT (which takes 15 minutes and results in better cardiovascular fitness than VR exercise because it has a progression model and is sufficiently intense to result in sufficient stress to evoke an adaptation) on a rest day and you have a far, far more effective recipe for general fitness with significantly less time spent. All other factors being equal, the man who can squat 400 lbs will always be fitter than the man who plays VR for 45 minutes every day--and the former can do it with a smaller time investment.

For any naysayers arguing that strength training isn't fun (like VR is): it is fun. You're playing Pokemon, just leveling up IRL instead of your Clefairy. The progression model I explained above makes it fun.

zfnmxt··on My First 80 Days of VR for Exercise
> I actually started bulking up in my upper arms for the first time in my life.

No you didn't, unless you were completely and utterly detrained (i.e., previously bedridden or something) and even then, the stimulus would've only resulted in adaptation for a short period.

VR exercise is far too submaximal (in regards to strength) to result in meaningful strength adaptations past a short initial adaptation period.

← PreviousPage 2 of 3Next →