Type Theory for the Working Rustacean - Dan Pittman

  Рет қаралды 16,308

Rust Belt Rust Conference

Rust Belt Rust Conference

4 жыл бұрын

Rust really hits a sweet spot with respect to programming languages on account of a) its usefulness when working at a low level, coupled with b) its style of type system. Because of a), Rust can be - and is - used in places which tend to safety-critical: cyber-physical systems, autonomous vehicle infrastructure, robotics, etc. When building systems for these safety-critical environments, one also often formally proves properties about their software. That’s where b) comes in.
Rust’s type system is borne from the same ilk as those used in proof assistants like Agda, Coq, or Lean. Because of this, we can use Rust’s type system in similar ways we’d use a proof assistant to produce safer and more correct programs. This is envisioned by reducing the language of these disparate systems into the lingua franca of type theory.
This talk will explore using (and abusing) Rust’s type system to mimic the proofs one writes about their Rust programs while also enumerating how this mimicry is derived from common ground in the worlds of types or categories.

Пікірлер: 32
@MarkMifsud
@MarkMifsud 3 жыл бұрын
I love thinking about this kind of stuff. Anything within discrete mathematics max me feel smart (once I understand it). Feels good!
@NonTwinBrothers
@NonTwinBrothers 7 ай бұрын
I wouldn't exactly consider myself a rustaceon, but I found this to be a nice talk
@SaHaRaSquad
@SaHaRaSquad 3 жыл бұрын
Wow, I'm glad I watched this talk, it's super interesting and makes me want to learn more about the whole thing.
@JosiahWarren
@JosiahWarren 3 жыл бұрын
Short and accurate. Thanks
@warwolt
@warwolt Жыл бұрын
Hadn't seed that thing about dependent types moving up one universe level, very cool
@phlimy
@phlimy 4 жыл бұрын
mind blown
@GrahamTodd-ca
@GrahamTodd-ca 8 ай бұрын
In _raku_ (`raku_lang`) the type hierarchy starts with "Mu" - which puts "the developer" in the realm of logical philosophy and Buddhist metaphysics right from the get go.
@StefanDeml
@StefanDeml 4 жыл бұрын
thanks for the great video. is the code for the implementation of IsLessOrEqualTo public?
@shenbomo
@shenbomo 2 жыл бұрын
This is the slides/code/video from the author.
@Almindor
@Almindor 4 жыл бұрын
One issue with this approach is compile-time increase. Imagine running IsLessOrEqualTo calculation for Vec with size i32::max_value() or such. It'd never finish...
@mybigbeak
@mybigbeak 4 жыл бұрын
my thoughts exactly. This function exists for every size of vec.
@meithecatte8492
@meithecatte8492 4 жыл бұрын
That's why the typenum crate encodes the numbers in the typesystem in binary instead of unary.
@JETBLAST88
@JETBLAST88 4 жыл бұрын
Compile time is free compared to debugging time. That's something the industry is slowly learning. But yes, if the language was actually designed around dependent types, patterns like these could be optimised just like anything else :)
@automatescellulaires8543
@automatescellulaires8543 2 жыл бұрын
@@JETBLAST88 Compile is certainly not free. It makes automated tests costs much higher. Also low debug time is achievable with good architecture + good test policy.
@manawa3832
@manawa3832 Жыл бұрын
Checking lens in properly implemented type systems with dependent types is done by reduction not literally counting
@minandychoi8597
@minandychoi8597 Жыл бұрын
omg let him hit the spacebar!!
@minandychoi8597
@minandychoi8597 Жыл бұрын
wow mathematicians couldn’t be bothered to type out Natural and succeed or increment but would/expect me to say ‘suck suck naturals’ with a straight face
@minandychoi8597
@minandychoi8597 Жыл бұрын
actually a brilliant talk. thanks for making this understandable for those of us who aren’t type theorists!! i’ve always been really bothered by how i have to check the lengths of vectors and such at runtime, learnt something really cool from this talk, and i’m gonna try and apply this idea in my code later. i still stand by my point that mathematicians should get over themselves and stop with the silly symbol business already. computers have been around for decades. just learn to type faster ffs. it’s 2023 and it’s ur fault if you type so slowly that you still have to Nat this and suc that.
@SkyBeast55
@SkyBeast55 4 жыл бұрын
What's the difference with const generics?
@shikablyat97
@shikablyat97 4 жыл бұрын
If I'm not wrong, const generics are juste a specialization of this concept, for some specific use cases.
@Caellyan
@Caellyan 2 ай бұрын
@@shikablyat97You're right. Const generics remove the need for "counting up/down" in the type checker and allow you to simply subtract numbers which is much quicker. There's still lots of features that could be added though and I just want to press a fast forward button to get them - const generics just made it to stable, 4 years later.
@PrettyGrossMKay
@PrettyGrossMKay 3 жыл бұрын
AHHHH that's why a Rust enum is a SUM-type; A FruitSnack so to speak; A variable can have enum-value 1 OR enum-value 2 OR ...; e.g. The Option enum can be either Some(x) or None.
@EngineerNick
@EngineerNick Жыл бұрын
I just wish slice::Windows could produce `Item`s of known length so that they could be unpacked. This would seem to be a solution. But there has got to be a limit somewhere; I think the typescript type system has been shown to be Turing complete. Maybe rust can beat it by being the first to run Doom on a type system.
@JorgetePanete
@JorgetePanete Жыл бұрын
Google it, Rust's is too.
@bocckoka
@bocckoka 3 жыл бұрын
singular they kindof kills the barbers paradox
@Theidmet
@Theidmet 3 жыл бұрын
Interesting. It appears as though, mathematically speaking, we are essentially running into Godel's "Incompleteness Theorems" in this endeavor. That whole "formal mathematics is essentially an impossibility because every paradigm/theory will require certain assumptions which themselves are impossible to prove, and further each and every system of number theory must by its nature omit or 'falsify' certain mathematical truths" thing. Thus no paradigm of thought regarding number can be "complete." - A paradigm by its very nature is an analytical beast, and analysis being primarily a destructive process (as opposed to synthesis) must omit "things" in its quest towards a satisfying conclusion. The problem being that all the "omitted things" also contain "mathematical truths," making every theory fundamentally incomplete, unable to express all mathematical truths, and requiring for their validation some other theory which itself is incomplete, ad infinitum. However, two individuals or components agreeing to operate within a certain paradigm can obviously communicate and "make sense" of each other just fine, thus "dependent types."
4 жыл бұрын
_succ_
@lolilollolilol7773
@lolilollolilol7773 3 жыл бұрын
I've had the same error with copy_from_slice, and it's bad, because it's basically memory corruption, something Rust is supposed to guarantee against.
@kolskytraveller1369
@kolskytraveller1369 2 жыл бұрын
That's not dependent types, but rather an overengineered, hardcoded, typed nightmare bullshit. Imagine trying to use this in a production code. Actual dependent types don't depend on types (pun not intended) and can be inferred automatically by proof checker from context.
@warwolt
@warwolt Жыл бұрын
The talk was clearly framed as bending the rust type system, this is just a demo and not meant for prod
@user-uf4rx5ih3v
@user-uf4rx5ih3v Күн бұрын
Dependent types cannot always be inferred by the proof assistant unfortunately. I think dependent types are better understood as a kind of macro, since (almost) all of the type information is completely deleted at compile time.
The Death and Rebirth of Docs.rs - Quiet Misdreavus
17:55
Rust Belt Rust Conference
Рет қаралды 1,7 М.
Traits and You: A Deep Dive - Nell Shamrell-Harrington
22:09
Rust Belt Rust Conference
Рет қаралды 38 М.
[Vowel]물고기는 물에서 살아야 해🐟🤣Fish have to live in the water #funny
00:53
The Noodle Stamp Secret 😱 #shorts
00:30
Mr DegrEE
Рет қаралды 66 МЛН
ШЕЛБИЛАР | bayGUYS
24:45
bayGUYS
Рет қаралды 695 М.
Rust for TypeScript Developers
11:52
Andrew Burgess
Рет қаралды 51 М.
Rust: Haskell, but more imperative
17:12
Trusty Bits
Рет қаралды 3,5 М.
Rust's Journey to Async/Await
48:46
InfoQ
Рет қаралды 86 М.
"Proof Theory Impressionism: Blurring the Curry-Howard Line" by Dan Pittman
35:08
Strange Loop Conference
Рет қаралды 12 М.
What is...homotopy type theory?
14:41
VisualMath
Рет қаралды 4,1 М.
Rust Programming Techniques
1:32:02
LinuxConfAu 2018 - Sydney, Australia
Рет қаралды 94 М.
Lightning talk - Metamorphic testing - Zach Mitchell
5:09
Rust Belt Rust Conference
Рет қаралды 2,2 М.
"A Little Taste of Dependent Types" by David Christiansen
38:36
Strange Loop Conference
Рет қаралды 37 М.
David McAllester - Dependent Type Theory from the Perspective of Mathematics, Physics, and (...)
51:03
Institut des Hautes Études Scientifiques (IHÉS)
Рет қаралды 1,6 М.
How much charging is in your phone right now? 📱➡️ 🔋VS 🪫
0:11
iPhone green Line Issue #iphone #greenlineissue #greenline #trending
0:10
Rk Electronics Servicing Center
Рет қаралды 4,7 МЛН