aboutsummaryrefslogtreecommitdiff
path: root/theories/Lists
AgeCommit message (Collapse)Author
2019-02-28Implement a method for manual declaration of implicits.Jasper Hugunin
This is intended to be separate from handling of implicit binders. The remaining uses of declare_manual_implicits satisfy a lot of assertions, giving the possibility of simplifying the interface in the future. Two disabled warnings are added for things that currently pass silently. Currently only Mtac passes non-maximal implicits to declare_manual_implicits with the force-usage flag set. When implicit arguments don't have to be named, should move Mtac over to set_implicits.
2019-01-23Pass some files to strict focusing mode.Gaëtan Gilbert
ie default goal selector ! How to do this: - change the default value of default goal selector in goal_select.ml - eval the emacs code in this commit message - compile Coq and in each erroring file repeatedly run [C-c f] (my/maybe-fix-buller-error) then [C-c C-b] (proof-process-buffer) until there are no errors (NB the first [C-c f] has no effect). You need to watch for 2 cases: - overly deep proofs where the bullets need to go beyond the list in my/bullet-stack (6 layers is enough the vast majority of the time though). The system will give you an error and you need to finish the lemma manually. - weird indentation when a bullet starts in the middle of a line and doesn't end in that line. Just reindent as you like then go to the next error and continue. ~~~emacs-lisp (defconst my/bullet-stack (list "-" "+" "*" "--" "++" "**") "Which bullets should be used, in order.") (defvar-local my/bullet-count nil "The value in the car indicates how many goals remain in the bullet at (length-1), and so on recursively. nil means we haven't started bulleting the current proof.") (defvar-local my/last-seen-qed nil) (defun my/get-maybe-bullet-error () "Extract the number of focused goals from the ! selector error message." (when-let* ((rbuf (get-buffer "*response*")) (str (with-current-buffer "*response*" (buffer-string))) (_ (string-match (rx "Error: Expected a single focused goal but " (group (+ digit))) str)) (ngoals (string-to-number (match-string 1 str)))) ngoals)) (defun my/bullet-fix-indent () "Auto indent until the next Qed/Defined, and update my/last-seen-qed." ;; (insert (format "(* %s -> %s *)\n" my/prev-count my/bullet-count)) (when-let ((qed (save-excursion (search-forward-regexp (rx (or "Defined." "Qed.")) nil t)))) (set-marker my/last-seen-qed qed) (indent-region (- (point) 1) qed))) (defun my/nth-bullet (n) "Get nth bullet, erroring if n >= length my/bullet-stack" (or (nth n my/bullet-stack) (error "Too many bullets."))) (defun my/maybe-fix-bullet-error (&optional arg) "Main function for porting a file to strict focusing. Repeatedly process your file in proof general until you get a focusing error, then run this function. Once there are no more errors you're done. Indentation commonly looks bad in the middle of fixing a proof, but will be fixed unless you start a bullet in the middle of a line and don't finish it in that line. ie in 'tac1. - tac2.\n tac3.' tac3 will get indented to align with tac2, but if tac2 finished the bullet the next action will reindent. This is a stateful process. The state is automatically reset when you get to the next proof, but if you get an error or take manual action which breaks the algorithm's expectation you can call with prefix argument to reset." (interactive "P") (unless my/last-seen-qed (setq my/last-seen-qed (set-marker (make-marker) 0))) (when (or arg (> (point) my/last-seen-qed)) (setq my/bullet-count nil) (set-marker my/last-seen-qed 0)) (when-let ((ngoals (my/get-maybe-bullet-error))) (setq my/prev-count (format "%s %s" ngoals my/bullet-count)) (if (= ngoals 0) (progn (while (and my/bullet-count (= (car my/bullet-count) 0)) (pop my/bullet-count)) (insert (concat (my/nth-bullet (- (length my/bullet-count) 1)) " ")) (setq my/bullet-count (cons (- (car my/bullet-count) 1) (cdr my/bullet-count))) (my/bullet-fix-indent)) (setq my/bullet-count (cons (- ngoals 1) my/bullet-count)) (insert (concat (my/nth-bullet (- (length my/bullet-count) 1)) " ")) (my/bullet-fix-indent)))) (bind-key "C-c f" #'my/maybe-fix-bullet-error coq-mode-map) ~~~
2018-12-19Put #[universes(template)] on all auto template spots in stdlibGaëtan Gilbert
2018-11-27Added two proofs to the Lists library. The first, Forall_inv_tail, extends ↵llee454@gmail.com
Forall_inv to assert that a property that is true for every element of a list is true for every element in the tail of the list. The second, Exists_impl, parallels Forall_impl and proves that if there exists an element in a list that satisfies a given predicate, and the predicate implies another proposition, then there exists an element in the list that satisfies the implied proposition. Both of these proofs fill natural gaps within the List library.
2018-11-14Deprecate hint declaration/removal with no specified databaseMaxime Dénès
Previously, hints added without a specified database where implicitly put in the "core" database, which was discouraged by the user manual (because of the lack of modularity of this approach).
2018-09-29New lemmas for List.vSimon Marechal
* ext_in_map * map_ext_in_iff * firstn_skipn_comm * skipn_firstn_comm * skipn_O * skipn_nil * skipn_cons * skipn_none * skipn_all * skipn_all2 * skipn_app * seq_ap * skipn_app * skipn_length * firstn_skipn_rev * firstn_rev * skipn_rev * seq_app All proofs by Anton Trunov.
2018-04-16Protecting against a "deprecated cofix" warning.Hugo Herbelin
2018-03-05Merge PR #6855: Update headers following #6543.Maxime Dénès
2018-03-02Remove VOld compatibility flag.Théo Zimmermann
2018-02-27Update headers following #6543.Théo Zimmermann
2017-11-15Make list functions returning sumbools transparentTej Chajed
Specifically Exists_dec, Forall_dec, and Forall_Exists_dec.
2017-07-04Bump year in headers.Pierre-Marie Pédrot
2017-06-01drop vo.itarget files and compute the corresponding the corresponding values ↵Matej Kosik
automatically instead
2017-03-14Fix 3 unused-intro-pattern warnings in stdlib.Théo Zimmermann
2016-10-24Remove v62 from stdlib.Théo Zimmermann
This old compatibility hint database can be safely removed now that coq-contribs do not depend on it anymore.
2016-09-29Move vector/list compat notations to their relevant filesJason Gross
Since edb55a94fc5c0473e57f5a61c0c723194c2ff414 landed, compat notations no longer modify the parser in non-compat-mode, so we can do this without breaking Ltac parsing. Also update the related test-suite files.
2016-09-26Remove spaces from around list notationsJason Gross
2016-06-18Giving a more natural semantics to injection by default.Hugo Herbelin
There were three versions of injection: 1. "injection term" without "as" clause: was leaving hypotheses on the goal in reverse order 2. "injection term as ipat", first version: was introduction hypotheses using ipat in reverse order without checking that the number of ipat was the size of the injection (activated with "Unset Injection L2R Pattern Order") 3. "injection term as ipat", second version: was introduction hypotheses using ipat in left-to-right order checking that the number of ipat was the size of the injection and clearing the injecting term by default if an hypothesis (activated with "Set Injection L2R Pattern Order", default one from 8.5) There is now: 4. "injection term" without "as" clause, new version: introducing the components of the injection in the context in left-to-right order using default intro-patterns "?" and clearing the injecting term by default if an hypothesis (activated with "Set Structural Injection") The new versions 3. and 4. are the "expected" ones in the sense that they have the following good properties: - introduction in the context is in the natural left-to-right order - "injection" behaves the same with and without "as", always introducing the hypotheses in the goal what corresponds to the natural expectation as the changes I made in the proof scripts for adaptation confirm - clear the "injection" hypothesis when an hypothesis which is the natural expectation as the changes I made in the proof scripts for adaptation confirm The compatibility can be preserved by "Unset Structural Injection" or by calling "simple injection". The flag is currently off.
2016-04-27Revert "Temporary hack to compensate missing comma while re-printing tactic"Hugo Herbelin
This reverts commit 3a2753bedf43a8c7306b1b3fc9cb37aafb78ad7a.
2016-04-27Temporary hack to compensate missing comma while re-printing tacticHugo Herbelin
"exists c1, c2".
2016-02-21Merge branch 'v8.5'Pierre-Marie Pédrot
2016-02-19Fixing bug #4582: cannot override notation [ x ].Pierre-Marie Pédrot
2016-01-21Merge branch 'v8.5'Pierre-Marie Pédrot
2016-01-20Update copyright headers.Maxime Dénès
2015-12-17Merge branch 'v8.5'Pierre-Marie Pédrot
2015-12-15Proof using: do not clear unused section hyps automaticallyEnrico Tassi
The option is still there, but not documented since it is too dangerous. Hints and type classes instances are not taking cleared variables into account.
2015-10-15Merge branch 'v8.5'Pierre-Marie Pédrot
2015-10-14Fix some typos.Guillaume Melquiond
2015-10-13Fix some typos.Guillaume Melquiond
2015-08-05Merge branch 'v8.5'Pierre-Marie Pédrot
2015-07-31Remove some outdated files and fix permissions.Guillaume Melquiond
2015-05-15Merge v8.5 into trunkHugo Herbelin
Conflicts: tactics/eauto.ml4 (merging eauto.ml4 and adapting coq_micromega.ml to new typing.ml API)
2015-05-12List.nth_error directly produces Some/None instead of value/errorPierre Letouzey
List.nth_error and List.hd_error were the only remaining places in the whole stdlib to use type "Exc" instead of "option" directly. So let's simplify things and use option everywhere. In particular, during teaching sessions about lists, we won't have anymore to explain the (lack of) difference between Exc,value,error and option,Some,None. This might cause a few incompatibilities in proof scripts, if they syntactically expect "value" or "error" to occur, but this should hopefully be very rare and quite easy to fix.
2015-05-05Merge branch 'v8.5'Pierre-Marie Pédrot
2015-05-01Giving to "subst" a more natural semantic (fixing #4214) by using allHugo Herbelin
equalities in configurations like x=y x=z === P(x,y,z) where it now produces === P(z,z,z) In particular (equations are processed from most ancient to most recent). Thanks to this, a "repeat subst" can just be a "subst" in List.v. Incidentally: moved a nf_enter to enter in subst_one, since the latter is normally called from other tactics having normalized evars.
2015-04-09Merge branch 'v8.5' into trunkPierre Letouzey
2015-04-09Prove [map_ext] using [map_ext_in].Nickolai Zeldovich
Since [map_ext_in] is more general, no need to have the same proof twice.
2015-04-09Add a [map_ext_in] lemma to List.v.Nickolai Zeldovich
Slightly broader version of the existing [map_ext]: two [map] expressions are equal if their respective functions agree on all arguments that are in the list being mapped.
2015-03-04Introducing MMaps, a modernized FMaps.Pierre Letouzey
NB: this is work-in-progress, there is currently only one provided implementation (MMapWeakList). In the same spirit as MSets w.r.t FSets, the main difference between MMaps and former FMaps is the use of a new version of OrderedType (see Orders.v instead of obsolete OrderedType.v). We also try to benefit more from recent notions such as Proper. For most function specifications, the style has changed : we now use equations over "find" instead of "MapsTo" predicates, whenever possible (cf. Maps in Compcert for a source of inspiration). Former specs are now derived in FMapFacts, so this is mostly a matter of taste. Two changes inspired by the current Maps of OCaml: - "elements" is now "bindings" - "map2" is now "merge" (and its function argument also receives a key). We now use a maximal implicit argument for "empty".
2015-03-04Introducing MMaps, a modernized FMaps.Pierre Letouzey
NB: this is work-in-progress, there is currently only one provided implementation (MMapWeakList). In the same spirit as MSets w.r.t FSets, the main difference between MMaps and former FMaps is the use of a new version of OrderedType (see Orders.v instead of obsolete OrderedType.v). We also try to benefit more from recent notions such as Proper. For most function specifications, the style has changed : we now use equations over "find" instead of "MapsTo" predicates, whenever possible (cf. Maps in Compcert for a source of inspiration). Former specs are now derived in FMapFacts, so this is mostly a matter of taste. Two changes inspired by the current Maps of OCaml: - "elements" is now "bindings" - "map2" is now "merge" (and its function argument also receives a key). We now use a maximal implicit argument for "empty".
2015-01-16Add two lemmas about firstn to the List standard library.Sébastien Hinderer
2015-01-16Lemmas related to the firstn function over lists.Sébastien Hinderer
2015-01-16ListSet: follow-up of Sebastien's last commitPierre Letouzey
More results on set_remove, in particular explicit the NoDup pre-condition. Show that NoDup is preserved by other operations.
2015-01-16Work in progress on listset.Sébastien Hinderer
2015-01-12Update headers.Maxime Dénès
2014-12-28Use [Proof using] to make sure that [List.in_flat_map] doesn't grab too many ↵Arnaud Spiwack
section variable. For some reason, the subproofs solved by [auto] had started using [Hfinjective] from the section context.
2014-12-18Adds two lemmas about hderror to the List standard library.Sébastien Hinderer
2014-12-18Implement the nodup function on lists and prove associated results.Sébastien Hinderer
2014-12-18Lists: enhanced version of Seb's last commit on Exists/ForallPierre Letouzey
2014-12-18Lists: a few results on Exists and Forall and a bit of code cleanup.Sébastien Hinderer