Documentation

Regex.Compiler.Lemmas

Lemmas #

Proof that Compiler.Code.compile gives an array with the Compiler.nextOfLt property

instantiate mvar, mspec with a precondition like fun s => s = states ∧ P gives a uninstantiated mvar

Equations
Instances For
    theorem Compiler.Lemmas.lift_StackM_to_PatchM_spec {σ α : Type} {n : σ} {ε : Type} (v : StateT σ Id α) {P : σProp} (Q : σασProp) (hspec : fun (s : σ) => s = n P n v (fun (a : α) (s : σ) => Q n a s, ())) :
    fun (s : σ) => s = n P n liftM v (fun (a : α) (s : σ) => Q n a s, fun (x : ε) => True, ())
    def Compiler.Lemmas.coe_spec_StackM_to_PatchM {σ α ε : Type} {v : StateT σ Id α} {P : σProp} {Q : ασProp} (hspec : fun (s : σ) => P s v (fun (a : α) (s : σ) => Q a s, ())) :
    fun (s : σ) => P s liftM v (fun (a : α) (s : σ) => Q a s, fun (x : ε) (x : σ) => True, ())
    Equations
    • = hspec
    Instances For
      instance Compiler.Lemmas.instCoeTripleStateTIdCurryEStateMLiftM_regex {σ α ε : Type} {v : StateT σ Id α} {P : σProp} {Q : ασProp} :
      Coe (fun (s : σ) => P s v (fun (a : α) (s : σ) => Q a s, ())) (fun (s : σ) => P s liftM v (fun (a : α) (s : σ) => Q a s, fun (x : ε) (x : σ) => True, ()))
      Equations
      def Compiler.Lemmas.coe_spec_PatchM_to_CompilerM {ε σ₁ α σ₂ : Type} {v : EStateM ε σ₁ α} {P : σ₁Prop} {Q : ασ₁Prop} (hspec : fun (s : σ₁) => P s v (fun (a : α) (s : σ₁) => Q a s, fun (x : ε) => True, ())) :
      fun (s : σ₁ × σ₂) => P s.fst liftM v (fun (r : α) (s : σ₁ × σ₂) => Q r s.fst, fun (x : ε) (x : σ₁ × σ₂) => True, ())
      Equations
      • =
      Instances For
        instance Compiler.Lemmas.instCoeTripleEStateMCurryProdLiftMFst_regex {ε σ₁ α σ₂ : Type} {v : EStateM ε σ₁ α} {P : σ₁Prop} {Q : ασ₁Prop} :
        Coe (fun (s : σ₁) => P s v (fun (a : α) (s : σ₁) => Q a s, fun (x : ε) => True, ())) (fun (s : σ₁ × σ₂) => P s.fst liftM v (fun (r : α) (s : σ₁ × σ₂) => Q r s.fst, fun (x : ε) => True, ()))
        Equations
        def Compiler.Lemmas.coe_spec_StackM_to_CompilerM {σ₁ α ε σ₂ : Type} {v : StateT σ₁ Id α} {P : σ₁Prop} {Q : ασ₁Prop} (hspec : fun (s : σ₁) => P s v (fun (a : α) (s : σ₁) => Q a s, ())) :
        fun (s : σ₁ × σ₂) => P s.fst liftM v (fun (r : α) (s : σ₁ × σ₂) => Q r s.fst, fun (x : ε) (x : σ₁ × σ₂) => True, ())
        Equations
        • =
        Instances For
          instance Compiler.Lemmas.instCoeTripleStateTIdCurryEStateMProdLiftMFst_regex {σ₁ α ε σ₂ : Type} {v : StateT σ₁ Id α} {P : σ₁Prop} {Q : ασ₁Prop} :
          Coe (fun (s : σ₁) => P s v (fun (a : α) (s : σ₁) => Q a s, ())) (fun (s : σ₁ × σ₂) => P s.fst liftM v (fun (r : α) (s : σ₁ × σ₂) => Q r s.fst, fun (x : ε) (x : σ₁ × σ₂) => True, ()))
          Equations
          theorem Compiler.Lemmas.pure_of_imp_spec {α σ ε : Type} {x : α} {P1 P2 : ασProp} (h : ∀ (a : α) (s : σ), P1 a sP2 a s) :
          fun (s : σ) => P1 x s EStateM.pure x (fun (r : α) (s : σ) => P2 r s, fun (x : ε) => True, ())
          @[simp]
          theorem Compiler.Lemmas.c_cap'_spec (role : NFA.Capture.Role) (pattern_id slot : Nat) (states : Array NFA.Unchecked.State) :
          theorem Compiler.Lemmas.c_back_ref_spec (case_insensitive : Bool) (n : Nat) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states nextOfLt states Code.c_back_ref case_insensitive n (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State) => tRefNextOfLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_back_ref_lift_spec (case_insensitive : Bool) (n : Nat) (states : Array NFA.Unchecked.State) :
          theorem Compiler.Lemmas.c_at_least_set_spec (possible_empty_capture_group : Option Nat) (greedy : Bool) (states : Array NFA.Unchecked.State) {groups : Array Nat} :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states s.snd = groups Code.c_at_least_set possible_empty_capture_group greedy (fun (x : Unit) (s : Array NFA.Unchecked.State × Array Nat) => states = s.fst groups.size s.snd.size, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_0_post_spec (compiled : ThompsonRef) (plus : NFA.Unchecked.StateID) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states plus < states.size compiled.start < states.size nextOfLt states Code.c_at_least_0_post compiled plus greedy possessive (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State) => tRefNextOfLeLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_0_post_lift_spec (compiled : ThompsonRef) (plus : NFA.Unchecked.StateID) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states plus < states.size compiled.start < states.size nextOfLt states liftM (Code.c_at_least_0_post compiled plus greedy possessive) (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State × Array Nat) => tRefNextOfLeLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_0_spec (compiled : ThompsonRef) (possible_empty_capture_group : Option Nat) (greedy : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states tRefLt compiled states nextOfLt states Code.c_at_least_0 compiled possible_empty_capture_group greedy (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State × Array Nat) => stateIdNextOfLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_1_post_spec (compiled : ThompsonRef) (union : NFA.Unchecked.StateID) (possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states union < states.size tRefLt compiled states nextOfLt states Code.c_at_least_1_post compiled union possessive (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State) => tRefNextOfLeLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_1_post_lift_spec (compiled : ThompsonRef) (union : NFA.Unchecked.StateID) (possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states union < states.size tRefLt compiled states nextOfLt states liftM (Code.c_at_least_1_post compiled union possessive) (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State × Array Nat) => tRefNextOfLeLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_1_spec (possible_empty_capture_group : Option Nat) (greedy : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states nextOfLt states Code.c_at_least_1 possible_empty_capture_group greedy (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State × Array Nat) => stateIdNextOfLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_2_spec («prefix» last : ThompsonRef) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states tRefLt «prefix» states tRefLt last states nextOfLt states Code.c_at_least_2 «prefix» last greedy possessive (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State) => tRefNextOfLeLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_at_least_2_lift_spec («prefix» last : ThompsonRef) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states tRefLt «prefix» states tRefLt last states nextOfLt states liftM (Code.c_at_least_2 «prefix» last greedy possessive) (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State × Array Nat) => tRefNextOfLeLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_bounded.fold.patch.pre_spec (compiled : ThompsonRef) (prev_end : NFA.Unchecked.StateID) (greedy : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states tRefLt compiled states prev_end < states.size nextOfLt states Code.c_bounded.fold.patch.pre compiled prev_end greedy (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State) => stateIdNextOfLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_bounded.fold.patch.post_spec (compiled : ThompsonRef) (union empty : NFA.Unchecked.StateID) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states compiled.end < states.size union < states.size empty < states.size nextOfLt states Code.c_bounded.fold.patch.post compiled union empty (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State) => stateIdNextOfLeLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_bounded.fold.patch_spec (compiled : ThompsonRef) (prev_end empty : NFA.Unchecked.StateID) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states tRefLt compiled states prev_end < states.size empty < states.size nextOfLt states Code.c_bounded.fold.patch compiled prev_end empty greedy possessive (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State) => stateIdNextOfLt states r s, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_bounded.fold.patch_lift_spec (compiled : ThompsonRef) (prev_end empty : NFA.Unchecked.StateID) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states tRefLt compiled states prev_end < states.size empty < states.size nextOfLt states liftM (Code.c_bounded.fold.patch compiled prev_end empty greedy possessive) (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State × Array Nat) => stateIdNextOfLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.c_alt_iter_step_spec (first second : ThompsonRef) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State) => s = states tRefLt first states tRefLt second states nextOfLt states Code.c_alt_iter_step first second (fun (r : NFA.Unchecked.StateID × NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State) => tRefNextOfLt states { start := r.fst, «end» := r.snd } s, fun (x : String) => True, ())
          @[irreducible]
          theorem Compiler.Lemmas.c_alt_iter_fold_spec (hirs : Array Syntax.Hir) (union «end» : NFA.Unchecked.StateID) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states union < states.size «end» < states.size nextOfLt states Code.c_alt_iter.fold hirs union «end» (fun (x : Unit) (s : Array NFA.Unchecked.State × Array Nat) => statesNextOfLeLt states s.fst, fun (x : String) => True, ())
          @[irreducible]
          theorem Compiler.Lemmas.c_at_least_spec (hir : Syntax.Hir) (n : Nat) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states nextOfLt states Code.c_at_least hir n greedy possessive (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State × Array Nat) => tRefNextOfLt states r s.fst, fun (x : String) => True, ())
          @[irreducible]
          theorem Compiler.Lemmas.c_bounded_fold_spec (hir : Syntax.Hir) (n : Nat) («prefix» : ThompsonRef) (empty : NFA.Unchecked.StateID) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states tRefLt «prefix» states empty < states.size nextOfLt states Code.c_bounded.fold hir n «prefix» empty greedy possessive (fun (r : NFA.Unchecked.StateID) (s : Array NFA.Unchecked.State × Array Nat) => stateIdNextOfLeLt states r s.fst, fun (x : String) => True, ())
          @[irreducible]
          theorem Compiler.Lemmas.c_bounded_spec (hir : Syntax.Hir) (min max : Nat) (greedy possessive : Bool) (states : Array NFA.Unchecked.State) :
          fun (s : Array NFA.Unchecked.State × Array Nat) => s.fst = states nextOfLt states Code.c_bounded hir min max greedy possessive (fun (r : ThompsonRef) (s : Array NFA.Unchecked.State × Array Nat) => tRefNextOfLt states r s.fst, fun (x : String) => True, ())
          theorem Compiler.Lemmas.compile_nextOf_lt {states : Array NFA.Unchecked.State} {groups : Array Nat} {anchored : Bool} {expr : Syntax.Hir} (h : Code.compile anchored expr (#[], #[]) = EStateM.Result.ok () (states, groups)) :
          nextOfLt states