@@ -10,16 +10,14 @@ import AesopTest.Forward.Definitions
10
10
open Aesop
11
11
open Lean Lean.Elab Lean.Elab.Command Lean.Elab.Term Lean.Parser
12
12
13
- --set_option aesop.dev.statefulForward true
14
-
15
- elab "test " nPremises:num nQs:num nLemmas:num erase:num a:num " by " ts:tacticSeq : command => do
13
+ elab "test " nPremises:num nQs:num nLemmas:num depth:num a:num " by " ts:tacticSeq : command => do
16
14
let some nPs := nPremises.raw.isNatLit?
17
15
| throwUnsupportedSyntax
18
16
let some nQs := nQs.raw.isNatLit?
19
17
| throwUnsupportedSyntax
20
18
let some nLemmas := nLemmas.raw.isNatLit?
21
19
| throwUnsupportedSyntax
22
- let some erase := erase .raw.isNatLit?
20
+ let some depth := depth .raw.isNatLit?
23
21
| throwUnsupportedSyntax
24
22
let some a := a.raw.isNatLit?
25
23
| throwUnsupportedSyntax
@@ -43,25 +41,6 @@ elab "test " nPremises:num nQs:num nLemmas:num erase:num a:num " by " ts:tacticS
43
41
$(mkIdent pName):ident $(mkIdent `n)))
44
42
let sig : Term ← `(∀ $(mkIdent `n) $binders:bracketedBinder*, True)
45
43
46
- /- Rule that we are able to complete. -/
47
-
48
- let mut mNames := pNames
49
- let bindersM : TSyntaxArray ``Term.bracketedBinder ←
50
- (mNames.eraseIdxIfInBounds erase).mapIdxM λ i pName => do
51
- `(bracketedBinder| ($(mkIdent $ .mkSimple $ "p" ++ toString i) :
52
- $(mkIdent pName):ident $(mkIdent `n)))
53
- let sigM : Term ← `(∀ $(mkIdent `n) $bindersM:bracketedBinder*, True)
54
- elabCommand $ ← `(command|
55
- @[aesop safe]
56
- axiom $(mkIdent $ .mkSimple $ "lM" ):ident : $sigM:term
57
- )
58
-
59
-
60
- -- ($(mkIdent $ .mkSimple $ "a") : $(mkIdent `A):ident $(mkIdent `n) $(mkIdent `n))
61
- -- Create `axiom li : ∀ n (p1 : P1 n) ... (pm : Pm n), Q → True` for
62
- -- i ∈ [0..nLemmas - 1] and m = nPs
63
- -- ($(mkIdent $ .mkSimple $ "q") : $(mkIdent `Q):ident $(mkIdent `n))
64
- -- ($(mkIdent $ .mkSimple $ "p" ++ toString i) : $(mkIdent pName):ident $(mkIdent `n))
65
44
for i in [:nLemmas] do
66
45
elabCommand $ ← `(command|
67
46
@[aesop safe forward]
@@ -73,34 +52,37 @@ elab "test " nPremises:num nQs:num nLemmas:num erase:num a:num " by " ts:tacticS
73
52
-/
74
53
/- Active hyps -/
75
54
let binders : TSyntaxArray ``Term.bracketedBinder ←
76
- --pNames.mapIdxM λ i pName => do
77
- (mNames.eraseIdxIfInBounds erase).mapIdxM λ i pName => do
55
+ pNames.mapIdxM λ i pName => do
56
+ let mut n := a
57
+ if i + 1 = nPs - depth then n := a + 1
78
58
`(bracketedBinder| ($(mkIdent $ .mkSimple $ "p" ++ toString i) :
79
- $(mkIdent pName):ident (snat% $(Syntax.mkNatLit a ))))
80
- -- Create `theorem t1 (p1 : P1 (snat% 0 )) ... (pm : Pm (snat% 0 )) : True := by ts`
59
+ $(mkIdent pName):ident (snat% $(Syntax.mkNatLit n ))))
60
+ -- Create `theorem t1 (p1 : P1 (snat% a )) ... (pm : Pm (snat% a )) : True := by ts`
81
61
82
62
/- Inert hyps -/
83
63
let bindersQ : TSyntaxArray ``Term.bracketedBinder ←
84
64
--pNames.mapIdxM λ i pName => do
85
65
(qNames).mapIdxM λ i qName => do
86
66
`(bracketedBinder| ($(mkIdent $ .mkSimple $ "q" ++ toString i) :
87
67
$(mkIdent qName):ident (snat% $(Syntax.mkNatLit a))))
88
- -- Create `theorem t1 (p1 : P1 (snat% 0 )) ... (pm : Pm (snat% 0 )) : True := by ts`
68
+ -- Create `theorem t1 (p1 : P1 (snat% a )) ... (pm : Pm (snat% a )) : True := by ts`
89
69
-- where m = nPs.
90
70
elabCommand $ ← `(command|
91
71
theorem $(mkIdent $ .mkSimple $ "t" ) $binders:bracketedBinder* $bindersQ:bracketedBinder*
92
- --($(mkIdent $ .mkSimple $ "a") : $(mkIdent `A):ident (snat% 0) (snat% 0))
93
72
: True := by $ts
94
73
)
95
74
96
75
/-
97
76
**Uncomment for single test** :
98
- test 6 0 100 1 by
77
+ test 6 0 100 1 0 by
99
78
set_option maxHeartbeats 5000000 in
100
- set_option aesop.dev.statefulForward false in
79
+ set_option aesop.dev.statefulForward true in
101
80
set_option trace.profiler true in
102
81
saturate
103
82
trivial
83
+
84
+ #check l1
85
+
104
86
-/
105
87
106
88
/--
@@ -126,22 +108,20 @@ are saved regardless of their slot's position.
126
108
- `nQs` : Number of hypotheses in the context which do not unify with any premise
127
109
of any rule.
128
110
- `nRs` : Number of rules; here they are all the same.
129
- - `e` : The number associated to the slot for which there is no hypothesis in
130
- the context that match this slot.
131
- If it is greater or equal to the number of premises, the context will contain
132
- hypotheses matching all the slots and the rules will be applied.
111
+ - `d` : The depth: This is the number of slots considered before the procedure stops
112
+ as the hypotheses are incompatible. This is well defined for `d ∈ [1,nPs]`.
133
113
- `a` : Instantiation of the predicates in the rule.
134
114
Note that this affects the run time as big number are designed to be much
135
115
harder to unify.
136
116
-/
137
- def runTestErase (nPs nQs nRs e a : Nat) : CommandElabM Nanos := do
117
+ def runTestDepth (nPs nQs nRs d a : Nat) : CommandElabM Nanos := do
138
118
let mut nPs := Syntax.mkNatLit nPs
139
119
let mut nQs := Syntax.mkNatLit nQs
140
120
let mut nRs := Syntax.mkNatLit nRs
141
- let mut e := Syntax.mkNatLit e
121
+ let mut d := Syntax.mkNatLit d
142
122
let mut a := Syntax.mkNatLit a
143
123
liftCoreM $ withoutModifyingState $ liftCommandElabM do
144
- elabCommand <| ← `(test $nPs $nQs $nRs $e $a by
124
+ elabCommand <| ← `(test $nPs $nQs $nRs $d $a by
145
125
set_option maxRecDepth 1000000 in
146
126
set_option maxHeartbeats 5000000 in
147
127
time saturate
0 commit comments