Commit Graph

339 Commits

Author SHA1 Message Date
rhiannon morris d5f4a012c5 add source locations to inner syntax 2023-05-02 03:06:25 +02:00
rhiannon morris 30fa93ab4e refactor core syntax slightly to derive Eq/Show
add a new `WithSubst tm env to` record that packages a `tm from`
with a `Subst env from to`, and write instances for just that. the
rest of the AST can be derived
2023-04-27 21:37:20 +02:00
rhiannon morris 7e079a9668 add file locations to Parser.Syntax
they're immediately thrown away currently. but one step at a time
2023-04-26 06:12:03 +02:00
rhiannon morris b5f42cde64 remove big mutual blocks in parser 2023-04-26 02:28:08 +02:00
rhiannon morris adebfe090c error message tweaks 2023-04-24 23:19:15 +02:00
rhiannon morris b74ffa0077 rewrite parser
previously it backtracked too much, so instead of giving a useful
parse error, it just said "expected end of input" at the beginning of
the problem toplevel. which, if it's a namespace, could be way off.
2023-04-24 22:25:04 +02:00
rhiannon morris a4ffd74625 fix the most embarrassing quantity mistake ever 2023-04-20 19:29:57 +02:00
rhiannon morris 3f06e8d68b allow multiple names in a binder
e.g. "(x y : ℕ) × plus x y ≡ 10 : ℕ"

fixes #2
2023-04-19 21:37:51 +02:00
rhiannon morris b666bc20cf do scope checking in FromParser where it belongs 2023-04-18 22:55:23 +02:00
rhiannon morris 55c0bf9974 fix skipping files 2023-04-18 00:10:53 +02:00
rhiannon morris 4578b30c79 namespaces work now 2023-04-18 00:10:53 +02:00
rhiannon morris 4db373a84f use constraints when checking δ
when checking δ 𝑖 ⇒ s, add 𝑖=ε to Ψ instead of checking s‹ε/𝑖›.
this has the same effect but an error message will show "𝑖, 𝑖=ε" in
the context
2023-04-17 22:02:40 +02:00
rhiannon morris ac85dc9352 don't put a ∷ℕ on nat literals that's silly 2023-04-17 22:02:40 +02:00
rhiannon morris 06b159973f pretty printing fixes 2023-04-17 21:45:05 +02:00
rhiannon morris 682965eebd 0∨1 is not undefined it's ω 2023-04-17 21:42:33 +02:00
rhiannon morris 6428d39ce1 semicolons between decls in namespaces 2023-04-17 21:41:00 +02:00
rhiannon morris 3fb8580f85 re-add tightening and use it when messing with scopes
e.g. "coe [_ ⇒ A] @p @q s" should immediately reduce to "s",
but if the "_ ⇒ A" happened to use an SY it didn't.

this will still happen if a wrong SY sneaks in but the alternative is
re-traversing the term over and over every time whnf runs
2023-04-17 20:56:31 +02:00
rhiannon morris a5ccf0215a coercions and compositions 2023-04-15 15:13:01 +02:00
rhiannon morris a42e82c355 type-case 2023-04-03 17:46:23 +02:00
rhiannon morris 1211272420 factor out some pretty printing stuff 2023-04-02 15:52:55 +02:00
rhiannon morris e1dbf272df rename EqualE to just Equal & add runEqual 2023-04-02 15:52:55 +02:00
rhiannon morris 38dbd275a1 add `case0` to syntax since that is possible sometimes 2023-04-02 15:52:55 +02:00
rhiannon morris ba2818a865 remove IsQty interface 2023-04-01 19:16:43 +02:00
rhiannon morris 924fd991f9 fix equality types 2023-04-01 16:02:02 +02:00
rhiannon morris 15f6f4c8a4 fix nat elim quantities 2023-04-01 16:01:53 +02:00
rhiannon morris 036e2bd4a5 fix case-box typing 2023-04-01 16:01:31 +02:00
rhiannon morris 1fce4d80f6 add box patterns to the parser oops 2023-04-01 15:59:16 +02:00
rhiannon morris a17752f31c fix up tests 2023-03-31 23:43:25 +02:00
rhiannon morris 5e220da2f4 a half-implemented verified dimeq 2023-03-31 19:34:24 +02:00
rhiannon morris 1ab0e42605 print a slightly better error if 'case' has no qty 2023-03-31 19:33:40 +02:00
rhiannon morris c8fbd73ea4 use names when pretty printing contexts 2023-03-31 19:30:55 +02:00
rhiannon morris ad942b2fd8 printing for most of FromParserError 2023-03-31 19:29:15 +02:00
rhiannon morris 2b2f79fca9 fix some typing mistakes 2023-03-31 19:26:55 +02:00
rhiannon morris 36609713ac mtl ⇒ eff 2023-03-31 19:26:24 +02:00
rhiannon morris 8a9b4c23dd box type 2023-03-31 19:26:24 +02:00
rhiannon morris 7d36a7ff54 allow matching at 0 where appropriate
(for pairs, and for enums with 0 or 1 constructors)
2023-03-27 00:08:09 +02:00
rhiannon morris 137962c176 add missing %default total 2023-03-27 00:07:39 +02:00
rhiannon morris 773f6372ea quantities in case don't need to be *exactly* the same
...as long as they are all compatible with the target.
for example, given ω.n : ℕ:
```
  case double_it? return ℕ of {
    'true  ⇒ plus n n;
    'false ⇒ n
  }
```
2023-03-27 00:01:32 +02:00
rhiannon morris f620dda639 fix error message 2023-03-26 16:15:30 +02:00
rhiannon morris 5df2a4538c more tests 2023-03-26 16:15:19 +02:00
rhiannon morris 5560cb6708 move 'enum' to Syntax.Base 2023-03-26 16:14:58 +02:00
rhiannon morris e6c4203b46 print ; between case branches 2023-03-26 16:13:36 +02:00
rhiannon morris 46e13c8ca2 don't print empty contexts in errors 2023-03-26 16:11:11 +02:00
rhiannon morris 84e1cc78cc use a SnocVect for subN 2023-03-26 16:09:47 +02:00
rhiannon morris 7e3a8e72bd clean up printing of contexts
- just π.x : A instead of π.(x : A)
- skip the " |" if the dctx is empty
2023-03-26 14:41:48 +02:00
rhiannon morris 78e48911d0 check that an enum case head has the right type
haha oops
2023-03-26 14:41:20 +02:00
rhiannon morris 9250789219 natural numbers 2023-03-26 14:40:54 +02:00
rhiannon morris fae534dae0 tweaks in equality checking 2023-03-26 14:38:37 +02:00
rhiannon morris 5053e9b234 remove inject stuff
injecting from m to (n+m) is just id ::: id ::: ... ::: shift n.
specifically, injecting from 0 is just the shift. so.
2023-03-25 22:44:30 +01:00
rhiannon morris 5945265867 some DimEq tests 2023-03-25 20:55:38 +01:00
rhiannon morris 75376619f9 move pretty stuff for DimEq 2023-03-25 20:54:31 +01:00
rhiannon morris ab73c474c3 add DimEq.wf and export some things to make it work 2023-03-25 20:51:10 +01:00
rhiannon morris 5a994ac0e2 derive Eq,Ord,Show for DimEq 2023-03-25 20:51:10 +01:00
rhiannon morris ab82883214 add weakD 2023-03-25 20:48:49 +01:00
rhiannon morris 100063ab91 add runPrettyWith, etc 2023-03-25 20:48:26 +01:00
rhiannon morris 443da20c4b print non-dependent function types as "π.A → B" 2023-03-18 23:33:18 +01:00
rhiannon morris 8f0f0c1891 "1.(x: A) → B" instead of "(1.x: A) → B"
also "1.A → B"
2023-03-18 23:27:27 +01:00
rhiannon morris ebf6aefb1d parser tweaks
qtys and dims don't allow useless parens any more. everything else
should be the same
2023-03-18 20:03:01 +01:00
rhiannon morris ea24d00544 print non-dependent products (easy mode)
only if the AST uses SN, like with Eq
2023-03-18 02:46:41 +01:00
rhiannon morris 958bc2f8b8 quote tags in printing if they're not identifiers 2023-03-18 02:45:43 +01:00
rhiannon morris f2272da4b4 replace '≔' and '·' with '=' and (only) '.' 2023-03-18 02:43:58 +01:00
rhiannon morris 8cf260ee2e reorder some imports 2023-03-17 21:50:04 +01:00
rhiannon morris f814b01c5c quote tags in printer when needed 2023-03-16 18:39:24 +01:00
rhiannon morris be94422668 move name lexing stuff to Quox.Name 2023-03-16 18:34:49 +01:00
rhiannon morris b9825fee55 ?????? 2023-03-16 18:20:33 +01:00
rhiannon morris f5fa63a6df some pretty printing tests 2023-03-16 18:19:17 +01:00
rhiannon morris 6dc7177be5 use NContext/SnocVect for scope name lists etc 2023-03-16 18:18:49 +01:00
rhiannon morris 32f38238ef pretty printing errors 2023-03-15 15:54:51 +01:00
rhiannon morris 54ba4e237f use snoclists in pretty printing
i think the names were in the wrong sometimes!!!
2023-03-15 15:53:39 +01:00
rhiannon morris c9b9f66693 rename 'prettyTerm' to 'prettyIO'
it meant pretty*Terminal*, but,
2023-03-15 15:42:28 +01:00
rhiannon morris 86d21caf24 put names into contexts, and contexts into errors 2023-03-14 16:04:41 +01:00
rhiannon morris f4af1a5a78 split up Quox.Typing 2023-03-13 21:41:57 +01:00
rhiannon morris ecd3be8bda "WhnfErr" ⇒ "WhnfError" 2023-03-13 19:39:29 +01:00
rhiannon morris 765c62866a more FromParser 2023-03-13 19:33:09 +01:00
rhiannon morris 90232dd1f8 rename some things to get rid of warnings 2023-03-13 19:32:52 +01:00
rhiannon morris 7f46537cbc "abstract" ⇒ "postulate"
abstracts still have a body, just not always visible. which i will deal
with Later
2023-03-13 19:31:05 +01:00
rhiannon morris 8e9b0abb34 Show Telescope 2023-03-13 18:25:07 +01:00
rhiannon morris c81aabcc14 more parser/FromParser stuff
- top level semicolons optional
- type optional [the def will need to be an elim]
- `load` statement
- namespaces
2023-03-12 18:28:37 +01:00
rhiannon morris d9bc68446f more fromparser stuff 2023-03-10 21:52:29 +01:00
rhiannon morris 426c138c2b clean up some old unused stuff 2023-03-08 22:33:52 +01:00
rhiannon morris 88985405ce change some single-character constructor names 2023-03-08 17:13:51 +01:00
rhiannon morris 47fca359f4 fix weird IsReserved issue 2023-03-06 12:04:43 +01:00
rhiannon morris 757ea89b0f add definitions to parser 2023-03-06 12:04:29 +01:00
rhiannon morris ab2508e0ce add fromPTerm, etc 2023-03-05 16:50:05 +01:00
rhiannon morris b7acf39c39 remove universe type 2023-03-05 16:48:29 +01:00
rhiannon morris 0cae84c75b add module Parser.Syntax with PTerm and toPTerm 2023-03-05 14:55:04 +01:00
rhiannon morris 02b94ab705 split check and checkType. UAny is kill 2023-03-05 13:14:25 +01:00
rhiannon morris 21da2d1d21 add - as an idCont char 2023-03-05 12:18:39 +01:00
rhiannon morris edeee68cb7 parser 2023-03-04 21:35:09 +01:00
rhiannon morris 95a6644a6c rename <&&>/<||> to andM/orM 2023-03-03 12:19:15 +01:00
rhiannon morris 841564f69f fix typo in comment 2023-03-02 19:56:22 +01:00
rhiannon morris 0a2d05818e fix fixities 2023-03-02 19:56:16 +01:00
rhiannon morris fc3c2dc8ab sop → elab-util 2023-03-02 19:52:32 +01:00
rhiannon morris dbe248be9a lexer 2023-02-28 20:51:54 +01:00
rhiannon morris cacb3225a2 unicode stuff 2023-02-27 07:27:27 +01:00
rhiannon morris 28356200c1 pretty printer refactoring 2023-02-26 14:54:18 +01:00
rhiannon morris 75ef078b4b don't print substitutions by default 2023-02-26 11:25:11 +01:00
rhiannon morris 8447098f28 look through substitutions in Q.S.T.Split 2023-02-26 11:24:28 +01:00
rhiannon morris e896b24f58 print ` before enum types 2023-02-26 11:23:43 +01:00
rhiannon morris eaf679edf7 print dimension app with an @ 2023-02-26 11:22:44 +01:00
rhiannon morris ab63edf572 print bound vars as e.g. x#1 instead of x:1 2023-02-26 11:21:47 +01:00
rhiannon morris 4826c35ad6 rearrange some auto args for better overriding 2023-02-26 11:21:25 +01:00
rhiannon morris 82a2f92ddf pprint universes as a direct suffix
in subscript in unicode mode
2023-02-26 11:20:06 +01:00
rhiannon morris fbfbe57266 change some highlighting 2023-02-26 11:18:11 +01:00
rhiannon morris 60f07a938e move pushSubsts to Q.S.T.Subst 2023-02-26 11:17:42 +01:00
rhiannon morris 55cdb19a4c replace ⇒ with . in lambdas, etc
also remove some weird duplication in the tests
2023-02-26 11:16:29 +01:00
rhiannon morris 79a828449a use ★ for Type in unicode mode 2023-02-25 19:14:26 +01:00
rhiannon morris 4b284d6e01 rename λᴰ to δ
sorry fen
2023-02-25 19:14:11 +01:00
rhiannon morris 302de6266e nicer constructors for ASTs 2023-02-25 15:26:11 +01:00
rhiannon morris 4b814d7502 fix quantity in CasePair typing 2023-02-23 10:04:00 +01:00
rhiannon morris efca9a7138 add enums, which also need whnf to be fallible :( 2023-02-22 07:45:10 +01:00
rhiannon morris 0e481a8098 new representation for scopes 2023-02-22 07:40:19 +01:00
rhiannon morris c75f1514ba add BoolExtra 2023-02-22 05:42:56 +01:00
rhiannon morris 1a7efc104e Replace subst overloading with interfaces too (mostly) 2023-02-20 22:22:49 +01:00
rhiannon morris cb5bd6c98c make overloaded reduce stuff into interfaces
this is kinda a pain so i might change it back i guess
2023-02-20 21:42:31 +01:00
rhiannon morris 56791e286d make typechecker NotClo args implicit 2023-02-20 21:42:21 +01:00
rhiannon morris f959dc28fe add Functor etc for IfConsistent 2023-02-20 21:38:47 +01:00
rhiannon morris 7895fa37e5 Q.S.T.Reduce ⇒ Q.Reduce and make it use Definition directly 2023-02-19 18:54:59 +01:00
rhiannon morris ae43c324c0 remove commented modules from ipkg 2023-02-19 18:22:27 +01:00
rhiannon morris 85a55f8123 wrap type errors in extra context 2023-02-19 17:54:39 +01:00
rhiannon morris 858b5db530 check for 0=1 in typechecker 2023-02-19 17:51:44 +01:00
rhiannon morris 195791e158 export isSubSing 2023-02-19 17:43:49 +01:00
rhiannon morris 27e61011ac %inline 2023-02-19 17:43:14 +01:00
rhiannon morris 810de09f61 zeroIsSubj/zeroIsGlobal work on all zeroes 2023-02-19 17:42:11 +01:00
rhiannon morris e375d008e5 comments etc 2023-02-19 17:04:57 +01:00
rhiannon morris d71ac8c34d rename Equal.Env to CmpContext 2023-02-19 17:02:13 +01:00
rhiannon morris cba6dafc58 remove unused confusing ClashE 2023-02-19 17:00:51 +01:00
rhiannon morris f22f194dc5 add `super` counterparts to `sub` 2023-02-14 22:29:06 +01:00
rhiannon morris bee6eeacdf pass a `TyContext` into `equal` etc, rather than its components 2023-02-14 22:28:10 +01:00
rhiannon morris 065ebedf2d use DimEq directly in typing context 2023-02-14 21:29:04 +01:00
rhiannon morris 4b7379f094 fix tiny bug in dimeq 2023-02-14 21:28:50 +01:00
rhiannon morris 802dfae493 slight simplify 2023-02-14 21:16:20 +01:00
rhiannon morris c40e6a60ff remove input qctx since it isn't used 2023-02-14 21:14:47 +01:00
rhiannon morris 534e0d2270 return () from check0
since it always returns 𝟎 anyway
2023-02-13 22:06:03 +01:00
rhiannon morris fe8c224299 write quantities before names in binders again
also fixup comments in typechecker
2023-02-13 22:05:27 +01:00
rhiannon morris a6f43a772e more equality & tests 2023-02-12 21:30:08 +01:00
rhiannon morris 7d2c3b5a8e more typed equality, uip, etc 2023-02-11 18:15:50 +01:00
rhiannon morris 7fd7a31635 write variables as #𝑖
previously non-coloured output was too ambiguous
2023-02-11 18:14:31 +01:00
rhiannon morris ac0334ca4c reexport needed types from Term.Split 2023-02-11 18:14:12 +01:00
rhiannon morris 8de5803cba add Context.unzip 2023-02-11 18:13:44 +01:00
rhiannon morris 42798f243f typed equality 2023-02-10 21:52:40 +01:00
rhiannon morris 3b13f0a82c silence a warning 2023-02-02 14:58:36 +01:00
rhiannon morris 4b36d8b7c8 pair stuff 2023-01-26 19:55:08 +01:00
rhiannon morris 6073ab4705 replace Split stuff with bools 2023-01-23 03:39:46 +01:00
rhiannon morris f0f49d9abf ScopeTerms that can bind multiple vars 2023-01-23 03:22:50 +01:00
rhiannon morris 92617a2e4a whnf actually reduces to whnf now (probably) 2023-01-23 03:02:55 +01:00
rhiannon morris f097e1c091 start of equality type stuff 2023-01-21 02:34:28 +01:00
rhiannon morris 8acc3aeadf visibility fix 2023-01-21 01:41:30 +01:00
rhiannon morris 8a2eea22fb make Definitions.isZero a predicate 2023-01-21 01:41:21 +01:00
rhiannon morris b25e5320d9 some more properties of var 2023-01-12 16:03:09 +01:00
rhiannon morris ef8b8b0da3 index Var.Compare by compare
i may go back on this if it's too annoying
2023-01-10 00:17:24 +01:00
rhiannon morris f405aeb7f9 simplify some matches 2023-01-09 23:45:21 +01:00
rhiannon morris 82795e9976 remove IsOne stuff; add timesSubj 2023-01-09 23:43:55 +01:00
rhiannon morris 28055c0f39 add Decidable-related stuff 2023-01-09 23:43:23 +01:00
rhiannon morris 84e524c978 make typechecker actually pass the dimeq to subT
also erase some length arguments
2023-01-09 19:03:21 +01:00
rhiannon morris c45a963ba0 parameterise over qty semiring 2023-01-08 20:44:25 +01:00
rhiannon morris 28eb99c091 style tweaks 2023-01-08 15:44:20 +01:00
rhiannon morris 0c1b3a78c3 remove ope stuff too 2023-01-08 15:43:54 +01:00
rhiannon morris 9dbd0b066c AnyTerm.(.def) => (.get) 2023-01-08 15:07:01 +01:00
rhiannon morris 98fa8d9967 mode eq mode into a reader 2023-01-08 14:59:25 +01:00
rhiannon morris 8443b2f6d8 remove lex/parse stuff for now 2023-01-08 14:58:18 +01:00
rhiannon morris 881b22eee6 %inline 2022-11-01 21:07:52 +01:00
rhiannon morris 68dd93c02e remove a believe_me 2022-11-01 21:05:04 +01:00
rhiannon morris ad794d4441 idris 0.6.0 [with temporary flake fork] 2022-10-30 18:05:30 +01:00
rhiannon morris 8a55cc9581 unfold definitions in equality checking, plus cleanup 2022-08-23 05:43:23 +02:00
rhiannon morris 44778825c2 add Definitions module 2022-08-22 10:29:58 +02:00
rhiannon morris 413c454898 pretty print E constructor as [brackets] 2022-08-22 10:08:18 +02:00
rhiannon morris 6dd18d89bd Uninhabited instances 2022-08-22 10:07:46 +02:00
rhiannon morris 77e94a3033 oops Shift.drop1 and ssDown were the same 2022-08-18 20:39:19 +02:00
rhiannon morris bc9344c6ba some reduction tests & fixes 2022-05-25 16:10:19 +02:00
rhiannon morris 2b756ae1bb tiny tweak 2022-05-25 16:03:23 +02:00
rhiannon morris 3cf246b4dc merge Quox.{Syntax.Term.}Reduce 2022-05-25 16:00:49 +02:00
rhiannon morris cde2a9b0d6 derive impls where possible 2022-05-13 07:18:49 +02:00
rhiannon morris 274ecfb58c normalizeNfc 2022-05-12 07:42:33 +02:00
rhiannon morris c743a99356 char class stuff 2022-05-10 22:44:11 +02:00
rhiannon morris 123e4b6ab4 general categories 2022-05-10 06:28:37 +02:00
rhiannon morris a26eba7d7f parser stuff 2022-05-09 18:31:30 +02:00
rhiannon morris 50a2ec02cb parser stuff 2022-05-08 20:03:18 +02:00
rhiannon morris 756bc5b9f3 fromInteger for universe 2022-05-08 20:02:21 +02:00
rhiannon morris 1e7a6cf01f parser stuff 2022-05-08 05:41:55 +02:00
rhiannon morris fcbc92e54c more tokens 2022-05-07 22:02:13 +02:00
rhiannon morris 809a0fc859 simplify lexical grammar
this is a core language after all
2022-05-07 21:26:16 +02:00
rhiannon morris 715a9fe8f9 Show for Name and Dim 2022-05-07 00:57:23 +02:00
rhiannon morris 804f1e3638 remove src directories 2022-05-06 22:01:44 +02:00
rhiannon morris 79211cff84 start of parser stuff 2022-05-06 21:58:32 +02:00
rhiannon morris 1dd4ff0e22 lex . and ω (and #) 2022-05-06 21:37:00 +02:00
rhiannon morris 49c43ad296 heartbreaking: Quox.Error doesn't actually work 2022-05-06 21:24:01 +02:00
rhiannon morris 1931f954fb renamings 2022-05-04 20:13:56 +02:00
rhiannon morris f5f2c4399e move lib to subdir 2022-05-04 17:44:38 +02:00