|
| 1 | +// define a type representing Lambdapi tactics |
| 2 | + |
| 3 | +require open Stdlib.Set Stdlib.Prop Stdlib.String Stdlib.Option |
| 4 | + Stdlib.List; |
| 5 | + |
| 6 | +constant symbol Tactic : TYPE; |
| 7 | + |
| 8 | +// mandatory builtins |
| 9 | + |
| 10 | +constant symbol #admit : Tactic; |
| 11 | +builtin "admit" ≔ #admit; |
| 12 | + |
| 13 | +symbol & : Tactic → Tactic → Tactic; |
| 14 | +builtin "and" ≔ &; |
| 15 | +notation & infix right 10; |
| 16 | + |
| 17 | +constant symbol #apply [p] : π p → Tactic; |
| 18 | +builtin "apply" ≔ #apply; |
| 19 | + |
| 20 | +constant symbol #assume : String → Tactic; |
| 21 | +builtin "assume" ≔ #assume; |
| 22 | + |
| 23 | +constant symbol #fail : Tactic; |
| 24 | +builtin "fail" ≔ #fail; |
| 25 | + |
| 26 | +constant symbol #generalize : Π [a], τ a → Tactic; |
| 27 | +builtin "generalize" ≔ #generalize; |
| 28 | + |
| 29 | +constant symbol #have : String → Π p, π p → Tactic; |
| 30 | +builtin "have" ≔ #have; |
| 31 | + |
| 32 | +constant symbol #induction : Tactic; |
| 33 | +builtin "induction" ≔ #induction; |
| 34 | + |
| 35 | +constant symbol #orelse : Tactic → Tactic → Tactic; |
| 36 | +builtin "orelse" ≔ #orelse; |
| 37 | + |
| 38 | +constant symbol #refine [p] : π p → Tactic; |
| 39 | +builtin "refine" ≔ #refine; |
| 40 | + |
| 41 | +constant symbol #reflexivity : Tactic; |
| 42 | +builtin "reflexivity" ≔ #reflexivity; |
| 43 | + |
| 44 | +constant symbol #remove : Π [a], π a → Tactic; |
| 45 | +builtin "remove" ≔ #remove; |
| 46 | + |
| 47 | +constant symbol #repeat : Tactic → Tactic; |
| 48 | +builtin "repeat" ≔ #repeat; |
| 49 | + |
| 50 | +constant symbol #rewrite [p] : π p → Tactic; |
| 51 | +builtin "rewrite" ≔ #rewrite; |
| 52 | + |
| 53 | +constant symbol #set : String → Π [a], τ a → Tactic; |
| 54 | +builtin "set" ≔ #set; |
| 55 | + |
| 56 | +constant symbol #simplify : Tactic; |
| 57 | +builtin "simplify" ≔ #simplify; |
| 58 | + |
| 59 | +constant symbol #simplify_beta : Tactic; |
| 60 | +builtin "simplify rule off" ≔ #simplify_beta; |
| 61 | + |
| 62 | +constant symbol #solve : Tactic; |
| 63 | +builtin "solve" ≔ #solve; |
| 64 | + |
| 65 | +constant symbol #symmetry : Tactic; |
| 66 | +builtin "symmetry" ≔ #symmetry; |
| 67 | + |
| 68 | +constant symbol #try : Tactic → Tactic; |
| 69 | +builtin "try" ≔ #try; |
| 70 | + |
| 71 | +constant symbol #why3 : Tactic; |
| 72 | +builtin "why3" ≔ #why3; |
| 73 | + |
| 74 | +// defined tactics |
| 75 | + |
| 76 | +symbol nothing ≔ #try #fail; |
| 77 | + |
| 78 | +require open Stdlib.Nat; |
| 79 | + |
| 80 | +symbol times : ℕ → Tactic → Tactic; |
| 81 | +notation times infix 20; |
| 82 | + |
| 83 | +rule 0 times _ ↪ nothing |
| 84 | +with $n +1 times $t ↪ $t & $n times $t; |
0 commit comments