added antiquotations @{lhs thm} and @{rhs thm}
authorkleing
Wed, 01 Dec 2004 06:30:20 +0100
changeset 15349 440687010501
parent 15348 0a60f15c2d7a
child 15350 53d2927d9680
added antiquotations @{lhs thm} and @{rhs thm}
src/Pure/Isar/isar_output.ML
--- a/src/Pure/Isar/isar_output.ML	Wed Dec 01 04:11:15 2004 +0100
+++ b/src/Pure/Isar/isar_output.ML	Wed Dec 01 06:30:20 2004 +0100
@@ -324,6 +324,22 @@
 
 fun pretty_thm ctxt = pretty_term ctxt o Thm.prop_of;
 
+fun lhs_of (Const ("==",_) $ t $ _) = t
+  | lhs_of (Const ("Trueprop",_) $ t) = lhs_of t
+  | lhs_of (Const ("==>",_) $ _ $ t) = lhs_of t
+  | lhs_of (_ $ t $ _) = t
+  | lhs_of _ = error ("Binary operator expected")
+
+fun pretty_lhs ctxt = pretty_term ctxt o lhs_of o Thm.prop_of;
+
+fun rhs_of (Const ("==",_) $ _ $ t) = t
+  | rhs_of (Const ("Trueprop",_) $ t) = rhs_of t
+  | rhs_of (Const ("==>",_) $ _ $ t) = rhs_of t
+  | rhs_of (_ $ _ $ t) = t
+  | rhs_of _ = error ("Binary operator expected")
+
+fun pretty_rhs ctxt = pretty_term ctxt o rhs_of o Thm.prop_of;
+
 fun pretty_prf full ctxt thms =    (* FIXME context syntax!? *)
   Pretty.chunks (map (ProofSyntax.pretty_proof_of full) thms);
 
@@ -345,6 +361,8 @@
 
 val _ = add_commands
  [("thm", args Attrib.local_thmss (output_seq_with pretty_thm)),
+  ("lhs", args Attrib.local_thmss (output_seq_with pretty_lhs)),
+  ("rhs", args Attrib.local_thmss (output_seq_with pretty_rhs)),
   ("prop", args Args.local_prop (output_with pretty_term)),
   ("term", args Args.local_term (output_with pretty_term)),
   ("typ", args Args.local_typ_raw (output_with ProofContext.pretty_typ)),