summaryrefslogtreecommitdiff
path: root/src/Core/Term/Thinned.idr
blob: 0bc6dcff547a970ec1d77a67d0f50f86da5ef922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Core.Term.Thinned

import Core.Term
import Core.Thinning

%prefix_record_projections off

infix 4 =~=

-- Definition ------------------------------------------------------------------

public export
record Thinned (n : Nat) where
  constructor Over
  {0 m : Nat}
  term : Term m
  thin : m `Thins` n

%name Thinned t, u, v

%inline
public export
expand : Thinned n -> Term n
expand (term `Over` thin) = wkn term thin

public export
(=~=) : Thinned n -> Thinned n -> Type
t =~= u = expand t = expand u

-- Weakening -------------------------------------------------------------------

public export
wkn : Thinned m -> m `Thins` n -> Thinned n
wkn t thin = { thin $= (thin .) } t