Mathematical limits on lossless data compression

Let’s say Bob wants to send a particular binary sequence to Alice. Imagine that Bob and Alice both have powerful machines but slow Internet connections. Bob could just send the sequence directly but the upload and the download would take a lot of time. Instead Bob could send a program that outputs the sequence. Assume Bob and Alice have agreed on the programming language they will use beforehand (be it C++ or Iota).

Two natural questions are what is the smallest possible size of the source file and how to find a program attaining the lower bound for a given sequence (e.g. can it be done algorithmically for any sequence or at least for some sequences). Have these questions been studied?