-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecificSPL.v
623 lines (530 loc) · 24.4 KB
/
specificSPL.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
Module SpecificSPL.
Require Export maps_int formulatheory_int featuremodelsemantics_int assettheory_int
assetmapping_int featuremodelrefinement_int.
Require Export maps_def formulatheory_def featuremodelsemantics_def featuremodelrefinement_def
assettheory_def assetmapping_def ckcomp_int ckcomp_def.
Import FormulaTheory FeatureModelSemantics AssetTheory AssetMapping CKComp
Maps FeatureModelRefinimentTheory.
Require Export formulatheory_inst featuremodelsemantics_inst assettheory_inst maps_inst
assetmapping_inst featuremodelrefinement_inst cktrans_inst ckcomp_inst.
Require Import Coq.Lists.ListSet.
Variable fm fm1 fm2: FM.
Variable am am1 am2 pairs: AM.
Variable ck ck1 ck2: CK.
Variable item item1 item2: Item.
Variable items items1 items2: set Item.
Variable c c1 c2: Configuration.
Variable expr: Formula.
Variable Fe G H opt: Name.
Variable a a1 a2 a3: Asset.
Variable an an1 an2: AssetName.
Axiom item_dec : forall x y:Item, {x = y} + {x <> y}.
Axiom pair_dec : forall x y:pair_, {x = y} + {x <> y}.
Axiom ns_dec : forall x y:Name, {x = y} + {x <> y}.
Axiom an_dec : forall x y:AssetName, {x = y} + {x <> y}.
Axiom as_dec : forall x y:AssetName, {x = y} + {x <> y}.
Require Export spl_int spl_def spl_proofs spl_inst.
Import SPL.
(*========= IF WE ADD NEW ASSETS TO AM THAT DID NOT EXIST BEFORE, CK EVALUATION IS THE SAME =============*)
Lemma mapSubsetAM {Mp: Maps AssetName Asset AM}: forall (fm: FM) (am1 am2: list pair_) ck,
forall an, set_In an (dom_func am2) -> ~(set_In an (dom_func am1))
/\ wfCK_func fm am1 ck
-> forall (c: Configuration), set_In c (semantics fm)
-> (semantics_func_ ck am1 c = semantics_func_ ck (set_union pair_dec am1 am2) c).
Proof.
unfold wfCK_func.
induction am4.
+ induction am3.
- simpl. intuition.
- simpl. intuition.
+ intuition. specialize (IHam4 ck0 an0).
apply set_add_elim in H0. inversion H0.
Admitted.
(*============= REPLACE FEATURE EXPRESSION ==================*)
Definition syntaxReplaceFeatureExp ck1 ck2 item1 item2 items: Prop:=
(ck1 = app (items :: nil) (item1 :: nil) ) /\
(ck2 = app (items :: nil) (item2 :: nil)) /\
item1.(assets) = item2.(assets).
Definition conditionsReplaceFeatureExp (fm:FM) item1 item2: Prop :=
wt fm (item2.(exp)) /\
forall c, set_In c (semantics fm) ->
iff (satisfies (item1.(exp)) c) (satisfies (item2.(exp)) c).
Theorem replaceFeatureExp_EqualCKeval
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall (pl: PL) ck2 item1 item2 items,
(
(
wfCK_func (getFM pl) (getAM pl) (getCK pl) /\
syntaxReplaceFeatureExp (getCK pl) ck2 item1 item2 items /\
conditionsReplaceFeatureExp (getFM pl) item1 item2
)
->
forall (c: Configuration), set_In c (semantics (getFM pl))
-> semantics_ (getCK pl)(getAM pl) c
= semantics_ ck2 (getAM pl) c
).
Proof.
intros. destruct H0. destruct H2. unfold syntaxReplaceFeatureExp in H2. destruct H2.
destruct H4. rewrite H4. rewrite H2. simpl. induction item4. induction item3.
simpl in H5. rewrite H5. intuition.
Qed.
Theorem replaceFeatureExpression
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall (pl: PL) ck2 item1 item2 items,
(
(
wfCK_func (getFM pl) (getAM pl) (getCK pl) /\
syntaxReplaceFeatureExp (getCK pl) ck2 item1 item2 items /\
conditionsReplaceFeatureExp (getFM pl) item1 item2
)
->
plRefinement_func pl (gerPL fm2 (getAM pl) ck2) /\
wfCK_func (getFM pl) (getAM pl) ck2 /\
wfPL (gerPL fm2 (getAM pl) ck2)
).
Proof.
intros.
Search plRefinement.
intros. split.
unfold plRefinement_func. intros. exists c3. split.
+ destruct gerPL. unfold getFM_func. simpl. unfold getFM_func in H1. destruct pl in H1.
simpl in H1. destruct pls1. simpl. destruct p.
simpl in H1. destruct pls0.
simpl. destruct p. simpl. destruct f, f0. apply H1.
+ admit.
+ unfold syntaxReplaceFeatureExp, conditionsReplaceFeatureExp in H0.
simpl in H0. destruct H0. destruct H1. destruct H2. destruct H1.
induction item3, item4. simpl in H1, H4, H2, H3.
destruct H4. rewrite H1 in H0. rewrite H4. symmetry in H5.
rewrite H5. induction exp0.
- induction exp1.
* intuition.
* simpl. simpl in H2, H3. intuition.
unfold wfCK_func.
split. unfold wfCK_func in H0. destruct H0.
- apply H0.
- intuition. unfold wfCK_func in H0.
destruct H0. destruct H7. specialize (H7 c0). intuition.
* unfold wfCK_func in H0. unfold wfCK_func in H0.
destruct H0. destruct H7. specialize (H7 c).
specialize (H8 exp2). intuition. apply H8.
induction exp0.
- *)
Admitted.
(*================== ADD MANDATORY FEATURE ======================*)
(* FOR ALL PRODUCTS OF A FM, EVALUATING THE CK WITH A DEAD FEATURE IS EQUIVALENT TO EVALUATING THE CK WITHOUT IT*)
Theorem evalCKdeadFeature
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}
{FormT: FormulaTheory Formula Name FM}
{FMS: FeatureModelSemantics Formula FM Name}
{FMR: FeatureModelRefinement Formula Name FM}:
forall pl (opt: Name),
~(set_In opt (nsf_func ((fst(fst pl))))) /\
wfCK (fst(fst pl)) (snd(fst pl)) (snd pl)
-> forall c, set_In c (semantics_func (fst(fst pl)))
-> semantics_func_ (snd pl) (snd(fst pl)) c =
semantics_func_ (snd pl) (snd(fst pl)) (app (opt:: nil) c).
Proof.
simpl. intuition. simpl. simpl in H1, H2, H0. unfold nsf_func in H1.
destruct a4. simpl in H1, H2, H0. destruct f. intuition.
destruct opt0, n. simpl in H1. intuition.
Qed.
Definition syntaxConditionsAddMandatoryFeature (fm1 fm2: FM) (F G: Name)
{FormT: FormulaTheory Formula Name FM} {FMS: FeatureModelSemantics Formula FM Name }
{FMR: FeatureModelRefinement Formula Name FM}: Prop :=
addMandatoryNode_func fm1 fm2 F G.
(*ADDING A MANDATORY FEATURE G WITHOUT CHANGING CK AND AM IS PL REFINEMENT*)
Theorem addMandatoryFeat
{Mp: Maps AssetName Asset AM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}
{FormT: FormulaTheory Formula Name FM}
{FMS: FeatureModelSemantics Formula FM Name }
{FMR: FeatureModelRefinement Formula Name FM}:
forall (pl: PL) (F G: Name) (fm2: FM),
(
syntaxConditionsAddMandatoryFeature (getFM pl) fm2 F G /\
wfCK (getFM pl) (getAM pl) (getCK pl)
->
plRefinement_func pl (gerPL fm2 (getAM pl) (getCK pl))
/\ wfCK fm2 (getAM pl) (getCK pl)
/\ wfPL (gerPL fm2 (getAM pl) (getCK pl))
).
Proof.
intuition. simpl. unfold syntaxConditionsAddMandatoryFeature in H1.
unfold addMandatoryNode_func in H1. destruct F, G0.
intuition. unfold syntaxConditionsAddMandatoryFeature in H1.
unfold addMandatoryNode_func in H1. destruct F, G0.
intuition. unfold syntaxConditionsAddMandatoryFeature in H1.
unfold addMandatoryNode_func in H1. destruct F, G0.
intuition.
Qed.
(* ============= SPLIT ASSETS ====================*)
(* SPLIT ASSETS conditions *)
Definition syntaxSplitAssets am1 am2 (ck1 ck2:CK) (item1 item2: Item) items
(an1 an2: AssetName) (a1 a2 a3: Asset) pairs: Prop :=
am1 = set_add pair_dec (an1, a1) pairs /\
am2 = set_add pair_dec (an1, a2) (set_add pair_dec (an2, a3) pairs) /\
ck1 = app (item1::nil) items /\
ck2 = app (item2::nil) items /\
item1.(exp) = item2.(exp) /\
item1.(assets) = set_add an_dec an1 nil /\
item2.(assets) = set_add an_dec an1 (an2::nil).
Definition conditionsSplitAssets a1 a2 a3 an1 an2 items: Prop :=
assetRef_func (a1::nil) (app (a2::nil) (a3::nil)) /\
forall (item: Item), set_In item items
-> ~(set_In an1 (item.(assets))) /\
(~ set_In an2 (item.(assets))).
Lemma same_add: forall (p:pair) pairs, set_add pair_dec p pairs =
set_add pair_dec p (set_add pair_dec p pairs).
Proof.
intros. induction p.
unfold set_add. induction pairs0.
- case_eq (pair_dec (a0,b) (a0,b)).
+ intros. reflexivity.
+ intros. intuition.
- intuition. case_eq (pair_dec (a0, b) a4).
+ intros. rewrite e. case_eq (pair_dec (a0,b) a4).
* intros. case_eq (pair_dec a4 a4).
{ intuition. }
{ intuition. }
* intuition.
+ intuition.
Admitted.
Theorem splitNotEvalItem {Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}: forall pl am2 ck2 item1 item2 a1 a2 a3 an1 an2 items pairs,
(
(
wfCK_func (fst(fst pl)) (snd(fst pl)) (snd pl) /\
syntaxSplitAssets (snd(fst pl)) am2 (snd pl) ck2 item1 item2 items an1 an2 a1 a2 a3 pairs /\
conditionsSplitAssets a1 a2 a3 an1 an2 items
)
->
forall c, set_In c (semantics_func (fst(fst pl))) /\ ~(satisfies_func (item1.(exp)) c)
-> semantics_func_ (snd pl) (snd(fst pl)) c = semantics_func_ ck2 am2 c).
Proof.
destruct pl. destruct p. simpl. destruct f. intros am ck item1 item2 a1 a2 a3 an1 an2 items pairs.
unfold syntaxSplitAssets. unfold conditionsSplitAssets. simpl.
intuition.
specialize (H5 item1). rewrite H8 in H5.
induction item1, item2.
simpl in H1, H2, H0, H5, H3, H4, H6, H7, H8, H10, H11, H12. simpl.
intuition.
rewrite H4, H2, H6, H3.
rewrite H7, H8, H10. rewrite H7, H8 in H5.
intuition. case_eq (an_dec an1 an2).
+ intros. rewrite same_add. destruct an1, a1, a2, an2, a3. reflexivity.
+ intros. destruct n. destruct an1, an2. reflexivity.
Qed.
(*When splitting assets, if item1 is evaluated as true, ck evaluation is equal to the asset mapped by this item union evaluation of other items*)
Theorem splitEvalItemUnion
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl am2 ck2 item1 item2 a1 a2 a3 an1 an2 items pairs,
(
(
wfCK (fst(fst pl)) (snd(fst pl)) (snd pl) /\
syntaxSplitAssets (snd(fst pl)) am2 (snd pl) ck2 item1 item2 items an1 an2 a1 a2 a3 pairs /\
conditionsSplitAssets a1 a2 a3 an1 an2 items
)
->
forall c, set_In c (semantics_func (fst(fst pl))) /\ ~(satisfies_func (item1.(exp)) c)
-> semantics_func_ (snd pl) (snd (fst pl)) c = app (a1::nil) (semantics_func_ items (snd (fst pl)) c) /\
semantics_func_ ck2 am2 c = app (app (a2:: nil) (a3::nil)) (semantics_func_ items am2 c)).
Proof.
destruct pl. destruct p. simpl. intros am ck item1 item2 a1 a2 a3 an1 an2 items pairs.
induction item1, item2.
unfold syntaxSplitAssets. unfold conditionsSplitAssets.
simpl. intuition.
+ rewrite H4. rewrite H8. rewrite H2. simpl. admit.
+ rewrite H6. rewrite H10.
Admitted.
Theorem splitEvalRemainingItems
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl am2 ck2 (item1 item2: Item) (a1 a2 a3: Asset) (an1 an2: AssetName) (items: list Item) (pairs: AM),
(
(
wfCK (fst(fst pl)) (snd(fst pl)) (snd pl) /\
syntaxSplitAssets (snd(fst pl)) am2 (snd pl) ck2 item1 item2 items an1 an2 a1 a2 a3 pairs /\
conditionsSplitAssets a1 a2 a3 an1 an2 items
)
->
forall c, set_In c (semantics (fst(fst pl)))
->
(semantics_ items (snd(fst pl)) c) = (semantics_ items am2 c)).
Proof.
destruct pl. destruct p. simpl. destruct f. intros am ck item1 item2 a1 a2 a3 an1 an2 items pairs.
unfold syntaxSplitAssets. unfold conditionsSplitAssets. simpl.
intuition.
specialize (H5 item1). rewrite H8 in H5.
induction item1, item2.
simpl in H1, H2, H0, H5, H3, H4, H6, H7, H8, H10. simpl.
intuition.
rewrite H2, H3.
rewrite same_add. destruct an1, a1, a2, an2, a3. reflexivity.
Qed.
(* Split assets preserves CK well-formedness *)
Theorem splitAssetWFCK
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl (am2:AM) (ck2: CK) (item1 item2: Item) (a1 a2 a3: Asset) (an1 an2: AssetName) items pairs,
(
(
wfCK_func (fst(fst pl)) (snd(fst pl)) (snd pl) /\
syntaxSplitAssets (snd(fst pl)) am2 (snd pl) ck2 item1 item2 items an1 an2 a1 a2 a3 pairs /\
conditionsSplitAssets a1 a2 a3 an1 an2 items
)
->
wfCK_func (fst(fst pl)) am2 ck2).
Proof.
destruct pl. destruct p. simpl. destruct f. intros am ck item1 item2 a1 a2 a3 an1 an2 items pairs.
unfold syntaxSplitAssets. unfold conditionsSplitAssets. simpl.
intuition.
specialize (H5 item1). rewrite H8 in H5.
induction item1, item2.
simpl in H1, H2, H0, H5, H3, H4, H6, H7, H8, H10. simpl.
intuition.
rewrite H6, H3. rewrite H2, H4 in H1.
rewrite H10. rewrite H8 in H1.
intuition. case_eq (an_dec an1 an2).
+ intros. rewrite same_add in H1. destruct an1, a1, a2, an2, a3. rewrite H7 in H1. apply H1.
+ intros. destruct n. destruct an1, an2. reflexivity.
Qed.
Theorem splitAsset
{Mp: Maps Asset AssetName AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall (pl:PL) (am2:AM) (ck2: CK) (item1 item2: Item) (a1 a2 a3: Asset) (an1 an2: AssetName) items pairs,
(
(
wfCK_func (getFM pl) (getAM pl) (getCK pl) /\
syntaxSplitAssets (getAM pl) am2 (getCK pl)
ck2 item1 item2 items an1 an2 a1 a2 a3 pairs /\
conditionsSplitAssets a1 a2 a3 an1 an2 items
)
->
plRefinement_func pl (gerPL (getFM pl) am2 ck2) /\
wfCK_func (getFM pl) am2 ck2) /\
wfPL (gerPL (getFM pl) am2 ck2).
Proof.
intuition.
+ unfold plRefinement_func. intros. admit.
+
Admitted.
(* ================= ADD OPTIONAL FEATURE ==================*)
Definition syntaxAddOptionalFeature {FormT: FormulaTheory Formula Name FM} {FMS: FeatureModelSemantics Formula FM Name }
{FMR: FeatureModelRefinement Formula Name FM} (fm1: FM) (am1: AM) (ck1: CK)
(fm2: FM) (am2: AM) (ck2: CK) (F G: Name) items (pairs: AM) :Prop :=
fst fm2 = app (G::nil) (fst fm1) /\
set_In F (fst fm1) /\
(snd fm2) = set_add form_dec (IMPLIES_FORMULA (NAME_FORMULA(G)) (NAME_FORMULA(F))) (snd fm1) /\
am2 = app am1 (pairs) /\
ck2 = app ck1 items.
Definition conditionsAddOptionalFeature (fm1 fm2: FM) (am1 am2 pairs: AM) (ck2: CK) (G: Name) (items: set Item)
{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL} : Prop :=
wfPL (gerPL fm2 am2 ck2) /\
wfCK_func fm2 am2 ck2 /\ forall an: AssetName, ~(set_In an (dom_func am1)) /\ (~ set_In G (fst fm1)) /\
forall c: Configuration, forall expr, set_In expr (exps items) /\
satisfies expr c -> satisfies (NAME_FORMULA(G)) c.
Theorem addOptionalFeatureEqualProducts
{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}
{FormT: FormulaTheory Formula Name FM}
{FMS: FeatureModelSemantics Formula FM Name }
{FMR: FeatureModelRefinement Formula Name FM}:
forall pl (fm2: FM) (am2: AM) (ck2: CK) (F G: Name) (items:set Item) (pairs: AM),
wfCK_func (fst (fst pl)) (snd (fst pl)) (snd pl) /\
syntaxAddOptionalFeature (fst (fst pl)) (snd (fst pl)) (snd pl) fm2 am2 ck2 F G items pairs /\
conditionsAddOptionalFeature (fst (fst pl)) fm2 (snd (fst pl)) am2 pairs ck2 G items
->
forall c, set_In c (semantics_func (fst (fst pl))) ->
semantics_func_ (snd pl) (snd (fst pl)) c = semantics_func_ ck2 am2 c.
Proof.
unfold syntaxAddOptionalFeature. unfold conditionsAddOptionalFeature.
simpl. intros pl fm am ck F G items pairs. destruct pl. destruct p.
simpl. intuition.
specialize (H7 an). rewrite H6, H9. destruct f. destruct fm.
simpl in H5, H2, H0, H6, H3, H1, H4, H8, H7. destruct H7. destruct H10. destruct G, F.
intuition.
Qed.
Theorem addOptionalFeature
{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}
{FormT: FormulaTheory Formula Name FM}
{FMS: FeatureModelSemantics Formula FM Name }
{FMR: FeatureModelRefinement Formula Name FM}:
forall (pl: PL) (fm2: FM) (am2: AM) (ck2: CK) (F G: Name) (items:set Item) (pairs: AM),
wfCK_func (getFM pl) (getAM pl) (getCK pl) /\
syntaxAddOptionalFeature (getFM pl) (getAM pl) (getCK pl) fm2 am2 ck2 F G items pairs /\
conditionsAddOptionalFeature (getFM pl) fm2 (getAM pl) am2 pairs ck2 G items
-> plRefinement_func pl (gerPL fm2 am2 ck2)
/\ wfCK_func fm2 am2 ck2 /\ wfPL (gerPL fm2 am2 ck2).
Proof.
intros pl fm am ck F G items pairs. unfold syntaxAddOptionalFeature.
unfold conditionsAddOptionalFeature. intros.
simpl. intuition. rewrite H6, H9. destruct gerPL.
unfold plRefinement_func. intros. exists c3. split.
+ destruct gerPL. unfold getFM_func. simpl. unfold getFM_func in H8. destruct pl in H8.
simpl in H8. destruct pls1. simpl. destruct p.
destruct pls2 in H8. simpl in H8. destruct p.
simpl in H8. destruct f, f0. simpl. apply H8.
+ specialize (H7 an). destruct H7. destruct H10. destruct G, F.
intuition.
Qed.
(*=================== ADD UNUSED ASSETS ===================*)
Fixpoint assetsCK (items:set Item): set AssetName :=
match items with
| nil => nil
| x :: xs => x.(assets) ++ assetsCK xs
end.
Definition Is_truePB (b:Prop) : bool :=
match b with
| True => true
end.
Fixpoint remov (ls: set AssetName) am1: AM :=
match am1 with
| nil => nil
| x :: xs => if Is_truePB(set_In (fst x) (ls)) then remov ls xs else (x :: remov ls xs)
end.
Definition syntaxAddUnusedAssets (am1 am2 pairs: AM) : Prop :=
am2 = app pairs (remov (dom_func pairs) am1).
Definition conditionsAddUnusedAssets {Mp: Maps AssetName Asset AM} pairs ck: Prop :=
forall an, set_In an (dom_ pairs) -> (~ set_In an (assetsCK ck)).
Theorem addUnusedAssetsSameCK
{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration}
{AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl am2 pairs,
(
syntaxAddUnusedAssets (snd( fst pl)) am2 pairs /\
conditionsAddUnusedAssets pairs (snd pl)
-> forall (c: Configuration), set_In c (semantics_func (fst(fst pl)))
-> (semantics_func_ (snd pl) (snd( fst pl)) c) =
semantics_func_ (snd pl) am2 c).
Proof.
simpl. intuition. simpl. simpl in H0.
unfold syntaxAddUnusedAssets in H1.
unfold conditionsAddUnusedAssets in H2.
specialize (H2 an). simpl in H1, H2, H0. rewrite H1.
simpl.
(*
destruct pl. destruct pls0. destruct p. destruct getFM.
destruct c0.
simpl. simpl in H1. unfold semantics_func in H1. simpl in H1. *)
Admitted.
Theorem addUnusedAssets{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl am2 pairs,
(
syntaxAddUnusedAssets (getAM pl) am2 pairs /\
conditionsAddUnusedAssets pairs (getCK pl)
->
strongerPLrefinement_func pl (gerPL (getFM pl) am2 (getCK pl))
/\ wfPL (gerPL (getFM pl) am2 (getCK pl))).
Proof.
intros. destruct H0. unfold syntaxAddUnusedAssets in H0.
unfold conditionsAddUnusedAssets in H1.
specialize (H1 an). intuition.
- unfold strongerPLrefinement_func. intros. split.
+ unfold getFM_func. simpl. unfold getFM_func in H2. destruct pl in H2.
simpl in H2. destruct gerPL. destruct pls1. simpl. destruct p.
simpl in H2. destruct pls0 in H2. simpl in H2. destruct p.
simpl in H2. destruct f, f0. simpl. apply H2.
+ destruct gerPL. unfold getCK_func. unfold getAM_func. simpl.
induction pl, pls0. simpl. induction pls1. simpl. simpl in H0. admit.
- intuition. destruct gerPL.
Admitted.
(*================== REMOVE UNUSED ASSETS =======================*)
Theorem removeUnusedAssetsSameEvalCK {Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall (pl: PL) am2 pairs,
(
syntaxAddUnusedAssets am2 (getAM pl) pairs /\
conditionsAddUnusedAssets pairs (getCK pl)
-> forall c, set_In c (semantics (getFM pl)) -> (semantics_func_ (getCK pl) (getAM pl) c) =
semantics_func_ (getCK pl) am2 c).
Proof.
unfold syntaxAddUnusedAssets.
unfold conditionsAddUnusedAssets.
intuition.
specialize (H2 an).
Admitted.
Theorem removeUnusedAssets{Mp: Maps AssetName Asset AM}
{Ft: FormulaTheory Formula Name FM}
{FtM: FeatureModel FM Configuration} {AssetM: AssetMapping Asset AssetName AM}
{ckTrans: CKTrans FM Asset AM CK Configuration}
{SPL: SPL Asset Configuration FM AM CK PL}:
forall pl am2 pairs,
(
syntaxAddUnusedAssets am2 (getAM pl) pairs /\
conditionsAddUnusedAssets pairs (getCK pl)
->
strongerPLrefinement_func pl (gerPL (getFM pl) am2 (getCK pl)) /\ wfPL (gerPL (getFM pl) am2 (getCK pl))).
Proof.
intros. destruct H0. unfold syntaxAddUnusedAssets in H0.
unfold conditionsAddUnusedAssets in H1.
specialize (H1 an). intuition.
- unfold strongerPLrefinement_func. intros. split.
+ unfold getFM_func. simpl. unfold getFM_func in H2. destruct pl in H2.
simpl in H2. destruct gerPL. destruct pls1. simpl. destruct p.
simpl in H2. destruct pls0 in H2. simpl in H2. destruct p.
simpl in H2. destruct f, f0. simpl. apply H2.
+ destruct gerPL. unfold getCK_func. unfold getAM_func. simpl.
induction pl, pls0. simpl. induction pls1. simpl. simpl in H0.
Admitted.
End SpecificSPL.