diff options
-rw-r--r-- | kernel/modops.ml | 17 | ||||
-rw-r--r-- | test-suite/success/Mod_strengthen.v | 64 |
2 files changed, 75 insertions, 6 deletions
diff --git a/kernel/modops.ml b/kernel/modops.ml index c194a6c71..7459dcad8 100644 --- a/kernel/modops.ml +++ b/kernel/modops.ml @@ -184,12 +184,17 @@ and add_module mp mb env = | MTBfunsig _ -> env -let strengthen_const env mp l cb = match cb.const_body with - | Some _ -> cb - | None -> {cb with const_body = - let const = mkConst (make_kn mp empty_dirpath l) in - Some (Declarations.from_val const) - } +let strengthen_const env mp l cb = + match cb.const_opaque, cb.const_body with + | false, Some _ -> cb + | true, Some _ + | _, None -> + let const = mkConst (make_kn mp empty_dirpath l) in + let const_subs = Some (Declarations.from_val const) in + {cb with + const_body = const_subs; + const_opaque = false + } let strengthen_mind env mp l mib = match mib.mind_equiv with | Some _ -> mib diff --git a/test-suite/success/Mod_strengthen.v b/test-suite/success/Mod_strengthen.v new file mode 100644 index 000000000..a472e698f --- /dev/null +++ b/test-suite/success/Mod_strengthen.v @@ -0,0 +1,64 @@ +Module Type Sub. + Axiom Refl1 : (x:nat)(x=x). + Axiom Refl2 : (x:nat)(x=x). + Axiom Refl3 : (x:nat)(x=x). + Inductive T : Set := A : T. +End Sub. + +Module Type Main. + Declare Module M:Sub. +End Main. + + +Module A <: Main. + Module M <: Sub. + Lemma Refl1 : (x:nat) x=x. + Intros;Reflexivity. + Qed. + Axiom Refl2 : (x:nat) x=x. + Lemma Refl3 : (x:nat) x=x. + Intros;Reflexivity. + Defined. + Inductive T : Set := A : T. + End M. +End A. + + + +(* first test *) + +Module F[S:Sub]. + Module M:=S. +End F. + +Module B <: Main with Module M:=A.M := F A.M. + + + +(* second test *) + +Lemma r1 : (A.M.Refl1 == B.M.Refl1). +Proof. + Reflexivity. +Qed. + +Lemma r2 : (A.M.Refl2 == B.M.Refl2). +Proof. + Reflexivity. +Qed. + +Lemma r3 : (A.M.Refl3 == B.M.Refl3). +Proof. + Reflexivity. +Qed. + +Lemma t : (A.M.T == B.M.T). +Proof. + Reflexivity. +Qed. + +Lemma a : (A.M.A == B.M.A). +Proof. + Reflexivity. +Qed. + |