Code-with-CS-shape characterizes the context-sensitive languages #
The bounded-search language contextSensitiveLanguageOf : Code T → Language T agrees
with the actual grammar language only on context-sensitive codes. So the adequate,
effective presentation of the CS class uses the subtype of codes whose decoded grammar
is context-sensitive:
CSCode T := {c : Code T // grammar_context_sensitive (ofCode c)}.
This file:
- proves the shape predicate
grammar_context_sensitive ∘ ofCodeis aPrimrecPred(so the subtype isPrimcodable); - packages
ComputableMembership CS contextSensitiveLanguageOf', wherecontextSensitiveLanguageOf'is the restriction toCSCode.
Boolean folds with clean specifications #
boolAll p l is true iff every element satisfies p.
Equations
- ContextSensitive.boolAll p l = List.foldr (fun (b : β) (acc : Bool) => p b && acc) true l
Instances For
boolAny p l is true iff some element satisfies p.
Equations
- ContextSensitive.boolAny p l = List.foldr (fun (b : β) (acc : Bool) => p b || acc) false l
Instances For
The CS-shape decision procedure #
The single-rule "is an initial epsilon rule" check.
Equations
Instances For
The single-rule "initial nonterminal not on this rule's RHS" check.
Equations
- ContextSensitive.notOnRhs init r = ContextSensitive.boolAll (fun (s : symbol T ℕ) => !decide (s = symbol.nonterminal init)) r.output_string
Instances For
Boolean decision of grammar_context_sensitive (ofCode c).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Correctness of the decision procedure #
Primitive recursiveness of the decision procedure #
The adequate, effective CS presentation #
The subtype of codes whose decoded grammar is context-sensitive. It is Primcodable
because the CS-shape predicate is primitive recursive (primrecPred_isCS).
Equations
- ContextSensitive.CSCode T = { c : Code T // grammar_context_sensitive (ofCode c) }
Instances For
The language presented by a context-sensitive code.
Equations
Instances For
On a context-sensitive code, the bounded-search language is the grammar language.
The CS code presentation is adequate: it denotes exactly the context-sensitive
languages (the library's class CS).
Uniform membership for the CS presentation is computable.
Context-sensitive membership is uniformly computable as a statement about the
class CS: the context-sensitive codes form an adequate, effective presentation with
uniformly decidable membership.