walther@59773
|
1 |
(* Title: calculation abstracted from Ctree
|
walther@59773
|
2 |
Author: Walther Neuper 200117
|
walther@59773
|
3 |
(c) due to copyright terms
|
walther@59773
|
4 |
*)
|
walther@59773
|
5 |
|
walther@59773
|
6 |
signature CALCULATION =
|
walther@59773
|
7 |
sig
|
walther@59773
|
8 |
type T
|
walther@59934
|
9 |
type result
|
walther@59928
|
10 |
val current_formula: T -> term
|
walther@59998
|
11 |
val specify_data: T -> Ctree.specify_data
|
walther@59998
|
12 |
val solve_data: T -> Ctree.solve_data
|
walther@59998
|
13 |
|
walther@59998
|
14 |
val references: T -> References.T
|
walther@59773
|
15 |
|
walther@59981
|
16 |
type state_pre
|
walther@59981
|
17 |
type state_post
|
walther@60251
|
18 |
\<^isac_test>\<open>
|
walther@59998
|
19 |
(*val state_pre_empty: state_pre*)
|
walther@59981
|
20 |
val state_empty_pre: state_pre
|
walther@60251
|
21 |
\<close>
|
walther@59998
|
22 |
(*val state_post_empty: state_post*)
|
walther@59981
|
23 |
val state_empty_post: state_post
|
walther@59773
|
24 |
end
|
walther@59773
|
25 |
|
walther@59773
|
26 |
(**)
|
walther@59773
|
27 |
structure Calc(**): CALCULATION(**) =
|
walther@59773
|
28 |
struct
|
walther@59773
|
29 |
(**)
|
walther@59934
|
30 |
type T = Ctree.state;
|
walther@59934
|
31 |
type result = (term * term list);
|
walther@59773
|
32 |
|
walther@59928
|
33 |
fun current_formula (pt, (p, p_)) =
|
walther@59848
|
34 |
case p_ of
|
walther@59848
|
35 |
Pos.Frm => Ctree.get_obj Ctree.g_form pt p
|
walther@59848
|
36 |
| Pos.Res => (fst o (Ctree.get_obj Ctree.g_result pt)) p
|
walther@59928
|
37 |
| _ => raise ERROR ("Solve_Step.check: call by " ^ Pos.pos'2str (p, p_));
|
walther@59848
|
38 |
|
walther@59998
|
39 |
fun specify_data (pt, p) =
|
walther@59998
|
40 |
case Ctree.get_obj I pt (fst p) of
|
walther@59998
|
41 |
Ctree.PblObj specify_data => specify_data
|
walther@59998
|
42 |
| _ => raise ERROR "Calc.specify_data called with PrfObj"
|
walther@59998
|
43 |
|
walther@59998
|
44 |
fun solve_data (pt, p) =
|
walther@59998
|
45 |
case Ctree.get_obj I pt (fst p) of
|
walther@59998
|
46 |
Ctree.PrfObj solve_data => solve_data
|
walther@59998
|
47 |
| _ => raise ERROR "Calc.solve_data called with PblObj"
|
walther@59998
|
48 |
|
walther@59998
|
49 |
|
walther@59998
|
50 |
|
walther@59998
|
51 |
fun references (pt, pos as (p, p_)) =
|
walther@59998
|
52 |
let
|
walther@59998
|
53 |
val (p', _) = if Pos.on_specification pos then pos else (Ctree.par_pblobj pt p, p_)
|
walther@59998
|
54 |
in
|
Walther@60494
|
55 |
References.select_input (#2 (Ctree.get_obj Ctree.g_origin pt p')) (Ctree.get_obj Ctree.g_spec pt p')
|
walther@59998
|
56 |
end
|
walther@59998
|
57 |
|
walther@59981
|
58 |
|
walther@59981
|
59 |
(** state to be deleted **)
|
walther@59981
|
60 |
(*
|
walther@59981
|
61 |
These states follow a design which is inadequate for PIDE:
|
walther@59981
|
62 |
state_pre holds Calc.T and State_Steps.T to be applied next,
|
walther@59981
|
63 |
Calc.state_post holds State_Steps.T which generated the Calc.T.
|
walther@59981
|
64 |
|
walther@59981
|
65 |
This design aimed at observing several Step's, re-do etc --
|
walther@59981
|
66 |
this has to be addresses in another layer.
|
walther@59981
|
67 |
*)
|
walther@59981
|
68 |
type state_pre = T * State_Steps.T;
|
walther@60251
|
69 |
\<^isac_test>\<open>
|
walther@59981
|
70 |
val state_empty_pre = ((Ctree.EmptyPtree, Pos.e_pos'), [State_Steps.single_empty]);
|
walther@60251
|
71 |
\<close>
|
walther@59981
|
72 |
|
walther@59981
|
73 |
type state_post =
|
walther@59981
|
74 |
State_Steps.T *
|
walther@59981
|
75 |
Pos.pos' list * (* a "continuous" sequence deleted by State_Steps.T *)
|
walther@59981
|
76 |
T;
|
walther@59981
|
77 |
val state_empty_post = ([State_Steps.single_empty], [Pos.e_pos'], (Ctree.EmptyPtree, Pos.e_pos'));
|
walther@59981
|
78 |
|
walther@60251
|
79 |
|
walther@59773
|
80 |
(**)end(**)
|
walther@59773
|
81 |
|