objectionary / normalizer

Command Line Normalizer of 𝜑-calculus Expressions
https://www.objectionary.com/normalizer/
7 stars 2 forks source link

Handle the `formations` metric properly #380

Closed deemp closed 1 month ago

deemp commented 1 month ago

Problem

We sometimes encounter programs with 0 or 1 formations where we can't reduce the number of formations (the formations metric).

Example:

non-normalized:

{
  ⟦
    org ↦ ⟦
      eolang ↦ ⟦
        compares-two-bools ↦ ⟦
          φ ↦ Φ.org.eolang.true.eq(
            α0 ↦ Φ.org.eolang.true
          )
        ⟧,
        ...
     ⟧
  ⟧
}

normalized:

{
  ⟦ 
    org ↦ ⟦ 
       eolang ↦ ⟦ 
         compares-two-bools ↦ ⟦ 
           Δ ⤍ 01- 
         ⟧,
         ...
       ⟧
    ⟧
  ⟧
}

The requirement for the formations metric in the contract

The number of object formations decreases by 10% or more, compared to the test (not optimized) φ-expression.

Options

@yegor256, @fizruk, there are the following options to deal with tests with 0 or 1 formations:

  1. We exclude such tests and don't calculate any metrics for them.
  2. We include such tests and adjust the formations metric definition for such tests.
  3. We include such tests and
    • Calculate metrics and improvements for such tests separately from tests with strictly more than 1 formation
    • Explicitly explain why we do so

Question

Which option should we choose?

yegor256 commented 1 month ago

@deemp the option 3 is the best. You calculate the metric as usual, but in the final result/summary take into account only the tests where the initial number of formations was >5 (for example)