Skip to content

Commit

Permalink
docs: Translate docs/DESIGN.ja.md to English
Browse files Browse the repository at this point in the history
  • Loading branch information
kmyk committed Sep 12, 2021
1 parent 9259235 commit efbd413
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ For developpers:
- On what it means to automatically solve problems of competitive programming / 競技プログラミングの問題を自動で解くとはどういうことなのかについて
- [docs/how-it-works.pdf](https://github.com/kmyk/Jikka/blob/master/docs/how-it-works.pdf) (Japanese)
- How it works and related theories / 動作原理や関連する理論
- [docs/DESIGN.md](https://github.com/kmyk/Jikka/blob/master/docs/DESIGN.md) (Japanese)
- [docs/DESIGN.md](https://github.com/kmyk/Jikka/blob/master/docs/DESIGN.md)
- The policy of designs / 実装方針
- [docs/internal.md](https://github.com/kmyk/Jikka/blob/master/docs/internal.md)
- The overview of internal processes / 内部の処理の流れ
Expand Down
88 changes: 88 additions & 0 deletions docs/DESIGN.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Design Doc

(このドキュメントの日本語バージョン: [docs/DESIGN.ja.md](https://github.com/kmyk/Jikka/blob/master/docs/DESIGN.ja.md))

## Objective

Jikka automates the very process of solving problems of competitive programming.

## Goals

- Automatically generating solutions to competition programming problems given in a formal form
- Mechanically processing some implementation parts of competition programming
- In practical use, it aims for a position similar to [OEIS](https://oeis.org/) and [Wolfram|Alpha](https://www.wolframalpha.com/).

## Non-Goals

- Automatically generating solutions to competition programming problems given in natural language
- Let GPT-3, GitHub Copilot, etc. do this for you.

## Background

There are some problems in competitive programming that can be solved mechanically.
Even if the whole problem cannot be solved mechanically, there are many problems that can be solved partially mechanically.
For example, there are problems that can be solved by carefully transforming the given formula, which each transformation itself is trivial.
We want to automate this.

## Overview

Jikka is an automatic solver for problems of competitive programming.
We can think many possible forms of automatic solvers, but Jikka is implemented especially as a transpiler doing optimization.
In other words, Jikka is just a transpiler in its overview.
It takes source code of a very restricted subset of Python as input, optimizes it in an internal language similar to GHC's Core, and finally writes source code of C++ as output.

In addition, Jikka can be used as an IDE plugin that provides rewriting functions for optimization, for more practical use during real contests.
For example, by right-clicking on a snippet of code and selecting "Rewrite this O(N²) loop to O(N)" from the menu, the code will be rewritten as such.
It is implemented using the Language Server Protocol, and supports both Python and C++ languages.

## Detailed Design

### Implemented as a transpiler

Jikka is implemented as a transpiler, because it is easy to develop and use.
The goal of a solver for competitive programming problems is too ambitious and vague to create a perfect one from the beginning.
Therefore, we should start with an easy-to-implement and already well-understood thing, i.e., a transpiler.

### Implemented as IDE plugin

Jikka is also available as an IDE plugin.
This makes it easier to use in practice.
With a transpiler that converts a large file to a large file, it is difficult to understand what kind of optimization has been done.
On the other hand, with the IDE's function that rewrites a small snippet of code into a small snippet of code, it is easier for the user to understand and control what kind of optimization has been done.

### Use Python for input

We will use a subset of Python as input, due to the following two reasons:

1. easy to use: easy to learn and write; Python is a widely used and reasonably expensive language.
2. easy to develop: easy to handle with a compiler, if we limit the features. The differences from real Python can be absorbed in the form of undefined behaviors.

We largely limit the language features, and makes it a statically typed language.
Side effects are left only as some kind of syntax suger, and removed in its core semantics.

### Don't use a new own language for input

We avoid using a new own language as input, due to the following two reasons.
Each of these is an inverse of the reason for using Python:

1. difficult to use: A new own language requires the user to learn the language anew. For most users, learning a new language is a significant burden.
2. difficult to develop: A new own language requires the developer to carefully write documentation for the language. Clear specifications and plenty of explanations are one of the important features of a programming language.

### Use C++ for output

There are two reasons:

1. ease of use: flexible in the context of competitive programming
2. easy to develop: no need to worry about constant-factor optimization

## Metrics Considerations

Under appropriate assumptions, it is possible to evaluate performance in terms of rating on AtCoder.
It may also be possible to evaluate performance in terms of how many of the problems in the AtCoder Beginner Contest can be solved.

## Testing Plan

In competition programming, it is easy to write fast and stable end-to-end tests, so we use them.
This is a form of testing that is commonly referred to as "verifying", in which you check the AC by using it against real problems of competition programming.

There are also dedicated online judges for this purpose: <https://judge.kimiyuki.net/>
2 changes: 2 additions & 0 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Design Doc

(The English version of this document: [docs/DESIGN.md](https://github.com/kmyk/Jikka/blob/master/docs/DESIGN.md))

## Objective

Jikka は競技プログラミングの問題を解くことそのものを自動化する。
Expand Down

0 comments on commit efbd413

Please sign in to comment.