15 KiB
master branch (aka work in progress branch)
Features
-
In addition to user-defined notation parsers introduced in Lean 3.2.0, users may now also define top-level commands in Lean. For an example, see the
coinductivecommand that has been ported to the new model. -
Add new simplifier configuration option
simp_config.single_pass. It is useful for simplification rules that may produce non-termination. Example:simp {single_pass := tt} -
The rewrite tactic has support for equational lemmas. Example: Given a definition
f,rw [f]will try to rewrite the goal using the equational lemmas forf. The tactic fails if none of the equational lemmas can be used. -
Add
simp * at *variant. It acts on all (non dependent propositional) hypotheses. Simplified hypotheses are automatically inserted into the simplification set as additional simplification rules. -
Add
«id»notation that can be used to declare and refer to identifiers containing prohibited characters. For example,a.«b.c»is a two-part identifier with partsaandb.c. -
simptactic now handles lemmas with metavariables. Examplesimp [add_comm _ b]. -
conv { ... }tactic for applying simplification and rewriting steps. In the block{...}, we can use tactics fromconv.interactive. Examples:conv at h in (f _ _) { simp }appliessimpto first subterm matchingf _ _at hypothesish.conv in (_ = _) { to_lhs, whnf }replace the left-hand-side of the equality in target with its weak-head-normal-form.conv at h in (0 + _) { rw [zero_add] }conv { for (f _ _) [1, 3] {rw [h]}, simp }, first executerw[h]to the first and third occurrences of anf-application, and then executesimp.
-
simptactics in interactive mode have a new configuration parameter (discharger : tactic unit) a tactic for discharging subgoals created by the simplifier. If the tactic fails, the simplifier tries to discharge the subgoal by reducing it totrue. Example:simp {discharger := assumption}. -
simpanddsimpcan be used to unfold projection applications when the argument is a type class instance. Example:simp [has_add.add]will replace@has_add.add nat nat.has_add a bwithnat.add a b -
dsimphas several new configuration options to control reduction (e.g.,iota,beta,zeta, ...). -
Non-exhaustive pattern matches now show missing cases.
-
induction enow also works on non-variablee. Unlikeginduction, it will not introduce equalities relatingeto the inductive cases. -
Add notation
#[a, b, c, d]forbin_tree.node (bin_tree.node (bin_tree.leaf a) (bin_tree.leaf b)) (bin_tree.node (bin_tree.leaf c) (bin_tree.leaf d)). There is a coercion frombin_treetolist. The new notation allows to input long sequences efficiently. It also prevents system stack overflows. -
Tactics that accept a location parameter, like
rw thm at h, may now use⊢or the ASCII version|-to select the goal as well as any hypotheses, for examplerw thm at h1 h2 ⊢. -
Add
user_attribute.after_set/before_unsethandlers that can be used for validation as well as side-effecting attributes. -
Field notation can now be used to make recursive calls.
def list.append : list α → list α → list α
| [] l := l
| (h :: s) t := h :: s.append t
-
leanpkg now stores the intended Lean version in the
leanpkg.tomlfile and reports a warning if the version does not match the installed Lean version. -
simpanddsimpcan now unfold let-bindings in the local context. Usedsimp [x]orsimp [x]to unfold the let-bindingx : nat := 3. -
User-defined attributes can now take parameters parsed by a
lean.parser. A[derive]attribute that can derive typeclasses such asdecidable_eqandinhabitedhas been implemented on top of this.
Changes
-
We now have two type classes for converting to string:
has_to_stringandhas_repr. Thehas_to_stringtype class in v3.2.0 is roughly equivalent tohas_repr. For more details, see discussion here. -
Merged
assertandnotetactics and renamed ->have. -
Renamed
posetactic ->let -
assumeis now a real tactic that does not exit tactic mode. -
Modified
applytactic configuration object, and implemented RFC #1342. It now has support forauto_paramandopt_param. The neweapplytactic only creates subgoals for non dependent premises, and it simulates the behavior of theapplytactic in version 3.2.0. -
Add configuration object
rewrite_cfgtorw/rewritetactic. It now has support forauto_paramandopt_param. The new goals are ordered using the same strategies available forapply. -
All
dsimptactics fail if they did not change anything. We can simulate the v3.2.0 usingdsimp {fail_if_unchaged := ff}ortry dsimp. -
dsimpdoes not unfold reducible definitions by default anymore. Example:function.compapplications will not be unfolded by default. We should usedsimp [f]if we want to reduce a reducible definitionf. Another option is to use the new configuration parameterunfold_reducible. Exampledsimp {unfold_reducible := tt} -
All
dunfoldandunfoldtactics fail if they did not unfold anything. We can simulate the v3.2.0 usingunfold f {fail_if_unchaged := ff}ortry {unfold f}. -
dunfold_occswas deleted, the newconvtactical should be used instead. -
unfoldtactic is now implemented on top of thesimptactics. So, we can use it to unfold declarations defined using well founded recursion. Theunfold1variant does not unfold recursively, and it is shorthand forunfold f {single_pass := tt}. Remark: in v3.2.0,unfoldwas just an alias for thedunfoldtactic. -
Deleted
simphandsimp_using_hstactics. We should usesimp [*]instead. -
Use
simp [-h]anddsimp [-h]instead ofsimp without handdsimp without h. Moreover,simp [*, -h]ifhis a hypothesis, we are adding all hypotheses buthas additional simplification lemmas. -
Changed notation
rw [-h]torw [← h]to avoid confusion with the newsimp [-h]notation. The ASCII versionrw [<- h]is also supported. -
rw [t] at *now skips any hypothesis used byt. See discussion here. -
Removed the redundant keywords
take(replace withassume) andsuppose(replace with the new anonymousassume :) -
Universes
max u v + 1andimax u v + 1are now parsed as(max u v) + 1and(imax u v) + 1. -
Merged
generalizeandgeneralize2tactics into newgeneralize id? : expr = idtactic -
standard.leanhas been removed. Any files thatimport standardcan simply remove the line as most things that were once imported by this are now imported by default. -
The type classes for orders have been refactored to combine both the
(<)and(≤)operations. The new classes arepreorder,partial_order, andlinear_order. Thepartial_orderclass corresponds toweak_order,strict_order,order_pair, andstrong_order_pair. Thelinear_orderclass corresponds tolinear_order_pair, andlinear_strong_order_pair. -
injectionandinjectionstactics generate fresh names when user does not provide names. The fresh names are of the formh_<idx>. See discussion here. -
Use
structureto declareand. This change allows us to useh.1andh.2as shorthand forh.leftandh.right. -
Add attribute
[pp_using_anonymous_constructor]toand. Now,and.intro h1 h2is pretty printed as⟨h1, h2⟩. This change is motivated by the previous one. Without it,and.intro h1 h2would be pretty printed as{left := h1, right := h2}.
API name changes
list.dropn=>list.droplist.taken=>list.taketactic.dsimpandtactic.dsimp_core=>tactic.dsimp_targettactic.dsimp_at_coreandtactic.dsimp_at=>tactic.dsimp_hyptactic.delta_expr=>tactic.deltatactic.delta=>tactic.delta_targettactic.delta_at=>tactic.delta_hyptactic.simplify_goal=>tactic.simp_targettactic.unfold_projection=>tactic.unfold_projtactic.unfold_projections_core=>tactic.unfold_projstactic.unfold_projections=>tactic.unfold_projs_targettactic.unfold_projections_at=>tactic.unfold_projs_hyptactic.simp_intros_using,tactic.simph_intros_using,tactic.simp_intro_lst_using,tactic.simph_intro_lst_using=>tactic.simp_introstactic.simp_at=>tactic.simp_hyp- deleted
tactic.simp_at_using - deleted
tactic.simph_at
v3.2.0 (18 June 2017)
Lean is still evolving rapidly, and we apologize for the resulting instabilities. The lists below summarizes some of the new features and incompatibilities with respect to release 3.1.0.
Features
-
Holes
{! ... !}expressions and (user-defined) hole commands. In Emacs, hole commands are executed using the keybinding C-c SPC. The available commands can be found here. -
The
leanpkgpackage manager now manages projects and dependencies. See the documentation here. Parts of the standard library, like the superposition theorem proversuper, have been moved to their own repositories..projectfiles are no longer needed to useemacswith projects. -
Well-founded recursion is now supported. (Details and examples for this and the next two items will soon appear in Theorem Proving in Lean.)
-
Mutually (non meta) recursive definitions are now supported.
-
Nested and mutual inductive data types are now supported.
-
There is support for coinductive predicates.
-
The
simptactic has been improved and supports more options, like wildcards. Hover oversimpin an editor to see the documentation string (docstring). -
Additional interactive tactics have been added, and can be found here.
-
A
casetactic can now be used to structure proofs by cases and by induction. See here. -
Various data structures, such as hash maps, have been added to the standard library here.
-
There is preliminary support for user-defined parser extensions. More information can be found here, and some examples can be found here.
-
Numerous improvements have been made to the parallel compilation infrastructure and editor interfaces, for example, as described here and here.
-
There is a
transfermethod that can be used to transfer results e.g. to isomorphic structures; see here. -
The monadic hierarchy now includes axioms for monadic classes. (See here.)
-
The tactic notation
tac ; [tac_1, ..., tac_n]has been added. -
The type classes
has_well_founded,has_map,has_seq,has_orelsehave been added. -
Type classes can have input/output parameters. Some examples can be found here.
-
tactic.run_iocan now be used to perform IO in tactics.
Changes
-
Type class instances are not
[reducible]by default anymore. -
Commands that produce output are now preceded by a hash symbol, as in
#check,#print,#evaland#reduce. The#evalcommand calls the bytecode evaluator, and#reducedoes definitional reduction in the kernel. Many instances of alternative syntax likepremiseforvariableandhypothesisforparameterhave been eliminated. See the discussion here. -
The hierarchy of universes is now named
Sort 0,Sort 1,Sort 2, and so on.Propis alternative syntax forSort 0,Typeis alternative syntax forSort 1, andType nis alternative syntax forSort (n + 1). Many general constructors have been specialized from arbitrarySorts toTypein order to simplify elaboration. -
Automatically generate dependent eliminators for inductive predicates.
-
Improve unification hint matcher.
-
Improve unifier. In function applications, explicit arguments are unified before implicit ones. Moreover, more aggresive unfolding is used when processing implicit arguments.
-
Use
universe uinstead ofuniverse variable uto declare a universe variable. -
The syntax
l^.map ffor projections is now deprecated in favor ofl.map f. -
The behavior of the
showtactic in interactive tactic mode has changed. It no longer leaves tactic mode. Also, it can now be used to select a goal other than the current one. -
The
assertvanddefinevtactics have been eliminated in favor ofnoteandpose. -
has_andthentype class is now heterogeneous, -
The encoding of structures has been changed, following the strategy described here. Generic operations like
addandmulare replaced byhas_add.addandhas_mul.mul, respectively. One can provisionally obtain the old encodings withset_option old_structure_cmd true. -
Syntax for quotations in metaprograms has changed. The notation
`(t)elaboratestat definition time and produces an expression. The notation``(t)resolves names at definition time produces a pre-expression, and```(t)resolves names at tactic execution time, and produces a pre-expression. Details can be found in the paper Ebner et al, A Metaprogramming Framework for Formal Verification. -
The types
exprfor expressions andpexprfor pre-expressions have been unified, so thatpexpris defined asexpr ff. See here. -
Handling of the
iomonad has changed. Examples can be found here in the code forleanpkg, which is written in Lean itself.
stateandstate_tare universe polymorphic.
-
option_mapandoption_bindhave been renamed tooption.mapandoption.bind, respectively. -
GCC 7 compatibility
-
Use single quotes for character literals (e.g., 'a').