always vsep scheme lets, otherwise they are unreadable
This commit is contained in:
parent
4cc50c6bcd
commit
e0ed37720f
29 changed files with 474 additions and 301 deletions
|
@ -158,6 +158,10 @@ parameters {auto _ : CanWhnf Term Interface.isRedexT}
|
|||
TYPE l tyLoc =>
|
||||
whnf defs ctx sg $ Ann s (TYPE l tyLoc) loc
|
||||
|
||||
-- (coe IOState @_ @_ s) ⇝ (s ∷ IOState)
|
||||
IOState tyLoc =>
|
||||
whnf defs ctx sg $ Ann s (IOState tyLoc) loc
|
||||
|
||||
-- η expand it so that whnf for App can deal with it
|
||||
--
|
||||
-- (coe (𝑖 ⇒ π.(x : A) → B) @p @q s)
|
||||
|
@ -210,6 +214,10 @@ parameters {auto _ : CanWhnf Term Interface.isRedexT}
|
|||
Nat tyLoc =>
|
||||
whnf defs ctx sg $ Ann s (Nat tyLoc) loc
|
||||
|
||||
-- (coe String @_ @_ s) ⇝ (s ∷ String)
|
||||
STRING tyLoc =>
|
||||
whnf defs ctx sg $ Ann s (STRING tyLoc) loc
|
||||
|
||||
-- η expand
|
||||
--
|
||||
-- (coe (𝑖 ⇒ [π. A]) @p @q s)
|
||||
|
|
|
@ -111,23 +111,26 @@ isAnn _ = False
|
|||
||| a syntactic type
|
||||
public export %inline
|
||||
isTyCon : Term {} -> Bool
|
||||
isTyCon (TYPE {}) = True
|
||||
isTyCon (Pi {}) = True
|
||||
isTyCon (Lam {}) = False
|
||||
isTyCon (Sig {}) = True
|
||||
isTyCon (Pair {}) = False
|
||||
isTyCon (Enum {}) = True
|
||||
isTyCon (Tag {}) = False
|
||||
isTyCon (Eq {}) = True
|
||||
isTyCon (DLam {}) = False
|
||||
isTyCon (Nat {}) = True
|
||||
isTyCon (Zero {}) = False
|
||||
isTyCon (Succ {}) = False
|
||||
isTyCon (BOX {}) = True
|
||||
isTyCon (Box {}) = False
|
||||
isTyCon (E {}) = False
|
||||
isTyCon (CloT {}) = False
|
||||
isTyCon (DCloT {}) = False
|
||||
isTyCon (TYPE {}) = True
|
||||
isTyCon (IOState {}) = True
|
||||
isTyCon (Pi {}) = True
|
||||
isTyCon (Lam {}) = False
|
||||
isTyCon (Sig {}) = True
|
||||
isTyCon (Pair {}) = False
|
||||
isTyCon (Enum {}) = True
|
||||
isTyCon (Tag {}) = False
|
||||
isTyCon (Eq {}) = True
|
||||
isTyCon (DLam {}) = False
|
||||
isTyCon (Nat {}) = True
|
||||
isTyCon (Zero {}) = False
|
||||
isTyCon (Succ {}) = False
|
||||
isTyCon (STRING {}) = True
|
||||
isTyCon (Str {}) = False
|
||||
isTyCon (BOX {}) = True
|
||||
isTyCon (Box {}) = False
|
||||
isTyCon (E {}) = False
|
||||
isTyCon (CloT {}) = False
|
||||
isTyCon (DCloT {}) = False
|
||||
|
||||
||| a syntactic type, or a neutral
|
||||
public export %inline
|
||||
|
@ -154,24 +157,27 @@ isK _ = False
|
|||
||| - `val` is a constructor form
|
||||
public export %inline
|
||||
canPushCoe : SQty -> (ty, val : Term {}) -> Bool
|
||||
canPushCoe sg (TYPE {}) _ = True
|
||||
canPushCoe sg (Pi {}) _ = True
|
||||
canPushCoe sg (Lam {}) _ = False
|
||||
canPushCoe sg (Sig {}) (Pair {}) = True
|
||||
canPushCoe sg (Sig {}) _ = False
|
||||
canPushCoe sg (Pair {}) _ = False
|
||||
canPushCoe sg (Enum {}) _ = True
|
||||
canPushCoe sg (Tag {}) _ = False
|
||||
canPushCoe sg (Eq {}) _ = True
|
||||
canPushCoe sg (DLam {}) _ = False
|
||||
canPushCoe sg (Nat {}) _ = True
|
||||
canPushCoe sg (Zero {}) _ = False
|
||||
canPushCoe sg (Succ {}) _ = False
|
||||
canPushCoe sg (BOX {}) _ = True
|
||||
canPushCoe sg (Box {}) _ = False
|
||||
canPushCoe sg (E {}) _ = False
|
||||
canPushCoe sg (CloT {}) _ = False
|
||||
canPushCoe sg (DCloT {}) _ = False
|
||||
canPushCoe sg (TYPE {}) _ = True
|
||||
canPushCoe sg (IOState {}) _ = True
|
||||
canPushCoe sg (Pi {}) _ = True
|
||||
canPushCoe sg (Lam {}) _ = False
|
||||
canPushCoe sg (Sig {}) (Pair {}) = True
|
||||
canPushCoe sg (Sig {}) _ = False
|
||||
canPushCoe sg (Pair {}) _ = False
|
||||
canPushCoe sg (Enum {}) _ = True
|
||||
canPushCoe sg (Tag {}) _ = False
|
||||
canPushCoe sg (Eq {}) _ = True
|
||||
canPushCoe sg (DLam {}) _ = False
|
||||
canPushCoe sg (Nat {}) _ = True
|
||||
canPushCoe sg (Zero {}) _ = False
|
||||
canPushCoe sg (Succ {}) _ = False
|
||||
canPushCoe sg (STRING {}) _ = True
|
||||
canPushCoe sg (Str {}) _ = False
|
||||
canPushCoe sg (BOX {}) _ = True
|
||||
canPushCoe sg (Box {}) _ = False
|
||||
canPushCoe sg (E {}) _ = False
|
||||
canPushCoe sg (CloT {}) _ = False
|
||||
canPushCoe sg (DCloT {}) _ = False
|
||||
|
||||
|
||||
mutual
|
||||
|
|
|
@ -225,20 +225,23 @@ CanWhnf Elim Interface.isRedexE where
|
|||
|
||||
covering
|
||||
CanWhnf Term Interface.isRedexT where
|
||||
whnf _ _ _ t@(TYPE {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Pi {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Lam {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Sig {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Pair {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Enum {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Tag {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Eq {}) = pure $ nred t
|
||||
whnf _ _ _ t@(DLam {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Nat {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Zero {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Succ {}) = pure $ nred t
|
||||
whnf _ _ _ t@(BOX {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Box {}) = pure $ nred t
|
||||
whnf _ _ _ t@(TYPE {}) = pure $ nred t
|
||||
whnf _ _ _ t@(IOState {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Pi {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Lam {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Sig {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Pair {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Enum {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Tag {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Eq {}) = pure $ nred t
|
||||
whnf _ _ _ t@(DLam {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Nat {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Zero {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Succ {}) = pure $ nred t
|
||||
whnf _ _ _ t@(STRING {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Str {}) = pure $ nred t
|
||||
whnf _ _ _ t@(BOX {}) = pure $ nred t
|
||||
whnf _ _ _ t@(Box {}) = pure $ nred t
|
||||
|
||||
-- s ∷ A ⇝ s (in term context)
|
||||
whnf defs ctx sg (E e) = do
|
||||
|
|
|
@ -99,7 +99,6 @@ parameters {auto _ : CanWhnf Term Interface.isRedexT}
|
|||
pure (a0, a1, a, l, r)
|
||||
tycaseEq t = throw $ ExpectedEq t.loc ctx.names t
|
||||
|
||||
|
||||
||| reduce a type-case applied to a type constructor
|
||||
|||
|
||||
||| `reduceTypeCase A i Q arms def _` reduces an expression
|
||||
|
@ -114,6 +113,10 @@ parameters {auto _ : CanWhnf Term Interface.isRedexT}
|
|||
TYPE {} =>
|
||||
whnf defs ctx SZero $ Ann (tycaseRhsDef0 def KTYPE arms) ret loc
|
||||
|
||||
-- (type-case IOState ∷ _ return Q of { IOState ⇒ s; ⋯ }) ⇝ s ∷ Q
|
||||
IOState {} =>
|
||||
whnf defs ctx SZero $ Ann (tycaseRhsDef0 def KIOState arms) ret loc
|
||||
|
||||
-- (type-case π.(x : A) → B ∷ ★ᵢ return Q of { (a → b) ⇒ s; ⋯ }) ⇝
|
||||
-- s[(A ∷ ★ᵢ)/a, ((λ x ⇒ B) ∷ 0.A → ★ᵢ)/b] ∷ Q
|
||||
Pi {arg, res, loc = piLoc, _} =>
|
||||
|
@ -156,6 +159,10 @@ parameters {auto _ : CanWhnf Term Interface.isRedexT}
|
|||
Nat {} =>
|
||||
whnf defs ctx SZero $ Ann (tycaseRhsDef0 def KNat arms) ret loc
|
||||
|
||||
-- (type-case String ∷ _ return Q of { String ⇒ s; ⋯ }) ⇝ s ∷ Q
|
||||
STRING {} =>
|
||||
whnf defs ctx SZero $ Ann (tycaseRhsDef0 def KString arms) ret loc
|
||||
|
||||
-- (type-case [π.A] ∷ ★ᵢ return Q of { [a] ⇒ s; ⋯ }) ⇝ s[(A ∷ ★ᵢ)/a] ∷ Q
|
||||
BOX {ty = a, loc = boxLoc, _} =>
|
||||
whnf defs ctx SZero $ Ann
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue