@@ -42,15 +42,15 @@ val _ = new_theory "p4_e_progress";
4242val prog_exp_def = Define `
4343 prog_exp (e) (ty:'a itself) =
4444 !gscope (scopest:scope list) t_scope_list t_scope_list_g
45- T_e tau b (c:'a ctx ) order delta_g delta_b (delta_t:delta_t) delta_x f Prs_n.
45+ T_e tau b (c:'a ectx ) order delta_g delta_b (delta_t:delta_t) delta_x f Prs_n.
4646
4747 type_scopes_list gscope t_scope_list_g ∧
4848 type_scopes_list scopest t_scope_list ∧
4949 star_not_in_sl (scopest) ∧
5050 ~(is_const e) ∧
5151 e_typ (t_scope_list_g,t_scope_list) T_e e tau b ∧
5252 (T_e = (order, f, (delta_g, delta_b, delta_x, delta_t))) /\
53- WT_c c order t_scope_list_g delta_g delta_b delta_x delta_t Prs_n ==>
53+ WT_ec c order t_scope_list_g delta_g delta_b delta_x delta_t Prs_n ==>
5454 ?e' framel. e_red c gscope scopest e e' framel
5555`;
5656
@@ -1335,15 +1335,16 @@ gvs[]
13351335
13361336
13371337val wf_imp_ci_abstract_single = prove ( ``
1338- ! e d x ss .
1339- wf_arg d x e (ss) ==>
1340- ? scope . copyin_abstract [x] [d] [e] (ss) scope``,
1338+ !e d x ss oracle_index random_oracle.
1339+ wf_arg d x e ss ==>
1340+ ?scope. copyin_abstract [x] [d] [e] ss scope oracle_index random_oracle ``,
13411341
13421342REPEAT STRIP_TAC >>
1343- Q.EXISTS_TAC `[(varn_name x , THE (one_arg_val_for_newscope (d) (e) ss))]` >>
1343+ Q.EXISTS_TAC `[(varn_name x , (\ (a,b). (FST a, b)) $ THE (one_arg_val_for_newscope d e ss oracle_index random_oracle ))]` >>
13441344
13451345fs[copyin_abstract_def] >>
13461346IMP_RES_TAC wf_imp_val_lval >>
1347+ Q.PAT_X_ASSUM ‘!random_oracle i. _’ (fn thm => assume_tac $ Q.SPECL [‘random_oracle’, ‘oracle_index’] thm) >>
13471348gvs[]
13481349);
13491350
@@ -1353,12 +1354,12 @@ gvs[]
13531354
13541355
13551356val wf_imp_new_vlval_list = prove ( ``
1356- ! i dl xl el ss.
1357+ ! i dl xl el ss oracle_index random_oracle .
13571358(LENGTH xl = LENGTH dl) /\
13581359(LENGTH dl = LENGTH el) /\
13591360(i < LENGTH dl ) /\
13601361wf_arg_list (dl) (xl) (el) ss ==>
1361- ? vlval . one_arg_val_for_newscope (EL i (dl)) (EL i (el)) ss = SOME vlval``,
1362+ ? vlval . one_arg_val_for_newscope (EL i (dl)) (EL i (el)) ss oracle_index random_oracle = SOME vlval``,
13621363
13631364Induct_on `xl` >>
13641365Induct_on `dl` >>
@@ -1372,7 +1373,7 @@ gvs[] >| [
13721373
13731374 IMP_RES_TAC wf_arg_normalization >>
13741375 IMP_RES_TAC wf_imp_val_lval >>
1375- srw_tac [SatisfySimps.SATISFY_ss][]
1376+ metis_tac[]
13761377 ,
13771378
13781379 IMP_RES_TAC wf_arg_normalization >>
@@ -1401,20 +1402,20 @@ gvs[] >| [
14011402
14021403
14031404val wf_arg_list_NONE2 = prove (``
1404- ! dl xl el ss .
1405+ ! dl xl el ss oracle_index random_oracle .
14051406(LENGTH xl = LENGTH dl) /\
14061407(LENGTH dl = LENGTH el) /\
14071408wf_arg_list dl xl el ss /\
14081409ALL_DISTINCT xl ==>
1409- ~ (all_arg_update_for_newscope xl dl el ss = NONE )``,
1410+ ~ (all_arg_update_for_newscope xl dl el ss oracle_index random_oracle = NONE )``,
14101411
14111412REPEAT STRIP_TAC >>
14121413fs[all_arg_update_for_newscope_def] >>
14131414ASSUME_TAC wf_arg_list_NONE >>
14141415
14151416FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL [`ZIP (dl,ZIP (xl,el))`])) >>
14161417gvs[] >>
1417- FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL [`ss`])) >>
1418+ FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL [`ss`, ‘oracle_index’, ‘random_oracle’ ])) >>
14181419gvs[] >| [
14191420
14201421`(MAP (λ(d,x,e). x) (ZIP (dl,ZIP (xl,el)))) = xl` by gvs[GSYM map_distrub] >>
@@ -1434,21 +1435,21 @@ gvs[] >| [
14341435
14351436
14361437val copyin_eq_rw = prove ( ``
1437- ! xl dl el gscope scopest scope.
1438+ ! xl dl el gscope scopest scope oracle_index random_oracle .
14381439 (LENGTH xl = LENGTH dl) /\
14391440 (LENGTH dl = LENGTH el) /\
14401441 (ALL_DISTINCT xl) ∧
14411442 (wf_arg_list dl xl el (scopest ⧺ gscope)) ==>
1442- ( ( SOME scope = copyin xl dl el gscope scopest)
1443+ ((?i_opt. SOME ( scope, i_opt) = copyin xl dl el gscope scopest oracle_index random_oracle )
14431444<=>
1444- copyin_abstract xl dl el (scopest ⧺ gscope) scope)
1445+ copyin_abstract xl dl el (scopest ⧺ gscope) scope oracle_index random_oracle )
14451446``,
14461447
14471448REPEAT STRIP_TAC >>
14481449ASSUME_TAC copyin_eq >>
14491450FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL
14501451 [`ZIP (el,ZIP (xl,dl))`, `gscope`,
1451- `scopest`, `scope`])) >>
1452+ `scopest`, `scope`, ‘oracle_index’, ‘random_oracle’ ])) >>
14521453gvs[] >>
14531454
14541455`(MAP (λ(e,x,d). x) (ZIP (el,ZIP (xl,dl)))) = xl` by gvs[GSYM map_distrub] >>
@@ -1929,18 +1930,23 @@ gvs[is_const_def, clause_name_def] >>
19291930
19301931(* the cases should be on if there is an element unreduced yet? *)
19311932Cases_on ` (unred_arg_index (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
1932- (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) = NONE ) ` >| [
1933+ (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) = NONE )` >| [
19331934
19341935 DISJ1_TAC >>
19351936
19361937 IMP_RES_TAC unred_arg_index_NONE >>
19371938
19381939 ASSUME_TAC tfunn_imp_sig_body_lookup >>
19391940 FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL
1940- [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`, `order`, `t_scope_list_g`,
1941+ [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`,
1942+ ‘get_oracle_index’, ‘set_oracle_index’, ‘c7’,
1943+ `order`, `t_scope_list_g`,
19411944 `delta_g`, `delta_b`, `delta_x`,
19421945 `(MAP (λ(e_,tau_,x_,d_,b_).(tau_,x_,d_)) (e_tau_x_d_b_list : (e # tau # string # d # bool) list))`,
19431946 `tau'`, `f` , ‘delta_t’, ‘Prs_n’ ])) >> gvs[] >>
1947+ assume_tac $ Q.SPECL
1948+ [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`, ‘get_oracle_index’, ‘set_oracle_index’, ‘c6’, ‘c7’] $ GSYM WT_c_ec >>
1949+ gs[] >>
19441950
19451951 Q.EXISTS_TAC `ZIP ((MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list),
19461952 ZIP(MAP FST xdl,MAP SND xdl))` >>
@@ -1978,19 +1984,21 @@ Cases_on ` (unred_arg_index (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
19781984 `gscope`, `scopest`, `scope`])) >>
19791985 gvs[] >>
19801986 gvs[] >>
1981-
1982- Q.EXISTS_TAC `THE(copyin (MAP FST xdl) (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
1983- (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) gscope scopest)` >>
1987+ qpat_x_assum ‘!oracle_index. _’ ( fn thm => assume_tac $ Q.SPECL [‘c6’, ‘c7’] thm) >>
1988+ Q.EXISTS_TAC `FST $ THE(copyin (MAP FST xdl) (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
1989+ (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) gscope scopest c6 c7 )` >>
19841990 gvs[] >>
19851991
19861992 Cases_on ` copyin (MAP FST xdl) (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
1987- (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) gscope scopest` >| [
1993+ (MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list) gscope scopest c6 c7 ` >| [
19881994
19891995 IMP_RES_TAC wf_arg_list_NONE2 >>
19901996 gvs[] >>
1991- fs [copyin_def]
1997+ gvs [copyin_def, AllCaseEqs() ]
19921998 ,
1993- gvs[]
1999+ gvs[] >>
2000+ qexists_tac ‘SND x’ >>
2001+ gs[]
19942002 ]
19952003 ,
19962004
@@ -2002,7 +2010,9 @@ Cases_on ` (unred_arg_index (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
20022010 (* first show that we can indeed find a map for the function f in the context *)
20032011 ASSUME_TAC tfunn_imp_sig_lookup >>
20042012 FIRST_X_ASSUM (STRIP_ASSUME_TAC o (Q.SPECL
2005- [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`, `order`, `t_scope_list_g`,
2013+ [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`,
2014+ ‘get_oracle_index’, ‘set_oracle_index’, ‘c7’,
2015+ `order`, `t_scope_list_g`,
20062016 `delta_g`, `delta_b`, `delta_x`,
20072017 `(MAP (λ(e_,tau_,x_,d_,b_).(tau_,x_,d_)) (e_tau_x_d_b_list : (e # tau # string # d # bool) list))`,
20082018 `tau'`, `f`, ‘delta_t’, ‘Prs_n’])) >> gvs[] >>
@@ -2027,11 +2037,14 @@ Cases_on ` (unred_arg_index (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
20272037 [`gscope`, `scopest`, `t_scope_list`, `t_scope_list_g`,
20282038 `(t_tau (EL i (MAP (λ(e_,tau_,x_,d_,b_). tau_) (e_tau_x_d_b_list : (e # tau # string # d # bool) list))))`,
20292039 `(EL i (MAP (λ(e_,tau_,x_,d_,b_). b_) (e_tau_x_d_b_list : (e # tau # string # d # bool) list)))`,
2030- `(c0,c1,c2,c3,c4,c5)`, `order`, `delta_g`, `delta_b`, `delta_t`, `delta_x`, `f'`, ‘Prs_n’])) >> gvs[] >>
2031-
2040+ `(c0,c1,c2,c3,c4,c5,c6,c7)`, `order`, `delta_g`, `delta_b`, `delta_t`, `delta_x`, `f'`, ‘Prs_n’])) >> gvs[] >>
20322041 IMP_RES_TAC unred_arg_index_result >| [
20332042 (* if d is in/none, then it shouldn't be a constant in order to reduce it *)
20342043 gvs[] >>
2044+ (* TODO: Why doesn't it work to rewrite? *)
2045+ assume_tac $ Q.SPECL
2046+ [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`, ‘get_oracle_index’, ‘set_oracle_index’, ‘c6’, ‘c7’] $ GSYM WT_c_ec >>
2047+ gs[] >>
20352048
20362049 Q.EXISTS_TAC `framel` >>
20372050 Q.EXISTS_TAC `ZIP ( MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list ,
@@ -2064,6 +2077,10 @@ Cases_on ` (unred_arg_index (MAP (λ(e_,tau_,x_,d_,b_). d_) e_tau_x_d_b_list)
20642077
20652078 IMP_RES_TAC notlval_case >| [
20662079 gvs[] >>
2080+ (* TODO: Why doesn't it work to rewrite? *)
2081+ assume_tac $ Q.SPECL
2082+ [`c0`, `c1`, `c2`, `c3`, `c4`, `c5`, ‘get_oracle_index’, ‘set_oracle_index’, ‘c6’, ‘c7’] $ GSYM WT_c_ec >>
2083+ gs[] >>
20672084
20682085 Q.EXISTS_TAC `framel` >>
20692086 Q.EXISTS_TAC `ZIP ( MAP (λ(e_,tau_,x_,d_,b_). e_) e_tau_x_d_b_list ,
0 commit comments