# Programowanie przez przykłady

EN: **Programming by example (PBE)** · id `pbe` · aliases: programming by example, programming by examples, PBE, programowanie przez przykłady

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Fundamenty i rozumowanie](https://aiatlasgraph.com/t/foundations.md) › [Synteza programów](https://aiatlasgraph.com/t/programsynthesis.md) › Programowanie przez przykłady

## Description

- PL: Synteza programu wyłącznie z par wejście–wyjście, zwykle w ograniczonym języku dziedzinowym, z rankingiem kandydatów i dopytywaniem użytkownika.
- EN: Synthesising a program solely from input–output pairs, usually in a restricted DSL, with candidate ranking and user disambiguation.

## In one sentence

- PL: Komputer odgaduje regułę przekształcenia z kilku pokazanych przykładów „przed i po” i stosuje ją do reszty danych.
- EN: The computer guesses a transformation rule from a few 'before and after' examples and applies it to the rest of the data.

## Problem it solves

- PL: Porządkowanie danych ręcznie wiersz po wierszu jest żmudne, a napisanie formuły lub skryptu przerasta wielu użytkowników.
- EN: Cleaning data by hand row by row is tedious, and writing a formula or script is beyond many users.

## What it does

- PL: Jak praktykant, któremu pokazujesz dwa razy, jak coś przerobić, a on sam robi resztę i dopytuje, gdy przykłady są dwuznaczne.
- EN: Like a trainee you show twice how to reformat something, who then does the rest and asks when examples are ambiguous.

## Everyday example

- PL: Wpisujesz w arkuszu dwa daty w nowym formacie, a reszta kolumny zmienia się sama w ten sam sposób.
- EN: You type two dates in a new format in a spreadsheet, and the rest of the column converts itself the same way.

## This concerns you if you…

- PL: często przerabiasz kolumny tekstu lub dat
- PL: nie piszesz kodu, a chcesz automatyzować powtarzalne poprawki
- EN: often reformat columns of text or dates
- EN: do not code but want to automate repetitive fixes

## Keywords

Flash Fill · PROSE · version space algebra · BlinkFill · programming by demonstration · SyGuS PBE track · few-shot program induction

## How it works

- PL: Syntezator przeszukuje język dziedzinowy operacji (np. wyrażenia regularne, podciągi, warunki) i reprezentuje zbiór wszystkich programów zgodnych z przykładami w zwartej strukturze przestrzeni wersji. Funkcja rankingu wybiera najbardziej naturalny program, a system pyta o wynik dla wejść, na których kandydaci się różnią.
- EN: The synthesiser searches a DSL of operations (e.g. regular expressions, substrings, conditionals) and represents all programs consistent with the examples in a compact version-space structure. A ranking function picks the most natural program, and the system asks for outputs on inputs where candidates disagree.

## Limits

- PL: Działa dobrze tylko w wąskim języku dziedzinowym, np. przekształceń tekstu. Kilka przykładów może pasować do wielu reguł, więc system bywa pewny siebie i błędny na nietypowych wierszach.
- EN: Works well only in a narrow DSL, such as text transformations. A few examples can fit many rules, so the system can be confident yet wrong on unusual rows.

## Key terms

- PL: **para wejście–wyjście**: Przykład pokazujący dane przed przekształceniem i po nim.
- PL: **przestrzeń wersji**: Zwarta reprezentacja wszystkich programów zgodnych z przykładami.
- PL: **ranking programów**: Wybór najbardziej prawdopodobnego programu spośród pasujących.
- EN: **input–output pair**: An example showing data before and after the transformation.
- EN: **version space**: Compact representation of all programs consistent with the examples.
- EN: **program ranking**: Choosing the most likely program among those that fit.

## Know first

- [Przeszukiwanie ślepe (BFS, DFS) (Uninformed search (BFS, DFS, uniform-cost))](https://aiatlasgraph.com/t/uninformedsearch.md)

## Sources

- [Program Synthesis (Foundations and Trends in Programming Languages)](<https://www.microsoft.com/en-us/research/publication/program-synthesis/>) `gulwani-program-synthesis-2017` · by Sumit Gulwani, Oleksandr Polozov, Rishabh Singh
- [Automating String Processing in Spreadsheets using Input-Output Examples (POPL 2011)](<https://www.microsoft.com/en-us/research/?p=335864>) `gulwani-flashfill-popl11` · by Sumit Gulwani

---

AI Atlas revision 125 (2026-11-01) · HTML: https://aiatlasgraph.com/t/pbe · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-01
