24 |
24 |
25 type fillpat |
25 type fillpat |
26 datatype thydata |
26 datatype thydata |
27 = Hcal of {calc: Rule_Set.calc, coursedesign: authors, guh: guh, mathauthors: authors} |
27 = Hcal of {calc: Rule_Set.calc, coursedesign: authors, guh: guh, mathauthors: authors} |
28 | Hord of {coursedesign: authors, guh: guh, mathauthors: authors, ord: Rule.subst -> term * term -> bool} |
28 | Hord of {coursedesign: authors, guh: guh, mathauthors: authors, ord: Rule.subst -> term * term -> bool} |
29 | Hrls of {coursedesign: authors, guh: guh, mathauthors: authors, thy_rls: Rule.thyID * Rule_Set.rls} |
29 | Hrls of {coursedesign: authors, guh: guh, mathauthors: authors, thy_rls: Rule.thyID * Rule_Set.T} |
30 | Hthm of {coursedesign: authors, fillpats: fillpat list, guh: guh, mathauthors: authors, thm: thm} |
30 | Hthm of {coursedesign: authors, fillpats: fillpat list, guh: guh, mathauthors: authors, thm: thm} |
31 | Html of {coursedesign: authors, guh: guh, html: string, mathauthors: authors} |
31 | Html of {coursedesign: authors, guh: guh, html: string, mathauthors: authors} |
32 type theID |
32 type theID |
33 type spec |
33 type spec |
34 val cas_eq: cas_elem * cas_elem -> bool |
34 val cas_eq: cas_elem * cas_elem -> bool |
283 (*WN060720 more consistent naming would be 'type thyelem' or 'thelem'*) |
283 (*WN060720 more consistent naming would be 'type thyelem' or 'thelem'*) |
284 datatype thydata = |
284 datatype thydata = |
285 Html of {guh: guh, coursedesign: authors, mathauthors: authors, html: string} |
285 Html of {guh: guh, coursedesign: authors, mathauthors: authors, html: string} |
286 | Hthm of {guh: guh, coursedesign: authors, mathauthors: authors, fillpats: fillpat list, |
286 | Hthm of {guh: guh, coursedesign: authors, mathauthors: authors, fillpats: fillpat list, |
287 thm: thm} (* here no sym_thm, thus no thmID required *) |
287 thm: thm} (* here no sym_thm, thus no thmID required *) |
288 | Hrls of {guh: guh, coursedesign: authors, mathauthors: authors, thy_rls: (Rule.thyID * Rule_Set.rls)} |
288 | Hrls of {guh: guh, coursedesign: authors, mathauthors: authors, thy_rls: (Rule.thyID * Rule_Set.T)} |
289 | Hcal of {guh: guh, coursedesign: authors, mathauthors: authors, calc: Rule_Set.calc} |
289 | Hcal of {guh: guh, coursedesign: authors, mathauthors: authors, calc: Rule_Set.calc} |
290 | Hord of {guh: guh, coursedesign: authors, mathauthors: authors, |
290 | Hord of {guh: guh, coursedesign: authors, mathauthors: authors, |
291 ord: (Rule.subst -> (term * term) -> bool)}; |
291 ord: (Rule.subst -> (term * term) -> bool)}; |
292 fun the2str (Html {guh, ...}) = guh |
292 fun the2str (Html {guh, ...}) = guh |
293 | the2str (Hthm {guh, ...}) = guh |
293 | the2str (Hthm {guh, ...}) = guh |
409 they do NOT handle overlays by re-using an identifier in different thys; |
409 they do NOT handle overlays by re-using an identifier in different thys; |
410 "thyID.rlsID" would be a good solution, if the "." would be possible |
410 "thyID.rlsID" would be a good solution, if the "." would be possible |
411 in scripts... |
411 in scripts... |
412 actually a hack to get alltogether run again with minimal effort *) |
412 actually a hack to get alltogether run again with minimal effort *) |
413 fun insthy thy' (rls', rls) = (rls', (thy', rls)); |
413 fun insthy thy' (rls', rls) = (rls', (thy', rls)); |
414 fun overwritelthy thy (al, bl: (Rule_Set.rls' * Rule_Set.rls) list) = |
414 fun overwritelthy thy (al, bl: (Rule_Set.rls' * Rule_Set.T) list) = |
415 let val bl' = map (insthy ((get_thy o Rule.theory2theory') thy)) bl |
415 let val bl' = map (insthy ((get_thy o Rule.theory2theory') thy)) bl |
416 in overwritel (al, bl') end; |
416 in overwritel (al, bl') end; |
417 |
417 |
418 fun maxthy thy1 thy2 = if Context.subthy (thy1, thy2) then thy2 else thy1; |
418 fun maxthy thy1 thy2 = if Context.subthy (thy1, thy2) then thy2 else thy1; |
419 |
419 |
458 because applied terms may be from 'subthy' as well as from super; |
458 because applied terms may be from 'subthy' as well as from super; |
459 thus we take 'maxthy'; see match_ags ! *) |
459 thus we take 'maxthy'; see match_ags ! *) |
460 cas : term option, (* 'CAS-command' *) |
460 cas : term option, (* 'CAS-command' *) |
461 met : metID list, (* methods solving the pbt *) |
461 met : metID list, (* methods solving the pbt *) |
462 (*TODO: abstract to ?pre_model?...*) |
462 (*TODO: abstract to ?pre_model?...*) |
463 prls : Rule_Set.rls, (* for preds in where_ *) |
463 prls : Rule_Set.T, (* for preds in where_ *) |
464 where_ : term list, (* where - predicates *) |
464 where_ : term list, (* where - predicates *) |
465 ppc : pat list (* this is the model-pattern; |
465 ppc : pat list (* this is the model-pattern; |
466 it contains "#Given","#Where","#Find","#Relate"-patterns |
466 it contains "#Given","#Where","#Find","#Relate"-patterns |
467 for constraints on identifiers see "fun cpy_nam" *) |
467 for constraints on identifiers see "fun cpy_nam" *) |
468 } |
468 } |
469 |
469 |
470 val e_pbt = {guh = "pbl_empty", mathauthors = [], init = e_pblID, thy = Thy_Info.get_theory "Pure", |
470 val e_pbt = {guh = "pbl_empty", mathauthors = [], init = e_pblID, thy = Thy_Info.get_theory "Pure", |
471 cas = NONE, prls = Rule_Set.Erls, where_ = [], ppc = [], met = []} : pbt |
471 cas = NONE, prls = Rule_Set.Empty, where_ = [], ppc = [], met = []} : pbt |
472 fun pbt2str ({cas = cas', guh = guh', init = init', mathauthors = ma', met = met', ppc = ppc', |
472 fun pbt2str ({cas = cas', guh = guh', init = init', mathauthors = ma', met = met', ppc = ppc', |
473 prls = prls', thy = thy', where_ = w'} : pbt) |
473 prls = prls', thy = thy', where_ = w'} : pbt) |
474 = "{cas = " ^ (Rule.termopt2str cas') ^ ", guh = \"" ^ guh' ^ "\", init = " |
474 = "{cas = " ^ (Rule.termopt2str cas') ^ ", guh = \"" ^ guh' ^ "\", init = " |
475 ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", met = " |
475 ^ (strs2str init') ^ ", mathauthors = " ^ (strs2str ma' |> quote) ^ ", met = " |
476 ^ (strslist2strs met') ^ ", ppc = " ^ pats2str ppc' ^ ", prls = " |
476 ^ (strslist2strs met') ^ ", ppc = " ^ pats2str ppc' ^ ", prls = " |
542 {guh : guh, (* unique within this isac-knowledge *) |
542 {guh : guh, (* unique within this isac-knowledge *) |
543 mathauthors: string list, (* copyright *) |
543 mathauthors: string list, (* copyright *) |
544 init : pblID, (* WN060721 introduced mistakenly--TODO.REMOVE! *) |
544 init : pblID, (* WN060721 introduced mistakenly--TODO.REMOVE! *) |
545 rew_ord' : Rule_Def.rew_ord', (* for rules in Detail |
545 rew_ord' : Rule_Def.rew_ord', (* for rules in Detail |
546 TODO.WN0509 store fun itself, see 'type pbt' *) |
546 TODO.WN0509 store fun itself, see 'type pbt' *) |
547 erls : Rule_Set.rls, (* the eval_rls for cond. in rules FIXME "rls' |
547 erls : Rule_Set.T, (* the eval_rls for cond. in rules FIXME "rls' |
548 instead erls in "fun prep_met" *) |
548 instead erls in "fun prep_met" *) |
549 srls : Rule_Set.rls, (* for evaluating list expressions in scr *) |
549 srls : Rule_Set.T, (* for evaluating list expressions in scr *) |
550 crls : Rule_Set.rls, (* for check_elementwise, ie. formulae in calc. *) |
550 crls : Rule_Set.T, (* for check_elementwise, ie. formulae in calc. *) |
551 nrls : Rule_Set.rls, (* canonical simplifier specific for this met *) |
551 nrls : Rule_Set.T, (* canonical simplifier specific for this met *) |
552 errpats : Rule.errpat list,(* error patterns expected in this method *) |
552 errpats : Rule.errpat list,(* error patterns expected in this method *) |
553 calc : Rule_Set.calc list, (* Theory_Data in fun prep_met *) |
553 calc : Rule_Set.calc list, (* Theory_Data in fun prep_met *) |
554 (*branch : TransitiveB set in append_problem at generation ob pblobj *) |
554 (*branch : TransitiveB set in append_problem at generation ob pblobj *) |
555 scr : Rule.program, (* progam, empty as @{thm refl} or Rfuns *) |
555 scr : Rule.program, (* progam, empty as @{thm refl} or Rfuns *) |
556 (*TODO: abstract to ?pre_model?...*) |
556 (*TODO: abstract to ?pre_model?...*) |
557 prls : Rule_Set.rls, (* for evaluating predicates in modelpattern *) |
557 prls : Rule_Set.T, (* for evaluating predicates in modelpattern *) |
558 ppc : pat list, (* items in given, find, relate; |
558 ppc : pat list, (* items in given, find, relate; |
559 items (in "#Find") which need not occur in the arg-list of a SubProblem |
559 items (in "#Find") which need not occur in the arg-list of a SubProblem |
560 are 'copy-named' with an identifier "*'.'". |
560 are 'copy-named' with an identifier "*'.'". |
561 copy-named items are 'generating' if they are NOT "*'''" ?WN120516?? |
561 copy-named items are 'generating' if they are NOT "*'''" ?WN120516?? |
562 see ME/calchead.sml 'fun is_copy_named'. *) |
562 see ME/calchead.sml 'fun is_copy_named'. *) |
612 (* for dialog-authoring *) |
612 (* for dialog-authoring *) |
613 fun update_hrls (Hrls {guh, coursedesign, mathauthors, thy_rls = (thyID, rls)}) errpatIDs = |
613 fun update_hrls (Hrls {guh, coursedesign, mathauthors, thy_rls = (thyID, rls)}) errpatIDs = |
614 let |
614 let |
615 val rls' = |
615 val rls' = |
616 case rls of |
616 case rls of |
617 Rule_Set.Rls {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...} |
617 Rule_Def.Repeat {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...} |
618 => Rule_Set.Rls {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, |
618 => Rule_Def.Repeat {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, |
619 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs} |
619 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs} |
620 | Rule_Set.Seq {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...} |
620 | Rule_Set.Seqence {id, preconds, rew_ord, erls, srls, calc, rules, scr, ...} |
621 => Rule_Set.Seq {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, |
621 => Rule_Set.Seqence {id = id, preconds = preconds, rew_ord = rew_ord, erls = erls, srls = srls, |
622 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs} |
622 calc = calc, rules = rules, scr = scr, errpatts = errpatIDs} |
623 | Rule_Set.Rrls {id, prepat, rew_ord, erls, calc, scr, ...} |
623 | Rule_Set.Rrls {id, prepat, rew_ord, erls, calc, scr, ...} |
624 => Rule_Set.Rrls {id = id, prepat = prepat, rew_ord = rew_ord, erls = erls, calc = calc, |
624 => Rule_Set.Rrls {id = id, prepat = prepat, rew_ord = rew_ord, erls = erls, calc = calc, |
625 scr = scr, errpatts = errpatIDs} |
625 scr = scr, errpatts = errpatIDs} |
626 | Erls => Erls |
626 | Erls => Erls |