Skip to content

Commit

Permalink
simplified term erasure
Browse files Browse the repository at this point in the history
  • Loading branch information
cty12 committed Oct 27, 2022
1 parent 8e24539 commit 419196e
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions Erasure.agda
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,8 @@ erase (L := M) = erase L := erase M
erase (L :=? M) = erase L :=? erase M
erase (L :=✓ M) = erase L :=✓ erase M
erase (M ⟨ c ⟩) = erase M
erase (prot ℓ M) =
case ℓ of λ where
low erase M
high
erase (cast-pc g M) = erase M
erase (error e) = error e
erase ● =
erase _ =

erase-val-value : {V} (v : Value V) Value (erase V)
erase-val-value (V-addr {a[ ℓ₁ ] n} {low}) with ℓ₁
Expand Down Expand Up @@ -106,12 +101,10 @@ erase-idem (L := M) = cong₂ _:=_ (erase-idem L) (erase-idem M)
erase-idem (L :=? M) = cong₂ _:=?_ (erase-idem L) (erase-idem M)
erase-idem (L :=✓ M) = cong₂ _:=✓_ (erase-idem L) (erase-idem M)
erase-idem (M ⟨ c ⟩) = erase-idem M
erase-idem (prot ℓ M) with
... | low = erase-idem M
... | high = refl
erase-idem (cast-pc g M) = erase-idem M
erase-idem (error e) = refl
erase-idem ● = refl
erase-idem (prot ℓ M) = refl
erase-idem (error e) = refl
erase-idem ● = refl

erase-stamp-high : {V} (v : Value V) erase (stamp-val V v high) ≡ ●
erase-stamp-high (V-addr {a[ ℓ₁ ] n} {ℓ}) rewrite ℓ⋎high≡high {ℓ} = refl
Expand Down Expand Up @@ -190,10 +183,9 @@ erase-is-erased (L := M) = e-assign (erase-is-erased L) (erase-is-erased M)
erase-is-erased (L :=? M) = e-assign? (erase-is-erased L) (erase-is-erased M)
erase-is-erased (L :=✓ M) = e-assign✓ (erase-is-erased L) (erase-is-erased M)
erase-is-erased (M ⟨ c ⟩) = erase-is-erased M
erase-is-erased (prot low M) = erase-is-erased M
erase-is-erased (prot high M) = e-●
erase-is-erased (cast-pc g M) = erase-is-erased M
erase-is-erased (error e) = e-error
erase-is-erased (prot _ M) = e-●
erase-is-erased (error _) = e-●
erase-is-erased ● = e-●

-- {- Erased value does not reduce -}
Expand Down

0 comments on commit 419196e

Please sign in to comment.