- inaccessible (e : Expr) : Pattern
- var (fvarId : FVarId) : Pattern
- ctor (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
- val (e : Expr) : Pattern
- arrayLit (type : Expr) (xs : List Pattern) : Pattern
- as (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
Instances For
Apply the free variable substitution s to the given pattern
Equations
Instances For
Match alternative
- ref : Syntax
Syntaxobject for providing position information - idx : Nat
Original alternative index. Alternatives can be split, this index is the original position of the alternative that generated this one.
- rhs : Expr
Right-hand-side of the alternative.
Alternative pattern variables.
Alternative patterns.
Instances For
Return true if fvarId is one of the alternative pattern variables
Equations
Instances For
Similar to checkAndReplaceFVarId, but ensures type of v is definitionally equal to type of fvarId.
This extra check is necessary when performing dependent elimination and inaccessible terms have been used.
For example, consider the following code fragment:
inductive Vec (α : Type u) : Nat → Type u where
| nil : Vec α 0
| cons {n} (head : α) (tail : Vec α n) : Vec α (n+1)
inductive VecPred {α : Type u} (P : α → Prop) : {n : Nat} → Vec α n → Prop where
| nil : VecPred P Vec.nil
| cons {n : Nat} {head : α} {tail : Vec α n} : P head → VecPred P tail → VecPred P (Vec.cons head tail)
theorem ex {α : Type u} (P : α → Prop) : {n : Nat} → (v : Vec α (n+1)) → VecPred P v → Exists P
| _, Vec.cons head _, VecPred.cons h (w : VecPred P Vec.nil) => ⟨head, h⟩
Recall that _ in a pattern can be elaborated into pattern variable or an inaccessible term.
The elaborator uses an inaccessible term when typing constraints restrict its value.
Thus, in the example above, the _ at Vec.cons head _ becomes the inaccessible pattern .(Vec.nil)
because the type ascription (w : VecPred P Vec.nil) propagates typing constraints that restrict its value to be Vec.nil.
After elaboration the alternative becomes:
| .(0), @Vec.cons .(α) .(0) head .(Vec.nil), @VecPred.cons .(α) .(P) .(0) .(head) .(Vec.nil) h w => ⟨head, h⟩
where
(head : α), (h: P head), (w : VecPred P Vec.nil)
Then, when we process this alternative in this module, the following check will detect that
w has type VecPred P Vec.nil, when it is supposed to have type VecPred P tail.
Note that if we had written
theorem ex {α : Type u} (P : α → Prop) : {n : Nat} → (v : Vec α (n+1)) → VecPred P v → Exists P
| _, Vec.cons head Vec.nil, VecPred.cons h (w : VecPred P Vec.nil) => ⟨head, h⟩
we would get the easier to digest error message
missing cases:
_, (Vec.cons _ _ (Vec.cons _ _ _)), _
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
- matcher : Expr
- counterExamples : List CounterExample