init
This commit is contained in:
commit
1fe10f27ff
69
BE2019/.Naturelle.aux
Executable file
69
BE2019/.Naturelle.aux
Executable file
|
@ -0,0 +1,69 @@
|
|||
COQAUX1 b99e0673e480d281145bd0be828a8006 /home/lfainsin/1A/Modé/BE2019/Naturelle.v
|
||||
383 387 proof_build_time "0.000"
|
||||
0 0 E_imp_th "0.000"
|
||||
383 387 context_used ""
|
||||
383 387 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
916 920 proof_build_time "0.000"
|
||||
0 0 E_forall_th "0.000"
|
||||
916 920 context_used ""
|
||||
916 920 proof_check_time "0.000"
|
||||
1291 1295 proof_build_time "0.001"
|
||||
0 0 E_et_g_th "0.001"
|
||||
1291 1295 context_used ""
|
||||
1291 1295 proof_check_time "0.000"
|
||||
1601 1605 proof_build_time "0.001"
|
||||
0 0 E_et_d_th "0.001"
|
||||
1601 1605 context_used ""
|
||||
1601 1605 proof_check_time "0.000"
|
||||
1983 1987 proof_build_time "0.001"
|
||||
0 0 E_ou_th "0.001"
|
||||
1983 1987 context_used ""
|
||||
1983 1987 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
2806 2810 proof_build_time "0.001"
|
||||
0 0 E_exists_th "0.001"
|
||||
2806 2810 context_used ""
|
||||
2806 2810 proof_check_time "0.000"
|
||||
3280 3284 proof_build_time "0.000"
|
||||
0 0 E_antiT_th "0.000"
|
||||
3280 3284 context_used ""
|
||||
3280 3284 proof_check_time "0.000"
|
||||
3502 3506 proof_build_time "0.001"
|
||||
0 0 I_antiT_th "0.001"
|
||||
3502 3506 context_used ""
|
||||
3502 3506 proof_check_time "0.000"
|
||||
3683 3687 proof_build_time "0.000"
|
||||
0 0 I_non_th "0.000"
|
||||
3683 3687 context_used ""
|
||||
3683 3687 proof_check_time "0.000"
|
||||
4135 4158 context_used ""
|
||||
4135 4158 context_used ""
|
||||
4135 4158 context_used ""
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
4398 4402 proof_build_time "0.003"
|
||||
0 0 Yoga "0.003"
|
||||
4398 4402 context_used ""
|
||||
4398 4402 proof_check_time "0.000"
|
||||
4404 4428 context_used ""
|
||||
4404 4428 context_used ""
|
||||
4557 4561 proof_build_time "0.001"
|
||||
0 0 contra "0.001"
|
||||
4557 4561 context_used ""
|
||||
4557 4561 proof_check_time "0.000"
|
||||
4642 4646 proof_build_time "0.001"
|
||||
0 0 P2nnP "0.001"
|
||||
4642 4646 context_used ""
|
||||
4642 4646 proof_check_time "0.000"
|
||||
4731 4735 proof_build_time "0.001"
|
||||
0 0 nnP2P "0.001"
|
||||
4731 4735 context_used ""
|
||||
4731 4735 proof_check_time "0.000"
|
||||
4737 4755 context_used ""
|
||||
4756 4786 context_used ""
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
4984 4988 proof_build_time "0.002"
|
||||
0 0 Swap "0.002"
|
||||
4984 4988 context_used ""
|
||||
4984 4988 proof_check_time "0.000"
|
||||
0 0 vo_compile_time "0.617"
|
254
BE2019/Naturelle.glob
Executable file
254
BE2019/Naturelle.glob
Executable file
|
@ -0,0 +1,254 @@
|
|||
DIGEST b99e0673e480d281145bd0be828a8006
|
||||
FNaturelle
|
||||
R15:23 Coq.Logic.Classical <> <> lib
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
prf 278:285 <> E_imp_th
|
||||
R314:314 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R325:329 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R333:336 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R337:339 Naturelle <> psi var
|
||||
R330:332 Naturelle <> phi var
|
||||
R318:321 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R322:324 Naturelle <> psi var
|
||||
R315:317 Naturelle <> phi var
|
||||
R443:450 Naturelle <> E_imp_th thm
|
||||
R521:528 Naturelle <> E_imp_th thm
|
||||
prf 816:826 <> E_forall_th
|
||||
R856:859 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R855:855 Naturelle <> A var
|
||||
R869:869 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R885:889 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R890:892 Naturelle <> phi var
|
||||
R894:894 Naturelle <> a var
|
||||
R880:882 Naturelle <> phi var
|
||||
R884:884 Naturelle <> x var
|
||||
R996:1006 Naturelle <> E_forall_th thm
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1105:1108 Coq.Init.Logic <> conj constr
|
||||
prf 1157:1165 <> E_et_g_th
|
||||
R1194:1194 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1205:1209 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1210:1212 Naturelle <> phi var
|
||||
R1198:1201 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1195:1197 Naturelle <> phi var
|
||||
R1202:1204 Naturelle <> psi var
|
||||
R1352:1360 Naturelle <> E_et_g_th thm
|
||||
R1432:1440 Naturelle <> E_et_g_th thm
|
||||
prf 1465:1473 <> E_et_d_th
|
||||
R1502:1502 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1513:1517 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1518:1520 Naturelle <> psi var
|
||||
R1506:1509 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1503:1505 Naturelle <> phi var
|
||||
R1510:1512 Naturelle <> psi var
|
||||
R1662:1670 Naturelle <> E_et_d_th thm
|
||||
R1743:1751 Naturelle <> E_et_d_th thm
|
||||
prf 1776:1782 <> E_ou_th
|
||||
R1815:1815 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1826:1830 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1831:1831 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1842:1846 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1847:1847 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1858:1862 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1863:1865 Naturelle <> chi var
|
||||
R1851:1854 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1855:1857 Naturelle <> chi var
|
||||
R1848:1850 Naturelle <> psi var
|
||||
R1835:1838 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1839:1841 Naturelle <> chi var
|
||||
R1832:1834 Naturelle <> phi var
|
||||
R1819:1822 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R1816:1818 Naturelle <> phi var
|
||||
R1823:1825 Naturelle <> psi var
|
||||
R2042:2048 Naturelle <> E_ou_th thm
|
||||
R2124:2130 Naturelle <> E_ou_th thm
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2213:2221 Coq.Init.Logic <> or_introl constr
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2324:2332 Coq.Init.Logic <> or_intror constr
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2453:2460 Coq.Init.Logic <> ex_intro constr
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2597:2604 Coq.Init.Logic <> ex_intro constr
|
||||
prf 2669:2679 <> E_exists_th
|
||||
R2709:2712 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2708:2708 Naturelle <> A var
|
||||
R2733:2733 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2749:2753 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2754:2754 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2777:2781 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2782:2784 Naturelle <> chi var
|
||||
R2770:2773 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2774:2776 Naturelle <> chi var
|
||||
R2765:2767 Naturelle <> phi var
|
||||
R2769:2769 Naturelle <> a var
|
||||
R2734:2740 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2742:2743 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2744:2746 Naturelle <> phi var
|
||||
R2748:2748 Naturelle <> x var
|
||||
R2963:2973 Naturelle <> E_exists_th thm
|
||||
R3083:3085 Coq.Init.Logic <> not def
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3145:3151 Coq.Logic.Classical_Prop <> classic prfax
|
||||
prf 3209:3218 <> E_antiT_th
|
||||
R3248:3251 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3252:3254 Naturelle <> phi var
|
||||
R3243:3247 Coq.Init.Logic <> False ind
|
||||
R3340:3349 Naturelle <> E_antiT_th thm
|
||||
prf 3370:3379 <> I_antiT_th
|
||||
R3407:3410 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3411:3411 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3416:3420 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3421:3425 Coq.Init.Logic <> False ind
|
||||
R3412:3412 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3413:3415 Naturelle <> phi var
|
||||
R3404:3406 Naturelle <> phi var
|
||||
R3435:3437 Coq.Init.Logic <> not def
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3567:3576 Naturelle <> I_antiT_th thm
|
||||
prf 3598:3605 <> I_non_th
|
||||
R3630:3630 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3643:3647 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3648:3648 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3649:3651 Naturelle <> phi var
|
||||
R3634:3637 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3638:3642 Coq.Init.Logic <> False ind
|
||||
R3631:3633 Naturelle <> phi var
|
||||
R3669:3671 Coq.Init.Logic <> not def
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3745:3752 Naturelle <> I_non_th thm
|
||||
R3801:3810 Naturelle <> I_antiT_th thm
|
||||
R3875:3878 Coq.Logic.Classical_Prop <> NNPP thm
|
||||
var 4144:4144 <> E
|
||||
var 4146:4146 <> Y
|
||||
var 4148:4148 <> R
|
||||
prf 4168:4171 <> Yoga
|
||||
R4175:4175 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4203:4207 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4210:4213 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4214:4214 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4215:4215 Naturelle <> E defax
|
||||
R4208:4208 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4209:4209 Naturelle <> R defax
|
||||
R4176:4176 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R4190:4195 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R4202:4202 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R4178:4182 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4189:4189 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4184:4187 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R4183:4183 Naturelle <> Y defax
|
||||
R4188:4188 Naturelle <> R defax
|
||||
R4177:4177 Naturelle <> E defax
|
||||
R4197:4200 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4201:4201 Naturelle <> R defax
|
||||
R4196:4196 Naturelle <> Y defax
|
||||
R4263:4263 Naturelle <> R defax
|
||||
R4272:4272 Naturelle <> Y defax
|
||||
R4274:4274 Naturelle <> R defax
|
||||
R4285:4285 Naturelle <> E defax
|
||||
R4300:4303 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4304:4304 Naturelle <> R defax
|
||||
R4299:4299 Naturelle <> Y defax
|
||||
R4300:4303 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4304:4304 Naturelle <> R defax
|
||||
R4299:4299 Naturelle <> Y defax
|
||||
R4343:4346 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4348:4351 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R4347:4347 Naturelle <> Y defax
|
||||
R4352:4352 Naturelle <> R defax
|
||||
R4342:4342 Naturelle <> E defax
|
||||
R4343:4346 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4348:4351 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R4347:4347 Naturelle <> Y defax
|
||||
R4352:4352 Naturelle <> R defax
|
||||
R4342:4342 Naturelle <> E defax
|
||||
var 4413:4415 <> phi
|
||||
var 4417:4419 <> psi
|
||||
prf 4438:4443 <> contra
|
||||
R4447:4447 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4458:4463 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4476:4476 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4468:4471 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4472:4472 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4473:4475 Naturelle <> phi defax
|
||||
R4464:4464 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4465:4467 Naturelle <> psi defax
|
||||
R4451:4454 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4455:4457 Naturelle <> psi defax
|
||||
R4448:4450 Naturelle <> phi defax
|
||||
R4517:4519 Naturelle <> psi defax
|
||||
R4528:4530 Naturelle <> phi defax
|
||||
prf 4571:4575 <> P2nnP
|
||||
R4582:4585 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4586:4586 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4587:4587 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4588:4590 Naturelle <> phi defax
|
||||
R4579:4581 Naturelle <> phi defax
|
||||
R4621:4623 Naturelle <> phi defax
|
||||
prf 4656:4660 <> nnP2P
|
||||
R4670:4673 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4674:4676 Naturelle <> phi defax
|
||||
R4664:4664 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4665:4666 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4667:4669 Naturelle <> phi defax
|
||||
R4708:4708 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4709:4711 Naturelle <> phi defax
|
||||
R4708:4708 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R4709:4711 Naturelle <> phi defax
|
||||
var 4746:4746 <> A
|
||||
var 4765:4767 <> chi
|
||||
R4772:4775 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4777:4780 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4776:4776 Naturelle <> A defax
|
||||
R4771:4771 Naturelle <> A defax
|
||||
prf 4796:4799 <> Swap
|
||||
R4803:4803 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4831:4836 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4864:4864 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R4847:4853 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R4855:4856 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R4857:4859 Naturelle <> chi defax
|
||||
R4863:4863 Naturelle <> y var
|
||||
R4861:4861 Naturelle <> x var
|
||||
R4804:4810 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R4812:4813 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R4824:4826 Naturelle <> chi defax
|
||||
R4830:4830 Naturelle <> y var
|
||||
R4828:4828 Naturelle <> x var
|
||||
R4926:4926 Naturelle <> A defax
|
||||
R4929:4931 Naturelle <> chi defax
|
||||
R4935:4935 Naturelle <> y var
|
||||
R4933:4933 Naturelle <> x var
|
||||
R4926:4926 Naturelle <> A defax
|
||||
R4929:4931 Naturelle <> chi defax
|
||||
R4935:4935 Naturelle <> y var
|
||||
R4933:4933 Naturelle <> x var
|
292
BE2019/Naturelle.v
Executable file
292
BE2019/Naturelle.v
Executable file
|
@ -0,0 +1,292 @@
|
|||
Require Export Classical.
|
||||
|
||||
Ltac Hyp Nom := exact Nom.
|
||||
|
||||
Ltac I_imp' :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => let hyp := fresh "H" in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_imp Nom :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_imp_th : forall (phi psi : Prop), (phi -> psi) -> phi -> psi.
|
||||
intros Pphi Ppsi Hphi2psi.
|
||||
Hyp Hphi2psi.
|
||||
Qed.
|
||||
|
||||
Ltac E_imp' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_imp_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_imp phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_imp_th phi P)
|
||||
end.
|
||||
|
||||
Ltac I_forall' :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => let hyp := fresh x in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_forall Nom :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_forall_th : forall (A : Type) (phi : A -> Prop) a, (forall x, phi x) -> phi a.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
|
||||
Ltac E_forall x :=
|
||||
pattern x;
|
||||
match goal with
|
||||
| |- (?P x) => apply (E_forall_th _ P x)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_et :=
|
||||
match goal with
|
||||
| |- (?A /\ ?B) => apply (@conj A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_et_g_th : forall (phi psi : Prop), (phi /\ psi) -> phi.
|
||||
intros Pphi Ppsi Hphi_et_psi.
|
||||
elim Hphi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_g' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_g_th P _)
|
||||
end.
|
||||
|
||||
Ltac E_et_g psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_et_g_th P psi)
|
||||
end.
|
||||
|
||||
Theorem E_et_d_th : forall (phi psi : Prop), (phi /\ psi) -> psi.
|
||||
intros Pphi Ppsi H_phi_et_psi.
|
||||
elim H_phi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hpsi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_d' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_et_d phi :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th phi P)
|
||||
end.
|
||||
|
||||
Theorem E_ou_th : forall (phi psi chi : Prop), (phi \/ psi) -> (phi -> chi) -> (psi -> chi) -> chi.
|
||||
intros Pphi Ppsi Pchi Hphi_ou_psi Hphi_imp_chi Hpsi_imp_chi.
|
||||
elim Hphi_ou_psi.
|
||||
Hyp Hphi_imp_chi.
|
||||
Hyp Hpsi_imp_chi.
|
||||
Qed.
|
||||
|
||||
Ltac E_ou' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_ou_th _ _ P)
|
||||
end.
|
||||
|
||||
Ltac E_ou phi psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_ou_th phi psi P)
|
||||
end.
|
||||
|
||||
Ltac I_ou_g :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_introl A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_ou_d :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_intror A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists' :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => eapply (@ex_intro A P _)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists t :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => apply (@ex_intro _ P t)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_exists_th : forall (A : Type) (phi : A -> Prop) (chi : Prop), (exists x, phi x) -> (forall a, phi a -> chi) -> chi.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
(*
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P)
|
||||
end.
|
||||
*)
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P); [ idtac | let t := fresh "t" in let ht := fresh "Ht" in intros t ht ]
|
||||
end.
|
||||
|
||||
Ltac TE :=
|
||||
unfold not;
|
||||
match goal with
|
||||
| |- (?P \/ (?P -> False)) => exact (classic P)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_antiT_th : forall (phi : Prop), False -> phi.
|
||||
intros Pphi F.
|
||||
elim F.
|
||||
Qed.
|
||||
|
||||
Ltac E_antiT :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_antiT_th P)
|
||||
end.
|
||||
|
||||
Theorem I_antiT_th : forall (phi : Prop), phi -> (~phi) -> False.
|
||||
unfold not.
|
||||
intro Pphi.
|
||||
intros Hphi Hnphi.
|
||||
cut Pphi.
|
||||
Hyp Hnphi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac I_antiT phi :=
|
||||
match goal with
|
||||
| |- False => apply (I_antiT_th phi)
|
||||
end.
|
||||
|
||||
Theorem I_non_th : forall (phi : Prop), (phi -> False) -> ~phi.
|
||||
intros.
|
||||
unfold not.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
Ltac I_non Nom :=
|
||||
match goal with
|
||||
| |- ~ ?P => apply (I_non_th P); intro Nom
|
||||
end.
|
||||
|
||||
Ltac E_non phi :=
|
||||
apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom :=
|
||||
match goal with
|
||||
| |- ?P => apply (NNPP P); intro Nom
|
||||
end.
|
||||
|
||||
(*
|
||||
Ltac I_antiT phi := apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom phi :=
|
||||
match goal with
|
||||
| |- phi =>
|
||||
cut (phi \/ ~phi);
|
||||
[
|
||||
intros L;
|
||||
elim L;
|
||||
[
|
||||
auto
|
||||
|
|
||||
clear L;
|
||||
intro Nom;
|
||||
apply (E_antiT_th)
|
||||
]
|
||||
|
|
||||
apply (classic phi)
|
||||
]
|
||||
| _ => fail
|
||||
end.
|
||||
*)
|
||||
|
||||
Variable E Y R : Prop.
|
||||
|
||||
Theorem Yoga : ((E -> (Y \/ R)) /\ (Y -> R)) -> ~R -> ~E.
|
||||
Proof.
|
||||
I_imp H1.
|
||||
I_imp H2.
|
||||
I_non H3.
|
||||
I_antiT R.
|
||||
E_ou Y R.
|
||||
E_imp E.
|
||||
E_et_g (Y -> R).
|
||||
Hyp H1.
|
||||
|
||||
Hyp H3.
|
||||
|
||||
E_et_d (E -> Y \/ R).
|
||||
Hyp H1.
|
||||
|
||||
I_imp H4.
|
||||
Hyp H4.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Variable phi psi : Prop.
|
||||
|
||||
Theorem contra : (phi -> psi) -> (~psi -> ~phi).
|
||||
I_imp H1.
|
||||
I_imp H2.
|
||||
I_non H3.
|
||||
I_antiT psi.
|
||||
E_imp phi.
|
||||
Hyp H1.
|
||||
Hyp H3.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem P2nnP : phi -> ~~phi.
|
||||
I_imp H1.
|
||||
I_non H2.
|
||||
I_antiT phi.
|
||||
Hyp H1.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem nnP2P : ~~ phi -> phi.
|
||||
I_imp H1.
|
||||
absurde H2.
|
||||
E_non (~phi).
|
||||
Hyp H2.
|
||||
Hyp H1.
|
||||
Qed.
|
||||
|
||||
Variable A : Type.
|
||||
Variable chi : A -> A -> Prop.
|
||||
|
||||
Theorem Swap : (exists y, forall x, chi x y) -> (forall x, exists y, chi x y).
|
||||
Proof.
|
||||
I_imp H1.
|
||||
I_forall x.
|
||||
E_exists (fun y => forall x : A, chi x y).
|
||||
Hyp H1.
|
||||
|
||||
I_exists t.
|
||||
E_forall x.
|
||||
Hyp Ht.
|
||||
Qed.
|
||||
|
23
BE2019/coq-exercice-1.v
Executable file
23
BE2019/coq-exercice-1.v
Executable file
|
@ -0,0 +1,23 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2019_Logique_Exercice_1.
|
||||
|
||||
Variable A B C : Prop.
|
||||
|
||||
Theorem Exercice_1_Coq : (A -> B -> C) -> ((A /\ B) -> C).
|
||||
intros.
|
||||
cut B.
|
||||
cut A.
|
||||
exact H.
|
||||
destruct H0.
|
||||
exact H0.
|
||||
destruct H0.
|
||||
exact H1.
|
||||
Qed.
|
||||
|
||||
Theorem Exercice_1_Naturelle : (A -> B -> C) -> ((A /\ B) -> C).
|
||||
Proof.
|
||||
(* A COMPLETER *)
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Logique_Exercice_1.
|
||||
|
19
BE2019/coq-exercice-2.v
Executable file
19
BE2019/coq-exercice-2.v
Executable file
|
@ -0,0 +1,19 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2019_Logique_Exercice_2.
|
||||
|
||||
Variable A B : Prop.
|
||||
|
||||
Theorem Exercice_2_Coq : (~A) \/ B -> (~A) \/ (A /\ B).
|
||||
intros.
|
||||
right.
|
||||
split.
|
||||
|
||||
Qed.
|
||||
|
||||
Theorem Exercice_2_Naturelle : (~A) \/ B -> (~A) \/ (A /\ B).
|
||||
Proof.
|
||||
(* A COMPLETER *)
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Logique_Exercice_2.
|
||||
|
102
BE2019/coq-exercice-3.v
Executable file
102
BE2019/coq-exercice-3.v
Executable file
|
@ -0,0 +1,102 @@
|
|||
Section Session1_2019_Induction_Exercice_3.
|
||||
|
||||
(* Déclaration d’un domaine pour les éléments des listes *)
|
||||
Variable A : Set.
|
||||
|
||||
(* Déclaration d'un type liste générique d'éléments de type E *)
|
||||
Inductive liste (E : Set) : Set :=
|
||||
Nil
|
||||
: liste E
|
||||
| Cons : E -> liste E -> liste E.
|
||||
|
||||
(* Déclaration du nom de la fonction append *)
|
||||
Variable append_spec : forall E : Set, liste E -> liste E -> liste E.
|
||||
|
||||
(* Spécification du comportement de append pour Nil en premier paramètre *)
|
||||
Axiom append_Nil : forall E : Set, forall (l : liste E), append_spec E (Nil E) l = l.
|
||||
|
||||
(* Spécification du comportement de append pour Cons en premier paramètre *)
|
||||
Axiom append_Cons : forall E : Set, forall (t : E), forall (q l : liste E),
|
||||
append_spec E ((Cons E) t q) l = (Cons E) t (append_spec E q l).
|
||||
|
||||
(* Spécification du comportement de append pour Nil en second paramètre *)
|
||||
Axiom append_Nil_right : forall E : Set, forall (l : liste E), (append_spec E l (Nil E)) = l.
|
||||
|
||||
(* append est associative à gauche et à droite *)
|
||||
Axiom append_associative : forall E : Set, forall (l1 l2 l3 : liste E),
|
||||
(append_spec E l1 (append_spec E l2 l3)) = (append_spec E (append_spec E l1 l2) l3).
|
||||
|
||||
(* Déclaration du nom de la fonction flatten *)
|
||||
Variable flatten_spec : forall E : Set, liste (liste E) -> liste E.
|
||||
|
||||
(* Spécification du comportement de flatten pour Nil *)
|
||||
Axiom flatten_Nil : forall E : Set, flatten_spec E (Nil (liste E)) = (Nil E).
|
||||
|
||||
(* Spécification du comportement de flatten pour Cons *)
|
||||
Axiom flatten_Cons : forall E : Set, forall (t : liste E), forall (q : liste (liste E)),
|
||||
flatten_spec E (Cons (liste E) t q) = append_spec E t (flatten_spec E q).
|
||||
|
||||
(* Déclaration du nom de la fonction split *)
|
||||
Variable split_spec : forall E : Set, liste E -> liste (liste E).
|
||||
|
||||
(* Spécification du comportement de split pour Nil *)
|
||||
Axiom split_Nil : forall E : Set, split_spec E (Nil E) = (Nil (liste E)).
|
||||
|
||||
(* Spécification du comportement de split pour Cons *)
|
||||
Axiom split_Cons : forall E : Set, forall (t : E), forall (q : liste E),
|
||||
split_spec E (Cons E t q) = Cons (liste E) (Cons E t (Nil E)) (split_spec E q).
|
||||
|
||||
(* Cohérence de flatten et de split : flatten(split(l)) = l*)
|
||||
Theorem flatten_split_consistency : forall E : Set, forall (l : liste E),
|
||||
flatten_spec E (split_spec E l) = l.
|
||||
intros.
|
||||
induction l.
|
||||
rewrite split_Nil.
|
||||
rewrite flatten_Nil.
|
||||
reflexivity.
|
||||
rewrite split_Cons.
|
||||
rewrite flatten_Cons.
|
||||
rewrite IHl.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Nil.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction append *)
|
||||
Fixpoint append_impl (E : Set) (l1 l2 : liste E) {struct l1} : liste E :=
|
||||
match l1 with
|
||||
Nil _ => l2
|
||||
| (Cons _ t1 q1) => (Cons E t1 (append_impl E q1 l2))
|
||||
end.
|
||||
|
||||
Theorem append_correctness : forall E : Set, forall (l1 l2 : liste E),
|
||||
(append_spec E l1 l2) = (append_impl E l1 l2).
|
||||
intro TE.
|
||||
induction l1.
|
||||
intro Hl2.
|
||||
rewrite append_Nil.
|
||||
simpl.
|
||||
reflexivity.
|
||||
intro Hl2.
|
||||
rewrite append_Cons.
|
||||
simpl.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction flatten *)
|
||||
Fixpoint flatten_impl (E : Set) (l : liste (liste E)) {struct l} : liste E :=
|
||||
match l with
|
||||
Nil => Nil
|
||||
| (Cons t1 q1) => (Cons t1 (flatten_impl q1 l2))
|
||||
end.
|
||||
|
||||
|
||||
(* Correction de l'implantation de flatten par rapport à sa spécification *)
|
||||
Theorem flatten_correctness : forall E : Set, forall (l : liste (liste E)),
|
||||
(flatten_spec E l) = (flatten_impl E l).
|
||||
Proof.
|
||||
(* A COMPLETER *)
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Induction_Exercice_3.
|
24
BE2019/why3-exercice-4.mlw
Executable file
24
BE2019/why3-exercice-4.mlw
Executable file
|
@ -0,0 +1,24 @@
|
|||
(* BE : Session 1 2019 *)
|
||||
(* Implémentation de la fonction somme des premiers entiers par un algorithme ascendant *)
|
||||
|
||||
module Somme
|
||||
|
||||
use int.Int
|
||||
use int.ComputerDivision
|
||||
use ref.Refint
|
||||
|
||||
let somme (n: int) : int
|
||||
requires { n >= 0 }
|
||||
ensures { 2*result = n*(n+1) }
|
||||
=
|
||||
let i = ref 0 in
|
||||
let r = ref 0 in
|
||||
while (!i < n) do
|
||||
invariant { 2*!r = !i*(!i+1) }
|
||||
variant { n - !i }
|
||||
i := (!i) + 1;
|
||||
r := (!r) + (!i)
|
||||
done;
|
||||
!r
|
||||
|
||||
end
|
44
BE2019/why3-exercice-4/why3mnexercicemn4_Somme_VC_somme_1.v
Executable file
44
BE2019/why3-exercice-4/why3mnexercicemn4_Somme_VC_somme_1.v
Executable file
|
@ -0,0 +1,44 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
Require int.Abs.
|
||||
Require int.ComputerDivision.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Parameter r: Z.
|
||||
|
||||
Parameter i: Z.
|
||||
|
||||
Axiom H : (i < n)%Z.
|
||||
|
||||
Parameter i1: Z.
|
||||
|
||||
Axiom H1 : (i1 = (i + 1%Z)%Z).
|
||||
|
||||
Parameter r1: Z.
|
||||
|
||||
Axiom H2 : (r1 = (r + i1)%Z).
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_somme : False.
|
||||
Proof.
|
||||
|
||||
|
||||
Qed.
|
||||
|
44
BE2019/why3-exercice-4/why3mnexercicemn4_Somme_VC_somme_2.v
Executable file
44
BE2019/why3-exercice-4/why3mnexercicemn4_Somme_VC_somme_2.v
Executable file
|
@ -0,0 +1,44 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
Require int.Abs.
|
||||
Require int.ComputerDivision.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Parameter r: Z.
|
||||
|
||||
Parameter i: Z.
|
||||
|
||||
Axiom H : (i < n)%Z.
|
||||
|
||||
Parameter i1: Z.
|
||||
|
||||
Axiom H1 : (i1 = (i + 1%Z)%Z).
|
||||
|
||||
Parameter r1: Z.
|
||||
|
||||
Axiom H2 : (r1 = (r + i1)%Z).
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_somme : False.
|
||||
Proof.
|
||||
|
||||
|
||||
Qed.
|
||||
|
39
BE2019/why3-exercice-4/why3session.xml
Executable file
39
BE2019/why3-exercice-4/why3session.xml
Executable file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="Coq" version="8.9.1" timelimit="0" steplimit="0" memlimit="0"/>
|
||||
<prover id="5" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file>
|
||||
<path name=".."/>
|
||||
<path name="why3-exercice-4.mlw"/>
|
||||
<theory name="Somme">
|
||||
<goal name="VC somme" expl="VC for somme">
|
||||
<proof prover="1"><result status="unknown" time="0.05"/></proof>
|
||||
<transf name="split_vc" >
|
||||
<goal name="VC somme.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="1"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.1" expl="loop variant decrease">
|
||||
<proof prover="0"><result status="unknown" time="0.07"/></proof>
|
||||
<proof prover="1"><result status="unknown" time="0.04"/></proof>
|
||||
<proof prover="2"><result status="timeout" time="5.00"/></proof>
|
||||
<proof prover="3"><result status="unknown" time="0.01"/></proof>
|
||||
<proof prover="4" obsolete="true" edited="why3mnexercicemn4_Somme_VC_somme_2.v"><result status="unknown" time="0.00" steps="0"/></proof>
|
||||
<proof prover="5"><result status="timeout" time="5.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="4"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.3" expl="postcondition" proved="true">
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="2"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
40
BE2020/.Naturelle.aux
Executable file
40
BE2020/.Naturelle.aux
Executable file
|
@ -0,0 +1,40 @@
|
|||
COQAUX1 3e03a7b5b5c26232f0f3e8f10219c975 /home/lfainsin/1A/Modé/BE2020/Naturelle.v
|
||||
383 387 proof_build_time "0.000"
|
||||
0 0 E_imp_th "0.000"
|
||||
383 387 context_used ""
|
||||
383 387 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
916 920 proof_build_time "0.000"
|
||||
0 0 E_forall_th "0.000"
|
||||
916 920 context_used ""
|
||||
916 920 proof_check_time "0.000"
|
||||
1291 1295 proof_build_time "0.001"
|
||||
0 0 E_et_g_th "0.001"
|
||||
1291 1295 context_used ""
|
||||
1291 1295 proof_check_time "0.000"
|
||||
1601 1605 proof_build_time "0.000"
|
||||
0 0 E_et_d_th "0.000"
|
||||
1601 1605 context_used ""
|
||||
1601 1605 proof_check_time "0.000"
|
||||
1983 1987 proof_build_time "0.001"
|
||||
0 0 E_ou_th "0.001"
|
||||
1983 1987 context_used ""
|
||||
1983 1987 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
2806 2810 proof_build_time "0.001"
|
||||
0 0 E_exists_th "0.001"
|
||||
2806 2810 context_used ""
|
||||
2806 2810 proof_check_time "0.000"
|
||||
3280 3284 proof_build_time "0.000"
|
||||
0 0 E_antiT_th "0.000"
|
||||
3280 3284 context_used ""
|
||||
3280 3284 proof_check_time "0.000"
|
||||
3502 3506 proof_build_time "0.001"
|
||||
0 0 I_antiT_th "0.001"
|
||||
3502 3506 context_used ""
|
||||
3502 3506 proof_check_time "0.000"
|
||||
3683 3687 proof_build_time "0.000"
|
||||
0 0 I_non_th "0.000"
|
||||
3683 3687 context_used ""
|
||||
3683 3687 proof_check_time "0.000"
|
||||
0 0 vo_compile_time "0.107"
|
150
BE2020/Naturelle.glob
Executable file
150
BE2020/Naturelle.glob
Executable file
|
@ -0,0 +1,150 @@
|
|||
DIGEST 3e03a7b5b5c26232f0f3e8f10219c975
|
||||
FNaturelle
|
||||
R15:23 Coq.Logic.Classical <> <> lib
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
prf 278:285 <> E_imp_th
|
||||
R314:314 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R325:329 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R333:336 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R337:339 Naturelle <> psi var
|
||||
R330:332 Naturelle <> phi var
|
||||
R318:321 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R322:324 Naturelle <> psi var
|
||||
R315:317 Naturelle <> phi var
|
||||
R443:450 Naturelle <> E_imp_th thm
|
||||
R521:528 Naturelle <> E_imp_th thm
|
||||
prf 816:826 <> E_forall_th
|
||||
R856:859 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R855:855 Naturelle <> A var
|
||||
R869:869 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R885:889 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R890:892 Naturelle <> phi var
|
||||
R894:894 Naturelle <> a var
|
||||
R880:882 Naturelle <> phi var
|
||||
R884:884 Naturelle <> x var
|
||||
R996:1006 Naturelle <> E_forall_th thm
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1105:1108 Coq.Init.Logic <> conj constr
|
||||
prf 1157:1165 <> E_et_g_th
|
||||
R1194:1194 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1205:1209 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1210:1212 Naturelle <> phi var
|
||||
R1198:1201 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1195:1197 Naturelle <> phi var
|
||||
R1202:1204 Naturelle <> psi var
|
||||
R1352:1360 Naturelle <> E_et_g_th thm
|
||||
R1432:1440 Naturelle <> E_et_g_th thm
|
||||
prf 1465:1473 <> E_et_d_th
|
||||
R1502:1502 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1513:1517 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1518:1520 Naturelle <> psi var
|
||||
R1506:1509 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1503:1505 Naturelle <> phi var
|
||||
R1510:1512 Naturelle <> psi var
|
||||
R1662:1670 Naturelle <> E_et_d_th thm
|
||||
R1743:1751 Naturelle <> E_et_d_th thm
|
||||
prf 1776:1782 <> E_ou_th
|
||||
R1815:1815 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1826:1830 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1831:1831 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1842:1846 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1847:1847 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1858:1862 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1863:1865 Naturelle <> chi var
|
||||
R1851:1854 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1855:1857 Naturelle <> chi var
|
||||
R1848:1850 Naturelle <> psi var
|
||||
R1835:1838 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1839:1841 Naturelle <> chi var
|
||||
R1832:1834 Naturelle <> phi var
|
||||
R1819:1822 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R1816:1818 Naturelle <> phi var
|
||||
R1823:1825 Naturelle <> psi var
|
||||
R2042:2048 Naturelle <> E_ou_th thm
|
||||
R2124:2130 Naturelle <> E_ou_th thm
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2213:2221 Coq.Init.Logic <> or_introl constr
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2324:2332 Coq.Init.Logic <> or_intror constr
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2453:2460 Coq.Init.Logic <> ex_intro constr
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2597:2604 Coq.Init.Logic <> ex_intro constr
|
||||
prf 2669:2679 <> E_exists_th
|
||||
R2709:2712 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2708:2708 Naturelle <> A var
|
||||
R2733:2733 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2749:2753 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2754:2754 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2777:2781 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2782:2784 Naturelle <> chi var
|
||||
R2770:2773 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2774:2776 Naturelle <> chi var
|
||||
R2765:2767 Naturelle <> phi var
|
||||
R2769:2769 Naturelle <> a var
|
||||
R2734:2740 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2742:2743 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2744:2746 Naturelle <> phi var
|
||||
R2748:2748 Naturelle <> x var
|
||||
R2963:2973 Naturelle <> E_exists_th thm
|
||||
R3083:3085 Coq.Init.Logic <> not def
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3145:3151 Coq.Logic.Classical_Prop <> classic prfax
|
||||
prf 3209:3218 <> E_antiT_th
|
||||
R3248:3251 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3252:3254 Naturelle <> phi var
|
||||
R3243:3247 Coq.Init.Logic <> False ind
|
||||
R3340:3349 Naturelle <> E_antiT_th thm
|
||||
prf 3370:3379 <> I_antiT_th
|
||||
R3407:3410 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3411:3411 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3416:3420 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3421:3425 Coq.Init.Logic <> False ind
|
||||
R3412:3412 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3413:3415 Naturelle <> phi var
|
||||
R3404:3406 Naturelle <> phi var
|
||||
R3435:3437 Coq.Init.Logic <> not def
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3567:3576 Naturelle <> I_antiT_th thm
|
||||
prf 3598:3605 <> I_non_th
|
||||
R3630:3630 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3643:3647 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3648:3648 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3649:3651 Naturelle <> phi var
|
||||
R3634:3637 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3638:3642 Coq.Init.Logic <> False ind
|
||||
R3631:3633 Naturelle <> phi var
|
||||
R3669:3671 Coq.Init.Logic <> not def
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3745:3752 Naturelle <> I_non_th thm
|
||||
R3801:3810 Naturelle <> I_antiT_th thm
|
||||
R3875:3878 Coq.Logic.Classical_Prop <> NNPP thm
|
224
BE2020/Naturelle.v
Executable file
224
BE2020/Naturelle.v
Executable file
|
@ -0,0 +1,224 @@
|
|||
Require Export Classical.
|
||||
|
||||
Ltac Hyp Nom := exact Nom.
|
||||
|
||||
Ltac I_imp' :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => let hyp := fresh "H" in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_imp Nom :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_imp_th : forall (phi psi : Prop), (phi -> psi) -> phi -> psi.
|
||||
intros Pphi Ppsi Hphi2psi.
|
||||
Hyp Hphi2psi.
|
||||
Qed.
|
||||
|
||||
Ltac E_imp' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_imp_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_imp phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_imp_th phi P)
|
||||
end.
|
||||
|
||||
Ltac I_forall' :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => let hyp := fresh x in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_forall Nom :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_forall_th : forall (A : Type) (phi : A -> Prop) a, (forall x, phi x) -> phi a.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
|
||||
Ltac E_forall x :=
|
||||
pattern x;
|
||||
match goal with
|
||||
| |- (?P x) => apply (E_forall_th _ P x)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_et :=
|
||||
match goal with
|
||||
| |- (?A /\ ?B) => apply (@conj A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_et_g_th : forall (phi psi : Prop), (phi /\ psi) -> phi.
|
||||
intros Pphi Ppsi Hphi_et_psi.
|
||||
elim Hphi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_g' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_g_th P _)
|
||||
end.
|
||||
|
||||
Ltac E_et_g psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_et_g_th P psi)
|
||||
end.
|
||||
|
||||
Theorem E_et_d_th : forall (phi psi : Prop), (phi /\ psi) -> psi.
|
||||
intros Pphi Ppsi H_phi_et_psi.
|
||||
elim H_phi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hpsi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_d' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_et_d phi :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th phi P)
|
||||
end.
|
||||
|
||||
Theorem E_ou_th : forall (phi psi chi : Prop), (phi \/ psi) -> (phi -> chi) -> (psi -> chi) -> chi.
|
||||
intros Pphi Ppsi Pchi Hphi_ou_psi Hphi_imp_chi Hpsi_imp_chi.
|
||||
elim Hphi_ou_psi.
|
||||
Hyp Hphi_imp_chi.
|
||||
Hyp Hpsi_imp_chi.
|
||||
Qed.
|
||||
|
||||
Ltac E_ou' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_ou_th _ _ P)
|
||||
end.
|
||||
|
||||
Ltac E_ou phi psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_ou_th phi psi P)
|
||||
end.
|
||||
|
||||
Ltac I_ou_g :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_introl A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_ou_d :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_intror A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists' :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => eapply (@ex_intro A P _)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists t :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => apply (@ex_intro _ P t)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_exists_th : forall (A : Type) (phi : A -> Prop) (chi : Prop), (exists x, phi x) -> (forall a, phi a -> chi) -> chi.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
(*
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P)
|
||||
end.
|
||||
*)
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P); [ idtac | let t := fresh "t" in let ht := fresh "Ht" in intros t ht ]
|
||||
end.
|
||||
|
||||
Ltac TE :=
|
||||
unfold not;
|
||||
match goal with
|
||||
| |- (?P \/ (?P -> False)) => exact (classic P)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_antiT_th : forall (phi : Prop), False -> phi.
|
||||
intros Pphi F.
|
||||
elim F.
|
||||
Qed.
|
||||
|
||||
Ltac E_antiT :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_antiT_th P)
|
||||
end.
|
||||
|
||||
Theorem I_antiT_th : forall (phi : Prop), phi -> (~phi) -> False.
|
||||
unfold not.
|
||||
intro Pphi.
|
||||
intros Hphi Hnphi.
|
||||
cut Pphi.
|
||||
Hyp Hnphi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac I_antiT phi :=
|
||||
match goal with
|
||||
| |- False => apply (I_antiT_th phi)
|
||||
end.
|
||||
|
||||
Theorem I_non_th : forall (phi : Prop), (phi -> False) -> ~phi.
|
||||
intros.
|
||||
unfold not.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
Ltac I_non Nom :=
|
||||
match goal with
|
||||
| |- ~ ?P => apply (I_non_th P); intro Nom
|
||||
end.
|
||||
|
||||
Ltac E_non phi :=
|
||||
apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom :=
|
||||
match goal with
|
||||
| |- ?P => apply (NNPP P); intro Nom
|
||||
end.
|
||||
|
||||
(*
|
||||
Ltac I_antiT phi := apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom phi :=
|
||||
match goal with
|
||||
| |- phi =>
|
||||
cut (phi \/ ~phi);
|
||||
[
|
||||
intros L;
|
||||
elim L;
|
||||
[
|
||||
auto
|
||||
|
|
||||
clear L;
|
||||
intro Nom;
|
||||
apply (E_antiT_th)
|
||||
]
|
||||
|
|
||||
apply (classic phi)
|
||||
]
|
||||
| _ => fail
|
||||
end.
|
||||
*)
|
41
BE2020/coq_exercice_1.v
Executable file
41
BE2020/coq_exercice_1.v
Executable file
|
@ -0,0 +1,41 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2020_Logique_Exercice_1.
|
||||
|
||||
Variable A B C : Prop.
|
||||
|
||||
Theorem Exercice_1_Naturelle : ((A -> C) \/ (B -> C)) -> ((A /\ B) -> C).
|
||||
I_imp H1.
|
||||
I_imp H2.
|
||||
E_imp A.
|
||||
E_ou (A -> C) (B -> C).
|
||||
Hyp H1.
|
||||
trivial.
|
||||
I_imp H3.
|
||||
I_imp H4.
|
||||
E_imp B.
|
||||
Hyp H3.
|
||||
E_et_d A.
|
||||
Hyp H2.
|
||||
E_et_g B.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem Exercice_1_Coq : ((A -> C) \/ (B -> C)) -> ((A /\ B) -> C).
|
||||
intros.
|
||||
destruct H.
|
||||
destruct H0.
|
||||
cut A.
|
||||
exact H.
|
||||
exact H0.
|
||||
cut B.
|
||||
exact H.
|
||||
cut (A /\ B).
|
||||
intro H2.
|
||||
elim H2.
|
||||
intros HA HB.
|
||||
exact HB.
|
||||
exact H0.
|
||||
Qed.
|
||||
|
||||
End Session1_2020_Logique_Exercice_1.
|
||||
|
17
BE2020/coq_exercice_2.v
Executable file
17
BE2020/coq_exercice_2.v
Executable file
|
@ -0,0 +1,17 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2020_Logique_Exercice_2.
|
||||
|
||||
Variable A B : Prop.
|
||||
|
||||
Theorem Exercice_2_Naturelle : (A -> B) -> ((~A) \/ B).
|
||||
Proof.
|
||||
(* A COMPLETER *)
|
||||
Qed.
|
||||
|
||||
Theorem Exercice_2_Coq : (A -> B) -> ((~A) \/ B).
|
||||
Proof.
|
||||
(* A COMPLETER *)
|
||||
Qed.
|
||||
|
||||
End Session1_2020_Logique_Exercice_2.
|
||||
|
91
BE2020/coq_exercice_3.v
Executable file
91
BE2020/coq_exercice_3.v
Executable file
|
@ -0,0 +1,91 @@
|
|||
Section Session1_2020_Induction_Exercice_3.
|
||||
|
||||
(* Déclaration d’un domaine pour les éléments des listes *)
|
||||
Variable A : Set.
|
||||
|
||||
Inductive entier : Set :=
|
||||
Zero : entier
|
||||
| Succ : entier -> entier.
|
||||
|
||||
(* Déclaration du nom de la fonction somme *)
|
||||
Variable somme_spec : entier -> entier -> entier.
|
||||
|
||||
(* Spécification du comportement de somme pour Zero en premier paramètre *)
|
||||
Axiom somme_Zero : forall (n : entier), somme_spec Zero n = n.
|
||||
|
||||
(* Spécification du comportement de somme pour Succ en premier paramètre *)
|
||||
Axiom somme_Succ : forall (n m : entier),
|
||||
somme_spec (Succ n) m = Succ (somme_spec n m).
|
||||
|
||||
(* somme est associative à gauche et à droite *)
|
||||
Axiom somme_associative : forall (n1 n2 n3 : entier),
|
||||
(somme_spec n1 (somme_spec n2 n3)) = (somme_spec (somme_spec n1 n2) n3).
|
||||
|
||||
Inductive liste : Set :=
|
||||
Nil
|
||||
: liste
|
||||
| Cons : A -> liste -> liste.
|
||||
|
||||
(* Déclaration du nom de la fonction append *)
|
||||
Variable append_spec : liste -> liste -> liste.
|
||||
|
||||
(* Spécification du comportement de append pour Nil en premier paramètre *)
|
||||
Axiom append_Nil : forall (l : liste), append_spec Nil l = l.
|
||||
|
||||
(* Spécification du comportement de append pour Cons en premier paramètre *)
|
||||
Axiom append_Cons : forall (t : A), forall (q l : liste),
|
||||
append_spec (Cons t q) l = Cons t (append_spec q l).
|
||||
|
||||
(* append est associative à gauche et à droite *)
|
||||
Axiom append_associative : forall (l1 l2 l3 : liste),
|
||||
(append_spec l1 (append_spec l2 l3)) = (append_spec (append_spec l1 l2) l3).
|
||||
|
||||
(* Déclaration du nom de la fonction taille *)
|
||||
Variable taille_spec : liste -> entier.
|
||||
|
||||
(* Spécification du comportement de taille pour Nil en paramètre *)
|
||||
Axiom taille_Nil : taille_spec Nil = Zero .
|
||||
|
||||
(* Spécification du comportement de taille pour Cons en paramètre *)
|
||||
Axiom taille_Cons : forall (t : A), forall (q : liste),
|
||||
taille_spec (Cons t q) = Succ (taille_spec q) .
|
||||
|
||||
|
||||
(* taille commute avec append *)
|
||||
Theorem taille_append : forall (l1 l2 : liste),
|
||||
(taille_spec (append_spec l1 l2)) = (somme_spec (taille_spec l1) (taille_spec l2)).
|
||||
intros.
|
||||
induction l1.
|
||||
rewrite append_Nil.
|
||||
rewrite taille_Nil.
|
||||
rewrite somme_Zero.
|
||||
reflexivity.
|
||||
rewrite append_Cons.
|
||||
rewrite taille_Cons.
|
||||
rewrite taille_Cons.
|
||||
rewrite somme_Succ.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction taille *)
|
||||
Fixpoint taille_impl (l : liste) {struct l} : entier :=
|
||||
match l with
|
||||
Nil => Zero
|
||||
| (Cons t q) => (Succ (taille_impl q))
|
||||
end.
|
||||
|
||||
Theorem taille_correctness : forall (l : liste),
|
||||
(taille_spec l) = (taille_impl l).
|
||||
intros.
|
||||
induction l.
|
||||
simpl taille_impl.
|
||||
rewrite taille_Nil.
|
||||
reflexivity.
|
||||
simpl taille_impl.
|
||||
rewrite taille_Cons.
|
||||
rewrite IHl.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
End Session1_2020_Induction_Exercice_3.
|
23
BE2020/why3_exercice_4.mlw
Executable file
23
BE2020/why3_exercice_4.mlw
Executable file
|
@ -0,0 +1,23 @@
|
|||
(* BE : Session 1 2020 *)
|
||||
(* Implémentation de la fonction carre d'un entier naturel par un algorithme inspiré des identités remarquables *)
|
||||
|
||||
module Carre
|
||||
|
||||
use int.Int
|
||||
use ref.Refint
|
||||
|
||||
let carre (n: int) : int
|
||||
requires { 0 <= n }
|
||||
ensures { !r = n*n }
|
||||
=
|
||||
let x = ref n in
|
||||
let r = ref 0 in
|
||||
while (!x <> 0) do
|
||||
invariant { !r + (!x)*(!x) = n*n && 0 <= !x }
|
||||
variant { !x }
|
||||
r := (!r) + 2 * (!x) - 1;
|
||||
x := (!x) - 1
|
||||
done;
|
||||
!r
|
||||
|
||||
end
|
36
BE2020/why3_exercice_4/why3session.xml
Executable file
36
BE2020/why3_exercice_4/why3session.xml
Executable file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file>
|
||||
<path name=".."/>
|
||||
<path name="why3_exercice_4.mlw"/>
|
||||
<theory name="Carre">
|
||||
<goal name="VC carre" expl="VC for carre">
|
||||
<transf name="split_vc" >
|
||||
<goal name="VC carre.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="1"/></proof>
|
||||
</goal>
|
||||
<goal name="VC carre.1" expl="loop variant decrease">
|
||||
<proof prover="0"><result status="unknown" time="0.01"/></proof>
|
||||
<proof prover="1"><result status="unknown" time="0.12"/></proof>
|
||||
<proof prover="2"><result status="timeout" time="5.00"/></proof>
|
||||
<proof prover="3"><result status="unknown" time="0.02"/></proof>
|
||||
<proof prover="4"><result status="timeout" time="5.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC carre.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="4"/></proof>
|
||||
</goal>
|
||||
<goal name="VC carre.3" expl="postcondition" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="2"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
40
TP1/.Naturelle.aux
Executable file
40
TP1/.Naturelle.aux
Executable file
|
@ -0,0 +1,40 @@
|
|||
COQAUX1 f13e540aa0997388dd1408b0662438d6 /home/lfainsin/1A/Modé/TP1/Naturelle.v
|
||||
383 387 proof_build_time "0.001"
|
||||
0 0 E_imp_th "0.001"
|
||||
383 387 context_used ""
|
||||
383 387 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
916 920 proof_build_time "0.001"
|
||||
0 0 E_forall_th "0.001"
|
||||
916 920 context_used ""
|
||||
916 920 proof_check_time "0.000"
|
||||
1291 1295 proof_build_time "0.001"
|
||||
0 0 E_et_g_th "0.001"
|
||||
1291 1295 context_used ""
|
||||
1291 1295 proof_check_time "0.000"
|
||||
1601 1605 proof_build_time "0.001"
|
||||
0 0 E_et_d_th "0.001"
|
||||
1601 1605 context_used ""
|
||||
1601 1605 proof_check_time "0.000"
|
||||
1983 1987 proof_build_time "0.001"
|
||||
0 0 E_ou_th "0.001"
|
||||
1983 1987 context_used ""
|
||||
1983 1987 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
2806 2810 proof_build_time "0.001"
|
||||
0 0 E_exists_th "0.001"
|
||||
2806 2810 context_used ""
|
||||
2806 2810 proof_check_time "0.000"
|
||||
3280 3284 proof_build_time "0.000"
|
||||
0 0 E_antiT_th "0.000"
|
||||
3280 3284 context_used ""
|
||||
3280 3284 proof_check_time "0.000"
|
||||
3502 3506 proof_build_time "0.001"
|
||||
0 0 I_antiT_th "0.001"
|
||||
3502 3506 context_used ""
|
||||
3502 3506 proof_check_time "0.000"
|
||||
3683 3687 proof_build_time "0.000"
|
||||
0 0 I_non_th "0.000"
|
||||
3683 3687 context_used ""
|
||||
3683 3687 proof_check_time "0.000"
|
||||
0 0 vo_compile_time "0.713"
|
150
TP1/Naturelle.glob
Executable file
150
TP1/Naturelle.glob
Executable file
|
@ -0,0 +1,150 @@
|
|||
DIGEST f13e540aa0997388dd1408b0662438d6
|
||||
FNaturelle
|
||||
R15:23 Coq.Logic.Classical <> <> lib
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
prf 278:285 <> E_imp_th
|
||||
R314:314 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R325:329 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R333:336 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R337:339 Naturelle <> psi var
|
||||
R330:332 Naturelle <> phi var
|
||||
R318:321 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R322:324 Naturelle <> psi var
|
||||
R315:317 Naturelle <> phi var
|
||||
R443:450 Naturelle <> E_imp_th thm
|
||||
R521:528 Naturelle <> E_imp_th thm
|
||||
prf 816:826 <> E_forall_th
|
||||
R856:859 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R855:855 Naturelle <> A var
|
||||
R869:869 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R885:889 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R890:892 Naturelle <> phi var
|
||||
R894:894 Naturelle <> a var
|
||||
R880:882 Naturelle <> phi var
|
||||
R884:884 Naturelle <> x var
|
||||
R996:1006 Naturelle <> E_forall_th thm
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1105:1108 Coq.Init.Logic <> conj constr
|
||||
prf 1157:1165 <> E_et_g_th
|
||||
R1194:1194 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1205:1209 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1210:1212 Naturelle <> phi var
|
||||
R1198:1201 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1195:1197 Naturelle <> phi var
|
||||
R1202:1204 Naturelle <> psi var
|
||||
R1352:1360 Naturelle <> E_et_g_th thm
|
||||
R1432:1440 Naturelle <> E_et_g_th thm
|
||||
prf 1465:1473 <> E_et_d_th
|
||||
R1502:1502 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1513:1517 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1518:1520 Naturelle <> psi var
|
||||
R1506:1509 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1503:1505 Naturelle <> phi var
|
||||
R1510:1512 Naturelle <> psi var
|
||||
R1662:1670 Naturelle <> E_et_d_th thm
|
||||
R1743:1751 Naturelle <> E_et_d_th thm
|
||||
prf 1776:1782 <> E_ou_th
|
||||
R1815:1815 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1826:1830 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1831:1831 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1842:1846 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1847:1847 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1858:1862 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1863:1865 Naturelle <> chi var
|
||||
R1851:1854 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1855:1857 Naturelle <> chi var
|
||||
R1848:1850 Naturelle <> psi var
|
||||
R1835:1838 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1839:1841 Naturelle <> chi var
|
||||
R1832:1834 Naturelle <> phi var
|
||||
R1819:1822 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R1816:1818 Naturelle <> phi var
|
||||
R1823:1825 Naturelle <> psi var
|
||||
R2042:2048 Naturelle <> E_ou_th thm
|
||||
R2124:2130 Naturelle <> E_ou_th thm
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2213:2221 Coq.Init.Logic <> or_introl constr
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2324:2332 Coq.Init.Logic <> or_intror constr
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2453:2460 Coq.Init.Logic <> ex_intro constr
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2597:2604 Coq.Init.Logic <> ex_intro constr
|
||||
prf 2669:2679 <> E_exists_th
|
||||
R2709:2712 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2708:2708 Naturelle <> A var
|
||||
R2733:2733 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2749:2753 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2754:2754 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2777:2781 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2782:2784 Naturelle <> chi var
|
||||
R2770:2773 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2774:2776 Naturelle <> chi var
|
||||
R2765:2767 Naturelle <> phi var
|
||||
R2769:2769 Naturelle <> a var
|
||||
R2734:2740 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2742:2743 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2744:2746 Naturelle <> phi var
|
||||
R2748:2748 Naturelle <> x var
|
||||
R2963:2973 Naturelle <> E_exists_th thm
|
||||
R3083:3085 Coq.Init.Logic <> not def
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3145:3151 Coq.Logic.Classical_Prop <> classic prfax
|
||||
prf 3209:3218 <> E_antiT_th
|
||||
R3248:3251 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3252:3254 Naturelle <> phi var
|
||||
R3243:3247 Coq.Init.Logic <> False ind
|
||||
R3340:3349 Naturelle <> E_antiT_th thm
|
||||
prf 3370:3379 <> I_antiT_th
|
||||
R3407:3410 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3411:3411 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3416:3420 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3421:3425 Coq.Init.Logic <> False ind
|
||||
R3412:3412 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3413:3415 Naturelle <> phi var
|
||||
R3404:3406 Naturelle <> phi var
|
||||
R3435:3437 Coq.Init.Logic <> not def
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3567:3576 Naturelle <> I_antiT_th thm
|
||||
prf 3598:3605 <> I_non_th
|
||||
R3630:3630 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3643:3647 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3648:3648 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3649:3651 Naturelle <> phi var
|
||||
R3634:3637 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3638:3642 Coq.Init.Logic <> False ind
|
||||
R3631:3633 Naturelle <> phi var
|
||||
R3669:3671 Coq.Init.Logic <> not def
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3745:3752 Naturelle <> I_non_th thm
|
||||
R3801:3810 Naturelle <> I_antiT_th thm
|
||||
R3875:3878 Coq.Logic.Classical_Prop <> NNPP thm
|
225
TP1/Naturelle.v
Executable file
225
TP1/Naturelle.v
Executable file
|
@ -0,0 +1,225 @@
|
|||
Require Export Classical.
|
||||
|
||||
Ltac Hyp Nom := exact Nom.
|
||||
|
||||
Ltac I_imp' :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => let hyp := fresh "H" in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_imp Nom :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_imp_th : forall (phi psi : Prop), (phi -> psi) -> phi -> psi.
|
||||
intros Pphi Ppsi Hphi2psi.
|
||||
Hyp Hphi2psi.
|
||||
Qed.
|
||||
|
||||
Ltac E_imp' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_imp_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_imp phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_imp_th phi P)
|
||||
end.
|
||||
|
||||
Ltac I_forall' :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => let hyp := fresh x in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_forall Nom :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_forall_th : forall (A : Type) (phi : A -> Prop) a, (forall x, phi x) -> phi a.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
|
||||
Ltac E_forall x :=
|
||||
pattern x;
|
||||
match goal with
|
||||
| |- (?P x) => apply (E_forall_th _ P x)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_et :=
|
||||
match goal with
|
||||
| |- (?A /\ ?B) => apply (@conj A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_et_g_th : forall (phi psi : Prop), (phi /\ psi) -> phi.
|
||||
intros Pphi Ppsi Hphi_et_psi.
|
||||
elim Hphi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_g' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_g_th P _)
|
||||
end.
|
||||
|
||||
Ltac E_et_g psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_et_g_th P psi)
|
||||
end.
|
||||
|
||||
Theorem E_et_d_th : forall (phi psi : Prop), (phi /\ psi) -> psi.
|
||||
intros Pphi Ppsi H_phi_et_psi.
|
||||
elim H_phi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hpsi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_d' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_et_d phi :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th phi P)
|
||||
end.
|
||||
|
||||
Theorem E_ou_th : forall (phi psi chi : Prop), (phi \/ psi) -> (phi -> chi) -> (psi -> chi) -> chi.
|
||||
intros Pphi Ppsi Pchi Hphi_ou_psi Hphi_imp_chi Hpsi_imp_chi.
|
||||
elim Hphi_ou_psi.
|
||||
Hyp Hphi_imp_chi.
|
||||
Hyp Hpsi_imp_chi.
|
||||
Qed.
|
||||
|
||||
Ltac E_ou' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_ou_th _ _ P)
|
||||
end.
|
||||
|
||||
Ltac E_ou phi psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_ou_th phi psi P)
|
||||
end.
|
||||
|
||||
Ltac I_ou_g :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_introl A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_ou_d :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_intror A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists' :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => eapply (@ex_intro A P _)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists t :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => apply (@ex_intro _ P t)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_exists_th : forall (A : Type) (phi : A -> Prop) (chi : Prop), (exists x, phi x) -> (forall a, phi a -> chi) -> chi.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
(*
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P)
|
||||
end.
|
||||
*)
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P); [ idtac | let t := fresh "t" in let ht := fresh "Ht" in intros t ht ]
|
||||
end.
|
||||
|
||||
Ltac TE :=
|
||||
unfold not;
|
||||
match goal with
|
||||
| |- (?P \/ (?P -> False)) => exact (classic P)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_antiT_th : forall (phi : Prop), False -> phi.
|
||||
intros Pphi F.
|
||||
elim F.
|
||||
Qed.
|
||||
|
||||
Ltac E_antiT :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_antiT_th P)
|
||||
end.
|
||||
|
||||
Theorem I_antiT_th : forall (phi : Prop), phi -> (~phi) -> False.
|
||||
unfold not.
|
||||
intro Pphi.
|
||||
intros Hphi Hnphi.
|
||||
cut Pphi.
|
||||
Hyp Hnphi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac I_antiT phi :=
|
||||
match goal with
|
||||
| |- False => apply (I_antiT_th phi)
|
||||
end.
|
||||
|
||||
Theorem I_non_th : forall (phi : Prop), (phi -> False) -> ~phi.
|
||||
intros.
|
||||
unfold not.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
Ltac I_non Nom :=
|
||||
match goal with
|
||||
| |- ~ ?P => apply (I_non_th P); intro Nom
|
||||
end.
|
||||
|
||||
Ltac E_non phi :=
|
||||
apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom :=
|
||||
match goal with
|
||||
| |- ?P => apply (NNPP P); intro Nom
|
||||
end.
|
||||
|
||||
(*
|
||||
Ltac I_antiT phi := apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom phi :=
|
||||
match goal with
|
||||
| |- phi =>
|
||||
cut (phi \/ ~phi);
|
||||
[
|
||||
intros L;
|
||||
elim L;
|
||||
[
|
||||
auto
|
||||
|
|
||||
clear L;
|
||||
intro Nom;
|
||||
apply (E_antiT_th)
|
||||
]
|
||||
|
|
||||
apply (classic phi)
|
||||
]
|
||||
| _ => fail
|
||||
end.
|
||||
*)
|
||||
|
119
TP1/TP1.v
Executable file
119
TP1/TP1.v
Executable file
|
@ -0,0 +1,119 @@
|
|||
(* Les règles de la déduction naturelle doivent être ajoutées à Coq. *)
|
||||
Require Import Naturelle.
|
||||
|
||||
(* Ouverture d\u2019une section *)
|
||||
Section CalculPropositionnel.
|
||||
|
||||
(* Déclaration de variables propositionnelles *)
|
||||
Variable A B C E Y R : Prop.
|
||||
|
||||
(*Exerice 1*)
|
||||
|
||||
Theorem Thm00 : A /\ B -> B /\ A.
|
||||
I_imp H.
|
||||
I_et.
|
||||
E_et_d A.
|
||||
Hyp H.
|
||||
E_et_g B.
|
||||
Hyp H.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_1 : ((A \/ B) -> C) -> (B -> C).
|
||||
I_imp H.
|
||||
I_imp H2.
|
||||
E_imp (A \/ B).
|
||||
Hyp H.
|
||||
I_ou_d.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_2 : A -> ~~A.
|
||||
I_imp H.
|
||||
I_non H2.
|
||||
I_antiT A.
|
||||
Hyp H.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_3 : (A -> B) -> (~B -> ~A).
|
||||
I_imp H.
|
||||
I_imp H2.
|
||||
I_non H3.
|
||||
I_antiT B.
|
||||
E_imp A.
|
||||
Hyp H.
|
||||
Hyp H3.
|
||||
Hyp H2.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_4 : ~~A -> A.
|
||||
I_imp H.
|
||||
absurde H2.
|
||||
I_antiT (~A).
|
||||
Hyp H2.
|
||||
Hyp H.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_5 : (~B -> ~A) -> (A -> B).
|
||||
|
||||
I_imp H.
|
||||
I_imp H2.
|
||||
absurde H3.
|
||||
I_antiT (A).
|
||||
Hyp H2.
|
||||
E_imp (~B).
|
||||
trivial.
|
||||
trivial.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_6 : ((E -> (Y \/ R)) /\ (Y -> R)) -> (~R -> ~E).
|
||||
intros.
|
||||
I_non H1.
|
||||
I_antiT (R).
|
||||
E_ou Y R.
|
||||
E_imp E.
|
||||
E_et_g (Y -> R).
|
||||
Hyp H.
|
||||
Hyp H1.
|
||||
E_et_d (E -> Y \/ R).
|
||||
Hyp H.
|
||||
I_imp H2.
|
||||
tauto.
|
||||
tauto.
|
||||
Qed.
|
||||
|
||||
(*Exerice 2*)
|
||||
|
||||
Theorem Coq_E_imp : ((A -> B) /\ A) -> B.
|
||||
intros.
|
||||
destruct H as (H1,H2).
|
||||
tauto.
|
||||
Qed.
|
||||
|
||||
Theorem Coq_E_et_g : (A /\ B) -> A.
|
||||
intros.
|
||||
destruct H as (H1,H2).
|
||||
trivial.
|
||||
Qed.
|
||||
|
||||
Theorem Coq_E_ou : ((A \/ B) /\ (A -> C) /\ (B -> C)) -> C.
|
||||
intros.
|
||||
destruct H as (H1,H2).
|
||||
destruct H2 as (H2,H3).
|
||||
destruct H1 as [H4 | H5].
|
||||
E_imp A.
|
||||
Hyp H2.
|
||||
Hyp H4.
|
||||
E_imp B.
|
||||
trivial.
|
||||
trivial.
|
||||
Qed.
|
||||
|
||||
Theorem Thm_7 : ((E -> (Y \/ R)) /\ (Y -> R)) -> (~R -> ~E).
|
||||
intros.
|
||||
destruct H as (H1,H2).
|
||||
tauto. (* à détailler *)
|
||||
Qed.
|
||||
|
||||
End CalculPropositionnel.
|
||||
|
29
TP2-3/TP2-enigme.mlw
Normal file
29
TP2-3/TP2-enigme.mlw
Normal file
|
@ -0,0 +1,29 @@
|
|||
theory Enigme
|
||||
|
||||
predicate a
|
||||
predicate b
|
||||
predicate c
|
||||
|
||||
predicate da = b /\ (not c)
|
||||
predicate db = a -> c
|
||||
predicate dc = (not c) /\ ( a \/ b )
|
||||
|
||||
goal Q1: not (da /\ db /\ dc)
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
goal Q2c: da /\ db -> dc (* vrai *)
|
||||
goal Q2b: dc /\ da -> db (* faux *)
|
||||
goal Q2a: db /\ dc -> da (* vrai *)
|
||||
|
||||
goal Q3a: (not a) /\ (not b) /\ (not c) -> da (* faux, a ment *)
|
||||
goal Q3b: (not a) /\ (not b) /\ (not c) -> db (* b dit la vérité *)
|
||||
goal Q3c: (not a) /\ (not b) /\ (not c) -> dc (* faux, c ment *)
|
||||
|
||||
goal Q4a: da /\ db /\ dc -> a (* faux, a innocent *)
|
||||
goal Q4b: da /\ db /\ dc -> b (* b coupable *)
|
||||
goal Q4c: da /\ db /\ dc -> c (* faux, c innocent *)
|
||||
|
||||
goal Q5: not ( (a -> (not da)) /\ (b -> (not db)) /\ (c -> (not dc)) )
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
end
|
45
TP2-3/TP2.v
Normal file
45
TP2-3/TP2.v
Normal file
|
@ -0,0 +1,45 @@
|
|||
(* Ouverture d’une section *)
|
||||
Section CalculPredicats.
|
||||
(* Définition de 2 domaines pour les prédicats *)
|
||||
Variable A B : Type.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_8 : forall (P Q : A -> Prop),
|
||||
(forall x1 : A, (P x1) /\ (Q x1))
|
||||
-> (forall x2 : A, (P x2)) /\ (forall x3 : A, (Q x3)).
|
||||
intros.
|
||||
split.
|
||||
intro x2.
|
||||
destruct (H x2).
|
||||
exact H0.
|
||||
intro x3.
|
||||
destruct (H x3).
|
||||
exact H1.
|
||||
Qed.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_9 : forall (P : A -> B -> Prop),
|
||||
(exists x1 : A, forall y1 : B, (P x1 y1))
|
||||
-> forall y2 : B, exists x2 : A, (P x2 y2).
|
||||
intros.
|
||||
destruct H.
|
||||
exists x.
|
||||
generalize y2.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_10 : forall (P Q : A -> Prop),
|
||||
(exists x1 : A, (P x1) -> (Q x1))
|
||||
-> (forall x2 : A, (P x2)) -> exists x3 : A, (Q x3).
|
||||
intros.
|
||||
destruct H.
|
||||
exists x.
|
||||
cut (P x).
|
||||
exact H.
|
||||
generalize x.
|
||||
exact H0.
|
||||
Qed.
|
||||
|
||||
End CalculPredicats.
|
49
TP2-3/TP2.v.crashcoqide
Normal file
49
TP2-3/TP2.v.crashcoqide
Normal file
|
@ -0,0 +1,49 @@
|
|||
(* Ouverture d’une section *)
|
||||
Section CalculPredicats.
|
||||
(* Définition de 2 domaines pour les prédicats *)
|
||||
Variable A B : Type.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_8 : forall (P Q : A -> Prop),
|
||||
(forall x1 : A, (P x1) /\ (Q x1))
|
||||
-> (forall x2 : A, (P x2)) /\ (forall x3 : A, (Q x3)).
|
||||
intros.
|
||||
split.
|
||||
intro x2.
|
||||
exists.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi
|
||||
Theorem Thm_9 : forall (P : A -> B -> Prop),
|
||||
(exists x1 : A, forall y1 : B, (P x1 y1))
|
||||
-> forall y2 : B, exists x2 : A, (P x2 y2).
|
||||
intros.*)
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi
|
||||
Theorem Thm_10 : forall (P Q : A -> Prop),
|
||||
(exists x1 : A, (P x1) -> (Q x1))
|
||||
-> (forall x2 : A, (P x2)) -> exists x3 : A, (Q x3).
|
||||
intros.
|
||||
exists x2.*)
|
||||
|
||||
End CalculPredicats.
|
29
TP2-3/enigme.mlw
Normal file
29
TP2-3/enigme.mlw
Normal file
|
@ -0,0 +1,29 @@
|
|||
theory Enigme
|
||||
|
||||
predicate a
|
||||
predicate b
|
||||
predicate c
|
||||
|
||||
predicate da = b /\ (not c)
|
||||
predicate db = a -> c
|
||||
predicate dc = (not c) /\ ( a \/ b )
|
||||
|
||||
goal Q1: not (da /\ db /\ dc)
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
goal Q2c: da /\ db -> dc (* vrai *)
|
||||
goal Q2b: dc /\ da -> db (* faux *)
|
||||
goal Q2a: db /\ dc -> da (* vrai *)
|
||||
|
||||
goal Q3a: (not a) /\ (not b) /\ (not c) -> da (* faux, a ment *)
|
||||
goal Q3b: (not a) /\ (not b) /\ (not c) -> db (* b dit la vérité *)
|
||||
goal Q3c: (not a) /\ (not b) /\ (not c) -> dc (* faux, c ment *)
|
||||
|
||||
goal Q4a: da /\ db /\ dc -> a (* faux, a innocent *)
|
||||
goal Q4b: da /\ db /\ dc -> b (* b coupable *)
|
||||
goal Q4c: da /\ db /\ dc -> c (* faux, c innocent *)
|
||||
|
||||
goal Q5: not ( (a -> (not da)) /\ (b -> (not db)) /\ (c -> (not dc)) )
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
end
|
83
TP2-3/enigme/enigme-Predicats-Thm01_1.cvc
Normal file
83
TP2-3/enigme/enigme-Predicats-Thm01_1.cvc
Normal file
|
@ -0,0 +1,83 @@
|
|||
%%% this is a prelude for CVC3
|
||||
uni : TYPE;
|
||||
|
||||
ty : TYPE;
|
||||
|
||||
sort: (ty, uni) -> BOOLEAN;
|
||||
|
||||
witness: (ty) -> uni;
|
||||
|
||||
% witness_sort
|
||||
ASSERT (FORALL (a : ty): (sort(a, witness(a))));
|
||||
|
||||
int: ty;
|
||||
|
||||
real: ty;
|
||||
|
||||
bool: ty;
|
||||
|
||||
match_bool: (ty, BITVECTOR(1), uni, uni) -> uni;
|
||||
|
||||
% match_bool_sort
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (x : BITVECTOR(1), x1 : uni, x2 : uni): (sort(a, match_bool(a, x,
|
||||
x1, x2)))));
|
||||
|
||||
% match_bool_True
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (z : uni, z1 : uni):
|
||||
((sort(a, z)) => (match_bool(a, 0bin1, z, z1) = z))));
|
||||
|
||||
% match_bool_False
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (z : uni, z1 : uni):
|
||||
((sort(a, z1)) => (match_bool(a, 0bin0, z, z1) = z1))));
|
||||
|
||||
index_bool: (BITVECTOR(1)) -> INT;
|
||||
|
||||
% index_bool_True
|
||||
ASSERT (index_bool(0bin1) = 0);
|
||||
|
||||
% index_bool_False
|
||||
ASSERT (index_bool(0bin0) = 1);
|
||||
|
||||
% bool_inversion
|
||||
ASSERT (FORALL (u : BITVECTOR(1)): ((u = 0bin1) OR (u = 0bin0)));
|
||||
|
||||
tuple0 : TYPE;
|
||||
|
||||
tuple01: ty;
|
||||
|
||||
Tuple0: tuple0;
|
||||
|
||||
% tuple0_inversion
|
||||
ASSERT (FORALL (u : tuple0): (u = Tuple0));
|
||||
|
||||
a: BOOLEAN;
|
||||
|
||||
b: BOOLEAN;
|
||||
|
||||
c: BOOLEAN;
|
||||
|
||||
da: BOOLEAN;
|
||||
|
||||
% da_def
|
||||
ASSERT (da <=> (b AND (NOT c)));
|
||||
|
||||
db: BOOLEAN;
|
||||
|
||||
% db_def
|
||||
ASSERT (db <=> (a => c));
|
||||
|
||||
dc: BOOLEAN;
|
||||
|
||||
% dc_def
|
||||
ASSERT (dc <=> ((NOT c) AND (a OR b)));
|
||||
|
||||
QUERY
|
||||
% Thm01
|
||||
% File "enigme.mlw", line 13, characters 7-12
|
||||
(da AND (db AND dc));
|
29
TP2-3/enigme/enigme-Predicats-Thm01_1.smt2
Normal file
29
TP2-3/enigme/enigme-Predicats-Thm01_1.smt2
Normal file
|
@ -0,0 +1,29 @@
|
|||
;;; generated by SMT-LIB2 driver
|
||||
;;; SMT-LIB2 driver: bit-vectors, common part
|
||||
(declare-datatypes () ((tuple0 (Tuple0))))
|
||||
(declare-fun a () Bool)
|
||||
|
||||
(declare-fun b () Bool)
|
||||
|
||||
(declare-fun c () Bool)
|
||||
|
||||
(declare-fun da () Bool)
|
||||
|
||||
;; da_def
|
||||
(assert (= da (and b (not c))))
|
||||
|
||||
(declare-fun db () Bool)
|
||||
|
||||
;; db_def
|
||||
(assert (= db (=> a c)))
|
||||
|
||||
(declare-fun dc () Bool)
|
||||
|
||||
;; dc_def
|
||||
(assert (= dc (and (not c) (or a b))))
|
||||
|
||||
(assert
|
||||
;; Thm01
|
||||
;; File "enigme.mlw", line 13, characters 7-12
|
||||
(not (and da (and db dc))))
|
||||
(check-sat)
|
34
TP2-3/enigme/enigme-Proposition-Q1_1.smt2
Normal file
34
TP2-3/enigme/enigme-Proposition-Q1_1.smt2
Normal file
|
@ -0,0 +1,34 @@
|
|||
;;; generated by SMT-LIB2 driver
|
||||
;;; SMT-LIB2 driver: bit-vectors, common part
|
||||
(declare-datatypes () ((tuple0 (Tuple0))))
|
||||
(declare-fun a () Bool)
|
||||
|
||||
(declare-fun b () Bool)
|
||||
|
||||
(declare-fun c () Bool)
|
||||
|
||||
(declare-fun da () Bool)
|
||||
|
||||
;; da_def
|
||||
(assert (= da (and b (not c))))
|
||||
|
||||
(declare-fun db () Bool)
|
||||
|
||||
;; db_def
|
||||
(assert (= db (=> a c)))
|
||||
|
||||
(declare-fun dc () Bool)
|
||||
|
||||
;; dc_def
|
||||
(assert (= dc (and (not c) (or a b))))
|
||||
|
||||
(declare-fun compat () Bool)
|
||||
|
||||
;; compat_def
|
||||
(assert (= compat (and da (and db dc))))
|
||||
|
||||
(assert
|
||||
;; Q1
|
||||
;; File "enigme/../enigme.mlw", line 15, characters 7-9
|
||||
(not (not compat)))
|
||||
(check-sat)
|
27
TP2-3/enigme/enigme_Predicats_Thm01_1.v
Normal file
27
TP2-3/enigme/enigme_Predicats_Thm01_1.v
Normal file
|
@ -0,0 +1,27 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
|
||||
Parameter a: Prop.
|
||||
|
||||
Parameter b: Prop.
|
||||
|
||||
Parameter c: Prop.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition da : Prop := b /\ ~ c.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition db : Prop := a -> c.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition dc : Prop := ~ c /\ (a \/ b).
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem Thm01 : da /\ (db /\ dc).
|
||||
Proof.
|
||||
|
||||
|
||||
Qed.
|
||||
|
46
TP2-3/enigme/why3session.xml
Normal file
46
TP2-3/enigme/why3session.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="Z3" version="4.4.1" alternative="counterexamples" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file>
|
||||
<path name=".."/>
|
||||
<path name="enigme.mlw"/>
|
||||
<theory name="Enigme">
|
||||
<goal name="Q1">
|
||||
<proof prover="1"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2c" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2b">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2a" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3a">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3b" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3c">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4a">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4b" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4c">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q5">
|
||||
<proof prover="1"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
BIN
TP2-3/sujet.pdf
Normal file
BIN
TP2-3/sujet.pdf
Normal file
Binary file not shown.
45
TP2/TP2.v
Executable file
45
TP2/TP2.v
Executable file
|
@ -0,0 +1,45 @@
|
|||
(* Ouverture d’une section *)
|
||||
Section CalculPredicats.
|
||||
(* Définition de 2 domaines pour les prédicats *)
|
||||
Variable A B : Type.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_8 : forall (P Q : A -> Prop),
|
||||
(forall x1 : A, (P x1) /\ (Q x1))
|
||||
-> (forall x2 : A, (P x2)) /\ (forall x3 : A, (Q x3)).
|
||||
intros.
|
||||
split.
|
||||
intro x2.
|
||||
destruct (H x2).
|
||||
exact H0.
|
||||
intro x3.
|
||||
destruct (H x3).
|
||||
exact H1.
|
||||
Qed.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_9 : forall (P : A -> B -> Prop),
|
||||
(exists x1 : A, forall y1 : B, (P x1 y1))
|
||||
-> forall y2 : B, exists x2 : A, (P x2 y2).
|
||||
intros.
|
||||
destruct H.
|
||||
exists x.
|
||||
generalize y2.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_10 : forall (P Q : A -> Prop),
|
||||
(exists x1 : A, (P x1) -> (Q x1))
|
||||
-> (forall x2 : A, (P x2)) -> exists x3 : A, (Q x3).
|
||||
intros.
|
||||
destruct H.
|
||||
exists x.
|
||||
cut (P x).
|
||||
exact H.
|
||||
generalize x.
|
||||
exact H0.
|
||||
Qed.
|
||||
|
||||
End CalculPredicats.
|
49
TP2/TP2.v.crashcoqide
Executable file
49
TP2/TP2.v.crashcoqide
Executable file
|
@ -0,0 +1,49 @@
|
|||
(* Ouverture d’une section *)
|
||||
Section CalculPredicats.
|
||||
(* Définition de 2 domaines pour les prédicats *)
|
||||
Variable A B : Type.
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi *)
|
||||
Theorem Thm_8 : forall (P Q : A -> Prop),
|
||||
(forall x1 : A, (P x1) /\ (Q x1))
|
||||
-> (forall x2 : A, (P x2)) /\ (forall x3 : A, (Q x3)).
|
||||
intros.
|
||||
split.
|
||||
intro x2.
|
||||
exists.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi
|
||||
Theorem Thm_9 : forall (P : A -> B -> Prop),
|
||||
(exists x1 : A, forall y1 : B, (P x1 y1))
|
||||
-> forall y2 : B, exists x2 : A, (P x2 y2).
|
||||
intros.*)
|
||||
|
||||
(* Formule du second ordre : Quantification des prédicats phi et psi
|
||||
Theorem Thm_10 : forall (P Q : A -> Prop),
|
||||
(exists x1 : A, (P x1) -> (Q x1))
|
||||
-> (forall x2 : A, (P x2)) -> exists x3 : A, (Q x3).
|
||||
intros.
|
||||
exists x2.*)
|
||||
|
||||
End CalculPredicats.
|
29
TP2/enigme.mlw
Executable file
29
TP2/enigme.mlw
Executable file
|
@ -0,0 +1,29 @@
|
|||
theory Enigme
|
||||
|
||||
predicate a
|
||||
predicate b
|
||||
predicate c
|
||||
|
||||
predicate da = b /\ (not c)
|
||||
predicate db = a -> c
|
||||
predicate dc = (not c) /\ ( a \/ b )
|
||||
|
||||
goal Q1: not (da /\ db /\ dc)
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
goal Q2c: da /\ db -> dc (* vrai *)
|
||||
goal Q2b: dc /\ da -> db (* faux *)
|
||||
goal Q2a: db /\ dc -> da (* vrai *)
|
||||
|
||||
goal Q3a: (not a) /\ (not b) /\ (not c) -> da (* faux, a ment *)
|
||||
goal Q3b: (not a) /\ (not b) /\ (not c) -> db (* b dit la vérité *)
|
||||
goal Q3c: (not a) /\ (not b) /\ (not c) -> dc (* faux, c ment *)
|
||||
|
||||
goal Q4a: da /\ db /\ dc -> a (* faux, a innocent *)
|
||||
goal Q4b: da /\ db /\ dc -> b (* b coupable *)
|
||||
goal Q4c: da /\ db /\ dc -> c (* faux, c innocent *)
|
||||
|
||||
goal Q5: not ( (a -> (not da)) /\ (b -> (not db)) /\ (c -> (not dc)) )
|
||||
(* on demande ensuite un contre exemple *)
|
||||
|
||||
end
|
83
TP2/enigme/enigme-Predicats-Thm01_1.cvc
Executable file
83
TP2/enigme/enigme-Predicats-Thm01_1.cvc
Executable file
|
@ -0,0 +1,83 @@
|
|||
%%% this is a prelude for CVC3
|
||||
uni : TYPE;
|
||||
|
||||
ty : TYPE;
|
||||
|
||||
sort: (ty, uni) -> BOOLEAN;
|
||||
|
||||
witness: (ty) -> uni;
|
||||
|
||||
% witness_sort
|
||||
ASSERT (FORALL (a : ty): (sort(a, witness(a))));
|
||||
|
||||
int: ty;
|
||||
|
||||
real: ty;
|
||||
|
||||
bool: ty;
|
||||
|
||||
match_bool: (ty, BITVECTOR(1), uni, uni) -> uni;
|
||||
|
||||
% match_bool_sort
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (x : BITVECTOR(1), x1 : uni, x2 : uni): (sort(a, match_bool(a, x,
|
||||
x1, x2)))));
|
||||
|
||||
% match_bool_True
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (z : uni, z1 : uni):
|
||||
((sort(a, z)) => (match_bool(a, 0bin1, z, z1) = z))));
|
||||
|
||||
% match_bool_False
|
||||
ASSERT
|
||||
(FORALL (a : ty):
|
||||
(FORALL (z : uni, z1 : uni):
|
||||
((sort(a, z1)) => (match_bool(a, 0bin0, z, z1) = z1))));
|
||||
|
||||
index_bool: (BITVECTOR(1)) -> INT;
|
||||
|
||||
% index_bool_True
|
||||
ASSERT (index_bool(0bin1) = 0);
|
||||
|
||||
% index_bool_False
|
||||
ASSERT (index_bool(0bin0) = 1);
|
||||
|
||||
% bool_inversion
|
||||
ASSERT (FORALL (u : BITVECTOR(1)): ((u = 0bin1) OR (u = 0bin0)));
|
||||
|
||||
tuple0 : TYPE;
|
||||
|
||||
tuple01: ty;
|
||||
|
||||
Tuple0: tuple0;
|
||||
|
||||
% tuple0_inversion
|
||||
ASSERT (FORALL (u : tuple0): (u = Tuple0));
|
||||
|
||||
a: BOOLEAN;
|
||||
|
||||
b: BOOLEAN;
|
||||
|
||||
c: BOOLEAN;
|
||||
|
||||
da: BOOLEAN;
|
||||
|
||||
% da_def
|
||||
ASSERT (da <=> (b AND (NOT c)));
|
||||
|
||||
db: BOOLEAN;
|
||||
|
||||
% db_def
|
||||
ASSERT (db <=> (a => c));
|
||||
|
||||
dc: BOOLEAN;
|
||||
|
||||
% dc_def
|
||||
ASSERT (dc <=> ((NOT c) AND (a OR b)));
|
||||
|
||||
QUERY
|
||||
% Thm01
|
||||
% File "enigme.mlw", line 13, characters 7-12
|
||||
(da AND (db AND dc));
|
29
TP2/enigme/enigme-Predicats-Thm01_1.smt2
Executable file
29
TP2/enigme/enigme-Predicats-Thm01_1.smt2
Executable file
|
@ -0,0 +1,29 @@
|
|||
;;; generated by SMT-LIB2 driver
|
||||
;;; SMT-LIB2 driver: bit-vectors, common part
|
||||
(declare-datatypes () ((tuple0 (Tuple0))))
|
||||
(declare-fun a () Bool)
|
||||
|
||||
(declare-fun b () Bool)
|
||||
|
||||
(declare-fun c () Bool)
|
||||
|
||||
(declare-fun da () Bool)
|
||||
|
||||
;; da_def
|
||||
(assert (= da (and b (not c))))
|
||||
|
||||
(declare-fun db () Bool)
|
||||
|
||||
;; db_def
|
||||
(assert (= db (=> a c)))
|
||||
|
||||
(declare-fun dc () Bool)
|
||||
|
||||
;; dc_def
|
||||
(assert (= dc (and (not c) (or a b))))
|
||||
|
||||
(assert
|
||||
;; Thm01
|
||||
;; File "enigme.mlw", line 13, characters 7-12
|
||||
(not (and da (and db dc))))
|
||||
(check-sat)
|
34
TP2/enigme/enigme-Proposition-Q1_1.smt2
Executable file
34
TP2/enigme/enigme-Proposition-Q1_1.smt2
Executable file
|
@ -0,0 +1,34 @@
|
|||
;;; generated by SMT-LIB2 driver
|
||||
;;; SMT-LIB2 driver: bit-vectors, common part
|
||||
(declare-datatypes () ((tuple0 (Tuple0))))
|
||||
(declare-fun a () Bool)
|
||||
|
||||
(declare-fun b () Bool)
|
||||
|
||||
(declare-fun c () Bool)
|
||||
|
||||
(declare-fun da () Bool)
|
||||
|
||||
;; da_def
|
||||
(assert (= da (and b (not c))))
|
||||
|
||||
(declare-fun db () Bool)
|
||||
|
||||
;; db_def
|
||||
(assert (= db (=> a c)))
|
||||
|
||||
(declare-fun dc () Bool)
|
||||
|
||||
;; dc_def
|
||||
(assert (= dc (and (not c) (or a b))))
|
||||
|
||||
(declare-fun compat () Bool)
|
||||
|
||||
;; compat_def
|
||||
(assert (= compat (and da (and db dc))))
|
||||
|
||||
(assert
|
||||
;; Q1
|
||||
;; File "enigme/../enigme.mlw", line 15, characters 7-9
|
||||
(not (not compat)))
|
||||
(check-sat)
|
27
TP2/enigme/enigme_Predicats_Thm01_1.v
Executable file
27
TP2/enigme/enigme_Predicats_Thm01_1.v
Executable file
|
@ -0,0 +1,27 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
|
||||
Parameter a: Prop.
|
||||
|
||||
Parameter b: Prop.
|
||||
|
||||
Parameter c: Prop.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition da : Prop := b /\ ~ c.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition db : Prop := a -> c.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition dc : Prop := ~ c /\ (a \/ b).
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem Thm01 : da /\ (db /\ dc).
|
||||
Proof.
|
||||
|
||||
|
||||
Qed.
|
||||
|
46
TP2/enigme/why3session.xml
Executable file
46
TP2/enigme/why3session.xml
Executable file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="Z3" version="4.4.1" alternative="counterexamples" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file>
|
||||
<path name=".."/>
|
||||
<path name="enigme.mlw"/>
|
||||
<theory name="Enigme">
|
||||
<goal name="Q1">
|
||||
<proof prover="1"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2c" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2b">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q2a" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3a">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3b" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q3c">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4a">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4b" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q4c">
|
||||
<proof prover="0"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="Q5">
|
||||
<proof prover="1"><result status="unknown" time="0.00"/></proof>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
23
TP4/induction-etu.mlw
Normal file
23
TP4/induction-etu.mlw
Normal file
|
@ -0,0 +1,23 @@
|
|||
theory Induction
|
||||
|
||||
(* Définition du type inductif liste *)
|
||||
type liste 'a = Nil | Cons 'a (liste 'a)
|
||||
|
||||
(* Concaténation de deux listes *)
|
||||
function append (l1 l2 : liste 'a) : liste 'a =
|
||||
match l1 with
|
||||
| Nil -> l2
|
||||
| Cons t q -> Cons t (append q l2)
|
||||
end
|
||||
|
||||
lemma append_Nil_left : forall l : liste 'a. append Nil l = l
|
||||
|
||||
lemma append_Cons_left : forall e : 'a. forall l1 l2 : liste 'a.
|
||||
append (Cons e l1) l2 = Cons e (append l1 l2)
|
||||
|
||||
lemma append_Nil_right: forall l : liste 'a. append l Nil = l
|
||||
|
||||
lemma append_associative : forall l1 [@induction] l2 l3 : liste 'a.
|
||||
append l1 (append l2 l3) = append (append l1 l2) l3
|
||||
|
||||
end
|
121
TP4/induction-etu.v
Normal file
121
TP4/induction-etu.v
Normal file
|
@ -0,0 +1,121 @@
|
|||
Require Import Extraction.
|
||||
(* Ouverture d’une section *)
|
||||
Section Induction.
|
||||
(* Déclaration d’un domaine pour les éléments des listes *)
|
||||
Variable A : Set.
|
||||
|
||||
Inductive liste : Set :=
|
||||
Nil : liste
|
||||
| Cons : A -> liste -> liste.
|
||||
|
||||
(* Déclaration du nom de la fonction *)
|
||||
Variable append_spec : liste -> liste -> liste.
|
||||
|
||||
(* Spécification du comportement pour Nil *)
|
||||
Axiom append_Nil : forall (l : liste), append_spec Nil l = l.
|
||||
|
||||
(* Spécification du comportement pour Cons *)
|
||||
Axiom append_Cons : forall (t : A), forall (q l : liste),
|
||||
append_spec (Cons t q) l = Cons t (append_spec q l).
|
||||
|
||||
Theorem append_Nil_right : forall (l : liste), (append_spec l Nil) = l.
|
||||
intros.
|
||||
induction l.
|
||||
(*cas de base*)
|
||||
apply append_Nil.
|
||||
(*cas general*)
|
||||
rewrite append_Cons.
|
||||
rewrite IHl.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
Theorem append_associative : forall (l1 l2 l3 : liste),
|
||||
(append_spec l1 (append_spec l2 l3)) = (append_spec (append_spec l1 l2) l3).
|
||||
intros.
|
||||
induction l1.
|
||||
(*cas de base*)
|
||||
rewrite append_Nil.
|
||||
rewrite append_Nil.
|
||||
reflexivity.
|
||||
(*cas general*)
|
||||
rewrite append_Cons.
|
||||
rewrite IHl1.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Cons.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction append *)
|
||||
Fixpoint append_impl (l1 l2 : liste) {struct l1} : liste :=
|
||||
match l1 with
|
||||
Nil => l2
|
||||
| (Cons t1 q1) => (Cons t1 (append_impl q1 l2))
|
||||
end.
|
||||
|
||||
Theorem append_correctness : forall (l1 l2 : liste),
|
||||
(append_spec l1 l2) = (append_impl l1 l2).
|
||||
intros.
|
||||
induction l1.
|
||||
(*cas de base*)
|
||||
rewrite append_Nil.
|
||||
simpl append_impl.
|
||||
reflexivity.
|
||||
(*cas general*)
|
||||
rewrite append_Cons.
|
||||
simpl append_impl.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction rev (reverse d'une liste) *)
|
||||
Fixpoint rev_impl (l : liste) : liste :=
|
||||
match l with
|
||||
Nil => Nil
|
||||
| (Cons t1 q1) => (append_impl (rev_impl q1)( Cons t1 Nil))
|
||||
end.
|
||||
|
||||
Lemma rev_append : forall (l1 l2 : liste),
|
||||
(rev_impl (append_impl l1 l2)) = (append_impl (rev_impl l2) (rev_impl l1)).
|
||||
intros.
|
||||
induction l1.
|
||||
(*cas de base *)
|
||||
simpl append_impl.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_Nil_right.
|
||||
reflexivity.
|
||||
(*cas general*)
|
||||
simpl rev_impl.
|
||||
rewrite IHl1.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_associative.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
Theorem rev_rev : forall (l : liste), (rev_impl (rev_impl l)) = l.
|
||||
intros.
|
||||
induction l.
|
||||
(*Cas de base*)
|
||||
simpl rev_impl.
|
||||
reflexivity.
|
||||
(*cas general*)
|
||||
simpl rev_impl.
|
||||
rewrite rev_append.
|
||||
rewrite IHl.
|
||||
simpl rev_impl.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Nil.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
End Induction.
|
||||
|
||||
Extraction Language Ocaml.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
||||
Extraction Language Haskell.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
||||
Extraction Language Scheme.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
9
TP4/readme.txt
Normal file
9
TP4/readme.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
2020-10-13
|
||||
Modélisation TP4
|
||||
http://moodle-n7.inp-toulouse.fr/pluginfile.php/90409/mod_resource/content/4/equipes-TD5TD6.txt
|
||||
|
||||
Membres de groupe G-5:
|
||||
EL HADFI Younes
|
||||
HAMMAMI Linda
|
||||
HAUTEVILLE Leane
|
||||
FAINSIN Laurent
|
23
TP5/induction-etu.mlw
Executable file
23
TP5/induction-etu.mlw
Executable file
|
@ -0,0 +1,23 @@
|
|||
theory Induction
|
||||
|
||||
(* Définition du type inductif liste *)
|
||||
type liste 'a = Nil | Cons 'a (liste 'a)
|
||||
|
||||
(* Concaténation de deux listes *)
|
||||
function append (l1 l2 : liste 'a) : liste 'a =
|
||||
match l1 with
|
||||
| Nil -> l2
|
||||
| Cons t q -> Cons t (append q l2)
|
||||
end
|
||||
|
||||
lemma append_Nil_left : forall l : liste 'a. append Nil l = l
|
||||
|
||||
lemma append_Cons_left : forall e : 'a. forall l1 l2 : liste 'a.
|
||||
append (Cons e l1) l2 = Cons e (append l1 l2)
|
||||
|
||||
lemma append_Nil_right: forall l : liste 'a. append l Nil = l
|
||||
|
||||
lemma append_associative : forall l1 [@induction] l2 l3 : liste 'a.
|
||||
append l1 (append l2 l3) = append (append l1 l2) l3
|
||||
|
||||
end
|
123
TP5/induction-etu.v
Executable file
123
TP5/induction-etu.v
Executable file
|
@ -0,0 +1,123 @@
|
|||
Require Import Extraction.
|
||||
(* Ouverture d’une section *)
|
||||
Section Induction.
|
||||
(* Déclaration d’un domaine pour les éléments des listes *)
|
||||
Variable A : Set.
|
||||
|
||||
Inductive liste : Set :=
|
||||
Nil : liste
|
||||
| Cons : A -> liste -> liste.
|
||||
|
||||
(* Déclaration du nom de la fonction *)
|
||||
Variable append_spec : liste -> liste -> liste.
|
||||
|
||||
(* Spécification du comportement pour Nil *)
|
||||
Axiom append_Nil : forall (l : liste), append_spec Nil l = l.
|
||||
|
||||
(* Spécification du comportement pour Cons *)
|
||||
Axiom append_Cons : forall (t : A), forall (q l : liste),
|
||||
append_spec (Cons t q) l = Cons t (append_spec q l).
|
||||
|
||||
Theorem append_Nil_right : forall (l : liste), (append_spec l Nil) = l.
|
||||
intros.
|
||||
induction l.
|
||||
(* cas de base *)
|
||||
apply append_Nil.
|
||||
(* cas général *)
|
||||
rewrite append_Cons.
|
||||
rewrite IHl.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
|
||||
Theorem append_associative : forall (l1 l2 l3 : liste),
|
||||
(append_spec l1 (append_spec l2 l3)) = (append_spec (append_spec l1 l2) l3).
|
||||
intros.
|
||||
induction l1.
|
||||
(* cas de base *)
|
||||
rewrite append_Nil.
|
||||
rewrite append_Nil.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
rewrite append_Cons.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Cons.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
|
||||
(* Implantation de la fonction append *)
|
||||
Fixpoint append_impl (l1 l2 : liste) {struct l1} : liste :=
|
||||
match l1 with
|
||||
Nil => l2
|
||||
| (Cons t1 q1) => (Cons t1 (append_impl q1 l2))
|
||||
end.
|
||||
|
||||
Theorem append_correctness : forall (l1 l2 : liste),
|
||||
(append_spec l1 l2) = (append_impl l1 l2).
|
||||
intros.
|
||||
induction l1.
|
||||
(* cas de base *)
|
||||
rewrite append_Nil.
|
||||
simpl append_impl.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
rewrite append_Cons.
|
||||
simpl append_impl.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction rev (reverse d'une liste) *)
|
||||
Fixpoint rev_impl (l : liste) : liste :=
|
||||
match l with
|
||||
Nil => l
|
||||
| (Cons x y) => ( append_impl (rev_impl y) (Cons x Nil) )
|
||||
end.
|
||||
|
||||
|
||||
Lemma rev_append : forall (l1 l2 : liste),
|
||||
(rev_impl (append_impl l1 l2)) = (append_impl (rev_impl l2) (rev_impl l1)).
|
||||
intros.
|
||||
induction l1.
|
||||
(* cas de base *)
|
||||
simpl rev_impl.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_Nil_right.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
simpl rev_impl.
|
||||
rewrite IHl1.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_associative.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
Theorem rev_rev : forall (l : liste), (rev_impl (rev_impl l)) = l.
|
||||
intros.
|
||||
induction l.
|
||||
(* cas de base *)
|
||||
simpl rev_impl.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
simpl rev_impl.
|
||||
rewrite rev_append.
|
||||
rewrite IHl.
|
||||
simpl rev_impl.
|
||||
rewrite <- append_correctness.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Nil.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
End Induction.
|
||||
Extraction Language Ocaml.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
||||
Extraction Language Haskell.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
||||
Extraction Language Scheme.
|
||||
Extraction "/tmp/induction" append_impl rev_impl.
|
23
TP5/induction-etu.wlm
Executable file
23
TP5/induction-etu.wlm
Executable file
|
@ -0,0 +1,23 @@
|
|||
theory Induction
|
||||
|
||||
(* Définition du type inductif liste *)
|
||||
type liste 'a = Nil | Cons 'a (liste 'a)
|
||||
|
||||
(* Concaténation de deux listes *)
|
||||
function append (l1 l2 : liste 'a) : liste 'a =
|
||||
match l1 with
|
||||
| Nil -> l2
|
||||
| Cons t q -> Cons t (append q l2)
|
||||
end
|
||||
|
||||
lemma append_Nil_left : forall l : liste 'a. append Nil l = l
|
||||
|
||||
lemma append_Cons_left : forall e : 'a. forall l1 l2 : liste 'a.
|
||||
append (Cons e l1) l2 = Cons e (append l1 l2)
|
||||
|
||||
lemma append_Nil_right: forall l : liste 'a. append l Nil = l
|
||||
|
||||
lemma append_associative : forall l1 [@induction] l2 l3 : liste 'a.
|
||||
append l1 (append l2 l3) = append (append l1 l2) l3
|
||||
|
||||
end
|
32
TP5/induction-etu/why3session.xml
Executable file
32
TP5/induction-etu/why3session.xml
Executable file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="induction-etu.mlw"/>
|
||||
<theory name="Induction" proved="true">
|
||||
<goal name="append_Nil_left" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
<goal name="append_Cons_left" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
<goal name="append_Nil_right" proved="true">
|
||||
<transf name="induction_ty_lex" proved="true" >
|
||||
<goal name="append_Nil_right.0" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
<goal name="append_associative" proved="true">
|
||||
<transf name="induction_ty_lex" proved="true" >
|
||||
<goal name="append_associative.0" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
37
TP6/ascendant.mlw
Executable file
37
TP6/ascendant.mlw
Executable file
|
@ -0,0 +1,37 @@
|
|||
(* Spécification de la fonction factorielle *)
|
||||
|
||||
theory Factorielle
|
||||
|
||||
use int.Int
|
||||
|
||||
function factorielle( n : int ) : int
|
||||
|
||||
axiom factorielle_zero : (factorielle zero) = one
|
||||
|
||||
axiom factorielle_succ : forall n : int. (n > 0) -> (factorielle n) = (n * (factorielle (n - 1)))
|
||||
|
||||
end
|
||||
|
||||
(* Implémentation de la fonction factorielle par un algorithme ascendant *)
|
||||
|
||||
module FactorielleAscendant
|
||||
|
||||
use int.Int
|
||||
use ref.Refint
|
||||
use Factorielle
|
||||
|
||||
let factorielle_ascendant (n: int) : int
|
||||
requires { 0 <= n }
|
||||
ensures { result = (factorielle n) }
|
||||
=
|
||||
let i = ref 0 in
|
||||
let r = ref 1 in
|
||||
while (!i < n) do
|
||||
invariant { !r = (factorielle !i) && ( 0 <= !i <= n ) }
|
||||
variant { n - !i }
|
||||
i := (!i) + 1;
|
||||
r := (!i) * (!r)
|
||||
done;
|
||||
!r
|
||||
|
||||
end
|
42
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_1.v
Executable file
42
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_1.v
Executable file
|
@ -0,0 +1,42 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter factorielle: Z -> Z.
|
||||
|
||||
Axiom factorielle_zero : ((factorielle 0%Z) = 1%Z).
|
||||
|
||||
Axiom factorielle_succ :
|
||||
forall (n:Z), (0%Z < n)%Z ->
|
||||
((factorielle n) = (n * (factorielle (n - 1%Z)%Z))%Z).
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Axiom H : (0%Z <= n)%Z.
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_factorielle_ascendant :
|
||||
(1%Z = (factorielle 0%Z)) /\ ((0%Z <= 0%Z)%Z /\ (0%Z <= n)%Z).
|
||||
split.
|
||||
rewrite factorielle_zero.
|
||||
reflexivity.
|
||||
split.
|
||||
omega.
|
||||
apply H.
|
||||
Qed.
|
||||
|
67
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_2.v
Executable file
67
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_2.v
Executable file
|
@ -0,0 +1,67 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter factorielle: Z -> Z.
|
||||
|
||||
Axiom factorielle_zero : ((factorielle 0%Z) = 1%Z).
|
||||
|
||||
Axiom factorielle_succ :
|
||||
forall (n:Z), (0%Z < n)%Z ->
|
||||
((factorielle n) = (n * (factorielle (n - 1%Z)%Z))%Z).
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Axiom H : (0%Z <= n)%Z.
|
||||
|
||||
Parameter r: Z.
|
||||
|
||||
Parameter i: Z.
|
||||
|
||||
Axiom H1 : (r = (factorielle i)).
|
||||
|
||||
Axiom H2 : (0%Z <= i)%Z.
|
||||
|
||||
Axiom H3 : (i <= n)%Z.
|
||||
|
||||
Axiom H4 : (i < n)%Z.
|
||||
|
||||
Parameter i1: Z.
|
||||
|
||||
Axiom H5 : (i1 = (i + 1%Z)%Z).
|
||||
|
||||
Parameter r1: Z.
|
||||
|
||||
Axiom H6 : (r1 = (i1 * r)%Z).
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_factorielle_ascendant :
|
||||
(0%Z <= (n - i)%Z)%Z /\ ((n - i1)%Z < (n - i)%Z)%Z.
|
||||
split.
|
||||
generalize H.
|
||||
intros.
|
||||
generalize H3.
|
||||
intros.
|
||||
omega.
|
||||
generalize H.
|
||||
intros.
|
||||
generalize H5.
|
||||
intros.
|
||||
omega.
|
||||
Qed.
|
||||
|
70
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_3.v
Executable file
70
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_3.v
Executable file
|
@ -0,0 +1,70 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter factorielle: Z -> Z.
|
||||
|
||||
Axiom factorielle_zero : ((factorielle 0%Z) = 1%Z).
|
||||
|
||||
Axiom factorielle_succ :
|
||||
forall (n:Z), (0%Z < n)%Z ->
|
||||
((factorielle n) = (n * (factorielle (n - 1%Z)%Z))%Z).
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Axiom H : (0%Z <= n)%Z.
|
||||
|
||||
Parameter r: Z.
|
||||
|
||||
Parameter i: Z.
|
||||
|
||||
Axiom H1 : (r = (factorielle i)).
|
||||
|
||||
Axiom H2 : (0%Z <= i)%Z.
|
||||
|
||||
Axiom H3 : (i <= n)%Z.
|
||||
|
||||
Axiom H4 : (i < n)%Z.
|
||||
|
||||
Parameter i1: Z.
|
||||
|
||||
Axiom H5 : (i1 = (i + 1%Z)%Z).
|
||||
|
||||
Parameter r1: Z.
|
||||
|
||||
Axiom H6 : (r1 = (i1 * r)%Z).
|
||||
|
||||
Axiom H7 : ((i+1-1) = i)%Z.
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_factorielle_ascendant :
|
||||
(r1 = (factorielle i1)) /\ ((0%Z <= i1)%Z /\ (i1 <= n)%Z).
|
||||
split.
|
||||
generalize H1.
|
||||
intros.
|
||||
rewrite H6.
|
||||
rewrite -> factorielle_succ.
|
||||
rewrite H5.
|
||||
rewrite H0.
|
||||
rewrite H7.
|
||||
reflexivity.
|
||||
generalize H2.
|
||||
intros.
|
||||
rewrite H5.
|
||||
Qed.
|
||||
|
52
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_4.v
Executable file
52
TP6/ascendant/ascendant_FactorielleAscendant_VC_factorielle_ascendant_4.v
Executable file
|
@ -0,0 +1,52 @@
|
|||
(* This file is generated by Why3's Coq driver *)
|
||||
(* Beware! Only edit allowed sections below *)
|
||||
Require Import BuiltIn.
|
||||
Require BuiltIn.
|
||||
Require int.Int.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Inductive ref (a:Type) :=
|
||||
| mk_ref : a -> ref a.
|
||||
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
|
||||
Existing Instance ref_WhyType.
|
||||
Arguments mk_ref {a}.
|
||||
|
||||
(* Why3 assumption *)
|
||||
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
|
||||
match v with
|
||||
| mk_ref x => x
|
||||
end.
|
||||
|
||||
Parameter factorielle: Z -> Z.
|
||||
|
||||
Axiom factorielle_zero : ((factorielle 0%Z) = 1%Z).
|
||||
|
||||
Axiom factorielle_succ :
|
||||
forall (n:Z), (0%Z < n)%Z ->
|
||||
((factorielle n) = (n * (factorielle (n - 1%Z)%Z))%Z).
|
||||
|
||||
Parameter n: Z.
|
||||
|
||||
Axiom H : (0%Z <= n)%Z.
|
||||
|
||||
Parameter r: Z.
|
||||
|
||||
Parameter i: Z.
|
||||
|
||||
Axiom H1 : (r = (factorielle i)).
|
||||
|
||||
Axiom H2 : (0%Z <= i)%Z.
|
||||
|
||||
Axiom H3 : (i <= n)%Z.
|
||||
Axiom H4 : ~ (i < n)%Z.
|
||||
|
||||
(* H3 et H4 implique H43 *)
|
||||
Axiom H34 : ( i = n )%Z.
|
||||
|
||||
(* Why3 goal *)
|
||||
Theorem VC_factorielle_ascendant : (r = (factorielle n)).
|
||||
rewrite H1.
|
||||
rewrite H34.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
45
TP6/ascendant/why3session.xml
Executable file
45
TP6/ascendant/why3session.xml
Executable file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="Coq" version="8.9.1" timelimit="0" steplimit="0" memlimit="0"/>
|
||||
<prover id="1" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="5" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="ascendant.mlw"/>
|
||||
<theory name="FactorielleAscendant" proved="true">
|
||||
<goal name="VC factorielle_ascendant" expl="VC for factorielle_ascendant" proved="true">
|
||||
<transf name="split_vc" proved="true" >
|
||||
<goal name="VC factorielle_ascendant.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="0" edited="ascendant_FactorielleAscendant_VC_factorielle_ascendant_1.v"><result status="valid" time="0.35"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="3"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="5"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_ascendant.1" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0" edited="ascendant_FactorielleAscendant_VC_factorielle_ascendant_2.v"><result status="unknown" time="0.33"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="9"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_ascendant.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0" edited="ascendant_FactorielleAscendant_VC_factorielle_ascendant_3.v"><result status="unknown" time="0.30"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="10"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.05"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.05"/></proof>
|
||||
<proof prover="5"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_ascendant.3" expl="postcondition" proved="true">
|
||||
<proof prover="0" edited="ascendant_FactorielleAscendant_VC_factorielle_ascendant_4.v"><result status="unknown" time="0.31"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00" steps="7"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
37
TP6/descendant.mlw
Executable file
37
TP6/descendant.mlw
Executable file
|
@ -0,0 +1,37 @@
|
|||
(* Spécification de la fonction factorielle *)
|
||||
|
||||
theory Factorielle
|
||||
|
||||
use int.Int
|
||||
|
||||
function factorielle( n : int ) : int
|
||||
|
||||
axiom factorielle_zero : (factorielle zero) = one
|
||||
|
||||
axiom factorielle_succ : forall n : int. (n > 0) -> (factorielle n) = (n * (factorielle (n - 1)))
|
||||
|
||||
end
|
||||
|
||||
(* Implémentation de la fonction factorielle par un algorithme descendant *)
|
||||
|
||||
module FactorielleDescendant
|
||||
|
||||
use int.Int
|
||||
use Factorielle
|
||||
use ref.Refint
|
||||
|
||||
let factorielle_descendant (n: int) : int
|
||||
requires { 0 <= n }
|
||||
ensures { result = (factorielle n) }
|
||||
=
|
||||
let i = ref n in
|
||||
let r = ref 1 in
|
||||
while (0 < !i) do
|
||||
invariant { !r * factorielle !i = factorielle n && 0 <= !i }
|
||||
variant { !i }
|
||||
r := !i * !r;
|
||||
i := !i - 1
|
||||
done;
|
||||
!r
|
||||
|
||||
end
|
47
TP6/descendant/why3session.xml
Executable file
47
TP6/descendant/why3session.xml
Executable file
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="descendant.mlw"/>
|
||||
<theory name="FactorielleDescendant" proved="true">
|
||||
<goal name="VC factorielle_descendant" expl="VC for factorielle_descendant" proved="true">
|
||||
<transf name="split_vc" proved="true" >
|
||||
<goal name="VC factorielle_descendant.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="3"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_descendant.1" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="8"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_descendant.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="1"><result status="timeout" time="5.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.01" steps="10"/></proof>
|
||||
<proof prover="3"><result status="timeout" time="5.00"/></proof>
|
||||
<proof prover="4"><result status="failure" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC factorielle_descendant.3" expl="postcondition" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="6"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="4"><result status="failure" time="0.00"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
23
TP6/division.mlw
Executable file
23
TP6/division.mlw
Executable file
|
@ -0,0 +1,23 @@
|
|||
|
||||
(* Division entière par l'algorithme d'Euclide *)
|
||||
|
||||
module Division
|
||||
|
||||
use int.Int
|
||||
use ref.Refint
|
||||
|
||||
let division (a b: int) (* renvoie une paire d'entiers (quotient,reste) *)
|
||||
requires { 0 <= a && 0 < b }
|
||||
ensures { let (q,r) = result in q * b + r = a && 0 <= r < b }
|
||||
=
|
||||
let q = ref 0 in
|
||||
let r = ref a in
|
||||
while !r >= b do
|
||||
invariant { a = !q * b + !r && 0 <= !q && 0 <= !r }
|
||||
variant { !r - b }
|
||||
q := (!q) + 1;
|
||||
r := (!r) - b
|
||||
done;
|
||||
(!q,!r)
|
||||
|
||||
end
|
28
TP6/division/why3session.xml
Executable file
28
TP6/division/why3session.xml
Executable file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="division.mlw"/>
|
||||
<theory name="Division" proved="true">
|
||||
<goal name="VC division" expl="VC for division" proved="true">
|
||||
<transf name="split_vc" proved="true" >
|
||||
<goal name="VC division.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="3"/></proof>
|
||||
</goal>
|
||||
<goal name="VC division.1" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="9"/></proof>
|
||||
</goal>
|
||||
<goal name="VC division.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="9"/></proof>
|
||||
</goal>
|
||||
<goal name="VC division.3" expl="postcondition" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="7"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
38
TP6/pgcd.mlw
Executable file
38
TP6/pgcd.mlw
Executable file
|
@ -0,0 +1,38 @@
|
|||
|
||||
(* PGCD : Algorithme Euclide *)
|
||||
|
||||
theory PGCD
|
||||
|
||||
use int.Int
|
||||
|
||||
function pgcd(a b : int) : int
|
||||
|
||||
axiom A1 : forall a: int. (a>0) -> ( pgcd a a ) = a
|
||||
axiom A2 : forall a,b: int. (a>0 && b>0) -> ( pgcd a b ) = ( pgcd b a )
|
||||
axiom A3 : forall a,b: int. (a>b>0) -> ( pgcd a b ) = (pgcd (a-b) b )
|
||||
|
||||
end
|
||||
|
||||
module PGCDEuclide
|
||||
|
||||
use import int.Int
|
||||
use import ref.Refint
|
||||
use import PGCD
|
||||
|
||||
let pgcd_euclide (a b: int) : int
|
||||
requires { 0 < a && 0 < b }
|
||||
ensures { result = (pgcd a b)}
|
||||
=
|
||||
let ap = ref a in
|
||||
let bp = ref b in
|
||||
while (!ap <> !bp) do
|
||||
invariant { (pgcd a b ) = ( pgcd !ap !bp ) && !ap > 0 && !bp > 0 }
|
||||
variant { !ap + !bp }
|
||||
if (!ap <= !bp) then
|
||||
bp := !bp - !ap
|
||||
else
|
||||
ap := !ap - !bp
|
||||
done;
|
||||
!ap
|
||||
|
||||
end
|
58
TP6/pgcd/why3session.xml
Executable file
58
TP6/pgcd/why3session.xml
Executable file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="pgcd.mlw"/>
|
||||
<theory name="PGCDEuclide" proved="true">
|
||||
<goal name="VC pgcd_euclide" expl="VC for pgcd_euclide" proved="true">
|
||||
<transf name="split_vc" proved="true" >
|
||||
<goal name="VC pgcd_euclide.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="3"/></proof>
|
||||
</goal>
|
||||
<goal name="VC pgcd_euclide.1" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="9"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC pgcd_euclide.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.02"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.01" steps="21"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
<goal name="VC pgcd_euclide.3" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="9"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.00"/></proof>
|
||||
</goal>
|
||||
<goal name="VC pgcd_euclide.4" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="14"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
<goal name="VC pgcd_euclide.5" expl="postcondition" proved="true">
|
||||
<proof prover="0"><undone/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.00" steps="8"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.00"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
40
TP7/.Naturelle.aux
Executable file
40
TP7/.Naturelle.aux
Executable file
|
@ -0,0 +1,40 @@
|
|||
COQAUX1 f13e540aa0997388dd1408b0662438d6 /home/lfainsin/1A/Modé/TP7/Naturelle.v
|
||||
383 387 proof_build_time "0.000"
|
||||
0 0 E_imp_th "0.000"
|
||||
383 387 context_used ""
|
||||
383 387 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
916 920 proof_build_time "0.000"
|
||||
0 0 E_forall_th "0.000"
|
||||
916 920 context_used ""
|
||||
916 920 proof_check_time "0.000"
|
||||
1291 1295 proof_build_time "0.001"
|
||||
0 0 E_et_g_th "0.001"
|
||||
1291 1295 context_used ""
|
||||
1291 1295 proof_check_time "0.000"
|
||||
1601 1605 proof_build_time "0.000"
|
||||
0 0 E_et_d_th "0.000"
|
||||
1601 1605 context_used ""
|
||||
1601 1605 proof_check_time "0.000"
|
||||
1983 1987 proof_build_time "0.001"
|
||||
0 0 E_ou_th "0.001"
|
||||
1983 1987 context_used ""
|
||||
1983 1987 proof_check_time "0.000"
|
||||
0 0 VernacProof "tac:no using:no"
|
||||
2806 2810 proof_build_time "0.001"
|
||||
0 0 E_exists_th "0.001"
|
||||
2806 2810 context_used ""
|
||||
2806 2810 proof_check_time "0.000"
|
||||
3280 3284 proof_build_time "0.000"
|
||||
0 0 E_antiT_th "0.000"
|
||||
3280 3284 context_used ""
|
||||
3280 3284 proof_check_time "0.000"
|
||||
3502 3506 proof_build_time "0.001"
|
||||
0 0 I_antiT_th "0.001"
|
||||
3502 3506 context_used ""
|
||||
3502 3506 proof_check_time "0.000"
|
||||
3683 3687 proof_build_time "0.000"
|
||||
0 0 I_non_th "0.000"
|
||||
3683 3687 context_used ""
|
||||
3683 3687 proof_check_time "0.000"
|
||||
0 0 vo_compile_time "0.107"
|
BIN
TP7/._Naturelle.v
Executable file
BIN
TP7/._Naturelle.v
Executable file
Binary file not shown.
150
TP7/Naturelle.glob
Executable file
150
TP7/Naturelle.glob
Executable file
|
@ -0,0 +1,150 @@
|
|||
DIGEST f13e540aa0997388dd1408b0662438d6
|
||||
FNaturelle
|
||||
R15:23 Coq.Logic.Classical <> <> lib
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R97:100 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R218:221 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
prf 278:285 <> E_imp_th
|
||||
R314:314 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R325:329 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R333:336 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R337:339 Naturelle <> psi var
|
||||
R330:332 Naturelle <> phi var
|
||||
R318:321 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R322:324 Naturelle <> psi var
|
||||
R315:317 Naturelle <> phi var
|
||||
R443:450 Naturelle <> E_imp_th thm
|
||||
R521:528 Naturelle <> E_imp_th thm
|
||||
prf 816:826 <> E_forall_th
|
||||
R856:859 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R855:855 Naturelle <> A var
|
||||
R869:869 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R885:889 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R890:892 Naturelle <> phi var
|
||||
R894:894 Naturelle <> a var
|
||||
R880:882 Naturelle <> phi var
|
||||
R884:884 Naturelle <> x var
|
||||
R996:1006 Naturelle <> E_forall_th thm
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1086:1089 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1105:1108 Coq.Init.Logic <> conj constr
|
||||
prf 1157:1165 <> E_et_g_th
|
||||
R1194:1194 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1205:1209 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1210:1212 Naturelle <> phi var
|
||||
R1198:1201 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1195:1197 Naturelle <> phi var
|
||||
R1202:1204 Naturelle <> psi var
|
||||
R1352:1360 Naturelle <> E_et_g_th thm
|
||||
R1432:1440 Naturelle <> E_et_g_th thm
|
||||
prf 1465:1473 <> E_et_d_th
|
||||
R1502:1502 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1513:1517 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1518:1520 Naturelle <> psi var
|
||||
R1506:1509 Coq.Init.Logic <> ::type_scope:x_'/\'_x not
|
||||
R1503:1505 Naturelle <> phi var
|
||||
R1510:1512 Naturelle <> psi var
|
||||
R1662:1670 Naturelle <> E_et_d_th thm
|
||||
R1743:1751 Naturelle <> E_et_d_th thm
|
||||
prf 1776:1782 <> E_ou_th
|
||||
R1815:1815 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1826:1830 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1831:1831 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1842:1846 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1847:1847 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1858:1862 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1863:1865 Naturelle <> chi var
|
||||
R1851:1854 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1855:1857 Naturelle <> chi var
|
||||
R1848:1850 Naturelle <> psi var
|
||||
R1835:1838 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R1839:1841 Naturelle <> chi var
|
||||
R1832:1834 Naturelle <> phi var
|
||||
R1819:1822 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R1816:1818 Naturelle <> phi var
|
||||
R1823:1825 Naturelle <> psi var
|
||||
R2042:2048 Naturelle <> E_ou_th thm
|
||||
R2124:2130 Naturelle <> E_ou_th thm
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2194:2197 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2213:2221 Coq.Init.Logic <> or_introl constr
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2305:2308 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R2324:2332 Coq.Init.Logic <> or_intror constr
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2416:2423 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2430:2433 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2439:2439 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2438:2438 Naturelle <> x var
|
||||
R2453:2460 Coq.Init.Logic <> ex_intro constr
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2561:2568 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2575:2578 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2584:2584 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2583:2583 Naturelle <> x var
|
||||
R2597:2604 Coq.Init.Logic <> ex_intro constr
|
||||
prf 2669:2679 <> E_exists_th
|
||||
R2709:2712 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2708:2708 Naturelle <> A var
|
||||
R2733:2733 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2749:2753 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2754:2754 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2777:2781 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2782:2784 Naturelle <> chi var
|
||||
R2770:2773 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R2774:2776 Naturelle <> chi var
|
||||
R2765:2767 Naturelle <> phi var
|
||||
R2769:2769 Naturelle <> a var
|
||||
R2734:2740 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2742:2743 Coq.Init.Logic <> ::type_scope:'exists'_x_'..'_x_','_x not
|
||||
R2744:2746 Naturelle <> phi var
|
||||
R2748:2748 Naturelle <> x var
|
||||
R2963:2973 Naturelle <> E_exists_th thm
|
||||
R3083:3085 Coq.Init.Logic <> not def
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3116:3120 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3132:3132 Coq.Init.Logic <> ::type_scope:x_'\/'_x not
|
||||
R3123:3126 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3127:3131 Coq.Init.Logic <> False ind
|
||||
R3145:3151 Coq.Logic.Classical_Prop <> classic prfax
|
||||
prf 3209:3218 <> E_antiT_th
|
||||
R3248:3251 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3252:3254 Naturelle <> phi var
|
||||
R3243:3247 Coq.Init.Logic <> False ind
|
||||
R3340:3349 Naturelle <> E_antiT_th thm
|
||||
prf 3370:3379 <> I_antiT_th
|
||||
R3407:3410 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3411:3411 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3416:3420 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3421:3425 Coq.Init.Logic <> False ind
|
||||
R3412:3412 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3413:3415 Naturelle <> phi var
|
||||
R3404:3406 Naturelle <> phi var
|
||||
R3435:3437 Coq.Init.Logic <> not def
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3551:3555 Coq.Init.Logic <> False ind
|
||||
R3567:3576 Naturelle <> I_antiT_th thm
|
||||
prf 3598:3605 <> I_non_th
|
||||
R3630:3630 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3643:3647 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3648:3648 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3649:3651 Naturelle <> phi var
|
||||
R3634:3637 Coq.Init.Logic <> ::type_scope:x_'->'_x not
|
||||
R3638:3642 Coq.Init.Logic <> False ind
|
||||
R3631:3633 Naturelle <> phi var
|
||||
R3669:3671 Coq.Init.Logic <> not def
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3730:3731 Coq.Init.Logic <> ::type_scope:'~'_x not
|
||||
R3745:3752 Naturelle <> I_non_th thm
|
||||
R3801:3810 Naturelle <> I_antiT_th thm
|
||||
R3875:3878 Coq.Logic.Classical_Prop <> NNPP thm
|
225
TP7/Naturelle.v
Executable file
225
TP7/Naturelle.v
Executable file
|
@ -0,0 +1,225 @@
|
|||
Require Export Classical.
|
||||
|
||||
Ltac Hyp Nom := exact Nom.
|
||||
|
||||
Ltac I_imp' :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => let hyp := fresh "H" in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_imp Nom :=
|
||||
match goal with
|
||||
| |- ?A -> ?B => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_imp_th : forall (phi psi : Prop), (phi -> psi) -> phi -> psi.
|
||||
intros Pphi Ppsi Hphi2psi.
|
||||
Hyp Hphi2psi.
|
||||
Qed.
|
||||
|
||||
Ltac E_imp' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_imp_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_imp phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_imp_th phi P)
|
||||
end.
|
||||
|
||||
Ltac I_forall' :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => let hyp := fresh x in intro hyp
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_forall Nom :=
|
||||
match goal with
|
||||
| |- forall (x : ?A), ?P => intro Nom
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_forall_th : forall (A : Type) (phi : A -> Prop) a, (forall x, phi x) -> phi a.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
|
||||
Ltac E_forall x :=
|
||||
pattern x;
|
||||
match goal with
|
||||
| |- (?P x) => apply (E_forall_th _ P x)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_et :=
|
||||
match goal with
|
||||
| |- (?A /\ ?B) => apply (@conj A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_et_g_th : forall (phi psi : Prop), (phi /\ psi) -> phi.
|
||||
intros Pphi Ppsi Hphi_et_psi.
|
||||
elim Hphi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_g' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_g_th P _)
|
||||
end.
|
||||
|
||||
Ltac E_et_g psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_et_g_th P psi)
|
||||
end.
|
||||
|
||||
Theorem E_et_d_th : forall (phi psi : Prop), (phi /\ psi) -> psi.
|
||||
intros Pphi Ppsi H_phi_et_psi.
|
||||
elim H_phi_et_psi.
|
||||
intros Hphi Hpsi.
|
||||
Hyp Hpsi.
|
||||
Qed.
|
||||
|
||||
Ltac E_et_d' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th _ P)
|
||||
end.
|
||||
|
||||
Ltac E_et_d phi :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_et_d_th phi P)
|
||||
end.
|
||||
|
||||
Theorem E_ou_th : forall (phi psi chi : Prop), (phi \/ psi) -> (phi -> chi) -> (psi -> chi) -> chi.
|
||||
intros Pphi Ppsi Pchi Hphi_ou_psi Hphi_imp_chi Hpsi_imp_chi.
|
||||
elim Hphi_ou_psi.
|
||||
Hyp Hphi_imp_chi.
|
||||
Hyp Hpsi_imp_chi.
|
||||
Qed.
|
||||
|
||||
Ltac E_ou' :=
|
||||
match goal with
|
||||
| |- ?P => eapply (E_ou_th _ _ P)
|
||||
end.
|
||||
|
||||
Ltac E_ou phi psi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_ou_th phi psi P)
|
||||
end.
|
||||
|
||||
Ltac I_ou_g :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_introl A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_ou_d :=
|
||||
match goal with
|
||||
| |- (?A \/ ?B) => apply (@or_intror A B)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists' :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => eapply (@ex_intro A P _)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Ltac I_exists t :=
|
||||
match goal with
|
||||
| |- exists (x : ?A), (@?P x) => apply (@ex_intro _ P t)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_exists_th : forall (A : Type) (phi : A -> Prop) (chi : Prop), (exists x, phi x) -> (forall a, phi a -> chi) -> chi.
|
||||
Proof.
|
||||
firstorder.
|
||||
Qed.
|
||||
(*
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P)
|
||||
end.
|
||||
*)
|
||||
Ltac E_exists phi :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_exists_th _ phi P); [ idtac | let t := fresh "t" in let ht := fresh "Ht" in intros t ht ]
|
||||
end.
|
||||
|
||||
Ltac TE :=
|
||||
unfold not;
|
||||
match goal with
|
||||
| |- (?P \/ (?P -> False)) => exact (classic P)
|
||||
| _ => fail
|
||||
end.
|
||||
|
||||
Theorem E_antiT_th : forall (phi : Prop), False -> phi.
|
||||
intros Pphi F.
|
||||
elim F.
|
||||
Qed.
|
||||
|
||||
Ltac E_antiT :=
|
||||
match goal with
|
||||
| |- ?P => apply (E_antiT_th P)
|
||||
end.
|
||||
|
||||
Theorem I_antiT_th : forall (phi : Prop), phi -> (~phi) -> False.
|
||||
unfold not.
|
||||
intro Pphi.
|
||||
intros Hphi Hnphi.
|
||||
cut Pphi.
|
||||
Hyp Hnphi.
|
||||
Hyp Hphi.
|
||||
Qed.
|
||||
|
||||
Ltac I_antiT phi :=
|
||||
match goal with
|
||||
| |- False => apply (I_antiT_th phi)
|
||||
end.
|
||||
|
||||
Theorem I_non_th : forall (phi : Prop), (phi -> False) -> ~phi.
|
||||
intros.
|
||||
unfold not.
|
||||
exact H.
|
||||
Qed.
|
||||
|
||||
Ltac I_non Nom :=
|
||||
match goal with
|
||||
| |- ~ ?P => apply (I_non_th P); intro Nom
|
||||
end.
|
||||
|
||||
Ltac E_non phi :=
|
||||
apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom :=
|
||||
match goal with
|
||||
| |- ?P => apply (NNPP P); intro Nom
|
||||
end.
|
||||
|
||||
(*
|
||||
Ltac I_antiT phi := apply (I_antiT_th phi).
|
||||
|
||||
Ltac absurde Nom phi :=
|
||||
match goal with
|
||||
| |- phi =>
|
||||
cut (phi \/ ~phi);
|
||||
[
|
||||
intros L;
|
||||
elim L;
|
||||
[
|
||||
auto
|
||||
|
|
||||
clear L;
|
||||
intro Nom;
|
||||
apply (E_antiT_th)
|
||||
]
|
||||
|
|
||||
apply (classic phi)
|
||||
]
|
||||
| _ => fail
|
||||
end.
|
||||
*)
|
||||
|
0
TP7/Unnamed_coqscript_1.crashcoqide
Executable file
0
TP7/Unnamed_coqscript_1.crashcoqide
Executable file
29
TP7/coq-exercice-1.v
Executable file
29
TP7/coq-exercice-1.v
Executable file
|
@ -0,0 +1,29 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2019_Logique_Exercice_1.
|
||||
|
||||
Variable A B C : Prop.
|
||||
|
||||
Theorem Exercice_1_Naturelle : (A -> B -> C) -> ((A /\ B) -> C).
|
||||
I_imp H.
|
||||
I_imp H0.
|
||||
E_imp B.
|
||||
E_imp A.
|
||||
exact H.
|
||||
E_et_g B.
|
||||
exact H0.
|
||||
E_et_d A.
|
||||
exact H0.
|
||||
Qed.
|
||||
|
||||
Theorem Exercice_1_Coq : (A -> B -> C) -> ((A /\ B) -> C).
|
||||
intros.
|
||||
destruct H0.
|
||||
cut B.
|
||||
cut A.
|
||||
exact H.
|
||||
exact H0.
|
||||
exact H1.
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Logique_Exercice_1.
|
||||
|
15
TP7/coq-exercice-2.v
Executable file
15
TP7/coq-exercice-2.v
Executable file
|
@ -0,0 +1,15 @@
|
|||
Require Import Naturelle.
|
||||
Section Session1_2019_Logique_Exercice_2.
|
||||
|
||||
Variable A B : Prop.
|
||||
|
||||
Theorem Exercice_2_Naturelle : (~A) \/ B -> (~A) \/ (A /\ B).
|
||||
|
||||
Theorem Exercice_2_Coq : (~A) \/ B -> (~A) \/ (A /\ B).
|
||||
intros.
|
||||
|
||||
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Logique_Exercice_2.
|
||||
|
113
TP7/coq-exercice-3.v
Executable file
113
TP7/coq-exercice-3.v
Executable file
|
@ -0,0 +1,113 @@
|
|||
Section Session1_2019_Induction_Exercice_3.
|
||||
|
||||
(* Déclaration d’un domaine pour les éléments des listes *)
|
||||
Variable A : Set.
|
||||
|
||||
(* Déclaration d'un type liste générique d'éléments de type E *)
|
||||
Inductive liste (E : Set) : Set :=
|
||||
Nil
|
||||
: liste E
|
||||
| Cons : E -> liste E -> liste E.
|
||||
|
||||
(* Déclaration du nom de la fonction append *)
|
||||
Variable append_spec : forall E : Set, liste E -> liste E -> liste E.
|
||||
|
||||
(* Spécification du comportement de append pour Nil en premier paramètre *)
|
||||
Axiom append_Nil : forall E : Set, forall (l : liste E), append_spec E (Nil E) l = l.
|
||||
|
||||
(* Spécification du comportement de append pour Cons en premier paramètre *)
|
||||
Axiom append_Cons : forall E : Set, forall (t : E), forall (q l : liste E),
|
||||
append_spec E ((Cons E) t q) l = (Cons E) t (append_spec E q l).
|
||||
|
||||
(* Spécification du comportement de append pour Nil en second paramètre *)
|
||||
Axiom append_Nil_right : forall E : Set, forall (l : liste E), (append_spec E l (Nil E)) = l.
|
||||
|
||||
(* append est associative à gauche et à droite *)
|
||||
Axiom append_associative : forall E : Set, forall (l1 l2 l3 : liste E),
|
||||
(append_spec E l1 (append_spec E l2 l3)) = (append_spec E (append_spec E l1 l2) l3).
|
||||
|
||||
(* Déclaration du nom de la fonction flatten *)
|
||||
Variable flatten_spec : forall E : Set, liste (liste E) -> liste E.
|
||||
|
||||
(* Spécification du comportement de flatten pour Nil *)
|
||||
Axiom flatten_Nil : forall E : Set, flatten_spec E (Nil (liste E)) = (Nil E).
|
||||
|
||||
(* Spécification du comportement de flatten pour Cons *)
|
||||
Axiom flatten_Cons : forall E : Set, forall (t : liste E), forall (q : liste (liste E)),
|
||||
flatten_spec E (Cons (liste E) t q) = append_spec E t (flatten_spec E q).
|
||||
|
||||
(* Déclaration du nom de la fonction split *)
|
||||
Variable split_spec : forall E : Set, liste E -> liste (liste E).
|
||||
|
||||
(* Spécification du comportement de split pour Nil *)
|
||||
Axiom split_Nil : forall E : Set, split_spec E (Nil E) = (Nil (liste E)).
|
||||
|
||||
(* Spécification du comportement de split pour Cons *)
|
||||
Axiom split_Cons : forall E : Set, forall (t : E), forall (q : liste E),
|
||||
split_spec E (Cons E t q) = Cons (liste E) (Cons E t (Nil E)) (split_spec E q).
|
||||
|
||||
(* Cohérence de flatten et de split : flatten(split(l)) = l*)
|
||||
Theorem flatten_split_consistency : forall E : Set, forall (l : liste E),
|
||||
flatten_spec E (split_spec E l) = l.
|
||||
intros.
|
||||
induction l.
|
||||
(* cas de base *)
|
||||
rewrite split_Nil.
|
||||
rewrite flatten_Nil.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
rewrite split_Cons.
|
||||
rewrite flatten_Cons.
|
||||
rewrite append_Cons.
|
||||
rewrite append_Nil.
|
||||
rewrite IHl.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction append *)
|
||||
Fixpoint append_impl (E : Set) (l1 l2 : liste E) {struct l1} : liste E :=
|
||||
match l1 with
|
||||
Nil _ => l2
|
||||
| (Cons _ t1 q1) => (Cons E t1 (append_impl E q1 l2))
|
||||
end.
|
||||
|
||||
Theorem append_correctness : forall E : Set, forall (l1 l2 : liste E),
|
||||
(append_spec E l1 l2) = (append_impl E l1 l2).
|
||||
intro TE.
|
||||
induction l1.
|
||||
intro Hl2.
|
||||
rewrite append_Nil.
|
||||
simpl.
|
||||
reflexivity.
|
||||
intro Hl2.
|
||||
rewrite append_Cons.
|
||||
simpl.
|
||||
rewrite IHl1.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
(* Implantation de la fonction flatten *)
|
||||
Fixpoint flatten_impl (E : Set) (l : liste (liste E)) {struct l} : liste E :=
|
||||
match l with
|
||||
Nil _ => Nil _
|
||||
| (Cons _ t q) => (append_impl E t (flatten_impl E q ))
|
||||
end.
|
||||
|
||||
(* Correction de l'implantation de flatten par rapport à sa spécification *)
|
||||
Theorem flatten_correctness : forall E : Set, forall (l : liste (liste E)),
|
||||
(flatten_spec E l) = (flatten_impl E l).
|
||||
intros.
|
||||
induction l.
|
||||
(* cas de base *)
|
||||
rewrite flatten_Nil.
|
||||
simpl flatten_impl.
|
||||
reflexivity.
|
||||
(* cas général *)
|
||||
rewrite flatten_Cons.
|
||||
simpl flatten_impl.
|
||||
rewrite append_correctness.
|
||||
rewrite IHl.
|
||||
reflexivity.
|
||||
Qed.
|
||||
|
||||
End Session1_2019_Induction_Exercice_3.
|
24
TP7/why3-exercice-4.mlw
Executable file
24
TP7/why3-exercice-4.mlw
Executable file
|
@ -0,0 +1,24 @@
|
|||
(* BE : Session 1 2019 *)
|
||||
(* Implémentation de la fonction somme des premiers entiers par un algorithme ascendant *)
|
||||
|
||||
module Somme
|
||||
|
||||
use int.Int
|
||||
use int.ComputerDivision
|
||||
use ref.Refint
|
||||
|
||||
let somme (n: int) : int
|
||||
requires { n >= 0 }
|
||||
ensures { 2 * result = n * (n+1) }
|
||||
=
|
||||
let i = ref 0 in
|
||||
let r = ref 0 in
|
||||
while (!i < n) do
|
||||
invariant { !r * 2 = !i * ( !i + 1 ) && n >= !i}
|
||||
variant { n - !i }
|
||||
i := (!i) + 1;
|
||||
r := (!r) + (!i)
|
||||
done;
|
||||
!r
|
||||
|
||||
end
|
36
TP7/why3-exercice-4/why3session.xml
Executable file
36
TP7/why3-exercice-4/why3session.xml
Executable file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
|
||||
"http://why3.lri.fr/why3session.dtd">
|
||||
<why3session shape_version="5">
|
||||
<prover id="0" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="1" name="CVC3" version="2.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="2" name="Z3" version="4.4.1" alternative="noBV" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="3" name="Z3" version="4.4.1" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<prover id="4" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
|
||||
<file proved="true">
|
||||
<path name=".."/>
|
||||
<path name="why3-exercice-4.mlw"/>
|
||||
<theory name="Somme" proved="true">
|
||||
<goal name="VC somme" expl="VC for somme" proved="true">
|
||||
<transf name="split_vc" proved="true" >
|
||||
<goal name="VC somme.0" expl="loop invariant init" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="2"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.1" expl="loop variant decrease" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="7"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.2" expl="loop invariant preservation" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="7"/></proof>
|
||||
</goal>
|
||||
<goal name="VC somme.3" expl="postcondition" proved="true">
|
||||
<proof prover="0"><result status="valid" time="0.00" steps="5"/></proof>
|
||||
<proof prover="1"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="2"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="3"><result status="valid" time="0.01"/></proof>
|
||||
<proof prover="4"><result status="valid" time="0.01"/></proof>
|
||||
</goal>
|
||||
</transf>
|
||||
</goal>
|
||||
</theory>
|
||||
</file>
|
||||
</why3session>
|
2
TP8-9/outils-unix/cmd-sed.txt
Executable file
2
TP8-9/outils-unix/cmd-sed.txt
Executable file
|
@ -0,0 +1,2 @@
|
|||
sed -E -e "s/<\/?[a-z]+>//g" < enseignant-element.xml-sed
|
||||
sed -E -e "s/<\/?[a-z]+>//g" < enseignant-attribut.xml-sed
|
11
TP8-9/outils-unix/commandes-TP5.sh
Executable file
11
TP8-9/outils-unix/commandes-TP5.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
echo "Affichage des lignes contenant des nombres entiers naturels :"
|
||||
egrep -e "\ ([0-9]+)$" exemple.txt
|
||||
echo "Affichage des lignes contenant des nombres entiers relatifs :"
|
||||
egrep -e "\ ([+-]+[0-9]+)$" exemple.txt
|
||||
echo "Affichage des lignes contenant des nombres décimaux :"
|
||||
egrep -e "\ ([+-]?[0-9]+[.][0-9]+([eE][-+]?[1-9][0-9]*)?)$" exemple.txt
|
||||
echo "Affichage des lignes contenant des nombres rationnels :"
|
||||
egrep -e "\ ([+-]?[0-9]+/[1-9][0-9]*)$" exemple.txt
|
||||
echo "Affichage des lignes contenant des nombres complexes rationnels :"
|
||||
egrep -e "\ (([+-]?[0-9]+/[1-9][0-9]*)?[+-]?[0-9]+/[1-9][0-9]*i?)$" exemple.txt
|
5
TP8-9/outils-unix/enseignant-attribut.xml-sed.out
Executable file
5
TP8-9/outils-unix/enseignant-attribut.xml-sed.out
Executable file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<identite prenom="Marc" nom="Pantel"/>
|
||||
<discipline nom="Traduction des langages"/>
|
||||
<discipline nom="Sémantique formelle"/>
|
||||
|
5
TP8-9/outils-unix/enseignant-attribut.xml-vim
Executable file
5
TP8-9/outils-unix/enseignant-attribut.xml-vim
Executable file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<identite prenom="Marc" nom="Pantel"/>
|
||||
<discipline nom="Traduction des langages"/>
|
||||
<discipline nom="Sémantique formelle"/>
|
||||
|
8
TP8-9/outils-unix/enseignant-element.xml-sed.out
Executable file
8
TP8-9/outils-unix/enseignant-element.xml-sed.out
Executable file
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
Marc
|
||||
Pantel
|
||||
|
||||
Traduction des langages
|
||||
Sémantique formelle
|
||||
|
8
TP8-9/outils-unix/enseignant-element.xml-vim
Executable file
8
TP8-9/outils-unix/enseignant-element.xml-vim
Executable file
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
Marc
|
||||
Pantel
|
||||
|
||||
Traduction des langages
|
||||
Sémantique formelle
|
||||
|
23
TP8-9/outils-unix/exemple.txt
Executable file
23
TP8-9/outils-unix/exemple.txt
Executable file
|
@ -0,0 +1,23 @@
|
|||
Suite de chiffres : 0123456789
|
||||
Entier naturel : 0
|
||||
Entier naturel : 123
|
||||
Entier relatif : +123
|
||||
Entier relatif : -123
|
||||
Décimal : 0.123
|
||||
Décimal : -0.123
|
||||
Décimal : 0.123e10
|
||||
Décimal : 0.123E10
|
||||
Décimal : -0.123e10
|
||||
Décimal : -0.123E10
|
||||
Décimal : 0.123e-10
|
||||
Décimal : 0.123E-10
|
||||
Décimal : -0.123e-10
|
||||
Décimal : -0.123e-10
|
||||
Rationnel : 1/2
|
||||
Rationnel : -1/2
|
||||
Complexe : 1/2i
|
||||
Complexe : -1/2i
|
||||
Complexe : 2/3+1/2i
|
||||
Complexe : 2/3+1/2i
|
||||
Complexe : -2/3-1/2i
|
||||
Complexe : -2/3-1/2i
|
BIN
TP8-9/process-analysis/MainProcessus
Executable file
BIN
TP8-9/process-analysis/MainProcessus
Executable file
Binary file not shown.
36
TP8-9/process-analysis/Makefile
Executable file
36
TP8-9/process-analysis/Makefile
Executable file
|
@ -0,0 +1,36 @@
|
|||
|
||||
OCAMLLEX = ocamllex
|
||||
OCAMLYACC = menhir
|
||||
OCAMLC = ocamlc
|
||||
OCAMLLD = ocamlc
|
||||
|
||||
|
||||
.SUFFIXES: .ml .mli .cmo .cmi .mll .mly
|
||||
|
||||
%.cmi : %.mli
|
||||
$(OCAMLC) -c $<
|
||||
|
||||
%.cmo : %.ml %.cmi
|
||||
$(OCAMLC) -c $<
|
||||
|
||||
%.cmo : %.ml
|
||||
$(OCAMLC) -c $<
|
||||
|
||||
%.cmo : %.cmi
|
||||
$(OCAMLC) -c $<
|
||||
|
||||
%.ml : %.mll
|
||||
$(OCAMLLEX) $<
|
||||
|
||||
%.mli %.ml : %.mly
|
||||
$(OCAMLYACC) $<
|
||||
|
||||
all : mainProcessus
|
||||
|
||||
lexerProcessus.ml : parserProcessus.cmi
|
||||
|
||||
mainProcessus : lexerProcessus.cmo parserProcessus.cmo mainProcessus.cmo
|
||||
$(OCAMLC) -o MainProcessus lexerProcessus.cmo parserProcessus.cmo mainProcessus.cmo
|
||||
|
||||
clean :
|
||||
-rm -f *.cmo *.cmi lexerProcessus.ml parserProcessus.ml MainProcessus
|
1279
TP8-9/process-analysis/lexerProcessus.ml
Executable file
1279
TP8-9/process-analysis/lexerProcessus.ml
Executable file
File diff suppressed because it is too large
Load diff
46
TP8-9/process-analysis/lexerProcessus.mll
Executable file
46
TP8-9/process-analysis/lexerProcessus.mll
Executable file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
|
||||
(* Partie recopiée dans le fichier CaML généré. *)
|
||||
(* Ouverture de modules exploités dans les actions *)
|
||||
(* Déclarations de types, de constantes, de fonctions, d'exceptions exploités dans les actions *)
|
||||
|
||||
open ParserProcessus
|
||||
exception LexicalError
|
||||
|
||||
}
|
||||
|
||||
(* Déclaration d'expressions régulières exploitées par la suite *)
|
||||
let chiffre = ['0' - '9']
|
||||
let minuscule = ['a' - 'z']
|
||||
let majuscule = ['A' - 'Z']
|
||||
let lettre = minuscule | majuscule
|
||||
let lettre_chiffre = lettre | chiffre | '_'
|
||||
let commentaire =
|
||||
(* Commentaire bloc à la C/C++/C#/Java/etc *)
|
||||
("/*" [^ '*']* '*'* ([^ '*' '/'] [^ '*']* '*'*)* '/')
|
||||
(* Commentaire fin de ligne à la C/C++/C#/Java/etc *)
|
||||
| "//" [^'\n']*
|
||||
|
||||
rule main = parse
|
||||
| ['\n' '\t' ' ']+ { main lexbuf }
|
||||
| commentaire { (main lexbuf) }
|
||||
| "process" { PROCESS }
|
||||
| "activity" { ACTIVITY }
|
||||
| "starts" { STARTS }
|
||||
| "finishes" { FINISHES }
|
||||
| "if" { IF }
|
||||
| "started" { STARTED }
|
||||
| "finished" { FINISHED }
|
||||
| "resource" { RESOURCE }
|
||||
| "amount" { AMOUNT }
|
||||
| "requires" { REQUIRES }
|
||||
| "{" { LEFT_BRACE }
|
||||
| "}" { RIGHT_BRACE }
|
||||
| chiffre+ as texte { (NUMBER (int_of_string texte)) }
|
||||
| ('_' | lettre) lettre_chiffre* as texte { (IDENTIFIER texte) }
|
||||
| eof { END }
|
||||
| _ as texte { (print_string "Erreur lexicale : ");(print_char texte);(print_newline ()); (main lexbuf) }
|
||||
|
||||
{
|
||||
|
||||
}
|
42
TP8-9/process-analysis/mainProcessus.ml
Executable file
42
TP8-9/process-analysis/mainProcessus.ml
Executable file
|
@ -0,0 +1,42 @@
|
|||
open ParserProcessus
|
||||
|
||||
(* Fonction d'affichage des unités lexicales et des données qu'elles contiennent *)
|
||||
let printToken t =
|
||||
(print_endline
|
||||
("token: " ^ (match t with
|
||||
| PROCESS -> "process"
|
||||
| IDENTIFIER (texte) -> ("identifier(" ^ texte ^ ")")
|
||||
| ACTIVITY -> "activity"
|
||||
| STARTS -> "starts"
|
||||
| FINISHES -> "finishes"
|
||||
| IF -> "if"
|
||||
| STARTED -> "started"
|
||||
| FINISHED -> "finished"
|
||||
| RESOURCE -> "resource"
|
||||
| REQUIRES -> "requires"
|
||||
| AMOUNT -> "amount"
|
||||
| LEFT_BRACE -> "{"
|
||||
| RIGHT_BRACE -> "}"
|
||||
| NUMBER (texte) -> ("number(" ^ (string_of_int texte) ^ ")")
|
||||
| END -> "EOF"
|
||||
)));;
|
||||
|
||||
(* Analyse lexicale du fichier passé en paramètre de la ligne de commande *)
|
||||
if (Array.length Sys.argv > 1)
|
||||
then
|
||||
let lexbuf = (Lexing.from_channel (open_in Sys.argv.(1))) in
|
||||
let token = ref (LexerProcessus.main lexbuf) in
|
||||
while ((!token) != END) do
|
||||
(printToken (!token));
|
||||
(token := (LexerProcessus.main lexbuf))
|
||||
done
|
||||
else
|
||||
(print_endline "MainMuProcessus fichier");;
|
||||
|
||||
(* Analyse lexicale, syntaxique et sémantique du fichier passé en paramètre de la ligne de commande *)
|
||||
if (Array.length Sys.argv > 1)
|
||||
then
|
||||
let lexbuf = (Lexing.from_channel (open_in Sys.argv.(1))) in
|
||||
(ParserProcessus.fichier LexerProcessus.main lexbuf)
|
||||
else
|
||||
(print_endline "MainProcessus fichier");;
|
945
TP8-9/process-analysis/parserProcessus.ml
Executable file
945
TP8-9/process-analysis/parserProcessus.ml
Executable file
|
@ -0,0 +1,945 @@
|
|||
|
||||
module MenhirBasics = struct
|
||||
|
||||
exception Error
|
||||
|
||||
type token =
|
||||
| STARTS
|
||||
| STARTED
|
||||
| RIGHT_BRACE
|
||||
| RESOURCE
|
||||
| REQUIRES
|
||||
| PROCESS
|
||||
| NUMBER of (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 17 "parserProcessus.ml"
|
||||
)
|
||||
| LEFT_BRACE
|
||||
| IF
|
||||
| IDENTIFIER of (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 24 "parserProcessus.ml"
|
||||
)
|
||||
| FINISHES
|
||||
| FINISHED
|
||||
| END
|
||||
| AMOUNT
|
||||
| ACTIVITY
|
||||
|
||||
end
|
||||
|
||||
include MenhirBasics
|
||||
|
||||
let _eRR =
|
||||
MenhirBasics.Error
|
||||
|
||||
type _menhir_env = {
|
||||
_menhir_lexer: Lexing.lexbuf -> token;
|
||||
_menhir_lexbuf: Lexing.lexbuf;
|
||||
_menhir_token: token;
|
||||
mutable _menhir_error: bool
|
||||
}
|
||||
|
||||
and _menhir_state =
|
||||
| MenhirState30
|
||||
| MenhirState21
|
||||
| MenhirState19
|
||||
| MenhirState17
|
||||
| MenhirState14
|
||||
| MenhirState9
|
||||
| MenhirState3
|
||||
|
||||
# 1 "parserProcessus.mly"
|
||||
|
||||
|
||||
(* Partie recopiee dans le fichier CaML genere. *)
|
||||
(* Ouverture de modules exploites dans les actions *)
|
||||
(* Declarations de types, de constantes, de fonctions, d'exceptions exploites dans les actions *)
|
||||
|
||||
|
||||
# 63 "parserProcessus.ml"
|
||||
|
||||
let rec _menhir_goto_etat : _menhir_env -> 'ttv_tail -> 'tv_etat -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv155 * _menhir_state * 'tv_action)) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 71 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let (_v : 'tv_etat) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv153 * _menhir_state * 'tv_action)) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 78 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let ((_4 : 'tv_etat) : 'tv_etat) = _v in
|
||||
((let ((_menhir_stack, _menhir_s, (_1 : 'tv_action)), (_3 : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 84 "parserProcessus.ml"
|
||||
))) = _menhir_stack in
|
||||
let _2 = () in
|
||||
let _v : 'tv_contrainte =
|
||||
# 49 "parserProcessus.mly"
|
||||
( (print_endline "contrainte : action if IDENTIFIER etat") )
|
||||
# 90 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv151) = _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_contrainte) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv149 * _menhir_state * 'tv_contrainte) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| FINISHES ->
|
||||
_menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState21
|
||||
| LEFT_BRACE ->
|
||||
_menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState21
|
||||
| REQUIRES ->
|
||||
_menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState21
|
||||
| STARTS ->
|
||||
_menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState21
|
||||
| ACTIVITY | RESOURCE | RIGHT_BRACE ->
|
||||
_menhir_reduce5 _menhir_env (Obj.magic _menhir_stack) MenhirState21
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState21) : 'freshtv150)) : 'freshtv152)) : 'freshtv154)) : 'freshtv156)
|
||||
|
||||
and _menhir_fail : unit -> 'a =
|
||||
fun () ->
|
||||
Printf.fprintf stderr "Internal failure -- please contact the parser generator's developers.\n%!";
|
||||
assert false
|
||||
|
||||
and _menhir_goto_contraintes : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_contraintes -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s _v ->
|
||||
match _menhir_s with
|
||||
| MenhirState19 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv129 * _menhir_state * 'tv_requires) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_contraintes) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv127 * _menhir_state * 'tv_requires) = Obj.magic _menhir_stack in
|
||||
let (_ : _menhir_state) = _menhir_s in
|
||||
let ((_2 : 'tv_contraintes) : 'tv_contraintes) = _v in
|
||||
((let (_menhir_stack, _menhir_s, (_1 : 'tv_requires)) = _menhir_stack in
|
||||
let _v : 'tv_contraintes =
|
||||
# 43 "parserProcessus.mly"
|
||||
( (print_endline "contraintes : requires contraintes") )
|
||||
# 138 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_contraintes _menhir_env _menhir_stack _menhir_s _v) : 'freshtv128)) : 'freshtv130)
|
||||
| MenhirState21 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv133 * _menhir_state * 'tv_contrainte) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_contraintes) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv131 * _menhir_state * 'tv_contrainte) = Obj.magic _menhir_stack in
|
||||
let (_ : _menhir_state) = _menhir_s in
|
||||
let ((_2 : 'tv_contraintes) : 'tv_contraintes) = _v in
|
||||
((let (_menhir_stack, _menhir_s, (_1 : 'tv_contrainte)) = _menhir_stack in
|
||||
let _v : 'tv_contraintes =
|
||||
# 44 "parserProcessus.mly"
|
||||
( (print_endline "contraintes : contrainte contraintes") )
|
||||
# 154 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_contraintes _menhir_env _menhir_stack _menhir_s _v) : 'freshtv132)) : 'freshtv134)
|
||||
| MenhirState17 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv137 * _menhir_state) * _menhir_state * 'tv_elements)) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_contraintes) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv135 * _menhir_state) * _menhir_state * 'tv_elements)) = Obj.magic _menhir_stack in
|
||||
let (_ : _menhir_state) = _menhir_s in
|
||||
let ((_4 : 'tv_contraintes) : 'tv_contraintes) = _v in
|
||||
((let ((_menhir_stack, _menhir_s), _, (_2 : 'tv_elements)) = _menhir_stack in
|
||||
let _3 = () in
|
||||
let _1 = () in
|
||||
let _v : 'tv_contraintes =
|
||||
# 45 "parserProcessus.mly"
|
||||
( (print_endline "contraintes : { elements } contraintes") )
|
||||
# 172 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_contraintes _menhir_env _menhir_stack _menhir_s _v) : 'freshtv136)) : 'freshtv138)
|
||||
| MenhirState9 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv147 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 180 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_contraintes) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv145 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 188 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let (_ : _menhir_state) = _menhir_s in
|
||||
let ((_3 : 'tv_contraintes) : 'tv_contraintes) = _v in
|
||||
((let ((_menhir_stack, _menhir_s), (_2 : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 195 "parserProcessus.ml"
|
||||
))) = _menhir_stack in
|
||||
let _1 = () in
|
||||
let _v : 'tv_activite =
|
||||
# 40 "parserProcessus.mly"
|
||||
( (print_endline "activite : activity IDENTIFIER contraintes") )
|
||||
# 201 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv143) = _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_activite) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv141) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_activite) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv139) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let ((_1 : 'tv_activite) : 'tv_activite) = _v in
|
||||
((let _v : 'tv_element =
|
||||
# 35 "parserProcessus.mly"
|
||||
( (print_endline "element : activite") )
|
||||
# 218 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_element _menhir_env _menhir_stack _menhir_s _v) : 'freshtv140)) : 'freshtv142)) : 'freshtv144)) : 'freshtv146)) : 'freshtv148)
|
||||
| _ ->
|
||||
_menhir_fail ()
|
||||
|
||||
and _menhir_goto_action : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_action -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s _v ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv125 * _menhir_state * 'tv_action) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IF ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv121 * _menhir_state * 'tv_action) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IDENTIFIER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv117 * _menhir_state * 'tv_action)) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 244 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| FINISHED ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv109) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv107) = Obj.magic _menhir_stack in
|
||||
((let _1 = () in
|
||||
let _v : 'tv_etat =
|
||||
# 55 "parserProcessus.mly"
|
||||
( (print_endline "etat : FINISHED") )
|
||||
# 260 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_etat _menhir_env _menhir_stack _v) : 'freshtv108)) : 'freshtv110)
|
||||
| STARTED ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv113) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv111) = Obj.magic _menhir_stack in
|
||||
((let _1 = () in
|
||||
let _v : 'tv_etat =
|
||||
# 54 "parserProcessus.mly"
|
||||
( (print_endline "etat : STARTED") )
|
||||
# 273 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_etat _menhir_env _menhir_stack _v) : 'freshtv112)) : 'freshtv114)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv115 * _menhir_state * 'tv_action)) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 283 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s, _), _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv116)) : 'freshtv118)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv119 * _menhir_state * 'tv_action)) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv120)) : 'freshtv122)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv123 * _menhir_state * 'tv_action) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv124)) : 'freshtv126)
|
||||
|
||||
and _menhir_goto_elements : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_elements -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s _v ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
|
||||
match _menhir_s with
|
||||
| MenhirState14 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv77 * _menhir_state) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| RIGHT_BRACE ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv73 * _menhir_state) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| FINISHES ->
|
||||
_menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState17
|
||||
| LEFT_BRACE ->
|
||||
_menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState17
|
||||
| REQUIRES ->
|
||||
_menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState17
|
||||
| STARTS ->
|
||||
_menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState17
|
||||
| ACTIVITY | RESOURCE | RIGHT_BRACE ->
|
||||
_menhir_reduce5 _menhir_env (Obj.magic _menhir_stack) MenhirState17
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState17) : 'freshtv74)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv75 * _menhir_state) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv76)) : 'freshtv78)
|
||||
| MenhirState30 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv81 * _menhir_state * 'tv_element) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv79 * _menhir_state * 'tv_element) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s, (_1 : 'tv_element)), _, (_2 : 'tv_elements)) = _menhir_stack in
|
||||
let _v : 'tv_elements =
|
||||
# 33 "parserProcessus.mly"
|
||||
( (print_endline "elements : element elements") )
|
||||
# 348 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_elements _menhir_env _menhir_stack _menhir_s _v) : 'freshtv80)) : 'freshtv82)
|
||||
| MenhirState3 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ((('freshtv105) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 356 "parserProcessus.ml"
|
||||
))) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| RIGHT_BRACE ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ((('freshtv101) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 366 "parserProcessus.ml"
|
||||
))) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ((('freshtv99) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 373 "parserProcessus.ml"
|
||||
))) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, (_2 : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 378 "parserProcessus.ml"
|
||||
))), _, (_4 : 'tv_elements)) = _menhir_stack in
|
||||
let _5 = () in
|
||||
let _3 = () in
|
||||
let _1 = () in
|
||||
let _v : 'tv_processus =
|
||||
# 30 "parserProcessus.mly"
|
||||
( (print_endline "processus : process IDENTIFIER { elements }") )
|
||||
# 386 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv97) = _menhir_stack in
|
||||
let (_v : 'tv_processus) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv95 * 'tv_processus) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| END ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv91 * 'tv_processus) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv89 * 'tv_processus) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, (_1 : 'tv_processus)) = _menhir_stack in
|
||||
let _2 = () in
|
||||
let _v : (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 407 "parserProcessus.ml"
|
||||
) =
|
||||
# 28 "parserProcessus.mly"
|
||||
( (print_endline "fichier : processus END") )
|
||||
# 411 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv87) = _menhir_stack in
|
||||
let (_v : (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 418 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv85) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 425 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv83) = Obj.magic _menhir_stack in
|
||||
let ((_1 : (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 432 "parserProcessus.ml"
|
||||
)) : (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 436 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
(Obj.magic _1 : 'freshtv84)) : 'freshtv86)) : 'freshtv88)) : 'freshtv90)) : 'freshtv92)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv93 * 'tv_processus) = Obj.magic _menhir_stack in
|
||||
(raise _eRR : 'freshtv94)) : 'freshtv96)) : 'freshtv98)) : 'freshtv100)) : 'freshtv102)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ((('freshtv103) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 452 "parserProcessus.ml"
|
||||
))) * _menhir_state * 'tv_elements) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv104)) : 'freshtv106)
|
||||
| _ ->
|
||||
_menhir_fail ()
|
||||
|
||||
and _menhir_goto_element : _menhir_env -> 'ttv_tail -> _menhir_state -> 'tv_element -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s _v ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv71 * _menhir_state * 'tv_element) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| ACTIVITY ->
|
||||
_menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState30
|
||||
| RESOURCE ->
|
||||
_menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState30
|
||||
| RIGHT_BRACE ->
|
||||
_menhir_reduce11 _menhir_env (Obj.magic _menhir_stack) MenhirState30
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState30) : 'freshtv72)
|
||||
|
||||
and _menhir_reduce5 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _v : 'tv_contraintes =
|
||||
# 42 "parserProcessus.mly"
|
||||
( (print_endline "contraintes : /* Lambda, mot vide */") )
|
||||
# 483 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_contraintes _menhir_env _menhir_stack _menhir_s _v
|
||||
|
||||
and _menhir_run10 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv69) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
((let _1 = () in
|
||||
let _v : 'tv_action =
|
||||
# 51 "parserProcessus.mly"
|
||||
( (print_endline "action : STARTS") )
|
||||
# 497 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_action _menhir_env _menhir_stack _menhir_s _v) : 'freshtv70)
|
||||
|
||||
and _menhir_run11 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| NUMBER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv65 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 513 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IDENTIFIER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv61 * _menhir_state) * (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 524 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 529 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv59 * _menhir_state) * (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 536 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
let ((_3 : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 541 "parserProcessus.ml"
|
||||
)) : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 545 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let ((_menhir_stack, _menhir_s), (_2 : (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 550 "parserProcessus.ml"
|
||||
))) = _menhir_stack in
|
||||
let _1 = () in
|
||||
let _v : 'tv_requires =
|
||||
# 47 "parserProcessus.mly"
|
||||
( (print_endline "requires : requires NUMBER IDENTIFIER") )
|
||||
# 556 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv57) = _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_requires) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv55 * _menhir_state * 'tv_requires) = Obj.magic _menhir_stack in
|
||||
((assert (not _menhir_env._menhir_error);
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| FINISHES ->
|
||||
_menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState19
|
||||
| LEFT_BRACE ->
|
||||
_menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState19
|
||||
| REQUIRES ->
|
||||
_menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState19
|
||||
| STARTS ->
|
||||
_menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState19
|
||||
| ACTIVITY | RESOURCE | RIGHT_BRACE ->
|
||||
_menhir_reduce5 _menhir_env (Obj.magic _menhir_stack) MenhirState19
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState19) : 'freshtv56)) : 'freshtv58)) : 'freshtv60)) : 'freshtv62)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv63 * _menhir_state) * (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 589 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s), _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv64)) : 'freshtv66)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv67 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv68)
|
||||
|
||||
and _menhir_run14 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| ACTIVITY ->
|
||||
_menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState14
|
||||
| RESOURCE ->
|
||||
_menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState14
|
||||
| RIGHT_BRACE ->
|
||||
_menhir_reduce11 _menhir_env (Obj.magic _menhir_stack) MenhirState14
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState14
|
||||
|
||||
and _menhir_run18 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv53) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
((let _1 = () in
|
||||
let _v : 'tv_action =
|
||||
# 52 "parserProcessus.mly"
|
||||
( (print_endline "action : FINISHES") )
|
||||
# 628 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_action _menhir_env _menhir_stack _menhir_s _v) : 'freshtv54)
|
||||
|
||||
and _menhir_errorcase : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
match _menhir_s with
|
||||
| MenhirState30 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv39 * _menhir_state * 'tv_element) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv40)
|
||||
| MenhirState21 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv41 * _menhir_state * 'tv_contrainte) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv42)
|
||||
| MenhirState19 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv43 * _menhir_state * 'tv_requires) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv44)
|
||||
| MenhirState17 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv45 * _menhir_state) * _menhir_state * 'tv_elements)) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s, _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv46)
|
||||
| MenhirState14 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv47 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv48)
|
||||
| MenhirState9 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv49 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 665 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s), _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv50)
|
||||
| MenhirState3 ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv51) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 674 "parserProcessus.ml"
|
||||
))) = Obj.magic _menhir_stack in
|
||||
(raise _eRR : 'freshtv52)
|
||||
|
||||
and _menhir_reduce11 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _v : 'tv_elements =
|
||||
# 32 "parserProcessus.mly"
|
||||
( (print_endline "elements : /* Lambda, mot vide */") )
|
||||
# 683 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_elements _menhir_env _menhir_stack _menhir_s _v
|
||||
|
||||
and _menhir_run4 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IDENTIFIER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv35 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 699 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| AMOUNT ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv31 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 710 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| NUMBER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv27 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 720 "parserProcessus.ml"
|
||||
))) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 725 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv25 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 732 "parserProcessus.ml"
|
||||
))) = Obj.magic _menhir_stack in
|
||||
let ((_4 : (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 737 "parserProcessus.ml"
|
||||
)) : (
|
||||
# 15 "parserProcessus.mly"
|
||||
(int)
|
||||
# 741 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let ((_menhir_stack, _menhir_s), (_2 : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 746 "parserProcessus.ml"
|
||||
))) = _menhir_stack in
|
||||
let _3 = () in
|
||||
let _1 = () in
|
||||
let _v : 'tv_resource =
|
||||
# 38 "parserProcessus.mly"
|
||||
( (print_endline "resource : resource IDENTIFIER amount NUMBER") )
|
||||
# 753 "parserProcessus.ml"
|
||||
in
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv23) = _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_resource) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv21) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let (_v : 'tv_resource) = _v in
|
||||
((let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv19) = Obj.magic _menhir_stack in
|
||||
let (_menhir_s : _menhir_state) = _menhir_s in
|
||||
let ((_1 : 'tv_resource) : 'tv_resource) = _v in
|
||||
((let _v : 'tv_element =
|
||||
# 36 "parserProcessus.mly"
|
||||
( (print_endline "element : resource") )
|
||||
# 770 "parserProcessus.ml"
|
||||
in
|
||||
_menhir_goto_element _menhir_env _menhir_stack _menhir_s _v) : 'freshtv20)) : 'freshtv22)) : 'freshtv24)) : 'freshtv26)) : 'freshtv28)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : (('freshtv29 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 780 "parserProcessus.ml"
|
||||
))) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s), _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv30)) : 'freshtv32)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv33 * _menhir_state) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 791 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let ((_menhir_stack, _menhir_s), _) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv34)) : 'freshtv36)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv37 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv38)
|
||||
|
||||
and _menhir_run8 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
|
||||
fun _menhir_env _menhir_stack _menhir_s ->
|
||||
let _menhir_stack = (_menhir_stack, _menhir_s) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IDENTIFIER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv15 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 815 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| FINISHES ->
|
||||
_menhir_run18 _menhir_env (Obj.magic _menhir_stack) MenhirState9
|
||||
| LEFT_BRACE ->
|
||||
_menhir_run14 _menhir_env (Obj.magic _menhir_stack) MenhirState9
|
||||
| REQUIRES ->
|
||||
_menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState9
|
||||
| STARTS ->
|
||||
_menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState9
|
||||
| ACTIVITY | RESOURCE | RIGHT_BRACE ->
|
||||
_menhir_reduce5 _menhir_env (Obj.magic _menhir_stack) MenhirState9
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState9) : 'freshtv16)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv17 * _menhir_state) = Obj.magic _menhir_stack in
|
||||
((let (_menhir_stack, _menhir_s) = _menhir_stack in
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s) : 'freshtv18)
|
||||
|
||||
and _menhir_discard : _menhir_env -> _menhir_env =
|
||||
fun _menhir_env ->
|
||||
let lexer = _menhir_env._menhir_lexer in
|
||||
let lexbuf = _menhir_env._menhir_lexbuf in
|
||||
let _tok = lexer lexbuf in
|
||||
{
|
||||
_menhir_lexer = lexer;
|
||||
_menhir_lexbuf = lexbuf;
|
||||
_menhir_token = _tok;
|
||||
_menhir_error = false;
|
||||
}
|
||||
|
||||
and fichier : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (
|
||||
# 21 "parserProcessus.mly"
|
||||
(unit)
|
||||
# 858 "parserProcessus.ml"
|
||||
) =
|
||||
fun lexer lexbuf ->
|
||||
let _menhir_env =
|
||||
let (lexer : Lexing.lexbuf -> token) = lexer in
|
||||
let (lexbuf : Lexing.lexbuf) = lexbuf in
|
||||
((let _tok = Obj.magic () in
|
||||
{
|
||||
_menhir_lexer = lexer;
|
||||
_menhir_lexbuf = lexbuf;
|
||||
_menhir_token = _tok;
|
||||
_menhir_error = false;
|
||||
}) : _menhir_env)
|
||||
in
|
||||
Obj.magic (let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv13) = ((), _menhir_env._menhir_lexbuf.Lexing.lex_curr_p) in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| PROCESS ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv9) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| IDENTIFIER _v ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv5) = Obj.magic _menhir_stack in
|
||||
let (_v : (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 889 "parserProcessus.ml"
|
||||
)) = _v in
|
||||
((let _menhir_stack = (_menhir_stack, _v) in
|
||||
let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| LEFT_BRACE ->
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv1) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 900 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
((let _menhir_env = _menhir_discard _menhir_env in
|
||||
let _tok = _menhir_env._menhir_token in
|
||||
match _tok with
|
||||
| ACTIVITY ->
|
||||
_menhir_run8 _menhir_env (Obj.magic _menhir_stack) MenhirState3
|
||||
| RESOURCE ->
|
||||
_menhir_run4 _menhir_env (Obj.magic _menhir_stack) MenhirState3
|
||||
| RIGHT_BRACE ->
|
||||
_menhir_reduce11 _menhir_env (Obj.magic _menhir_stack) MenhirState3
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
_menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState3) : 'freshtv2)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : ('freshtv3) * (
|
||||
# 16 "parserProcessus.mly"
|
||||
(string)
|
||||
# 922 "parserProcessus.ml"
|
||||
)) = Obj.magic _menhir_stack in
|
||||
(raise _eRR : 'freshtv4)) : 'freshtv6)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv7) = Obj.magic _menhir_stack in
|
||||
(raise _eRR : 'freshtv8)) : 'freshtv10)
|
||||
| _ ->
|
||||
assert (not _menhir_env._menhir_error);
|
||||
_menhir_env._menhir_error <- true;
|
||||
let (_menhir_env : _menhir_env) = _menhir_env in
|
||||
let (_menhir_stack : 'freshtv11) = Obj.magic _menhir_stack in
|
||||
(raise _eRR : 'freshtv12)) : 'freshtv14))
|
||||
|
||||
# 57 "parserProcessus.mly"
|
||||
|
||||
|
||||
# 941 "parserProcessus.ml"
|
||||
|
||||
# 269 "<standard.mly>"
|
||||
|
||||
|
||||
# 946 "parserProcessus.ml"
|
27
TP8-9/process-analysis/parserProcessus.mli
Executable file
27
TP8-9/process-analysis/parserProcessus.mli
Executable file
|
@ -0,0 +1,27 @@
|
|||
|
||||
(* The type of tokens. *)
|
||||
|
||||
type token =
|
||||
| STARTS
|
||||
| STARTED
|
||||
| RIGHT_BRACE
|
||||
| RESOURCE
|
||||
| REQUIRES
|
||||
| PROCESS
|
||||
| NUMBER of (int)
|
||||
| LEFT_BRACE
|
||||
| IF
|
||||
| IDENTIFIER of (string)
|
||||
| FINISHES
|
||||
| FINISHED
|
||||
| END
|
||||
| AMOUNT
|
||||
| ACTIVITY
|
||||
|
||||
(* This exception is raised by the monolithic API functions. *)
|
||||
|
||||
exception Error
|
||||
|
||||
(* The monolithic API. *)
|
||||
|
||||
val fichier: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (unit)
|
57
TP8-9/process-analysis/parserProcessus.mly
Executable file
57
TP8-9/process-analysis/parserProcessus.mly
Executable file
|
@ -0,0 +1,57 @@
|
|||
%{
|
||||
|
||||
(* Partie recopiee dans le fichier CaML genere. *)
|
||||
(* Ouverture de modules exploites dans les actions *)
|
||||
(* Declarations de types, de constantes, de fonctions, d'exceptions exploites dans les actions *)
|
||||
|
||||
%}
|
||||
|
||||
/* Declaration des unites lexicales et de leur type si une valeur particuliere leur est associee */
|
||||
|
||||
%token PROCESS ACTIVITY STARTS FINISHES IF STARTED FINISHED
|
||||
%token RESOURCE AMOUNT REQUIRES
|
||||
%token LEFT_BRACE RIGHT_BRACE
|
||||
/* Defini le type des donnees associees a l'unite lexicale */
|
||||
%token <int> NUMBER
|
||||
%token <string> IDENTIFIER
|
||||
/* Unite lexicale particuliere qui represente la fin du fichier */
|
||||
%token END
|
||||
|
||||
/* Type renvoye pour le nom terminal fichier */
|
||||
%type <unit> fichier
|
||||
|
||||
/* Le non terminal fichier est l'axiome */
|
||||
%start fichier
|
||||
|
||||
%% /* Regles de productions */
|
||||
|
||||
fichier : processus END { (print_endline "fichier : processus END") }
|
||||
|
||||
processus : PROCESS IDENTIFIER LEFT_BRACE elements RIGHT_BRACE { (print_endline "processus : process IDENTIFIER { elements }") }
|
||||
|
||||
elements : /* Lambda, mot vide */ { (print_endline "elements : /* Lambda, mot vide */") }
|
||||
| element elements { (print_endline "elements : element elements") }
|
||||
|
||||
element : activite { (print_endline "element : activite") }
|
||||
| resource { (print_endline "element : resource") }
|
||||
|
||||
resource : RESOURCE IDENTIFIER AMOUNT NUMBER { (print_endline "resource : resource IDENTIFIER amount NUMBER") }
|
||||
|
||||
activite : ACTIVITY IDENTIFIER contraintes { (print_endline "activite : activity IDENTIFIER contraintes") }
|
||||
|
||||
contraintes : /* Lambda, mot vide */ { (print_endline "contraintes : /* Lambda, mot vide */") }
|
||||
| requires contraintes { (print_endline "contraintes : requires contraintes") }
|
||||
| contrainte contraintes { (print_endline "contraintes : contrainte contraintes") }
|
||||
| LEFT_BRACE elements RIGHT_BRACE contraintes { (print_endline "contraintes : { elements } contraintes") }
|
||||
|
||||
requires : REQUIRES NUMBER IDENTIFIER { (print_endline "requires : requires NUMBER IDENTIFIER") }
|
||||
|
||||
contrainte : action IF IDENTIFIER etat { (print_endline "contrainte : action if IDENTIFIER etat") }
|
||||
|
||||
action : STARTS { (print_endline "action : STARTS") }
|
||||
| FINISHES { (print_endline "action : FINISHES") }
|
||||
|
||||
etat : STARTED { (print_endline "etat : STARTED") }
|
||||
| FINISHED { (print_endline "etat : FINISHED") }
|
||||
|
||||
%%
|
8
TP8-9/process-analysis/tests/test00.processus
Executable file
8
TP8-9/process-analysis/tests/test00.processus
Executable file
|
@ -0,0 +1,8 @@
|
|||
/* Un premier exemple de processus */
|
||||
process ABC {
|
||||
activity A
|
||||
activity B
|
||||
activity C
|
||||
starts if A started
|
||||
finishes if B finished
|
||||
}
|
11
TP8-9/process-analysis/tests/test01.processus
Executable file
11
TP8-9/process-analysis/tests/test01.processus
Executable file
|
@ -0,0 +1,11 @@
|
|||
/* Un deuxième exemple de processus avec des ressources */
|
||||
process ABC {
|
||||
resource R amount 5
|
||||
activity A
|
||||
requires 2 R
|
||||
activity B
|
||||
activity C
|
||||
requires 3 R
|
||||
starts if A started
|
||||
finishes if B finished
|
||||
}
|
18
TP8-9/process-analysis/tests/test02.processus
Executable file
18
TP8-9/process-analysis/tests/test02.processus
Executable file
|
@ -0,0 +1,18 @@
|
|||
/* Un troisième exemple de processus hiérarchique avec des ressources */
|
||||
process ABC {
|
||||
resource R amount 5
|
||||
activity A {
|
||||
activity A1 {
|
||||
activity A11
|
||||
}
|
||||
requires 1 R
|
||||
activity A2
|
||||
requires 2 R
|
||||
starts if A1 finished
|
||||
}
|
||||
requires 2 R
|
||||
activity B
|
||||
activity C requires 3 R
|
||||
starts if A started
|
||||
finishes if B finished
|
||||
}
|
Loading…
Reference in a new issue