167 val add_abbrev: string -> binding * term -> Proof.context -> (term * term) * Proof.context |
167 val add_abbrev: string -> binding * term -> Proof.context -> (term * term) * Proof.context |
168 val revert_abbrev: string -> string -> Proof.context -> Proof.context |
168 val revert_abbrev: string -> string -> Proof.context -> Proof.context |
169 val generic_add_abbrev: string -> binding * term -> Context.generic -> |
169 val generic_add_abbrev: string -> binding * term -> Context.generic -> |
170 (term * term) * Context.generic |
170 (term * term) * Context.generic |
171 val generic_revert_abbrev: string -> string -> Context.generic -> Context.generic |
171 val generic_revert_abbrev: string -> string -> Context.generic -> Context.generic |
172 val cert_stmt: |
172 type stmt = |
173 (binding * typ option * mixfix) list -> (term * term list) list list -> Proof.context -> |
173 {vars: ((binding * typ option * mixfix) * (string * term)) list, |
174 (((binding * typ option * mixfix) * (string * term)) list * term list list * |
174 propss: term list list, |
175 (indexname * term) list * (indexname * term) list * term) * Proof.context |
175 binds: (indexname * term) list, |
176 val read_stmt: |
176 result_binds: (indexname * term) list} |
177 (binding * string option * mixfix) list -> (string * string list) list list -> Proof.context -> |
177 val cert_stmt: (binding * typ option * mixfix) list -> (term * term list) list list -> |
178 (((binding * typ option * mixfix) * (string * term)) list * term list list * |
178 Proof.context -> stmt * Proof.context |
179 (indexname * term) list * (indexname * term) list * term) * Proof.context |
179 val read_stmt: (binding * string option * mixfix) list -> (string * string list) list list -> |
|
180 Proof.context -> stmt * Proof.context |
|
181 type statement = |
|
182 {fixes: (string * term) list, |
|
183 assumes: term list list, |
|
184 shows: term list list, |
|
185 result_binds: (indexname * term option) list, |
|
186 text: term, |
|
187 result_text: term} |
180 val cert_statement: (binding * typ option * mixfix) list -> |
188 val cert_statement: (binding * typ option * mixfix) list -> |
181 (term * term list) list list -> (term * term list) list list -> Proof.context -> |
189 (term * term list) list list -> (term * term list) list list -> Proof.context -> |
182 ((string * term) list * term list list * term list list * (indexname * term option) list * term) * |
190 statement * Proof.context |
183 Proof.context |
|
184 val read_statement: (binding * string option * mixfix) list -> |
191 val read_statement: (binding * string option * mixfix) list -> |
185 (string * string list) list list -> (string * string list) list list -> Proof.context -> |
192 (string * string list) list list -> (string * string list) list list -> Proof.context -> |
186 ((string * term) list * term list list * term list list * (indexname * term option) list * term) * |
193 statement * Proof.context |
187 Proof.context |
|
188 val print_syntax: Proof.context -> unit |
194 val print_syntax: Proof.context -> unit |
189 val print_abbrevs: bool -> Proof.context -> unit |
195 val print_abbrevs: bool -> Proof.context -> unit |
190 val pretty_term_bindings: Proof.context -> Pretty.T list |
196 val pretty_term_bindings: Proof.context -> Pretty.T list |
191 val pretty_local_facts: bool -> Proof.context -> Pretty.T list |
197 val pretty_local_facts: bool -> Proof.context -> Pretty.T list |
192 val print_local_facts: bool -> Proof.context -> unit |
198 val print_local_facts: bool -> Proof.context -> unit |
1332 end; |
1338 end; |
1333 |
1339 |
1334 |
1340 |
1335 (* structured statements *) |
1341 (* structured statements *) |
1336 |
1342 |
|
1343 type stmt = |
|
1344 {vars: ((binding * typ option * mixfix) * (string * term)) list, |
|
1345 propss: term list list, |
|
1346 binds: (indexname * term) list, |
|
1347 result_binds: (indexname * term) list}; |
|
1348 |
|
1349 type statement = |
|
1350 {fixes: (string * term) list, |
|
1351 assumes: term list list, |
|
1352 shows: term list list, |
|
1353 result_binds: (indexname * term option) list, |
|
1354 text: term, |
|
1355 result_text: term}; |
|
1356 |
1337 local |
1357 local |
1338 |
1358 |
1339 fun export_binds ctxt' ctxt params binds = |
1359 fun export_binds ctxt' ctxt params binds = |
1340 let |
1360 let |
1341 val rhss = |
1361 val rhss = |
1360 val binds' = binds |
1380 val binds' = binds |
1361 |> map (apsnd SOME) |
1381 |> map (apsnd SOME) |
1362 |> export_binds params_ctxt ctxt params |
1382 |> export_binds params_ctxt ctxt params |
1363 |> map (apsnd the); |
1383 |> map (apsnd the); |
1364 |
1384 |
1365 val text' = Logic.close_prop params [] (Logic.mk_conjunction_list (flat propss)); |
|
1366 |
|
1367 val _ = Variable.warn_extra_tfrees fixes_ctxt params_ctxt; |
1385 val _ = Variable.warn_extra_tfrees fixes_ctxt params_ctxt; |
1368 in ((vars' ~~ params, propss, binds, binds', text'), params_ctxt) end; |
1386 val result : stmt = |
|
1387 {vars = vars' ~~ params, propss = propss, binds = binds, result_binds = binds'}; |
|
1388 in (result, params_ctxt) end; |
1369 |
1389 |
1370 fun prep_statement prep_var prep_propp raw_fixes raw_assumes raw_shows ctxt = |
1390 fun prep_statement prep_var prep_propp raw_fixes raw_assumes raw_shows ctxt = |
1371 let |
1391 let |
1372 val ((fixes, (assumes, shows), binds, text'), ctxt') = ctxt |
1392 val ((fixes, (assumes, shows), binds), ctxt') = ctxt |
1373 |> prep_stmt prep_var prep_propp raw_fixes (raw_assumes @ raw_shows) |
1393 |> prep_stmt prep_var prep_propp raw_fixes (raw_assumes @ raw_shows) |
1374 |-> (fn (vars, propss, binds, _, text') => |
1394 |-> (fn {vars, propss, binds, ...} => |
1375 fold Variable.bind_term binds #> |
1395 fold Variable.bind_term binds #> |
1376 pair (map #2 vars, chop (length raw_assumes) propss, binds, text')); |
1396 pair (map #2 vars, chop (length raw_assumes) propss, binds)); |
1377 val binds' = |
1397 val binds' = |
1378 (Auto_Bind.facts ctxt' (flat shows) @ |
1398 (Auto_Bind.facts ctxt' (flat shows) @ |
1379 (case try List.last (flat shows) of |
1399 (case try List.last (flat shows) of |
1380 NONE => [] |
1400 NONE => [] |
1381 | SOME prop => map (apsnd (SOME o Auto_Bind.abs_params prop)) binds)) |
1401 | SOME prop => map (apsnd (SOME o Auto_Bind.abs_params prop)) binds)) |
1382 |> export_binds ctxt' ctxt fixes; |
1402 |> export_binds ctxt' ctxt fixes; |
1383 in ((fixes, assumes, shows, binds', text'), ctxt') end; |
1403 |
|
1404 val text = Logic.close_prop fixes (flat assumes) (Logic.mk_conjunction_list (flat shows)); |
|
1405 val text' = singleton (Variable.export_terms ctxt' ctxt) text; |
|
1406 |
|
1407 val result : statement = |
|
1408 {fixes = fixes, |
|
1409 assumes = assumes, |
|
1410 shows = shows, |
|
1411 result_binds = binds', |
|
1412 text = text, |
|
1413 result_text = text'}; |
|
1414 in (result, ctxt') end; |
1384 |
1415 |
1385 in |
1416 in |
1386 |
1417 |
1387 val cert_stmt = prep_stmt cert_var cert_propp; |
1418 val cert_stmt = prep_stmt cert_var cert_propp; |
1388 val read_stmt = prep_stmt read_var read_propp; |
1419 val read_stmt = prep_stmt read_var read_propp; |