coq.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. /*
  2. Language: Coq
  3. Author: Stephan Boyer <stephan@stephanboyer.com>
  4. Category: functional
  5. Website: https://coq.inria.fr
  6. */
  7. /** @type LanguageFn */
  8. function coq(hljs) {
  9. const KEYWORDS = [
  10. "_|0",
  11. "as",
  12. "at",
  13. "cofix",
  14. "else",
  15. "end",
  16. "exists",
  17. "exists2",
  18. "fix",
  19. "for",
  20. "forall",
  21. "fun",
  22. "if",
  23. "IF",
  24. "in",
  25. "let",
  26. "match",
  27. "mod",
  28. "Prop",
  29. "return",
  30. "Set",
  31. "then",
  32. "Type",
  33. "using",
  34. "where",
  35. "with",
  36. "Abort",
  37. "About",
  38. "Add",
  39. "Admit",
  40. "Admitted",
  41. "All",
  42. "Arguments",
  43. "Assumptions",
  44. "Axiom",
  45. "Back",
  46. "BackTo",
  47. "Backtrack",
  48. "Bind",
  49. "Blacklist",
  50. "Canonical",
  51. "Cd",
  52. "Check",
  53. "Class",
  54. "Classes",
  55. "Close",
  56. "Coercion",
  57. "Coercions",
  58. "CoFixpoint",
  59. "CoInductive",
  60. "Collection",
  61. "Combined",
  62. "Compute",
  63. "Conjecture",
  64. "Conjectures",
  65. "Constant",
  66. "constr",
  67. "Constraint",
  68. "Constructors",
  69. "Context",
  70. "Corollary",
  71. "CreateHintDb",
  72. "Cut",
  73. "Declare",
  74. "Defined",
  75. "Definition",
  76. "Delimit",
  77. "Dependencies",
  78. "Dependent",
  79. "Derive",
  80. "Drop",
  81. "eauto",
  82. "End",
  83. "Equality",
  84. "Eval",
  85. "Example",
  86. "Existential",
  87. "Existentials",
  88. "Existing",
  89. "Export",
  90. "exporting",
  91. "Extern",
  92. "Extract",
  93. "Extraction",
  94. "Fact",
  95. "Field",
  96. "Fields",
  97. "File",
  98. "Fixpoint",
  99. "Focus",
  100. "for",
  101. "From",
  102. "Function",
  103. "Functional",
  104. "Generalizable",
  105. "Global",
  106. "Goal",
  107. "Grab",
  108. "Grammar",
  109. "Graph",
  110. "Guarded",
  111. "Heap",
  112. "Hint",
  113. "HintDb",
  114. "Hints",
  115. "Hypotheses",
  116. "Hypothesis",
  117. "ident",
  118. "Identity",
  119. "If",
  120. "Immediate",
  121. "Implicit",
  122. "Import",
  123. "Include",
  124. "Inductive",
  125. "Infix",
  126. "Info",
  127. "Initial",
  128. "Inline",
  129. "Inspect",
  130. "Instance",
  131. "Instances",
  132. "Intro",
  133. "Intros",
  134. "Inversion",
  135. "Inversion_clear",
  136. "Language",
  137. "Left",
  138. "Lemma",
  139. "Let",
  140. "Libraries",
  141. "Library",
  142. "Load",
  143. "LoadPath",
  144. "Local",
  145. "Locate",
  146. "Ltac",
  147. "ML",
  148. "Mode",
  149. "Module",
  150. "Modules",
  151. "Monomorphic",
  152. "Morphism",
  153. "Next",
  154. "NoInline",
  155. "Notation",
  156. "Obligation",
  157. "Obligations",
  158. "Opaque",
  159. "Open",
  160. "Optimize",
  161. "Options",
  162. "Parameter",
  163. "Parameters",
  164. "Parametric",
  165. "Path",
  166. "Paths",
  167. "pattern",
  168. "Polymorphic",
  169. "Preterm",
  170. "Print",
  171. "Printing",
  172. "Program",
  173. "Projections",
  174. "Proof",
  175. "Proposition",
  176. "Pwd",
  177. "Qed",
  178. "Quit",
  179. "Rec",
  180. "Record",
  181. "Recursive",
  182. "Redirect",
  183. "Relation",
  184. "Remark",
  185. "Remove",
  186. "Require",
  187. "Reserved",
  188. "Reset",
  189. "Resolve",
  190. "Restart",
  191. "Rewrite",
  192. "Right",
  193. "Ring",
  194. "Rings",
  195. "Save",
  196. "Scheme",
  197. "Scope",
  198. "Scopes",
  199. "Script",
  200. "Search",
  201. "SearchAbout",
  202. "SearchHead",
  203. "SearchPattern",
  204. "SearchRewrite",
  205. "Section",
  206. "Separate",
  207. "Set",
  208. "Setoid",
  209. "Show",
  210. "Solve",
  211. "Sorted",
  212. "Step",
  213. "Strategies",
  214. "Strategy",
  215. "Structure",
  216. "SubClass",
  217. "Table",
  218. "Tables",
  219. "Tactic",
  220. "Term",
  221. "Test",
  222. "Theorem",
  223. "Time",
  224. "Timeout",
  225. "Transparent",
  226. "Type",
  227. "Typeclasses",
  228. "Types",
  229. "Undelimit",
  230. "Undo",
  231. "Unfocus",
  232. "Unfocused",
  233. "Unfold",
  234. "Universe",
  235. "Universes",
  236. "Unset",
  237. "Unshelve",
  238. "using",
  239. "Variable",
  240. "Variables",
  241. "Variant",
  242. "Verbose",
  243. "Visibility",
  244. "where",
  245. "with"
  246. ];
  247. const BUILT_INS = [
  248. "abstract",
  249. "absurd",
  250. "admit",
  251. "after",
  252. "apply",
  253. "as",
  254. "assert",
  255. "assumption",
  256. "at",
  257. "auto",
  258. "autorewrite",
  259. "autounfold",
  260. "before",
  261. "bottom",
  262. "btauto",
  263. "by",
  264. "case",
  265. "case_eq",
  266. "cbn",
  267. "cbv",
  268. "change",
  269. "classical_left",
  270. "classical_right",
  271. "clear",
  272. "clearbody",
  273. "cofix",
  274. "compare",
  275. "compute",
  276. "congruence",
  277. "constr_eq",
  278. "constructor",
  279. "contradict",
  280. "contradiction",
  281. "cut",
  282. "cutrewrite",
  283. "cycle",
  284. "decide",
  285. "decompose",
  286. "dependent",
  287. "destruct",
  288. "destruction",
  289. "dintuition",
  290. "discriminate",
  291. "discrR",
  292. "do",
  293. "double",
  294. "dtauto",
  295. "eapply",
  296. "eassumption",
  297. "eauto",
  298. "ecase",
  299. "econstructor",
  300. "edestruct",
  301. "ediscriminate",
  302. "eelim",
  303. "eexact",
  304. "eexists",
  305. "einduction",
  306. "einjection",
  307. "eleft",
  308. "elim",
  309. "elimtype",
  310. "enough",
  311. "equality",
  312. "erewrite",
  313. "eright",
  314. "esimplify_eq",
  315. "esplit",
  316. "evar",
  317. "exact",
  318. "exactly_once",
  319. "exfalso",
  320. "exists",
  321. "f_equal",
  322. "fail",
  323. "field",
  324. "field_simplify",
  325. "field_simplify_eq",
  326. "first",
  327. "firstorder",
  328. "fix",
  329. "fold",
  330. "fourier",
  331. "functional",
  332. "generalize",
  333. "generalizing",
  334. "gfail",
  335. "give_up",
  336. "has_evar",
  337. "hnf",
  338. "idtac",
  339. "in",
  340. "induction",
  341. "injection",
  342. "instantiate",
  343. "intro",
  344. "intro_pattern",
  345. "intros",
  346. "intuition",
  347. "inversion",
  348. "inversion_clear",
  349. "is_evar",
  350. "is_var",
  351. "lapply",
  352. "lazy",
  353. "left",
  354. "lia",
  355. "lra",
  356. "move",
  357. "native_compute",
  358. "nia",
  359. "nsatz",
  360. "omega",
  361. "once",
  362. "pattern",
  363. "pose",
  364. "progress",
  365. "proof",
  366. "psatz",
  367. "quote",
  368. "record",
  369. "red",
  370. "refine",
  371. "reflexivity",
  372. "remember",
  373. "rename",
  374. "repeat",
  375. "replace",
  376. "revert",
  377. "revgoals",
  378. "rewrite",
  379. "rewrite_strat",
  380. "right",
  381. "ring",
  382. "ring_simplify",
  383. "rtauto",
  384. "set",
  385. "setoid_reflexivity",
  386. "setoid_replace",
  387. "setoid_rewrite",
  388. "setoid_symmetry",
  389. "setoid_transitivity",
  390. "shelve",
  391. "shelve_unifiable",
  392. "simpl",
  393. "simple",
  394. "simplify_eq",
  395. "solve",
  396. "specialize",
  397. "split",
  398. "split_Rabs",
  399. "split_Rmult",
  400. "stepl",
  401. "stepr",
  402. "subst",
  403. "sum",
  404. "swap",
  405. "symmetry",
  406. "tactic",
  407. "tauto",
  408. "time",
  409. "timeout",
  410. "top",
  411. "transitivity",
  412. "trivial",
  413. "try",
  414. "tryif",
  415. "unfold",
  416. "unify",
  417. "until",
  418. "using",
  419. "vm_compute",
  420. "with"
  421. ];
  422. return {
  423. name: 'Coq',
  424. keywords: {
  425. keyword: KEYWORDS,
  426. built_in: BUILT_INS
  427. },
  428. contains: [
  429. hljs.QUOTE_STRING_MODE,
  430. hljs.COMMENT('\\(\\*', '\\*\\)'),
  431. hljs.C_NUMBER_MODE,
  432. {
  433. className: 'type',
  434. excludeBegin: true,
  435. begin: '\\|\\s*',
  436. end: '\\w+'
  437. },
  438. { // relevance booster
  439. begin: /[-=]>/ }
  440. ]
  441. };
  442. }
  443. export { coq as default };