/ Math ∩ Programming
  • Main Content
  • Primers
  • All articles
  • About
  • rss

Math ∩ Programming

  • Main Content
  • Primers
  • Shortform posts
  • Program Gallery
  • Proof Gallery
  • Research
  • All articles by date
  • About the author
pimbook cover

Sign up for a mailing list to be notified of new books I'm working on.

Featured Posts

#featured  #mathematics  #programming 
2011-06-20
My next book will be Practical Math for Programmers
Searching for Riemann Hypothesis Counterexamples
Linear Programming and Healthy Diets
Hybrid Images
Bezier Curves and Picasso
Correcting Errors in Data

  • A High-Level Technical Overview of Fully Homomorphic Encryption
    2024-05-04
    #cryptography  #fhe  #fully homomorphic encryption  #linear algebra  #lwe  #mathematics  #programming  #rlwe 
    About two years ago, I switched teams at Google to focus on fully homomorphic encryption (abbreviated FHE, or sometimes HE). Since then I’ve got to work on a lot of interesting projects, learning along the way about post-quantum cryptography, compiler design, and the ins and outs of fully homomorphic encryption. If you’ve heard about FHE and you’re a software person, you’ve probably heard two things: it lets you run programs directly on encrypted data without ever decrypting it; and it’s still too slow to be useful for anything.
  • Unusual Tips for Parenting Toddlers
    2024-04-01
    #april cools 
    It’s April Cools! Last year I wrote about friendship bracelets and the year before about cocktails. This year it’s parenting. Parenting articles are a dime a dozen and always bury the lede behind a long story. I’ll skip that. How to think about your child and your role as a parent These are framing devices. Concrete things to do to work toward these are in the next section. I will refer to the numbers for each action to show what principle it is applying.
  • Tabletop Games Based on Math Problems
    2024-03-08
    #tabletop games  #mathematics  #set  #card games 
    There’s a family of tabletop games that are based directly on a nontrivial mathematics problem. As a casual and fun way to inaugurate my new blog (migrated from Wordpress to Hugo, after my work on getting better LaTeX mathmode support in Hugo), I thought I’d write a short listicle about them, so that I have a place to add more as I find them, as well as give the shortest canonical description of the associated math problem.
  • MLIR — A Global Optimization and Dataflow Analysis
    2023-11-15
    #compilers  #heir  #mathematics  #mlir  #optimization  #primer  #programming 
    Table of Contents In this article we’ll implement a global optimization pass, and show how to use the dataflow analysis framework to verify the results of our optimization. The code for this article is in this pull request, and as usual the commits are organized to be read in order. The noisy arithmetic problem This demonstration is based on a simplified model of computation relevant to the HEIR project. You don’t need to be familiar with that project to follow this article, but if you’re wondering why someone would ever want the kind of optimization I’m going to write, that project is why.
  • MLIR — Lowering through LLVM
    2023-11-01
    #compilers  #heir  #llvm  #mathematics  #mlir  #primer  #programming 
    Table of Contents In the last article we lowered our custom poly dialect to standard MLIR dialects. In this article we’ll continue lowering it to LLVM IR, exporting it out of MLIR to LLVM, and then compiling to x86 machine code. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Defining a Pipeline The first step in lowering to machine code is to lower to an “exit dialect.
  • MLIR — Dialect Conversion
    2023-10-23
    #cryptography  #heir  #mathematics  #mlir  #polynomial ring  #polynomials  #primer  #programming 
    Table of Contents In previous articles we defined a dialect, and wrote various passes to optimize and canonicalize a program using that dialect. However, one of the main tenets of MLIR is “incremental lowering,” the idea that there are lots of levels of IR granularity, and you incrementally lower different parts of the IR, only discarding information when it’s no longer useful for optimizations. In this article we’ll see the first step of that: lowering the poly dialect to a combination of standard MLIR dialects, using the so-called dialect conversion infrastructure to accomplish it.
  • Socks, a matching game based on an additive combinatorics problem
    2023-10-14
    #additive combinatorics  #board games  #card game  #games  #Group Theory  #mathematics 
    Can you find a set of cards among these six, such that the socks on the chosen cards can be grouped into matching pairs? (Duplicate pairs of the same sock are OK) Spoilers: If the cards are indexed as 1 2 3 4 5 6 Then the following three subsets work: $\{ 1, 2, 4, 5, 6 \}$, $\{ 2, 3, 6 \}$, and $\{ 1, 3, 4, 5 \}$.
  • MLIR — Canonicalizers and Declarative Rewrite Patterns
    2023-09-20
    #c++  #canonicalization  #compilers  #complex numbers  #mathematics  #mlir  #polynomials  #primer  #programming 
    Table of Contents In a previous article we defined folding functions, and used them to enable some canonicalization and the sccp constant propagation pass for the poly dialect. This time we’ll see how to add more general canonicalization patterns. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Why is Canonicalization Needed? MLIR provides folding as a mechanism to simplify an IR, which can result in simpler, more efficient ops (e.
  • Encoding Schemes in FHE
    2023-09-18
    #complex numbers  #cryptography  #encoding  #fhe  #fully homomorphic encryption  #learning with errors  #lwe  #mathematics  #Number Theory  #programming  #residue number system  #rlwe 
    In cryptography, we need a distinction between a cleartext and a plaintext. A cleartext is a message in its natural form. A plaintext is a cleartext that is represented in a specific way to prepare it for encryption in a specific scheme. The process of taking a cleartext and turning it into a plaintext is called encoding, and the reverse is called decoding. In homomorphic encryption, the distinction matters. Cleartexts are generally all integers, though the bit width of allowed integers can be restricted (e.
  • MLIR — Verifiers
    2023-09-13
    #c++  #compilers  #mathematics  #mlir  #primer  #programming 
    Table of Contents Last time we defined folders and used them to enable some canonicalization and the sccp constant propagation pass for the poly dialect. This time we’ll add some additional safety checks to the dialect in the form of verifiers. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Purpose of a verifier Verifiers ensure the types and operations in a concrete MLIR program are well-formed.