diff options
| author | sacerdot | 2005-01-03 19:25:36 +0000 |
|---|---|---|
| committer | sacerdot | 2005-01-03 19:25:36 +0000 |
| commit | 977ed2c9596ce455719521d3bcb2a02fac98ceb8 (patch) | |
| tree | ee41075c643a206404e09ec5b127e77abe54832e /pretyping/recordops.ml | |
| parent | 0c9329df2466c38b5cea09426e1981dc35278fa2 (diff) | |
HUGE COMMIT
1. when applying a functor F(X) := B to a module M, the obtained module
is no longer B{X.t := M.t for all t}, but B{X.t := b where b is the
body of t in M}. In principle it is now easy to fine tune the behaviour
to choose whether b or M.t must be used. This change implies modifications
both inside and outside the kernel.
2. for each object in the library it is now necessary to define the behaviour
w.r.t. the substitution {X.t := b}. Notice that in many many cases the
pre-existing behaviour w.r.t. the substitution {X.t := M.t} was broken
(in the sense that it used to break several invariants). This commit
fixes the behaviours for most of the objects, excluded
a) coercions: a future commit should allow any term to be declared
as a coercion; moreover the invariant that just a coercion path
exists between two classes will be broken by the instantiation.
b) global references when used as arguments of a few tactics/commands
In all the other cases the behaviour implemented is the one that looks
to me as the one expected by the user (if possible):
[ terminology: not expanded (X.t := M.t) vs expanded (X.t := b) ]
a) argument scopes: not expanded
b) SYNTAXCONSTANT: expanded
c) implicit arguments: not expanded
d) coercions: expansion to be done (for now not expanded)
e) concrete syntax tree for patterns: expanded
f) concrete syntax tree for raw terms: expanded
g) evaluable references (used by unfold, delta expansion, etc.): not
expanded
h) auto's hints: expanded when possible (i.e. when the expansion of the
head of the pattern is rigid)
i) realizers (for program extraction): nothing is done since the actual
code does not look for the realizer of definitions with a body;
however this solution is fragile.
l) syntax and notation: expanded
m) structures and canonical structures: an invariant says that no
parameter can happear in them ==> the substitution always yelds the
original term
n) stuff related to V7 syntax: since this part of the code is doomed
to disappear, I have made no effort to fix a reasonable semantics;
not expanded is the default one applied
o) RefArgTypes: to be understood. For now a warning is issued whether
expanded != not expanded, and the not expanded solution is chosen.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@6555 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping/recordops.ml')
| -rwxr-xr-x | pretyping/recordops.ml | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/pretyping/recordops.ml b/pretyping/recordops.ml index 4cbd02ca4d..cc53ae7f3f 100755 --- a/pretyping/recordops.ml +++ b/pretyping/recordops.ml @@ -47,9 +47,12 @@ let cache_structure (_,(ind,struc)) = let subst_structure (_,subst,((kn,i),struc as obj)) = let kn' = subst_kn subst kn in - let proj' = list_smartmap - (option_smartmap (subst_con subst)) - struc.s_PROJ + let proj' = + (* invariant: struc.s_PROJ is an evaluable reference. Thus we can take *) + (* the first component of subst_con. *) + list_smartmap + (option_smartmap (fun kn -> fst (subst_con subst kn))) + struc.s_PROJ in if proj' == struc.s_PROJ && kn' == kn then obj else (kn',i),{struc with s_PROJ = proj'} @@ -120,14 +123,19 @@ let cache_canonical_structure (_,(cst,lo)) = object_table := x :: (!object_table)) lo let subst_object subst ((r1,r2),o as obj) = - let r1' = subst_global subst r1 in - let r2' = subst_global subst r2 in + (* invariant: r1 and r2 are evaluable references. Thus subst_global *) + (* cannot instantiate them. Hence we can use just the first component *) + (* of the answer. *) + let r1',_ = subst_global subst r1 in + let r2',_ = subst_global subst r2 in let o' = subst_obj subst o in if r1' == r1 && r2' == r2 && o' == o then obj else (r1',r2'),o' let subst_canonical_structure (_,subst,(cst,lo as obj)) = - let cst' = subst_con subst cst in + (* invariant: cst is an evaluable reference. Thus we can take *) + (* the first component of subst_con. *) + let cst' = fst (subst_con subst cst) in let lo' = list_smartmap (subst_object subst) lo in if cst' == cst & lo' == lo then obj else (cst',lo') |
