This renames `BitVec.getLsb` to `getLsbD` (`D` for "default" value, i.e.
false), and introduces `getLsb?` and `getLsb'` (which we can rename to
`getLsb` after a deprecation cycle).
(Similarly for `getMsb`.)
Also adds a `GetElem` class so we can use `x[i]` and `x[i]?` notation.
Later, we will turn
```
theorem getLsbD_eq_getElem?_getD (x : BitVec w) (i : Nat) (h : i < w) :
x.getLsbD i = x[i]?.getD false
```
on as a `@[simp]` lemma.
This PR doesn't attempt to demonstrate the benefits, but I think both
arguments are going to get easier, and this will bring the BitVec API
closer in line to List/Array, etc.
---------
Co-authored-by: Markus Himmel <markus@lean-fro.org>
99 lines
3.1 KiB
Text
99 lines
3.1 KiB
Text
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 2, "character": 11}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "blaBlaBoo",
|
|
"kind": 21,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 2, "character": 11}},
|
|
"id": {"const": {"declName": "_private.0.blaBlaBoo"}}}}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "booBoo",
|
|
"kind": 21,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}},
|
|
"id": {"const": {"declName": "_private.0.Foo.booBoo"}}}},
|
|
{"sortText": "1",
|
|
"label": "instToBoolBool",
|
|
"kind": 21,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}},
|
|
"id": {"const": {"declName": "instToBoolBool"}}}},
|
|
{"sortText": "2",
|
|
"label": "BitVec.getLsbD_ofBoolListBE",
|
|
"kind": 3,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}},
|
|
"id": {"const": {"declName": "BitVec.getLsbD_ofBoolListBE"}}}},
|
|
{"sortText": "3",
|
|
"label": "BitVec.getMsbD_ofBoolListBE",
|
|
"kind": 3,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}},
|
|
"id": {"const": {"declName": "BitVec.getMsbD_ofBoolListBE"}}}},
|
|
{"sortText": "4",
|
|
"label": "BitVec.ofBoolListBE",
|
|
"kind": 3,
|
|
"documentation":
|
|
{"value": "Converts a list of `Bool`s to a big-endian `BitVec`. ",
|
|
"kind": "markdown"},
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 9, "character": 11}},
|
|
"id": {"const": {"declName": "BitVec.ofBoolListBE"}}}}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 21, "character": 5}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "field1",
|
|
"kind": 5,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 21, "character": 5}},
|
|
"id": {"const": {"declName": "S.field1"}}}},
|
|
{"sortText": "1",
|
|
"label": "getInc",
|
|
"kind": 3,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 21, "character": 5}},
|
|
"id": {"const": {"declName": "_private.0.S.getInc"}}}}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 25, "character": 4}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "field1",
|
|
"kind": 5,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 25, "character": 4}},
|
|
"id": {"const": {"declName": "S.field1"}}}},
|
|
{"sortText": "1",
|
|
"label": "getInc",
|
|
"kind": 3,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
|
"position": {"line": 25, "character": 4}},
|
|
"id": {"const": {"declName": "_private.0.S.getInc"}}}}],
|
|
"isIncomplete": true}
|