This commit avoids cleaning dummy dependent types in the arities of inductive
types. This is an overkilling solution to the problem of avoiding cleaning
dummy dependent types in the left products in the arities of inductive types.
The left products should be _syntactically_ the same as those of the
constructors. Otherwise, error reporting is incorrect.
New check implemented: the sort of each constructor should be constrained by
the sort of its inductive type.
Note: I just realized that nobody implements the check that the left
abstractions of each constructors/inductive type must be exactly the same.
To be implemented.
The file bug_universi.ma shows a strage case where the ranked universe
graph does not contain any universe for one object that does contain a
user-provided universe. In turns, this make check.ml fail (since no constraint
is defined between Type0, which occurs in the object, and Type1).
Bug fixed: since circular <= graphs are allowed, added an avoid list to
avoid looping.
Even more code semplification.
Little optimization: adding x <= x does nothing
The code for universes was not correct in many borderline cases.
The new code should be correct. For sure, it is much simpler, shorter,
characterized by better invariants and its interface has less functions.
Enrico Tassi [Thu, 15 May 2008 12:39:00 +0000 (12:39 +0000)]
Major code semplification and bugs removed (thanks to a better invariant):
small_delta_step always put the terms in WHNF, even if it can do that with delta > 0.
Terms in WHNF, delta=0 that are not head-alpha convertible and tail-machine convertible
are not convertible.
- is_closed removed from the kernel (it used to make a loose test, replaced
with a tighter one)
- does_not_occur no longer calls lift (performance improvement)
- does_not_occur: bug fixed in management of Metas
New implementation of CicEnvironment:
a) I have splitted out nCicLibrary from nCicEnvironment
b) Recursion changed: the nCicTypechecker now registers itself to the
nCicEnvironment. Then it is the nCicEnvironment.get_obj that retrieves
an object from the library before calling the registered typecheck_obj
c) The logger is now called every time NCicTypechecker.get_obj is invoked,
both by the nCicEnvironment and by another module
Enrico Tassi [Mon, 5 May 2008 17:02:26 +0000 (17:02 +0000)]
get_check_fix and cofix unified, bug regarding debruijnation of constructors types fixed everywhere.
the constructor typs are debruinated wrt some inductive type uri an not wrt
their own, thus a wrong context was created. guarded by constructors ported from the old kernel.
Enrico Tassi [Mon, 5 May 2008 13:34:10 +0000 (13:34 +0000)]
guarded_by_constructors implemented, some cleanup here and there.
fix_lefts_in_constr fixed: the inductive type list was returned with
constructors instantiated and debruijned, but with types whose arity was
instantiated with lefts too. This is wrong since we want to use these types to
build a context, that is closed, and will be put at the end of the actual
context since debruijn will make uris point to those terms
Bug fixed in handling of explicit named substitutions: it could happen that
explicit named substitution are merged not in the expected order. This happens
comparing the case of an instantiation inside and outside a (nested) section.
Thus I have added back the re-ordering of the explicit named substitution in
CicSubstitution.subst_vars and in CicReduction.unwind_aux. Moreover, I have
added to CicTypechecker.type_of_aux' the check that verifies if an explicit
named substitution is ordered.
Implementation of guarded_by_destructor is now complete w.r.t. the old kernel:
a) bug fixed in eat_lambdas_etc: we cannot apply the term to the residual
arguments since these are not left arguments
b) when the recursive argument of the nested "let rec" is safe, the formal
argument can also be considered safe.
TODO:
This implementation of condition b) could be improved by re-writing eat_lambdas
in such a way that it uses a shift_k function to add the context item to the
"context".