Ltac2 check_constr x y := match Constr.equal x y with
| true => ()
| false => Control.throw Nope end.
Ltac2 check_id id id' := match Ident.equal id id' with
| true => ()
| false => Control.throw Nope end.
Goal True -> False. Proof.
Fail let b := { contents := true } in let f c := match b.(contents) with
| true => Message.print (Message.of_constr c); b.(contents) := false; fail
| false => () end
in (** This fails because the matching is not allowed to backtrack once
it commits to a branch*)
lazy_match! '(nat -> bool) with context [?a] => f a end.
lazy_match! Control.goal () with ?a -> ?b => Message.print (Message.of_constr b) end.
(** This one works by taking the second match context, i.e. ?a := nat *) let b := { contents := true } in let f c := match b.(contents) with
| true => b.(contents) := false; fail
| false => Message.print (Message.of_constr c) end
in match! '(nat -> bool) with context [?a] => f a end. Abort.
Goalforall (i j : unit) (x y : nat) (b : bool), True. Proof.
Fail match! goalwith
| [ h : ?t, h' : ?t |- _ ] => () end. intros i j x y b. match! goalwith
| [ h : ?t, h' : ?t |- _ ] =>
check_id h @x;
check_id h' @y end. match! reverse goalwith
| [ h : ?t, h' : ?t |- _ ] =>
check_id h @j;
check_id h' @i end.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.