Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get syntax declarations to be used by case splitting

Tags:

emacs

agda

I would like to automatically case over arguments using a syntax declared besides the one given as a type constructor. For example,

postulate P : ℕ → ℕ → Set

data Silly : Set where
  goo : (n : ℕ) → Fin n → (m : ℕ) → Fin m → P n m → Silly

Here, I'd like to have the proof P n m occur between the n and m arguments, but that cannot be since both need to be declare for it to be expressed. Hence, we use a syntax declaration:

syntax goo n i m j pf = i ⟵[ n , pf , m ]⟶ j

Now, we can write-up by-hand

want-to-use-syntax-in-pattern-matching : Silly → Set
want-to-use-syntax-in-pattern-matching (i ⟵[ n , pf , m ]⟶ j) = ℕ

This works fine, but when I case-split via C-c C-c, it uses goo instead of my syntax. Is there any way to make case splitting use my declared syntax ?

( Incidentally, using

syntax goo n i m j pf = i ─[ n , pf , m ]⟶ j

fails, where is produced by \---

)

like image 352
Musa Al-hassy Avatar asked Jan 04 '16 00:01

Musa Al-hassy


People also ask

How to control split in Python?

You can perform split by defining a value to the maxsplit parameter. If you put whitespaces as separator and the maxsplit value to be 2, the Split function splits the string into a list with maximum two items. Here, you can see the variable str is declared with a string of different subject names.

What helps to split data into several subsets?

A split acts as a partition of a dataset: it separates the cases in a dataset into two or more new datasets.

How to subset observations in SAS?

Subsetting a SAS data set means extracting a part of the data set by selecting a fewer number of variables or fewer number of observations or both. While subsetting of variables is done by using KEEP and DROP statement, the sub setting of observations is done using DELETE statement.


1 Answers

Nowadays Agda resugars patterns on the left if they are in scope unqualified so this would just work.

like image 138
gallais Avatar answered Sep 22 '22 13:09

gallais