-
Notifications
You must be signed in to change notification settings - Fork 8
Integrate the new structure of abstract domains #1966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
OliverGerstl
wants to merge
13
commits into
main
Choose a base branch
from
1965-intregrate-the-new-structure-of-abstract-domains
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,785
−1,749
Open
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
de06a39
feat: integrate new domains in data frame shape inference
OliverGerstl e346305
feat: creation function for abstract values
OliverGerstl 6503573
feat: positive interval domain extends interval domain
OliverGerstl af9ba11
feat-fix: type inference for interval top element
OliverGerstl bdd71a0
feat-fix: typo in satisfiable domain
OliverGerstl b6af850
Merge branch 'main' into 1965-intregrate-the-new-structure-of-abstrac…
OliverGerstl d193ff2
feat: better JSON format for df-shape query result
OliverGerstl 21c36eb
Merge branch 'main' into 1965-intregrate-the-new-structure-of-abstrac…
EagleoutIce c6c9314
feat: include review feedback
OliverGerstl e338a6f
feat: remove self generic from abstract domains
OliverGerstl f8c579a
feat-fix: doc comments for abstract domain
OliverGerstl 53c357b
test-fix: string serialization of domains
OliverGerstl 2d0197a
feat: over-approximation for calls with unknown side effects
OliverGerstl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 35 additions & 20 deletions
55
src/abstract-interpretation/data-frame/dataframe-domain.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,90 @@ | ||
| import type { AbstractDomain } from '../domains/abstract-domain'; | ||
| import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id'; | ||
| import type { AbstractDomainValue } from '../domains/abstract-domain'; | ||
| import { PosIntervalDomain } from '../domains/positive-interval-domain'; | ||
| import { ProductDomain } from '../domains/product-domain'; | ||
| import { SetBoundedSetDomain } from '../domains/set-bounded-set-domain'; | ||
| import { SetUpperBoundDomain } from '../domains/set-upper-bound-domain'; | ||
| import { StateAbstractDomain } from '../domains/state-abstract-domain'; | ||
|
|
||
| /** The type of the abstract product representing the shape of data frames */ | ||
| export type AbstractDataFrameShape = { | ||
| colnames: SetBoundedSetDomain<string>; | ||
| colnames: SetUpperBoundDomain<string>; | ||
| cols: PosIntervalDomain; | ||
| rows: PosIntervalDomain; | ||
| } | ||
|
|
||
| /** The type of abstract values of a sub abstract domain (shape property) of the data frame shape product */ | ||
| type DataFrameShapeProperty<Property extends keyof AbstractDataFrameShape> = | ||
| AbstractDataFrameShape[Property] extends AbstractDomain<unknown, unknown, unknown, unknown, infer Lift> ? Lift : never; | ||
| /** The type of abstract values of a sub abstract domain (shape property) of the data frame shape product domain */ | ||
| export type DataFrameShapeProperty<Property extends keyof AbstractDataFrameShape> = AbstractDomainValue<AbstractDataFrameShape[Property]>; | ||
|
|
||
| /** | ||
| * The data frame abstract domain as product domain of a column names domain, column count domain, and row count domain. | ||
| */ | ||
| export class DataFrameDomain extends ProductDomain<AbstractDataFrameShape> { | ||
| export class DataFrameDomain extends ProductDomain<DataFrameDomain, AbstractDataFrameShape> { | ||
| constructor(value: AbstractDataFrameShape, maxColNames?: number) { | ||
| super({ | ||
| colnames: new SetBoundedSetDomain(value.colnames.value, maxColNames), | ||
| colnames: new SetUpperBoundDomain(value.colnames.value, maxColNames ?? value.colnames.limit), | ||
| cols: new PosIntervalDomain(value.cols.value), | ||
| rows: new PosIntervalDomain(value.rows.value) | ||
| }); | ||
| } | ||
|
|
||
| public create(value: AbstractDataFrameShape, maxColNames?: number): DataFrameDomain { | ||
| return new DataFrameDomain(value, maxColNames); | ||
| public create(value: AbstractDataFrameShape): DataFrameDomain { | ||
| return new DataFrameDomain(value, this.maxColNames); | ||
| } | ||
|
|
||
| /** | ||
| * The current abstract value of the column names domain. | ||
| */ | ||
| public get colnames(): DataFrameShapeProperty<'colnames'> { | ||
| return this.value.colnames.value; | ||
| public get colnames(): AbstractDataFrameShape['colnames'] { | ||
| return this.value.colnames; | ||
| } | ||
|
|
||
| /** | ||
| * The current abstract value of the column count domain. | ||
| */ | ||
| public get cols(): DataFrameShapeProperty<'cols'> { | ||
| return this.value.cols.value; | ||
| public get cols(): AbstractDataFrameShape['cols'] { | ||
| return this.value.cols; | ||
| } | ||
|
|
||
| /** | ||
| * The current abstract value of the row count domain. | ||
| */ | ||
| public get rows(): DataFrameShapeProperty<'rows'> { | ||
| return this.value.rows.value; | ||
| public get rows(): AbstractDataFrameShape['rows'] { | ||
| return this.value.rows; | ||
| } | ||
|
|
||
| /** | ||
| * The maximum number of inferred column names of the column names domain. | ||
| */ | ||
| public get maxColNames(): number { | ||
| return this.value.colnames.limit; | ||
| } | ||
|
|
||
| public static bottom(maxColNames?: number): DataFrameDomain { | ||
| return new DataFrameDomain({ | ||
| colnames: SetBoundedSetDomain.bottom(maxColNames), | ||
| colnames: SetUpperBoundDomain.bottom(maxColNames), | ||
| cols: PosIntervalDomain.bottom(), | ||
| rows: PosIntervalDomain.bottom() | ||
| }); | ||
| } | ||
|
|
||
| public static top(maxColNames?: number): DataFrameDomain { | ||
| return new DataFrameDomain({ | ||
| colnames: SetBoundedSetDomain.top(maxColNames), | ||
| colnames: SetUpperBoundDomain.top(maxColNames), | ||
| cols: PosIntervalDomain.top(), | ||
| rows: PosIntervalDomain.top() | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * The data frame state abstract domain as state abstract domain mapping AST node IDs to inferred abstract data frame shapes. | ||
| * The data frame state abstract domain as state domain mapping AST node IDs to inferred abstract data frame shapes. | ||
| */ | ||
| export class DateFrameStateDomain extends StateAbstractDomain<DataFrameDomain> {} | ||
| export class DataFrameStateDomain extends StateAbstractDomain<DataFrameStateDomain, DataFrameDomain> { | ||
| public create(value: ReadonlyMap<NodeId, DataFrameDomain>): DataFrameStateDomain { | ||
| return new DataFrameStateDomain(value); | ||
| } | ||
|
|
||
| public static bottom(): DataFrameStateDomain { | ||
| return new DataFrameStateDomain(new Map<NodeId, DataFrameDomain>()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.