forked from hazelgrove/hazelnut-dynamics-agda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheq-dec.agda
53 lines (50 loc) · 1.89 KB
/
eq-dec.agda
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
open import Prelude
open import Nat
open import core-type
open import core-exp
module eq-dec where
htyp-eq-dec : (τ1 τ2 : htyp) → (τ1 == τ2) + (τ1 ≠ τ2)
htyp-eq-dec b b = Inl refl
htyp-eq-dec b (T x) = Inr (λ ())
htyp-eq-dec b ⦇-⦈ = Inr (λ ())
htyp-eq-dec b (τ2 ==> τ3) = Inr (λ ())
htyp-eq-dec b (·∀ τ2) = Inr (λ ())
htyp-eq-dec (T x) b = Inr (λ ())
htyp-eq-dec (T x) (T y) with natEQ x y
... | Inl refl = Inl refl
... | Inr neq = Inr λ x₁ → neq (h1 x₁)
where
h1 : T x == T y → x == y
h1 refl = refl
htyp-eq-dec (T x) ⦇-⦈ = Inr (λ ())
htyp-eq-dec (T x) (τ2 ==> τ3) = Inr (λ ())
htyp-eq-dec (T x) (·∀ τ2) = Inr (λ ())
htyp-eq-dec ⦇-⦈ b = Inr (λ ())
htyp-eq-dec ⦇-⦈ (T x) = Inr (λ ())
htyp-eq-dec ⦇-⦈ ⦇-⦈ = Inl refl
htyp-eq-dec ⦇-⦈ (τ2 ==> τ3) = Inr (λ ())
htyp-eq-dec ⦇-⦈ (·∀ τ2) = Inr (λ ())
htyp-eq-dec (τ1 ==> τ2) b = Inr (λ ())
htyp-eq-dec (τ1 ==> τ2) (T x) = Inr (λ ())
htyp-eq-dec (τ1 ==> τ2) ⦇-⦈ = Inr (λ ())
htyp-eq-dec (τ1 ==> τ2) (τ3 ==> τ4) with htyp-eq-dec τ1 τ3 | htyp-eq-dec τ2 τ4
... | Inl refl | Inl refl = Inl refl
... | _ | Inr x = Inr λ x₁ → x (h1 x₁)
where
h1 : (τ1 ==> τ2) == (τ3 ==> τ4) → τ2 == τ4
h1 refl = refl
... | Inr x | _ = Inr λ x₁ → x (h1 x₁)
where
h1 : (τ1 ==> τ2) == (τ3 ==> τ4) → τ1 == τ3
h1 refl = refl
htyp-eq-dec (τ1 ==> τ2) (·∀ τ3) = Inr (λ ())
htyp-eq-dec (·∀ τ1) b = Inr (λ ())
htyp-eq-dec (·∀ τ1) (T x) = Inr (λ ())
htyp-eq-dec (·∀ τ1) ⦇-⦈ = Inr (λ ())
htyp-eq-dec (·∀ τ1) (τ2 ==> τ3) = Inr (λ ())
htyp-eq-dec (·∀ τ1) (·∀ τ2) with htyp-eq-dec τ1 τ2
... | Inl refl = Inl refl
... | Inr neq = Inr λ x → neq (h1 x)
where
h1 : ·∀ τ1 == ·∀ τ2 → τ1 == τ2
h1 refl = refl