JetBrains / JetBrains/Arend

Arend forces splitting on unnecessary variables

Open
#286 1 comment 0 reactions 0 assignees View on GitHub
pattern-match
Dominant language
Java
Stars
756
Forks
31
PR merge metrics
No merged PRs in 30d

Description

![image](https://user-images.githubusercontent.com/16398479/107923605-afd59400-6fac-11eb-928c-b9b7e7dbeaa8.png)

```arend
\data T (n : Nat) \elim n
| zero => To
| n => Tn

\func ummm (n : Nat) (t : T n) : T n \elim t
```

Arend asks me to split on `n` as well. In Agda or Coq, they are translated into the so-called 'dotted pattern' which are not actually needed to be split.

```agda
data T : ℕ → Set where
To : T 0
Tn : ∀ n → T n

ummm : ∀ n → T n → T n
ummm a To = To
ummm a (Tn a) = Tn a

test : ∀ n → ummm n (Tn n) ≡ Tn n
test n = refl
```

The above Agda code checks (note that the binding second pattern is not even linear, `a` was bound twice! But internally it is translated to the code below). Before Jesper's work, you need to write `ummm` as follows, but the computational behavior is the same.

```agda
ummm : ∀ n → T n → T n
ummm .0 To = To
ummm a (Tn .a) = Tn a
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior with the Arend snippets in the issue and compare the requested result with the Agda examples. The issue names no source files or tests, so first locate the implementation of pattern matching and elimination in the Arend compiler; done means unnecessary variables no longer require splitting while the shown definitions still check.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.