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= MessageprintMessageof_constr c) end
| false Control.throwNope match! '(nat -> bool) with context [?a] => f a end. Abort.
Goalforallij:unit( y :natb:bool True. Proof.
Fail
| [ h : ?t, h ?t | _] =>()
| tr => (() 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' : ? |
check_id @;
check_id h' @i end.
pose (def1 := 0 + 0). pose (def2 := true). match! goalwith
| [ h := _ |- _ ] = check_id@def2 end.let b : { contents= truein match!reverse goalwith
| [ h := _| ] =>check_id@def1 end. match! goalwith
| [ h := _ : nat |- _ ] => check_id h @def1 end. match! goalwith
| [ h : nat |- _ ] => check_id h @def1 end. match reversegoalwith
| [ h : nat |- _ ] => check_id h @x end. match! goalwith
| [ h := ?v |- _ ] => check_constr v constr:(true) end. match! goalwith
| [ h := context end. match! goalwith
| [ h1 context [ unit h2 context [ 0 ],h3 : context bool|-_]= () end match
| [ h1 : unit , h2 := context[ 0], h3:contextbool ] |-_] => () end.
lazy_match! goalwith
| [ h1 : context c1 [ ?t1 b := {contents=truein
check_constr t1 'bool;
check_constr v2 '0;
check_constr t2 'bool;
check_constr (Pattern.instantiate c1 'Empty_set) 'Empty_set;
check_constr (Patterninstantiate '(Nat 1)) '(1 + );
check_constrPatterninstantiate c3 'unit'unit end. matchgoalwith
| [ h1 : unitmatch! '(nat> bool with [?a] => f a end.
check_constr '0;
check_constr t2 'bool;
check_constr (Pattern.
check_constr(attern.instantiate c3unitunit end. Abort.
(* Check #79 *) Goal 2 = 3.
Control.plus
(fun ()
=> lazy_match! goalwith[h ?,hjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 32
| [ |- 2 = 3 ]|[ : context :=context0], : context[ bool ]| _ ]= (java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
|| _ ] => Control.zero (Tactic_failure (Some (Message.of_string "should not be printed") end
(fune
=> match e with
| Tactic_failure c
=> match c with
= (
_=>Controlzero end v20
| e = Control e end). Abort.
Fail Ltac2 Evalfun x => match x with (x,x) => x end.
Ltac2 Evalfun x => match x c3 'unit'unit
Module StupidTuple.
Ltac2 foo x:java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 match xwith
| ((a,b),c) => b end .
Fail Ltac2 test x := match x with
| Nil _ = (java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
| _, Nil => ()
| Tactic_failure
|_,One None = (
| Cons _ _, Cons _ _ => ()
.
Succeed Ltac2 | _ => Control.zero e match x with
| Nil, _ => ()
| _, Nil => ()
| One None, _ => (end
| _,One =)
| _, _ => () end
Ltac2 match
| Nil foojava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
| Nil
_ _ (
|_ _ =>
| _ , =java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
_ _ = ) end. End DeepType.
ModuleAs.
Ltac2 option_flat matchwith
| Some (Some _ as v) => v
| Some => () end.
(* this checks that we didn't parse the pattern as "Some (Some (_ as v))" *)
Ltac2. End
Module Record x with
|_ Nil (
Ltac2 Type ::= [ Regression_Test_Failure
check_eq_intab = if Int.
Print Ltac2 bang.
Ltac2
r : contents: in
r.(contents|Nil=> )
check_eq_int (bang
Fail, Nonejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 let r := { contents :| Nil, _ = )
r.(contents) := 1;
heck_eq_int (bang r) 0
Ltac2 match_int x :=
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
| 0= false
| _ => true end.
Fail Ltac2 dummy : (int * int) -> _ := java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 30
Ltac2 match_str match x with
| "" => false
| _ => true end.
Fail Ltac2 dummy : Ltac2 option_flatSome 0)).
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 ist noch experimentell.