Skip to content

Commit

Permalink
fix: change eliminator to the new, more specific, induction_eliminator
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeizer committed Oct 9, 2024
1 parent cb8de20 commit 46b75a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Qpf/Macro/Data/Ind.lean
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def flattenForArg (n : Name) := Name.str .anonymous $ n.toStringWithSep "_" true
/-- Both `bracketedBinder` and `matchAlts` have optional arguments,
which cause them to not by recognized as parsers in quotation syntax
(that is, ``` `(bracketedBinder| ...) ``` does not work).
To work around this, we define aliases that force the optional argument to it's default value,
To work around this, we define aliases that force the optional argument to it's default value,
so that we can write ``` `(bb| ...) ```instead. -/
abbrev bb : Parser := bracketedBinder
abbrev matchAltExprs : Parser := matchAlts
Expand Down Expand Up @@ -64,7 +64,6 @@ def seq (f : TSyntax kx → TSyntax kx → m (TSyntax kx)) : List (TSyntax kx)
| hd :: tl => do f hd (← seq f tl)
| [] => throwError "Expected at least one value for interspersing"


def generateIndBody (ctors : Array (Name × List RecursionForm)) (includeMotive : Bool) : m $ TSyntax ``matchAlts := do
let deeper: (TSyntaxArray ``matchAlt) ← ctors.mapM fun ⟨outerCase, form⟩ => do
let callName := mkIdent $ flattenForArg outerCase
Expand Down Expand Up @@ -107,8 +106,7 @@ def generateIndBody (ctors : Array (Name × List RecursionForm)) (includeMotive
have $proofs:term : $type := by
simp only [
$(mkIdent ``MvFunctor.LiftP):ident,
$(mkIdent ``TypeVec.PredLast):ident,
$(mkIdent ``Fin2.instOfNatFin2HAddNatInstHAddInstAddNatOfNat):ident
$(mkIdent ``TypeVec.PredLast):ident
] at ih

rcases ih with ⟨w, proof⟩
Expand Down Expand Up @@ -159,7 +157,7 @@ def genRecursors (view : DataView) : CommandElabM Unit := do
mkRecursorBinder (rec_type) (name) base true

let indDef : Command ← `(
@[elab_as_elim, eliminator]
@[elab_as_elim, induction_eliminator]
def $(view.shortDeclName ++ `ind |> mkIdent):ident
{ motive : $rec_type → Prop}
$ih_types*
Expand Down
4 changes: 2 additions & 2 deletions Test/List.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Qpf

namespace Test

data QpfList α
data QpfList α
| nil
| cons : α → QpfList α → QpfList α
| cons : α → QpfList α → QpfList α

end Test

0 comments on commit 46b75a5

Please sign in to comment.