1 (* Title: 100-init-rootpbl.sml
2 Author: Walther Neuper 1105
3 (c) copyright due to lincense terms.
6 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
7 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
8 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
9 val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
11 ("Test", ["sqroot-test","univariate","equation","test"],
12 ["Test","squ-equ-test-subpbl1"]);
13 "~~~~~ fun CalcTreeTEST, args:"; val [(fmz, sp):fmz] = [(fmz, (dI',pI',mI'))];
14 "~~~~~ fun nxt_specify_init_calc, args:"; val (fmz : fmz_, (dI, pI, mI) : spec) = (fmz, sp);
15 val thy = assoc_thy dI
16 ;mI = ["no_met"]; (*false*)
17 val (pI, (pors, pctxt), mI) = (pI, get_pbt pI |> #ppc |> prep_ori fmz thy, mI)
18 val {cas, ppc, thy=thy',...} = get_pbt pI
19 val dI = theory2theory' (maxthy thy thy');
21 case cas of SOME t => subst_atomic ((vars_of_pbl_' ppc) ~~~ vals_of_oris pors) t
22 | _ => error "Minisubplb/100-init-rootpbl.sml no headline"
23 val (pt, _) = cappend_problem e_ctree [] (e_istate, pctxt) (fmz, (dI, pI, mI))
24 (pors, (dI, pI, mI), hdl)
25 val pt = update_ctxt pt [] pctxt
26 ;((pt, ([], Pbl)), fst3 (nxt_specif Model_Problem (pt, ([], Pbl)))) : calcstate;
28 (* INVESTIGATE val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];*)
29 (*///----------------------------------------- save for final check ------------------------\\\*)
30 val [(fmz''''', spec''''')] = [(fmz, (dI',pI',mI'))];
31 "~~~~~ fun CalcTreeTEST, args:"; val ([(fmz, sp)]) = ([(fmz, (dI',pI',mI'))]);
32 val ((pt, p), tacis) = Chead.nxt_specify_init_calc (fmz, sp)
34 val PblObj {origin= (oris, (dI', pI', mI'), _), spec= (dI, _, _), ctxt, ...} = get_obj I pt (fst p);
35 (* ERROR nxt_add: types or dsc DO NOT MATCH BETWEEN fmz --- pbt
36 IN Minimsubpbl/150-add-given.sml IS CAUSED HEREBY:*)
38 ((1, [1], "#Given", Const ("Descript.equality", _),
39 [Const ("HOL.eq", _) $ _ $ Free ("2", _)]) :: _) => ()
40 | ((1, [1], "#undef", Const ("empty", _), _) :: _) => error "START specify: oris are not properly initialised"
43 "~~~~~ fun nxt_specify_init_calc, args:"; val (fmz, (dI, pI, mI)) = (fmz, sp);
44 val thy = Celem.assoc_thy dI;
45 (*if*) mI = ["no_met"] = false (*else*);
46 val xxx = Specify.get_pbt pI
48 val (oris, ctxt) = Specify.prep_ori fmz thy yyy
51 ((1, [1], "#Given", Const ("Descript.equality", _),
52 [Const ("HOL.eq", _) $ _ $ Free ("2", _)]) :: _) => ()
53 | ((1, [1], "#undef", Const ("empty", _), _) :: _) => error "START specify: oris are not properly initialised"
56 "~~~~~ fun prep_ori, args:"; val (fmz, thy, pbt) = (fmz, thy, yyy);
57 val ctxt = Proof_Context.init_global thy |> fold Stool.declare_constraints fmz;
59 case TermC.parseNEW ctxt "equality (x+1=(2::real))" of
60 SOME (Const ("Descript.equality", _) (* <<< ---------------- this needs to be recognised *) $
61 (Const ("HOL.eq", _) $ (Const ("Groups.plus_class.plus", _) $
62 Free ("x", _) $ Free ("1", _)) $ Free ("2", _))) => ()
63 | SOME (Free ("equality", _) $
64 (Const ("HOL.eq", _) $ (Const ("Groups.plus_class.plus", _) $
65 Free ("x", _) $ Free ("1", _)) $ Free ("2", _))) => error ""
66 | _ => error "something is wrong with initialising Minisubpnl";
68 val [(fmz, (dI',pI',mI'))] = [(fmz''''', spec''''')];
69 (*\\\----------------------------------------- saved for final check -----------------------///*)
71 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
72 case nxt of ("Model_Problem", _) => ()
73 | _ => error "minisubpbl: CalcTreeTEST has no nxt = Model_Problem";