Home
Module IntermSetDynTypeWf
Require Import Coqlib.
Require Import Cplusconcepts.
Require Import LibLists.
Require Import Tactics.
Require Import LibMaps.
Require Import IntermSetDynType.
Require Import CplusWf.
Require Import Wellfounded.
Require Import Relations.
Load Param.
Open Scope Z_scope.
Section Set_dynamic_type.
Variable A :
ATOM.t .
Variable hierarchy :
PTree.t (
Class.t A).
Section Concat_repeated.
Lemma concat_repeated :
forall h'
p'
from to,
path hierarchy to p'
from h' ->
forall p1 a,
last p1 =
Some a ->
forall h1 p2, (
h',
p') =
concat (
h1,
p1) (
Class.Inheritance.Repeated,
a ::
p2) ->
h1 =
h' /\
path hierarchy to (
a ::
p2)
a Class.Inheritance.Repeated /\
path hierarchy a p1 from h'.
Proof.
End Concat_repeated.
Hypothesis hierarchy_wf :
Well_formed_hierarchy.prop hierarchy.
Variable obj :
positive.
Variable ar :
array_path A.
Variable i :
Z.
Variable h0 :
Class.Inheritance.t.
Variable p0 :
list ident.
Variable dt :
ident.
Lemma set_dynamic_type_other_path :
forall (
Hdt :
last p0 =
Some dt)
l1 l2,
set_dynamic_type hierarchy obj ar i h0 p0 l1 l2 ->
forall h'
p',
(
forall to h p,
path hierarchy to p dt h -> (
h',
p') <>
concat (
h0,
p0) (
h,
p)) ->
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l2 =
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l1.
Proof.
Corollary set_dynamic_type_other_path_2 :
forall (
Hdt :
last p0 =
Some dt)
l1 l2,
set_dynamic_type hierarchy obj ar i h0 p0 l1 l2 ->
forall to'
p',
last p' =
Some to' ->
forall h',
(
forall h p,
path hierarchy to'
p dt h -> (
h',
p') <>
concat (
h0,
p0) (
h,
p)) ->
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l2 =
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l1.
Proof.
Section Same.
Variable from :
ident.
Section S.
Hypothesis Hpath :
path hierarchy dt p0 from h0.
Let Hdt :
last p0 =
Some dt.
Proof.
Lemma set_dynamic_type_same_path :
forall l1 l2,
set_dynamic_type hierarchy obj ar i h0 p0 l1 l2 ->
forall to h p,
path hierarchy to p dt h ->
forall h'
p',
(
h',
p') =
concat (
h0,
p0) (
h,
p) ->
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l2 =
Some ((
h0,
p0), (
h,
p)).
Proof.
End S.
Variable is_primary_path :
list ident ->
bool.
Variable h':
Class.Inheritance.t.
Variable p' :
list ident.
Variable to' :
ident.
Variable Hpath' :
path hierarchy to'
p'
from h'.
Hypothesis p'
_not_base :
forall h''
p'',
path hierarchy to'
p''
dt h'' -> (
h',
p') <>
concat (
h0,
p0) (
h'',
p'').
Lemma set_dynamic_type_strong_other_not_primary_base :
forall Hpath :
path hierarchy dt p0 from h0,
(
forall p'',
is_primary_path (
to' ::
p'') =
true -> (
h0,
p0) <>
concat (
h',
p') (
Class.Inheritance.Repeated,
to' ::
p'')) ->
forall l1 l2,
set_dynamic_type hierarchy obj ar i h0 p0 (
erase_non_primary_ancestor_dynamic_type obj ar i h0 p0 is_primary_path l1)
l2 ->
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l2 =
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l1.
Proof.
Lemma set_dynamic_type_strong_other_primary_base :
last p0 =
Some dt ->
forall p'',
is_primary_path (
to' ::
p'') =
true ->
(
h0,
p0) =
concat (
h',
p') (
Class.Inheritance.Repeated,
to' ::
p'') ->
forall l1 l2,
set_dynamic_type hierarchy obj ar i h0 p0 (
erase_non_primary_ancestor_dynamic_type obj ar i h0 p0 is_primary_path l1)
l2 ->
assoc (@
pointer_eq_dec _) (
obj, (
ar,
i, (
h',
p')))
l2 =
None.
Proof.
End Same.
Lemma set_dynamic_type_non_virtual_aux_exists :
forall j p,
last p =
Some j ->
forall l,
(
forall cn,
In cn l ->
Plt cn j) ->
(
forall cn,
In cn l ->
hierarchy !
cn <>
None) ->
forall h l1,
{
l2 |
set_dynamic_type_non_virtual_aux hierarchy obj ar i h0 p0 h p l l1 l2}.
Proof.
Corollary set_dynamic_type_non_virtual_exists :
forall j p,
last p =
Some j ->
hierarchy !
j <>
None ->
forall h l1,
{
l2 |
set_dynamic_type_non_virtual hierarchy obj ar i h0 p0 h p l1 l2}.
Proof.
Lemma set_dynamic_type_virtual_aux_exists :
forall l,
(
forall cn,
In cn l ->
hierarchy !
cn <>
None) ->
forall l1,
{
l2 |
set_dynamic_type_virtual_aux hierarchy obj ar i h0 p0 l l1 l2}.
Proof.
Corollary set_dynamic_type_exists :
last p0 =
Some dt ->
hierarchy !
dt <>
None ->
forall l1,
{
l2 |
set_dynamic_type hierarchy obj ar i h0 p0 l1 l2}.
Proof.
End Set_dynamic_type.