"abstract" ⇒ "postulate"

abstracts still have a body, just not always visible. which i will deal
with Later
This commit is contained in:
rhiannon morris 2023-03-13 19:31:05 +01:00
parent 8e9b0abb34
commit 7f46537cbc
3 changed files with 39 additions and 27 deletions

View file

@ -12,12 +12,18 @@ record AnyTerm q where
constructor T
get : forall d, n. Term q d n
public export
data DefBody q =
Concrete (AnyTerm q)
| Postulate
public export
record Definition' q (isGlobal : Pred q) where
constructor MkDef'
constructor MkDef
qty : q
type : AnyTerm q
term : Maybe $ AnyTerm q
body : DefBody q
{auto 0 qtyGlobal : isGlobal qty}
public export
@ -27,12 +33,12 @@ Definition q = Definition' q IsGlobal
public export %inline
mkDef : IsQty q => (qty : q) -> (0 _ : IsGlobal qty) =>
(type, term : forall d, n. Term q d n) -> Definition q
mkDef qty type term = MkDef' {qty, type = T type, term = Just (T term)}
mkDef qty type term = MkDef {qty, type = T type, body = Concrete (T term)}
public export %inline
mkAbstract : IsQty q => (qty : q) -> (0 _ : IsGlobal qty) =>
mkPostulate : IsQty q => (qty : q) -> (0 _ : IsGlobal qty) =>
(type : forall d, n. Term q d n) -> Definition q
mkAbstract qty type = MkDef' {qty, type = T type, term = Nothing}
mkPostulate qty type = MkDef {qty, type = T type, body = Postulate}
public export %inline
@ -43,9 +49,15 @@ public export %inline
(.type0) : Definition' q _ -> Term q 0 0
g.type0 = g.type.get
public export %inline
(.term) : Definition' q _ -> Maybe (AnyTerm q)
g.term = case g.body of
Concrete t => Just t
Postulate => Nothing
public export %inline
(.term0) : Definition' q _ -> Maybe (Term q 0 0)
g.term0 = map (\t => t.get) g.term
g.term0 = map (\x => x.get) g.term
public export %inline
(.qtyP) : forall q, isGlobal. Definition' q isGlobal -> Subset q isGlobal