src/Pure/Syntax/syntax_trans.ML
changeset 56245 84fc7dfa3cd4
parent 56243 2e10a36b8d46
child 56438 7f6b2634d853
equal deleted inserted replaced
56244:3298b7a2795a 56245:84fc7dfa3cd4
   172 fun bigimpl_ast_tr (asts as [asms, concl]) =
   172 fun bigimpl_ast_tr (asts as [asms, concl]) =
   173       let val prems =
   173       let val prems =
   174         (case Ast.unfold_ast_p "_asms" asms of
   174         (case Ast.unfold_ast_p "_asms" asms of
   175           (asms', Ast.Appl [Ast.Constant "_asm", asm']) => asms' @ [asm']
   175           (asms', Ast.Appl [Ast.Constant "_asm", asm']) => asms' @ [asm']
   176         | _ => raise Ast.AST ("bigimpl_ast_tr", asts))
   176         | _ => raise Ast.AST ("bigimpl_ast_tr", asts))
   177       in Ast.fold_ast_p "\\<^const>==>" (prems, concl) end
   177       in Ast.fold_ast_p "\\<^const>Pure.imp" (prems, concl) end
   178   | bigimpl_ast_tr asts = raise Ast.AST ("bigimpl_ast_tr", asts);
   178   | bigimpl_ast_tr asts = raise Ast.AST ("bigimpl_ast_tr", asts);
   179 
   179 
   180 
   180 
   181 (* type/term reflection *)
   181 (* type/term reflection *)
   182 
   182 
   380 (* meta implication *)
   380 (* meta implication *)
   381 
   381 
   382 fun impl_ast_tr' asts =
   382 fun impl_ast_tr' asts =
   383   if no_brackets () then raise Match
   383   if no_brackets () then raise Match
   384   else
   384   else
   385     (case Ast.unfold_ast_p "\\<^const>==>" (Ast.Appl (Ast.Constant "\\<^const>==>" :: asts)) of
   385     (case Ast.unfold_ast_p "\\<^const>Pure.imp"
       
   386         (Ast.Appl (Ast.Constant "\\<^const>Pure.imp" :: asts)) of
   386       (prems as _ :: _ :: _, concl) =>
   387       (prems as _ :: _ :: _, concl) =>
   387         let
   388         let
   388           val (asms, asm) = split_last prems;
   389           val (asms, asm) = split_last prems;
   389           val asms' = Ast.fold_ast_p "_asms" (asms, Ast.Appl [Ast.Constant "_asm", asm]);
   390           val asms' = Ast.fold_ast_p "_asms" (asms, Ast.Appl [Ast.Constant "_asm", asm]);
   390         in Ast.Appl [Ast.Constant "_bigimpl", asms', concl] end
   391         in Ast.Appl [Ast.Constant "_bigimpl", asms', concl] end
   496 val pure_print_ast_translation =
   497 val pure_print_ast_translation =
   497  [("\\<^type>fun", fn _ => fun_ast_tr'),
   498  [("\\<^type>fun", fn _ => fun_ast_tr'),
   498   ("_abs", fn _ => abs_ast_tr'),
   499   ("_abs", fn _ => abs_ast_tr'),
   499   ("_idts", fn _ => idtyp_ast_tr' "_idts"),
   500   ("_idts", fn _ => idtyp_ast_tr' "_idts"),
   500   ("_pttrns", fn _ => idtyp_ast_tr' "_pttrns"),
   501   ("_pttrns", fn _ => idtyp_ast_tr' "_pttrns"),
   501   ("\\<^const>==>", fn _ => impl_ast_tr'),
   502   ("\\<^const>Pure.imp", fn _ => impl_ast_tr'),
   502   ("_index", fn _ => index_ast_tr')];
   503   ("_index", fn _ => index_ast_tr')];
   503 
   504 
   504 end;
   505 end;
   505 
   506 
   506 structure Basic_Syntax_Trans: BASIC_SYNTAX_TRANS = Syntax_Trans;
   507 structure Basic_Syntax_Trans: BASIC_SYNTAX_TRANS = Syntax_Trans;